diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateCollection.cs new file mode 100644 index 000000000000..433f9a7697b1 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateCollection.cs @@ -0,0 +1,344 @@ +// 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; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// 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 GetCaCertificates method from an instance of . + /// + public partial class CaCertificateCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _caCertificateClientDiagnostics; + private readonly CaCertificatesRestOperations _caCertificateRestClient; + + /// Initializes a new instance of the class for mocking. + protected CaCertificateCollection() + { + } + + /// 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 CaCertificateCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _caCertificateClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", CaCertificateResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(CaCertificateResource.ResourceType, out string caCertificateApiVersion); + _caCertificateRestClient = new CaCertificatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, caCertificateApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NamespaceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NamespaceResource.ResourceType), nameof(id)); + } + + /// + /// Create or update a CA certificate with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_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 CA certificate name. + /// CA certificate information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string caCertificateName, CaCertificateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(caCertificateName, nameof(caCertificateName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _caCertificateClientDiagnostics.CreateScope("CaCertificateCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _caCertificateRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, caCertificateName, data, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new CaCertificateOperationSource(Client), _caCertificateClientDiagnostics, Pipeline, _caCertificateRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, caCertificateName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a CA certificate with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_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 CA certificate name. + /// CA certificate information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string caCertificateName, CaCertificateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(caCertificateName, nameof(caCertificateName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _caCertificateClientDiagnostics.CreateScope("CaCertificateCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _caCertificateRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, caCertificateName, data, cancellationToken); + var operation = new EventGridArmOperation(new CaCertificateOperationSource(Client), _caCertificateClientDiagnostics, Pipeline, _caCertificateRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, caCertificateName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a CA certificate. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_Get + /// + /// + /// + /// Name of the CA certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string caCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(caCertificateName, nameof(caCertificateName)); + + using var scope = _caCertificateClientDiagnostics.CreateScope("CaCertificateCollection.Get"); + scope.Start(); + try + { + var response = await _caCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, caCertificateName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new CaCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a CA certificate. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_Get + /// + /// + /// + /// Name of the CA certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string caCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(caCertificateName, nameof(caCertificateName)); + + using var scope = _caCertificateClientDiagnostics.CreateScope("CaCertificateCollection.Get"); + scope.Start(); + try + { + var response = _caCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, caCertificateName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new CaCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get all the CA certificates under a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates + /// + /// + /// Operation Id + /// CaCertificates_ListByNamespace + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _caCertificateRestClient.CreateListByNamespaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _caCertificateRestClient.CreateListByNamespaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CaCertificateResource(Client, CaCertificateData.DeserializeCaCertificateData(e)), _caCertificateClientDiagnostics, Pipeline, "CaCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get all the CA certificates under a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates + /// + /// + /// Operation Id + /// CaCertificates_ListByNamespace + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _caCertificateRestClient.CreateListByNamespaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _caCertificateRestClient.CreateListByNamespaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CaCertificateResource(Client, CaCertificateData.DeserializeCaCertificateData(e)), _caCertificateClientDiagnostics, Pipeline, "CaCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_Get + /// + /// + /// + /// Name of the CA certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string caCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(caCertificateName, nameof(caCertificateName)); + + using var scope = _caCertificateClientDiagnostics.CreateScope("CaCertificateCollection.Exists"); + scope.Start(); + try + { + var response = await _caCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, caCertificateName, 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.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_Get + /// + /// + /// + /// Name of the CA certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string caCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(caCertificateName, nameof(caCertificateName)); + + using var scope = _caCertificateClientDiagnostics.CreateScope("CaCertificateCollection.Exists"); + scope.Start(); + try + { + var response = _caCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, caCertificateName, 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateData.cs new file mode 100644 index 000000000000..31779d4645e7 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateData.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// A class representing the CaCertificate data model. + /// The CA Certificate resource. + /// + public partial class CaCertificateData : ResourceData + { + /// Initializes a new instance of CaCertificateData. + public CaCertificateData() + { + } + + /// Initializes a new instance of CaCertificateData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Description for the CA Certificate resource. + /// Base64 encoded PEM (Privacy Enhanced Mail) format certificate data. + /// Certificate issue time in UTC. This is a read-only field. + /// Certificate expiry time in UTC. This is a read-only field. + /// Provisioning state of the CA Certificate resource. + internal CaCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string encodedCertificate, DateTimeOffset? issueTimeInUtc, DateTimeOffset? expiryTimeInUtc, CaCertificateProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + { + Description = description; + EncodedCertificate = encodedCertificate; + IssueTimeInUtc = issueTimeInUtc; + ExpiryTimeInUtc = expiryTimeInUtc; + ProvisioningState = provisioningState; + } + + /// Description for the CA Certificate resource. + public string Description { get; set; } + /// Base64 encoded PEM (Privacy Enhanced Mail) format certificate data. + public string EncodedCertificate { get; set; } + /// Certificate issue time in UTC. This is a read-only field. + public DateTimeOffset? IssueTimeInUtc { get; } + /// Certificate expiry time in UTC. This is a read-only field. + public DateTimeOffset? ExpiryTimeInUtc { get; } + /// Provisioning state of the CA Certificate resource. + public CaCertificateProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateResource.cs new file mode 100644 index 000000000000..71065a5446ce --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateResource.cs @@ -0,0 +1,297 @@ +// 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.EventGrid +{ + /// + /// A Class representing a CaCertificate 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 GetCaCertificateResource method. + /// Otherwise you can get one from its parent resource using the GetCaCertificate method. + /// + public partial class CaCertificateResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string caCertificateName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _caCertificateClientDiagnostics; + private readonly CaCertificatesRestOperations _caCertificateRestClient; + private readonly CaCertificateData _data; + + /// Initializes a new instance of the class for mocking. + protected CaCertificateResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal CaCertificateResource(ArmClient client, CaCertificateData 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 CaCertificateResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _caCertificateClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string caCertificateApiVersion); + _caCertificateRestClient = new CaCertificatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, caCertificateApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.EventGrid/namespaces/caCertificates"; + + /// 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 CaCertificateData 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)); + } + + /// + /// Get properties of a CA certificate. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _caCertificateClientDiagnostics.CreateScope("CaCertificateResource.Get"); + scope.Start(); + try + { + var response = await _caCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new CaCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a CA certificate. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _caCertificateClientDiagnostics.CreateScope("CaCertificateResource.Get"); + scope.Start(); + try + { + var response = _caCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new CaCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete an existing CA certificate. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _caCertificateClientDiagnostics.CreateScope("CaCertificateResource.Delete"); + scope.Start(); + try + { + var response = await _caCertificateRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(_caCertificateClientDiagnostics, Pipeline, _caCertificateRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete an existing CA certificate. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _caCertificateClientDiagnostics.CreateScope("CaCertificateResource.Delete"); + scope.Start(); + try + { + var response = _caCertificateRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new EventGridArmOperation(_caCertificateClientDiagnostics, Pipeline, _caCertificateRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a CA certificate with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_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. + /// CA certificate information. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, CaCertificateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _caCertificateClientDiagnostics.CreateScope("CaCertificateResource.Update"); + scope.Start(); + try + { + var response = await _caCertificateRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new CaCertificateOperationSource(Client), _caCertificateClientDiagnostics, Pipeline, _caCertificateRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a CA certificate with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_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. + /// CA certificate information. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, CaCertificateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _caCertificateClientDiagnostics.CreateScope("CaCertificateResource.Update"); + scope.Start(); + try + { + var response = _caCertificateRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new EventGridArmOperation(new CaCertificateOperationSource(Client), _caCertificateClientDiagnostics, Pipeline, _caCertificateRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientCollection.cs new file mode 100644 index 000000000000..e7b0f981a3cc --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientCollection.cs @@ -0,0 +1,344 @@ +// 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; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// 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 GetClients method from an instance of . + /// + public partial class ClientCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientClientDiagnostics; + private readonly ClientsRestOperations _clientRestClient; + + /// Initializes a new instance of the class for mocking. + protected ClientCollection() + { + } + + /// 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 ClientCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _clientClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", ClientResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ClientResource.ResourceType, out string clientApiVersion); + _clientRestClient = new ClientsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, clientApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NamespaceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NamespaceResource.ResourceType), nameof(id)); + } + + /// + /// Create or update a client with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_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 client name. + /// Client information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string clientName, ClientData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientName, nameof(clientName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _clientClientDiagnostics.CreateScope("ClientCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _clientRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientName, data, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new ClientOperationSource(Client), _clientClientDiagnostics, Pipeline, _clientRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a client with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_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 client name. + /// Client information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string clientName, ClientData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientName, nameof(clientName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _clientClientDiagnostics.CreateScope("ClientCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _clientRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientName, data, cancellationToken); + var operation = new EventGridArmOperation(new ClientOperationSource(Client), _clientClientDiagnostics, Pipeline, _clientRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a client. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_Get + /// + /// + /// + /// Name of the client. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string clientName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientName, nameof(clientName)); + + using var scope = _clientClientDiagnostics.CreateScope("ClientCollection.Get"); + scope.Start(); + try + { + var response = await _clientRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ClientResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a client. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_Get + /// + /// + /// + /// Name of the client. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string clientName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientName, nameof(clientName)); + + using var scope = _clientClientDiagnostics.CreateScope("ClientCollection.Get"); + scope.Start(); + try + { + var response = _clientRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ClientResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get all the permission bindings under a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients + /// + /// + /// Operation Id + /// Clients_ListByNamespace + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _clientRestClient.CreateListByNamespaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _clientRestClient.CreateListByNamespaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ClientResource(Client, ClientData.DeserializeClientData(e)), _clientClientDiagnostics, Pipeline, "ClientCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get all the permission bindings under a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients + /// + /// + /// Operation Id + /// Clients_ListByNamespace + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _clientRestClient.CreateListByNamespaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _clientRestClient.CreateListByNamespaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ClientResource(Client, ClientData.DeserializeClientData(e)), _clientClientDiagnostics, Pipeline, "ClientCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_Get + /// + /// + /// + /// Name of the client. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string clientName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientName, nameof(clientName)); + + using var scope = _clientClientDiagnostics.CreateScope("ClientCollection.Exists"); + scope.Start(); + try + { + var response = await _clientRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientName, 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.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_Get + /// + /// + /// + /// Name of the client. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string clientName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientName, nameof(clientName)); + + using var scope = _clientClientDiagnostics.CreateScope("ClientCollection.Exists"); + scope.Start(); + try + { + var response = _clientRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientName, 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientData.cs new file mode 100644 index 000000000000..d7da4c66562e --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientData.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// A class representing the Client data model. + /// The Client resource. + /// + public partial class ClientData : ResourceData + { + /// Initializes a new instance of ClientData. + public ClientData() + { + Attributes = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of ClientData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Description for the Client resource. + /// The name presented by the client for authentication. The default value is the name of the resource. + /// Authentication information for the client. + /// The client certificate authentication information. + /// Indicates if the client is enabled or not. Default value is Enabled. + /// + /// Attributes for the client. Supported values are int, bool, string, string[]. + /// Example: + /// "attributes": { "room": "345", "floor": 12, "deviceTypes": ["Fan", "Light"] } + /// + /// Provisioning state of the Client resource. + internal ClientData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string authenticationName, ClientAuthentication authentication, ClientCertificateAuthentication clientCertificateAuthentication, ClientState? state, IDictionary attributes, ClientProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + { + Description = description; + AuthenticationName = authenticationName; + Authentication = authentication; + ClientCertificateAuthentication = clientCertificateAuthentication; + State = state; + Attributes = attributes; + ProvisioningState = provisioningState; + } + + /// Description for the Client resource. + public string Description { get; set; } + /// The name presented by the client for authentication. The default value is the name of the resource. + public string AuthenticationName { get; set; } + /// Authentication information for the client. + public ClientAuthentication Authentication { get; set; } + /// The client certificate authentication information. + public ClientCertificateAuthentication ClientCertificateAuthentication { get; set; } + /// Indicates if the client is enabled or not. Default value is Enabled. + public ClientState? State { get; set; } + /// + /// Attributes for the client. Supported values are int, bool, string, string[]. + /// Example: + /// "attributes": { "room": "345", "floor": 12, "deviceTypes": ["Fan", "Light"] } + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formated json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public IDictionary Attributes { get; } + /// Provisioning state of the Client resource. + public ClientProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientGroupCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientGroupCollection.cs new file mode 100644 index 000000000000..8d6e257224fb --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientGroupCollection.cs @@ -0,0 +1,344 @@ +// 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; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// 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 GetClientGroups method from an instance of . + /// + public partial class ClientGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientGroupClientDiagnostics; + private readonly ClientGroupsRestOperations _clientGroupRestClient; + + /// Initializes a new instance of the class for mocking. + protected ClientGroupCollection() + { + } + + /// 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 ClientGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _clientGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", ClientGroupResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ClientGroupResource.ResourceType, out string clientGroupApiVersion); + _clientGroupRestClient = new ClientGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, clientGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NamespaceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NamespaceResource.ResourceType), nameof(id)); + } + + /// + /// Create or update a client group with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_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 client group name. + /// Client group information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string clientGroupName, ClientGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientGroupName, nameof(clientGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _clientGroupClientDiagnostics.CreateScope("ClientGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _clientGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientGroupName, data, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new ClientGroupOperationSource(Client), _clientGroupClientDiagnostics, Pipeline, _clientGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientGroupName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a client group with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_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 client group name. + /// Client group information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string clientGroupName, ClientGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientGroupName, nameof(clientGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _clientGroupClientDiagnostics.CreateScope("ClientGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _clientGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientGroupName, data, cancellationToken); + var operation = new EventGridArmOperation(new ClientGroupOperationSource(Client), _clientGroupClientDiagnostics, Pipeline, _clientGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientGroupName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a client group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_Get + /// + /// + /// + /// Name of the client group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string clientGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientGroupName, nameof(clientGroupName)); + + using var scope = _clientGroupClientDiagnostics.CreateScope("ClientGroupCollection.Get"); + scope.Start(); + try + { + var response = await _clientGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientGroupName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ClientGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a client group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_Get + /// + /// + /// + /// Name of the client group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string clientGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientGroupName, nameof(clientGroupName)); + + using var scope = _clientGroupClientDiagnostics.CreateScope("ClientGroupCollection.Get"); + scope.Start(); + try + { + var response = _clientGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientGroupName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ClientGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get all the client groups under a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups + /// + /// + /// Operation Id + /// ClientGroups_ListByNamespace + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _clientGroupRestClient.CreateListByNamespaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _clientGroupRestClient.CreateListByNamespaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ClientGroupResource(Client, ClientGroupData.DeserializeClientGroupData(e)), _clientGroupClientDiagnostics, Pipeline, "ClientGroupCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get all the client groups under a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups + /// + /// + /// Operation Id + /// ClientGroups_ListByNamespace + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _clientGroupRestClient.CreateListByNamespaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _clientGroupRestClient.CreateListByNamespaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ClientGroupResource(Client, ClientGroupData.DeserializeClientGroupData(e)), _clientGroupClientDiagnostics, Pipeline, "ClientGroupCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_Get + /// + /// + /// + /// Name of the client group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string clientGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientGroupName, nameof(clientGroupName)); + + using var scope = _clientGroupClientDiagnostics.CreateScope("ClientGroupCollection.Exists"); + scope.Start(); + try + { + var response = await _clientGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientGroupName, 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.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_Get + /// + /// + /// + /// Name of the client group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string clientGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientGroupName, nameof(clientGroupName)); + + using var scope = _clientGroupClientDiagnostics.CreateScope("ClientGroupCollection.Exists"); + scope.Start(); + try + { + var response = _clientGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientGroupName, 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientGroupData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientGroupData.cs new file mode 100644 index 000000000000..41e6403f6ed7 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientGroupData.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// A class representing the ClientGroup data model. + /// The Client group resource. + /// + public partial class ClientGroupData : ResourceData + { + /// Initializes a new instance of ClientGroupData. + public ClientGroupData() + { + } + + /// Initializes a new instance of ClientGroupData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Description for the Client Group resource. + /// + /// The grouping query for the clients. + /// Example : attributes.keyName IN ['a', 'b', 'c']. + /// + /// Provisioning state of the ClientGroup resource. + internal ClientGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string query, ClientGroupProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + { + Description = description; + Query = query; + ProvisioningState = provisioningState; + } + + /// Description for the Client Group resource. + public string Description { get; set; } + /// + /// The grouping query for the clients. + /// Example : attributes.keyName IN ['a', 'b', 'c']. + /// + public string Query { get; set; } + /// Provisioning state of the ClientGroup resource. + public ClientGroupProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientGroupResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientGroupResource.cs new file mode 100644 index 000000000000..f073f2e091e4 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientGroupResource.cs @@ -0,0 +1,297 @@ +// 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.EventGrid +{ + /// + /// A Class representing a ClientGroup 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 GetClientGroupResource method. + /// Otherwise you can get one from its parent resource using the GetClientGroup method. + /// + public partial class ClientGroupResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string clientGroupName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _clientGroupClientDiagnostics; + private readonly ClientGroupsRestOperations _clientGroupRestClient; + private readonly ClientGroupData _data; + + /// Initializes a new instance of the class for mocking. + protected ClientGroupResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ClientGroupResource(ArmClient client, ClientGroupData 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 ClientGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _clientGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string clientGroupApiVersion); + _clientGroupRestClient = new ClientGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, clientGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.EventGrid/namespaces/clientGroups"; + + /// 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 ClientGroupData 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)); + } + + /// + /// Get properties of a client group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientGroupClientDiagnostics.CreateScope("ClientGroupResource.Get"); + scope.Start(); + try + { + var response = await _clientGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ClientGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a client group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientGroupClientDiagnostics.CreateScope("ClientGroupResource.Get"); + scope.Start(); + try + { + var response = _clientGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ClientGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete an existing client group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _clientGroupClientDiagnostics.CreateScope("ClientGroupResource.Delete"); + scope.Start(); + try + { + var response = await _clientGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(_clientGroupClientDiagnostics, Pipeline, _clientGroupRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete an existing client group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _clientGroupClientDiagnostics.CreateScope("ClientGroupResource.Delete"); + scope.Start(); + try + { + var response = _clientGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new EventGridArmOperation(_clientGroupClientDiagnostics, Pipeline, _clientGroupRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a client group with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_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. + /// Client group information. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ClientGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _clientGroupClientDiagnostics.CreateScope("ClientGroupResource.Update"); + scope.Start(); + try + { + var response = await _clientGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new ClientGroupOperationSource(Client), _clientGroupClientDiagnostics, Pipeline, _clientGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a client group with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_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. + /// Client group information. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ClientGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _clientGroupClientDiagnostics.CreateScope("ClientGroupResource.Update"); + scope.Start(); + try + { + var response = _clientGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new EventGridArmOperation(new ClientGroupOperationSource(Client), _clientGroupClientDiagnostics, Pipeline, _clientGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientResource.cs new file mode 100644 index 000000000000..bf23719f0b8b --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ClientResource.cs @@ -0,0 +1,297 @@ +// 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.EventGrid +{ + /// + /// A Class representing a Client 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 GetClientResource method. + /// Otherwise you can get one from its parent resource using the GetClient method. + /// + public partial class ClientResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string clientName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _clientClientDiagnostics; + private readonly ClientsRestOperations _clientRestClient; + private readonly ClientData _data; + + /// Initializes a new instance of the class for mocking. + protected ClientResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ClientResource(ArmClient client, ClientData 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 ClientResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _clientClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string clientApiVersion); + _clientRestClient = new ClientsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, clientApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.EventGrid/namespaces/clients"; + + /// 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 ClientData 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)); + } + + /// + /// Get properties of a client. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientClientDiagnostics.CreateScope("ClientResource.Get"); + scope.Start(); + try + { + var response = await _clientRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ClientResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a client. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientClientDiagnostics.CreateScope("ClientResource.Get"); + scope.Start(); + try + { + var response = _clientRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ClientResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete an existing client. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _clientClientDiagnostics.CreateScope("ClientResource.Delete"); + scope.Start(); + try + { + var response = await _clientRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(_clientClientDiagnostics, Pipeline, _clientRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete an existing client. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _clientClientDiagnostics.CreateScope("ClientResource.Delete"); + scope.Start(); + try + { + var response = _clientRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new EventGridArmOperation(_clientClientDiagnostics, Pipeline, _clientRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a client with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_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. + /// Client information. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ClientData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _clientClientDiagnostics.CreateScope("ClientResource.Update"); + scope.Start(); + try + { + var response = await _clientRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new ClientOperationSource(Client), _clientClientDiagnostics, Pipeline, _clientRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a client with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_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. + /// Client information. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ClientData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _clientClientDiagnostics.CreateScope("ClientResource.Update"); + scope.Start(); + try + { + var response = _clientRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new EventGridArmOperation(new ClientOperationSource(Client), _clientClientDiagnostics, Pipeline, _clientRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicEventSubscriptionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicEventSubscriptionResource.cs index 86e5a382138f..9296ccbe74c8 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicEventSubscriptionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicEventSubscriptionResource.cs @@ -295,6 +295,48 @@ public virtual ArmOperation Update(WaitUnt } } + /// + /// Get all delivery attributes for an event subscription for domain topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes + /// + /// + /// Operation Id + /// DomainTopicEventSubscriptions_GetDeliveryAttributes + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeliveryAttributesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _domainTopicEventSubscriptionRestClient.CreateGetDeliveryAttributesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, DeliveryAttributeMapping.DeserializeDeliveryAttributeMapping, _domainTopicEventSubscriptionClientDiagnostics, Pipeline, "DomainTopicEventSubscriptionResource.GetDeliveryAttributes", "value", null, cancellationToken); + } + + /// + /// Get all delivery attributes for an event subscription for domain topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes + /// + /// + /// Operation Id + /// DomainTopicEventSubscriptions_GetDeliveryAttributes + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeliveryAttributes(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _domainTopicEventSubscriptionRestClient.CreateGetDeliveryAttributesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return PageableHelpers.CreatePageable(FirstPageRequest, null, DeliveryAttributeMapping.DeserializeDeliveryAttributeMapping, _domainTopicEventSubscriptionClientDiagnostics, Pipeline, "DomainTopicEventSubscriptionResource.GetDeliveryAttributes", "value", null, cancellationToken); + } + /// /// Get the full endpoint URL for a nested event subscription for domain topic. /// @@ -354,47 +396,5 @@ public virtual Response GetFullUri(CancellationToken c throw; } } - - /// - /// Get all delivery attributes for an event subscription for domain topic. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes - /// - /// - /// Operation Id - /// DomainTopicEventSubscriptions_GetDeliveryAttributes - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeliveryAttributesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _domainTopicEventSubscriptionRestClient.CreateGetDeliveryAttributesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, DeliveryAttributeMapping.DeserializeDeliveryAttributeMapping, _domainTopicEventSubscriptionClientDiagnostics, Pipeline, "DomainTopicEventSubscriptionResource.GetDeliveryAttributes", "value", null, cancellationToken); - } - - /// - /// Get all delivery attributes for an event subscription for domain topic. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes - /// - /// - /// Operation Id - /// DomainTopicEventSubscriptions_GetDeliveryAttributes - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeliveryAttributes(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _domainTopicEventSubscriptionRestClient.CreateGetDeliveryAttributesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return PageableHelpers.CreatePageable(FirstPageRequest, null, DeliveryAttributeMapping.DeserializeDeliveryAttributeMapping, _domainTopicEventSubscriptionClientDiagnostics, Pipeline, "DomainTopicEventSubscriptionResource.GetDeliveryAttributes", "value", null, cancellationToken); - } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainData.cs index acd0be426b09..767e11ed7f53 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainData.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainData.cs @@ -34,11 +34,17 @@ public EventGridDomainData(AzureLocation location) : base(location) /// The systemData. /// The tags. /// The location. + /// The Sku pricing tier for the Event Grid Domain resource. /// Identity information for the Event Grid Domain resource. - /// List of private endpoint connections. + /// /// Provisioning state of the Event Grid Domain Resource. + /// Minimum TLS version of the publisher allowed to publish to this domain. /// Endpoint for the Event Grid Domain Resource which is used for publishing the events. /// This determines the format that Event Grid should expect for incoming events published to the Event Grid Domain Resource. + /// + /// Event Type Information for the domain. This information is provided by the publisher and can be used by the + /// subscriber to view different types of events that are published. + /// /// /// Information about the InputSchemaMapping which specified the info about mapping event payload. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -70,13 +76,16 @@ public EventGridDomainData(AzureLocation location) : base(location) /// resources by the user. /// /// Data Residency Boundary of the resource. - internal EventGridDomainData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, IReadOnlyList privateEndpointConnections, EventGridDomainProvisioningState? provisioningState, Uri endpoint, EventGridInputSchema? inputSchema, EventGridInputSchemaMapping inputSchemaMapping, string metricResourceId, EventGridPublicNetworkAccess? publicNetworkAccess, IList inboundIPRules, bool? isLocalAuthDisabled, bool? autoCreateTopicWithFirstSubscription, bool? autoDeleteTopicWithLastSubscription, DataResidencyBoundary? dataResidencyBoundary) : base(id, name, resourceType, systemData, tags, location) + internal EventGridDomainData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ResourceSku sku, ManagedServiceIdentity identity, IReadOnlyList privateEndpointConnections, EventGridDomainProvisioningState? provisioningState, TlsVersion? minimumTlsVersionAllowed, Uri endpoint, EventGridInputSchema? inputSchema, PartnerTopicEventTypeInfo eventTypeInfo, EventGridInputSchemaMapping inputSchemaMapping, string metricResourceId, EventGridPublicNetworkAccess? publicNetworkAccess, IList inboundIPRules, bool? isLocalAuthDisabled, bool? autoCreateTopicWithFirstSubscription, bool? autoDeleteTopicWithLastSubscription, DataResidencyBoundary? dataResidencyBoundary) : base(id, name, resourceType, systemData, tags, location) { + Sku = sku; Identity = identity; PrivateEndpointConnections = privateEndpointConnections; ProvisioningState = provisioningState; + MinimumTlsVersionAllowed = minimumTlsVersionAllowed; Endpoint = endpoint; InputSchema = inputSchema; + EventTypeInfo = eventTypeInfo; InputSchemaMapping = inputSchemaMapping; MetricResourceId = metricResourceId; PublicNetworkAccess = publicNetworkAccess; @@ -87,17 +96,38 @@ internal EventGridDomainData(ResourceIdentifier id, string name, ResourceType re DataResidencyBoundary = dataResidencyBoundary; } + /// The Sku pricing tier for the Event Grid Domain resource. + internal ResourceSku Sku { get; set; } + /// The Sku name of the resource. The possible values are: Basic or Premium. + public EventGridSku? SkuName + { + get => Sku is null ? default : Sku.Name; + set + { + if (Sku is null) + Sku = new ResourceSku(); + Sku.Name = value; + } + } + /// Identity information for the Event Grid Domain resource. public ManagedServiceIdentity Identity { get; set; } - /// List of private endpoint connections. + /// Gets the private endpoint connections. public IReadOnlyList PrivateEndpointConnections { get; } /// Provisioning state of the Event Grid Domain Resource. public EventGridDomainProvisioningState? ProvisioningState { get; } + /// Minimum TLS version of the publisher allowed to publish to this domain. + public TlsVersion? MinimumTlsVersionAllowed { get; set; } /// Endpoint for the Event Grid Domain Resource which is used for publishing the events. public Uri Endpoint { get; } /// This determines the format that Event Grid should expect for incoming events published to the Event Grid Domain Resource. public EventGridInputSchema? InputSchema { get; set; } /// + /// Event Type Information for the domain. This information is provided by the publisher and can be used by the + /// subscriber to view different types of events that are published. + /// + public PartnerTopicEventTypeInfo EventTypeInfo { get; set; } + /// /// Information about the InputSchemaMapping which specified the info about mapping event payload. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include . diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionCollection.cs index 3c47c38861e9..65882b3a1044 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionCollection.cs @@ -136,7 +136,7 @@ public virtual ArmOperation Cr } /// - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -173,7 +173,7 @@ public virtual async Task - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -210,7 +210,7 @@ public virtual Response Get(st } /// - /// Get all private endpoint connections under a topic, domain, or partner namespace. + /// Get all private endpoint connections under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -234,7 +234,7 @@ public virtual AsyncPageable G } /// - /// Get all private endpoint connections under a topic, domain, or partner namespace. + /// Get all private endpoint connections under a topic, domain, or partner namespace or namespace. /// /// /// Request Path diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionResource.cs index f283c28d78d5..7d5b44971389 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionResource.cs @@ -88,7 +88,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -120,7 +120,7 @@ public virtual async Task - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -152,7 +152,7 @@ public virtual Response Get(Ca } /// - /// Delete a specific private endpoint connection under a topic, domain, or partner namespace. + /// Delete a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -186,7 +186,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete a specific private endpoint connection under a topic, domain, or partner namespace. + /// Delete a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateLinkResourceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateLinkResourceCollection.cs index 28e50c8dc468..11f2fe9ca591 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateLinkResourceCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateLinkResourceCollection.cs @@ -66,7 +66,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -103,7 +103,7 @@ public virtual async Task> GetAsync /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -128,7 +128,7 @@ public virtual Response Get(string privateLi } /// - /// List all the private link resources under a topic, domain, or partner namespace. + /// List all the private link resources under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -152,7 +152,7 @@ public virtual AsyncPageable GetAllAsync(str } /// - /// List all the private link resources under a topic, domain, or partner namespace. + /// List all the private link resources under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -188,7 +188,7 @@ public virtual Pageable GetAll(string filter /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -223,7 +223,7 @@ public virtual async Task> ExistsAsync(string privateLinkResource /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainResource.cs index e6f0fe7c1a7e..58992f129f9d 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainResource.cs @@ -203,7 +203,7 @@ public virtual EventGridDomainPrivateEndpointConnectionCollection GetEventGridDo } /// - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -226,7 +226,7 @@ public virtual async Task - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -268,7 +268,7 @@ public virtual EventGridDomainPrivateLinkResourceCollection GetEventGridDomainPr /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -291,7 +291,7 @@ public virtual async Task> GetEvent /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionCollection.cs index 79dfe2cf60c4..4233185ec5e2 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionCollection.cs @@ -136,7 +136,7 @@ public virtual ArmOperation - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -173,7 +173,7 @@ public virtual async Task - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -210,7 +210,7 @@ public virtual Response - /// Get all private endpoint connections under a topic, domain, or partner namespace. + /// Get all private endpoint connections under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -234,7 +234,7 @@ public virtual AsyncPageable - /// Get all private endpoint connections under a topic, domain, or partner namespace. + /// Get all private endpoint connections under a topic, domain, or partner namespace or namespace. /// /// /// Request Path diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionResource.cs index 6589b227d55f..b8ba91893a21 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionResource.cs @@ -88,7 +88,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -120,7 +120,7 @@ public virtual async Task - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -152,7 +152,7 @@ public virtual Response - /// Delete a specific private endpoint connection under a topic, domain, or partner namespace. + /// Delete a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -186,7 +186,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete a specific private endpoint connection under a topic, domain, or partner namespace. + /// Delete a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridSubscriptionData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridSubscriptionData.cs index 172613f6420b..8e16fe4ae45a 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridSubscriptionData.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridSubscriptionData.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.EventGrid { /// /// A class representing the EventGridSubscription data model. - /// Event Subscription + /// Event Subscription. /// public partial class EventGridSubscriptionData : ResourceData { @@ -36,7 +36,7 @@ public EventGridSubscriptionData() /// Information about the destination where events have to be delivered for the event subscription. /// Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , and . + /// The available derived classes include , , , , , , and . /// /// /// Information about the destination where events have to be delivered for the event subscription. @@ -80,7 +80,7 @@ internal EventGridSubscriptionData(ResourceIdentifier id, string name, ResourceT /// Information about the destination where events have to be delivered for the event subscription. /// Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , and . + /// The available derived classes include , , , , , , and . /// public EventSubscriptionDestination Destination { get; set; } /// diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicData.cs index d98bdc069533..05f8a5b91095 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicData.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicData.cs @@ -10,6 +10,7 @@ using Azure.Core; using Azure.ResourceManager.EventGrid.Models; using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.EventGrid { @@ -34,10 +35,18 @@ public EventGridTopicData(AzureLocation location) : base(location) /// The systemData. /// The tags. /// The location. + /// The Sku pricing tier for the topic. /// Identity information for the resource. + /// Kind of the resource. + /// Extended location of the resource. /// /// Provisioning state of the topic. /// Endpoint for the topic. + /// + /// Event Type Information for the user topic. This information is provided by the publisher and can be used by the + /// subscriber to view different types of events that are published. + /// + /// Minimum TLS version of the publisher allowed to publish to this topic. /// This determines the format that Event Grid should expect for incoming events published to the topic. /// /// This enables publishing using custom event schemas. An InputSchemaMapping can be specified to map various properties of a source schema to various required properties of the EventGridEvent schema. @@ -52,12 +61,17 @@ public EventGridTopicData(AzureLocation location) : base(location) /// This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. /// This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the topic. /// Data Residency Boundary of the resource. - internal EventGridTopicData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, IReadOnlyList privateEndpointConnections, EventGridTopicProvisioningState? provisioningState, Uri endpoint, EventGridInputSchema? inputSchema, EventGridInputSchemaMapping inputSchemaMapping, string metricResourceId, EventGridPublicNetworkAccess? publicNetworkAccess, IList inboundIPRules, bool? isLocalAuthDisabled, DataResidencyBoundary? dataResidencyBoundary) : base(id, name, resourceType, systemData, tags, location) + internal EventGridTopicData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ResourceSku sku, ManagedServiceIdentity identity, ResourceKind? kind, ExtendedLocation extendedLocation, IReadOnlyList privateEndpointConnections, EventGridTopicProvisioningState? provisioningState, Uri endpoint, PartnerTopicEventTypeInfo eventTypeInfo, TlsVersion? minimumTlsVersionAllowed, EventGridInputSchema? inputSchema, EventGridInputSchemaMapping inputSchemaMapping, string metricResourceId, EventGridPublicNetworkAccess? publicNetworkAccess, IList inboundIPRules, bool? isLocalAuthDisabled, DataResidencyBoundary? dataResidencyBoundary) : base(id, name, resourceType, systemData, tags, location) { + Sku = sku; Identity = identity; + Kind = kind; + ExtendedLocation = extendedLocation; PrivateEndpointConnections = privateEndpointConnections; ProvisioningState = provisioningState; Endpoint = endpoint; + EventTypeInfo = eventTypeInfo; + MinimumTlsVersionAllowed = minimumTlsVersionAllowed; InputSchema = inputSchema; InputSchemaMapping = inputSchemaMapping; MetricResourceId = metricResourceId; @@ -67,14 +81,39 @@ internal EventGridTopicData(ResourceIdentifier id, string name, ResourceType res DataResidencyBoundary = dataResidencyBoundary; } + /// The Sku pricing tier for the topic. + internal ResourceSku Sku { get; set; } + /// The Sku name of the resource. The possible values are: Basic or Premium. + public EventGridSku? SkuName + { + get => Sku is null ? default : Sku.Name; + set + { + if (Sku is null) + Sku = new ResourceSku(); + Sku.Name = value; + } + } + /// Identity information for the resource. public ManagedServiceIdentity Identity { get; set; } + /// Kind of the resource. + public ResourceKind? Kind { get; set; } + /// Extended location of the resource. + public ExtendedLocation ExtendedLocation { get; set; } /// Gets the private endpoint connections. public IReadOnlyList PrivateEndpointConnections { get; } /// Provisioning state of the topic. public EventGridTopicProvisioningState? ProvisioningState { get; } /// Endpoint for the topic. public Uri Endpoint { get; } + /// + /// Event Type Information for the user topic. This information is provided by the publisher and can be used by the + /// subscriber to view different types of events that are published. + /// + public PartnerTopicEventTypeInfo EventTypeInfo { get; set; } + /// Minimum TLS version of the publisher allowed to publish to this topic. + public TlsVersion? MinimumTlsVersionAllowed { get; set; } /// This determines the format that Event Grid should expect for incoming events published to the topic. public EventGridInputSchema? InputSchema { get; set; } /// diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionCollection.cs index b837efea17a5..e817b3007f3d 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionCollection.cs @@ -136,7 +136,7 @@ public virtual ArmOperation Cre } /// - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -173,7 +173,7 @@ public virtual async Task - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -210,7 +210,7 @@ public virtual Response Get(str } /// - /// Get all private endpoint connections under a topic, domain, or partner namespace. + /// Get all private endpoint connections under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -234,7 +234,7 @@ public virtual AsyncPageable Ge } /// - /// Get all private endpoint connections under a topic, domain, or partner namespace. + /// Get all private endpoint connections under a topic, domain, or partner namespace or namespace. /// /// /// Request Path diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionResource.cs index 39bb08bfdded..c5fd14011f3a 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionResource.cs @@ -88,7 +88,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -120,7 +120,7 @@ public virtual async Task - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -152,7 +152,7 @@ public virtual Response Get(Can } /// - /// Delete a specific private endpoint connection under a topic, domain, or partner namespace. + /// Delete a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -186,7 +186,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete a specific private endpoint connection under a topic, domain, or partner namespace. + /// Delete a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateLinkResourceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateLinkResourceCollection.cs index 3e823b947df1..34447b3c0f1f 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateLinkResourceCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateLinkResourceCollection.cs @@ -66,7 +66,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -103,7 +103,7 @@ public virtual async Task> GetAsync( /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -128,7 +128,7 @@ public virtual Response Get(string privateLin } /// - /// List all the private link resources under a topic, domain, or partner namespace. + /// List all the private link resources under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -152,7 +152,7 @@ public virtual AsyncPageable GetAllAsync(stri } /// - /// List all the private link resources under a topic, domain, or partner namespace. + /// List all the private link resources under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -188,7 +188,7 @@ public virtual Pageable GetAll(string filter /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -223,7 +223,7 @@ public virtual async Task> ExistsAsync(string privateLinkResource /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicResource.cs index cba6185e040d..181807ba19e7 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicResource.cs @@ -150,7 +150,7 @@ public virtual EventGridTopicPrivateEndpointConnectionCollection GetEventGridTop } /// - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -173,7 +173,7 @@ public virtual async Task - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -215,7 +215,7 @@ public virtual EventGridTopicPrivateLinkResourceCollection GetEventGridTopicPriv /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -238,7 +238,7 @@ public virtual async Task> GetEventG /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -530,19 +530,19 @@ public virtual Response GetSharedAccessKeys(CancellationT /// /// /// 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. - /// Request body to regenerate key. + /// Request body to regenerate key. /// The cancellation token to use. - /// is null. - public virtual async Task> RegenerateKeyAsync(WaitUntil waitUntil, TopicRegenerateKeyContent content, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> RegenerateKeyAsync(WaitUntil waitUntil, TopicRegenerateKeyRequest regenerateKeyRequest, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(regenerateKeyRequest, nameof(regenerateKeyRequest)); using var scope = _eventGridTopicTopicsClientDiagnostics.CreateScope("EventGridTopicResource.RegenerateKey"); scope.Start(); try { - var response = await _eventGridTopicTopicsRestClient.RegenerateKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new EventGridArmOperation(new TopicSharedAccessKeysOperationSource(), _eventGridTopicTopicsClientDiagnostics, Pipeline, _eventGridTopicTopicsRestClient.CreateRegenerateKeyRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = await _eventGridTopicTopicsRestClient.RegenerateKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, regenerateKeyRequest, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new TopicSharedAccessKeysOperationSource(), _eventGridTopicTopicsClientDiagnostics, Pipeline, _eventGridTopicTopicsRestClient.CreateRegenerateKeyRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, regenerateKeyRequest).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -568,19 +568,19 @@ public virtual async Task> RegenerateKeyAsyn /// /// /// 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. - /// Request body to regenerate key. + /// Request body to regenerate key. /// The cancellation token to use. - /// is null. - public virtual ArmOperation RegenerateKey(WaitUntil waitUntil, TopicRegenerateKeyContent content, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation RegenerateKey(WaitUntil waitUntil, TopicRegenerateKeyRequest regenerateKeyRequest, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(regenerateKeyRequest, nameof(regenerateKeyRequest)); using var scope = _eventGridTopicTopicsClientDiagnostics.CreateScope("EventGridTopicResource.RegenerateKey"); scope.Start(); try { - var response = _eventGridTopicTopicsRestClient.RegenerateKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); - var operation = new EventGridArmOperation(new TopicSharedAccessKeysOperationSource(), _eventGridTopicTopicsClientDiagnostics, Pipeline, _eventGridTopicTopicsRestClient.CreateRegenerateKeyRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = _eventGridTopicTopicsRestClient.RegenerateKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, regenerateKeyRequest, cancellationToken); + var operation = new EventGridArmOperation(new TopicSharedAccessKeysOperationSource(), _eventGridTopicTopicsClientDiagnostics, Pipeline, _eventGridTopicTopicsRestClient.CreateRegenerateKeyRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, regenerateKeyRequest).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionCollection.cs index c58aee9a80db..f6f8c99e3730 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionCollection.cs @@ -243,7 +243,7 @@ public virtual Response Get(string eventSubscriptionN /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) { - if (Id.ResourceType == SubscriptionResource.ResourceType) + if (Id.ResourceType == Resources.SubscriptionResource.ResourceType) { HttpMessage FirstPageRequest(int? pageSizeHint) => _eventSubscriptionRestClient.CreateListGlobalBySubscriptionRequest(Id.SubscriptionId, filter, top); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _eventSubscriptionRestClient.CreateListGlobalBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); @@ -312,7 +312,7 @@ public virtual AsyncPageable GetAllAsync(string filte /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default) { - if (Id.ResourceType == SubscriptionResource.ResourceType) + if (Id.ResourceType == Resources.SubscriptionResource.ResourceType) { HttpMessage FirstPageRequest(int? pageSizeHint) => _eventSubscriptionRestClient.CreateListGlobalBySubscriptionRequest(Id.SubscriptionId, filter, top); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _eventSubscriptionRestClient.CreateListGlobalBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionResource.cs index 8abbc1a75e35..7e6b61fc6423 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionResource.cs @@ -295,6 +295,48 @@ public virtual ArmOperation Update(WaitUntil waitUnti } } + /// + /// Get all delivery attributes for an event subscription. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes + /// + /// + /// Operation Id + /// EventSubscriptions_GetDeliveryAttributes + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeliveryAttributesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _eventSubscriptionRestClient.CreateGetDeliveryAttributesRequest(Id.Parent, Id.Name); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, DeliveryAttributeMapping.DeserializeDeliveryAttributeMapping, _eventSubscriptionClientDiagnostics, Pipeline, "EventSubscriptionResource.GetDeliveryAttributes", "value", null, cancellationToken); + } + + /// + /// Get all delivery attributes for an event subscription. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes + /// + /// + /// Operation Id + /// EventSubscriptions_GetDeliveryAttributes + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeliveryAttributes(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _eventSubscriptionRestClient.CreateGetDeliveryAttributesRequest(Id.Parent, Id.Name); + return PageableHelpers.CreatePageable(FirstPageRequest, null, DeliveryAttributeMapping.DeserializeDeliveryAttributeMapping, _eventSubscriptionClientDiagnostics, Pipeline, "EventSubscriptionResource.GetDeliveryAttributes", "value", null, cancellationToken); + } + /// /// Get the full endpoint URL for an event subscription. /// @@ -354,47 +396,5 @@ public virtual Response GetFullUri(CancellationToken c throw; } } - - /// - /// Get all delivery attributes for an event subscription. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes - /// - /// - /// Operation Id - /// EventSubscriptions_GetDeliveryAttributes - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeliveryAttributesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _eventSubscriptionRestClient.CreateGetDeliveryAttributesRequest(Id.Parent, Id.Name); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, DeliveryAttributeMapping.DeserializeDeliveryAttributeMapping, _eventSubscriptionClientDiagnostics, Pipeline, "EventSubscriptionResource.GetDeliveryAttributes", "value", null, cancellationToken); - } - - /// - /// Get all delivery attributes for an event subscription. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes - /// - /// - /// Operation Id - /// EventSubscriptions_GetDeliveryAttributes - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeliveryAttributes(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _eventSubscriptionRestClient.CreateGetDeliveryAttributesRequest(Id.Parent, Id.Name); - return PageableHelpers.CreatePageable(FirstPageRequest, null, DeliveryAttributeMapping.DeserializeDeliveryAttributeMapping, _eventSubscriptionClientDiagnostics, Pipeline, "EventSubscriptionResource.GetDeliveryAttributes", "value", null, cancellationToken); - } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/EventGridExtensions.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/EventGridExtensions.cs index 8195ec15ffdf..001da3d816d1 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/EventGridExtensions.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/EventGridExtensions.cs @@ -82,6 +82,25 @@ private static TenantResourceExtensionClient GetTenantResourceExtensionClient(Ar return new TenantResourceExtensionClient(client, scope); }); } + #region CaCertificateResource + /// + /// 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 CaCertificateResource GetCaCertificateResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + CaCertificateResource.ValidateResourceId(id); + return new CaCertificateResource(client, id); + } + ); + } + #endregion + #region PartnerNamespaceChannelResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -101,6 +120,44 @@ public static PartnerNamespaceChannelResource GetPartnerNamespaceChannelResource } #endregion + #region ClientGroupResource + /// + /// 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 ClientGroupResource GetClientGroupResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ClientGroupResource.ValidateResourceId(id); + return new ClientGroupResource(client, id); + } + ); + } + #endregion + + #region ClientResource + /// + /// 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 ClientResource GetClientResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ClientResource.ValidateResourceId(id); + return new ClientResource(client, id); + } + ); + } + #endregion + #region EventGridDomainResource /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. @@ -139,6 +196,25 @@ public static DomainTopicResource GetDomainTopicResource(this ArmClient client, } #endregion + #region DomainTopicEventSubscriptionResource + /// + /// 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 DomainTopicEventSubscriptionResource GetDomainTopicEventSubscriptionResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DomainTopicEventSubscriptionResource.ValidateResourceId(id); + return new DomainTopicEventSubscriptionResource(client, id); + } + ); + } + #endregion + #region TopicEventSubscriptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -196,25 +272,6 @@ public static EventSubscriptionResource GetEventSubscriptionResource(this ArmCli } #endregion - #region DomainTopicEventSubscriptionResource - /// - /// 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 DomainTopicEventSubscriptionResource GetDomainTopicEventSubscriptionResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - DomainTopicEventSubscriptionResource.ValidateResourceId(id); - return new DomainTopicEventSubscriptionResource(client, id); - } - ); - } - #endregion - #region SystemTopicEventSubscriptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -253,20 +310,58 @@ public static PartnerTopicEventSubscriptionResource GetPartnerTopicEventSubscrip } #endregion - #region EventGridTopicResource + #region SubscriptionResource /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// 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 EventGridTopicResource GetEventGridTopicResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static SubscriptionResource GetSubscriptionResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - EventGridTopicResource.ValidateResourceId(id); - return new EventGridTopicResource(client, id); + SubscriptionResource.ValidateResourceId(id); + return new SubscriptionResource(client, id); + } + ); + } + #endregion + + #region NamespaceResource + /// + /// 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 NamespaceResource GetNamespaceResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + NamespaceResource.ValidateResourceId(id); + return new NamespaceResource(client, id); + } + ); + } + #endregion + + #region NamespaceTopicResource + /// + /// 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 NamespaceTopicResource GetNamespaceTopicResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + NamespaceTopicResource.ValidateResourceId(id); + return new NamespaceTopicResource(client, id); } ); } @@ -291,6 +386,25 @@ public static PartnerConfigurationResource GetPartnerConfigurationResource(this } #endregion + #region PartnerDestinationResource + /// + /// 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 PartnerDestinationResource GetPartnerDestinationResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + PartnerDestinationResource.ValidateResourceId(id); + return new PartnerDestinationResource(client, id); + } + ); + } + #endregion + #region PartnerNamespaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -348,6 +462,25 @@ public static PartnerTopicResource GetPartnerTopicResource(this ArmClient client } #endregion + #region PermissionBindingResource + /// + /// 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 PermissionBindingResource GetPermissionBindingResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + PermissionBindingResource.ValidateResourceId(id); + return new PermissionBindingResource(client, id); + } + ); + } + #endregion + #region EventGridTopicPrivateEndpointConnectionResource /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. @@ -481,6 +614,25 @@ public static SystemTopicResource GetSystemTopicResource(this ArmClient client, } #endregion + #region EventGridTopicResource + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static EventGridTopicResource GetEventGridTopicResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + EventGridTopicResource.ValidateResourceId(id); + return new EventGridTopicResource(client, id); + } + ); + } + #endregion + #region ExtensionTopicResource /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. @@ -500,6 +652,25 @@ public static ExtensionTopicResource GetExtensionTopicResource(this ArmClient cl } #endregion + #region TopicSpaceResource + /// + /// 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 TopicSpaceResource GetTopicSpaceResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + TopicSpaceResource.ValidateResourceId(id); + return new TopicSpaceResource(client, id); + } + ); + } + #endregion + #region TopicTypeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -662,60 +833,60 @@ public static Response GetEventGridDomain(this Resource return resourceGroupResource.GetEventGridDomains().Get(domainName, cancellationToken); } - /// Gets a collection of EventGridTopicResources in the ResourceGroupResource. + /// Gets a collection of NamespaceResources in the ResourceGroupResource. /// The instance the method will execute against. - /// An object representing collection of EventGridTopicResources and their operations over a EventGridTopicResource. - public static EventGridTopicCollection GetEventGridTopics(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of NamespaceResources and their operations over a NamespaceResource. + public static NamespaceCollection GetNamespaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEventGridTopics(); + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNamespaces(); } /// - /// Get properties of a topic. + /// Get properties of a namespace. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} /// /// /// Operation Id - /// Topics_Get + /// Namespaces_Get /// /// /// /// The instance the method will execute against. - /// Name of the topic. + /// Name of the namespace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. + /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] - public static async Task> GetEventGridTopicAsync(this ResourceGroupResource resourceGroupResource, string topicName, CancellationToken cancellationToken = default) + public static async Task> GetNamespaceAsync(this ResourceGroupResource resourceGroupResource, string namespaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetEventGridTopics().GetAsync(topicName, cancellationToken).ConfigureAwait(false); + return await resourceGroupResource.GetNamespaces().GetAsync(namespaceName, cancellationToken).ConfigureAwait(false); } /// - /// Get properties of a topic. + /// Get properties of a namespace. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} /// /// /// Operation Id - /// Topics_Get + /// Namespaces_Get /// /// /// /// The instance the method will execute against. - /// Name of the topic. + /// Name of the namespace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. + /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] - public static Response GetEventGridTopic(this ResourceGroupResource resourceGroupResource, string topicName, CancellationToken cancellationToken = default) + public static Response GetNamespace(this ResourceGroupResource resourceGroupResource, string namespaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetEventGridTopics().Get(topicName, cancellationToken); + return resourceGroupResource.GetNamespaces().Get(namespaceName, cancellationToken); } /// Gets an object representing a PartnerConfigurationResource along with the instance operations that can be performed on it in the ResourceGroupResource. @@ -726,6 +897,62 @@ public static PartnerConfigurationResource GetPartnerConfiguration(this Resource return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPartnerConfiguration(); } + /// Gets a collection of PartnerDestinationResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// An object representing collection of PartnerDestinationResources and their operations over a PartnerDestinationResource. + public static PartnerDestinationCollection GetPartnerDestinations(this ResourceGroupResource resourceGroupResource) + { + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPartnerDestinations(); + } + + /// + /// Get properties of a partner destination. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// The instance the method will execute against. + /// Name of the partner destination. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetPartnerDestinationAsync(this ResourceGroupResource resourceGroupResource, string partnerDestinationName, CancellationToken cancellationToken = default) + { + return await resourceGroupResource.GetPartnerDestinations().GetAsync(partnerDestinationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a partner destination. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// The instance the method will execute against. + /// Name of the partner destination. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetPartnerDestination(this ResourceGroupResource resourceGroupResource, string partnerDestinationName, CancellationToken cancellationToken = default) + { + return resourceGroupResource.GetPartnerDestinations().Get(partnerDestinationName, cancellationToken); + } + /// Gets a collection of PartnerNamespaceResources in the ResourceGroupResource. /// The instance the method will execute against. /// An object representing collection of PartnerNamespaceResources and their operations over a PartnerNamespaceResource. @@ -950,6 +1177,62 @@ public static Response GetSystemTopic(this ResourceGroupRes return resourceGroupResource.GetSystemTopics().Get(systemTopicName, cancellationToken); } + /// Gets a collection of EventGridTopicResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// An object representing collection of EventGridTopicResources and their operations over a EventGridTopicResource. + public static EventGridTopicCollection GetEventGridTopics(this ResourceGroupResource resourceGroupResource) + { + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEventGridTopics(); + } + + /// + /// Get properties of a topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName} + /// + /// + /// Operation Id + /// Topics_Get + /// + /// + /// + /// The instance the method will execute against. + /// Name of the topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetEventGridTopicAsync(this ResourceGroupResource resourceGroupResource, string topicName, CancellationToken cancellationToken = default) + { + return await resourceGroupResource.GetEventGridTopics().GetAsync(topicName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName} + /// + /// + /// Operation Id + /// Topics_Get + /// + /// + /// + /// The instance the method will execute against. + /// Name of the topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetEventGridTopic(this ResourceGroupResource resourceGroupResource, string topicName, CancellationToken cancellationToken = default) + { + return resourceGroupResource.GetEventGridTopics().Get(topicName, cancellationToken); + } + /// /// List all the domains under an Azure subscription. /// @@ -963,12 +1246,12 @@ public static Response GetSystemTopic(this ResourceGroupRes /// /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetEventGridDomainsAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + public static AsyncPageable GetEventGridDomainsAsync(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventGridDomainsAsync(filter, top, cancellationToken); } @@ -986,60 +1269,222 @@ public static AsyncPageable GetEventGridDomainsAsync(th /// /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetEventGridDomains(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + public static Pageable GetEventGridDomains(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventGridDomains(filter, top, cancellationToken); } /// - /// List all the topics under an Azure subscription. + /// List all global event subscriptions under an Azure subscription for a topic type. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions /// /// /// Operation Id - /// Topics_ListBySubscription + /// EventSubscriptions_ListGlobalBySubscriptionForTopicType /// /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. + /// Name of the topic type. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetEventGridTopicsAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetGlobalEventSubscriptionsDataForTopicTypeAsync(this Resources.SubscriptionResource subscriptionResource, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventGridTopicsAsync(filter, top, cancellationToken); + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetGlobalEventSubscriptionsDataForTopicTypeAsync(topicTypeName, filter, top, cancellationToken); } /// - /// List all the topics under an Azure subscription. + /// List all global event subscriptions under an Azure subscription for a topic type. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions /// /// /// Operation Id - /// Topics_ListBySubscription + /// EventSubscriptions_ListGlobalBySubscriptionForTopicType /// /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. + /// Name of the topic type. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetEventGridTopics(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetGlobalEventSubscriptionsDataForTopicType(this Resources.SubscriptionResource subscriptionResource, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventGridTopics(filter, top, cancellationToken); + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetGlobalEventSubscriptionsDataForTopicType(topicTypeName, filter, top, cancellationToken); + } + + /// + /// List all event subscriptions from the given location under a specific Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions + /// + /// + /// Operation Id + /// EventSubscriptions_ListRegionalBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// Name of the location. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetRegionalEventSubscriptionsDataAsync(this Resources.SubscriptionResource subscriptionResource, AzureLocation location, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRegionalEventSubscriptionsDataAsync(location, filter, top, cancellationToken); + } + + /// + /// List all event subscriptions from the given location under a specific Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions + /// + /// + /// Operation Id + /// EventSubscriptions_ListRegionalBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// Name of the location. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetRegionalEventSubscriptionsData(this Resources.SubscriptionResource subscriptionResource, AzureLocation location, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRegionalEventSubscriptionsData(location, filter, top, cancellationToken); + } + + /// + /// List all event subscriptions from the given location under a specific Azure subscription and topic type. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions + /// + /// + /// Operation Id + /// EventSubscriptions_ListRegionalBySubscriptionForTopicType + /// + /// + /// + /// The instance the method will execute against. + /// Name of the location. + /// Name of the topic type. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetRegionalEventSubscriptionsDataForTopicTypeAsync(this Resources.SubscriptionResource subscriptionResource, AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRegionalEventSubscriptionsDataForTopicTypeAsync(location, topicTypeName, filter, top, cancellationToken); + } + + /// + /// List all event subscriptions from the given location under a specific Azure subscription and topic type. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions + /// + /// + /// Operation Id + /// EventSubscriptions_ListRegionalBySubscriptionForTopicType + /// + /// + /// + /// The instance the method will execute against. + /// Name of the location. + /// Name of the topic type. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetRegionalEventSubscriptionsDataForTopicType(this Resources.SubscriptionResource subscriptionResource, AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRegionalEventSubscriptionsDataForTopicType(location, topicTypeName, filter, top, cancellationToken); + } + + /// + /// List all the namespaces under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/namespaces + /// + /// + /// Operation Id + /// Namespaces_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetNamespacesAsync(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNamespacesAsync(filter, top, cancellationToken); + } + + /// + /// List all the namespaces under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/namespaces + /// + /// + /// Operation Id + /// Namespaces_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetNamespaces(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNamespaces(filter, top, cancellationToken); } /// @@ -1055,12 +1500,12 @@ public static Pageable GetEventGridTopics(this Subscript /// /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetPartnerConfigurationsAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + public static AsyncPageable GetPartnerConfigurationsAsync(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerConfigurationsAsync(filter, top, cancellationToken); } @@ -1078,16 +1523,62 @@ public static AsyncPageable GetPartnerConfiguratio /// /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetPartnerConfigurations(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + public static Pageable GetPartnerConfigurations(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerConfigurations(filter, top, cancellationToken); } + /// + /// List all the partner destinations under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerDestinations + /// + /// + /// Operation Id + /// PartnerDestinations_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetPartnerDestinationsAsync(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerDestinationsAsync(filter, top, cancellationToken); + } + + /// + /// List all the partner destinations under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerDestinations + /// + /// + /// Operation Id + /// PartnerDestinations_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetPartnerDestinations(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerDestinations(filter, top, cancellationToken); + } + /// /// List all the partner namespaces under an Azure subscription. /// @@ -1101,12 +1592,12 @@ public static Pageable GetPartnerConfigurations(th /// /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetPartnerNamespacesAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + public static AsyncPageable GetPartnerNamespacesAsync(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerNamespacesAsync(filter, top, cancellationToken); } @@ -1124,12 +1615,12 @@ public static AsyncPageable GetPartnerNamespacesAsync( /// /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetPartnerNamespaces(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + public static Pageable GetPartnerNamespaces(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerNamespaces(filter, top, cancellationToken); } @@ -1147,12 +1638,12 @@ public static Pageable GetPartnerNamespaces(this Subsc /// /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetPartnerRegistrationsAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + public static AsyncPageable GetPartnerRegistrationsAsync(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerRegistrationsAsync(filter, top, cancellationToken); } @@ -1170,12 +1661,12 @@ public static AsyncPageable GetPartnerRegistrations /// /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetPartnerRegistrations(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + public static Pageable GetPartnerRegistrations(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerRegistrations(filter, top, cancellationToken); } @@ -1193,12 +1684,12 @@ public static Pageable GetPartnerRegistrations(this /// /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetPartnerTopicsAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + public static AsyncPageable GetPartnerTopicsAsync(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerTopicsAsync(filter, top, cancellationToken); } @@ -1216,12 +1707,12 @@ public static AsyncPageable GetPartnerTopicsAsync(this Sub /// /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetPartnerTopics(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + public static Pageable GetPartnerTopics(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerTopics(filter, top, cancellationToken); } @@ -1239,12 +1730,12 @@ public static Pageable GetPartnerTopics(this SubscriptionR /// /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetSystemTopicsAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + public static AsyncPageable GetSystemTopicsAsync(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSystemTopicsAsync(filter, top, cancellationToken); } @@ -1262,16 +1753,62 @@ public static AsyncPageable GetSystemTopicsAsync(this Subsc /// /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetSystemTopics(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + public static Pageable GetSystemTopics(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSystemTopics(filter, top, cancellationToken); } + /// + /// List all the topics under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics + /// + /// + /// Operation Id + /// Topics_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetEventGridTopicsAsync(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventGridTopicsAsync(filter, top, cancellationToken); + } + + /// + /// List all the topics under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics + /// + /// + /// Operation Id + /// Topics_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetEventGridTopics(this Resources.SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventGridTopics(filter, top, cancellationToken); + } + /// Gets a collection of TopicTypeResources in the TenantResource. /// The instance the method will execute against. /// An object representing collection of TopicTypeResources and their operations over a TopicTypeResource. diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs index 8e4c0f582bd3..132ac941b402 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs @@ -52,11 +52,11 @@ public virtual EventGridDomainCollection GetEventGridDomains() return GetCachedClient(Client => new EventGridDomainCollection(Client, Id)); } - /// Gets a collection of EventGridTopicResources in the ResourceGroupResource. - /// An object representing collection of EventGridTopicResources and their operations over a EventGridTopicResource. - public virtual EventGridTopicCollection GetEventGridTopics() + /// Gets a collection of NamespaceResources in the ResourceGroupResource. + /// An object representing collection of NamespaceResources and their operations over a NamespaceResource. + public virtual NamespaceCollection GetNamespaces() { - return GetCachedClient(Client => new EventGridTopicCollection(Client, Id)); + return GetCachedClient(Client => new NamespaceCollection(Client, Id)); } /// Gets an object representing a PartnerConfigurationResource along with the instance operations that can be performed on it in the ResourceGroupResource. @@ -66,6 +66,13 @@ public virtual PartnerConfigurationResource GetPartnerConfiguration() return new PartnerConfigurationResource(Client, Id.AppendProviderResource("Microsoft.EventGrid", "partnerConfigurations", "default")); } + /// Gets a collection of PartnerDestinationResources in the ResourceGroupResource. + /// An object representing collection of PartnerDestinationResources and their operations over a PartnerDestinationResource. + public virtual PartnerDestinationCollection GetPartnerDestinations() + { + return GetCachedClient(Client => new PartnerDestinationCollection(Client, Id)); + } + /// Gets a collection of PartnerNamespaceResources in the ResourceGroupResource. /// An object representing collection of PartnerNamespaceResources and their operations over a PartnerNamespaceResource. public virtual PartnerNamespaceCollection GetPartnerNamespaces() @@ -94,6 +101,13 @@ public virtual SystemTopicCollection GetSystemTopics() return GetCachedClient(Client => new SystemTopicCollection(Client, Id)); } + /// Gets a collection of EventGridTopicResources in the ResourceGroupResource. + /// An object representing collection of EventGridTopicResources and their operations over a EventGridTopicResource. + public virtual EventGridTopicCollection GetEventGridTopics() + { + return GetCachedClient(Client => new EventGridTopicCollection(Client, Id)); + } + /// /// List event types for a topic. /// diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index efdf348f58b5..e51509089e75 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -20,10 +20,12 @@ internal partial class SubscriptionResourceExtensionClient : ArmResource private DomainsRestOperations _eventGridDomainDomainsRestClient; private ClientDiagnostics _eventSubscriptionClientDiagnostics; private EventSubscriptionsRestOperations _eventSubscriptionRestClient; - private ClientDiagnostics _eventGridTopicTopicsClientDiagnostics; - private TopicsRestOperations _eventGridTopicTopicsRestClient; + private ClientDiagnostics _namespaceClientDiagnostics; + private NamespacesRestOperations _namespaceRestClient; private ClientDiagnostics _partnerConfigurationClientDiagnostics; private PartnerConfigurationsRestOperations _partnerConfigurationRestClient; + private ClientDiagnostics _partnerDestinationClientDiagnostics; + private PartnerDestinationsRestOperations _partnerDestinationRestClient; private ClientDiagnostics _partnerNamespaceClientDiagnostics; private PartnerNamespacesRestOperations _partnerNamespaceRestClient; private ClientDiagnostics _partnerRegistrationClientDiagnostics; @@ -32,6 +34,8 @@ internal partial class SubscriptionResourceExtensionClient : ArmResource private PartnerTopicsRestOperations _partnerTopicRestClient; private ClientDiagnostics _systemTopicClientDiagnostics; private SystemTopicsRestOperations _systemTopicRestClient; + private ClientDiagnostics _eventGridTopicTopicsClientDiagnostics; + private TopicsRestOperations _eventGridTopicTopicsRestClient; /// Initializes a new instance of the class for mocking. protected SubscriptionResourceExtensionClient() @@ -49,10 +53,12 @@ internal SubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifie private DomainsRestOperations EventGridDomainDomainsRestClient => _eventGridDomainDomainsRestClient ??= new DomainsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventGridDomainResource.ResourceType)); private ClientDiagnostics EventSubscriptionClientDiagnostics => _eventSubscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventSubscriptionResource.ResourceType.Namespace, Diagnostics); private EventSubscriptionsRestOperations EventSubscriptionRestClient => _eventSubscriptionRestClient ??= new EventSubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventSubscriptionResource.ResourceType)); - private ClientDiagnostics EventGridTopicTopicsClientDiagnostics => _eventGridTopicTopicsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventGridTopicResource.ResourceType.Namespace, Diagnostics); - private TopicsRestOperations EventGridTopicTopicsRestClient => _eventGridTopicTopicsRestClient ??= new TopicsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventGridTopicResource.ResourceType)); + private ClientDiagnostics NamespaceClientDiagnostics => _namespaceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", NamespaceResource.ResourceType.Namespace, Diagnostics); + private NamespacesRestOperations NamespaceRestClient => _namespaceRestClient ??= new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NamespaceResource.ResourceType)); private ClientDiagnostics PartnerConfigurationClientDiagnostics => _partnerConfigurationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", PartnerConfigurationResource.ResourceType.Namespace, Diagnostics); private PartnerConfigurationsRestOperations PartnerConfigurationRestClient => _partnerConfigurationRestClient ??= new PartnerConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PartnerConfigurationResource.ResourceType)); + private ClientDiagnostics PartnerDestinationClientDiagnostics => _partnerDestinationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", PartnerDestinationResource.ResourceType.Namespace, Diagnostics); + private PartnerDestinationsRestOperations PartnerDestinationRestClient => _partnerDestinationRestClient ??= new PartnerDestinationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PartnerDestinationResource.ResourceType)); private ClientDiagnostics PartnerNamespaceClientDiagnostics => _partnerNamespaceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", PartnerNamespaceResource.ResourceType.Namespace, Diagnostics); private PartnerNamespacesRestOperations PartnerNamespaceRestClient => _partnerNamespaceRestClient ??= new PartnerNamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PartnerNamespaceResource.ResourceType)); private ClientDiagnostics PartnerRegistrationClientDiagnostics => _partnerRegistrationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", PartnerRegistrationResource.ResourceType.Namespace, Diagnostics); @@ -61,6 +67,8 @@ internal SubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifie private PartnerTopicsRestOperations PartnerTopicRestClient => _partnerTopicRestClient ??= new PartnerTopicsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PartnerTopicResource.ResourceType)); private ClientDiagnostics SystemTopicClientDiagnostics => _systemTopicClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", SystemTopicResource.ResourceType.Namespace, Diagnostics); private SystemTopicsRestOperations SystemTopicRestClient => _systemTopicRestClient ??= new SystemTopicsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SystemTopicResource.ResourceType)); + private ClientDiagnostics EventGridTopicTopicsClientDiagnostics => _eventGridTopicTopicsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventGridTopicResource.ResourceType.Namespace, Diagnostics); + private TopicsRestOperations EventGridTopicTopicsRestClient => _eventGridTopicTopicsRestClient ??= new TopicsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventGridTopicResource.ResourceType)); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -117,51 +125,51 @@ public virtual Pageable GetEventGridDomains(string filt } /// - /// List all the topics under an Azure subscription. + /// List all the namespaces under an Azure subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/namespaces /// /// /// Operation Id - /// Topics_ListBySubscription + /// Namespaces_ListBySubscription /// /// /// /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEventGridTopicsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNamespacesAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridTopicTopicsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridTopicTopicsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventGridTopicResource(Client, EventGridTopicData.DeserializeEventGridTopicData(e)), EventGridTopicTopicsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEventGridTopics", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => NamespaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NamespaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NamespaceResource(Client, NamespaceData.DeserializeNamespaceData(e)), NamespaceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNamespaces", "value", "nextLink", cancellationToken); } /// - /// List all the topics under an Azure subscription. + /// List all the namespaces under an Azure subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/namespaces /// /// /// Operation Id - /// Topics_ListBySubscription + /// Namespaces_ListBySubscription /// /// /// /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEventGridTopics(string filter = null, int? top = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNamespaces(string filter = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridTopicTopicsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridTopicTopicsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventGridTopicResource(Client, EventGridTopicData.DeserializeEventGridTopicData(e)), EventGridTopicTopicsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEventGridTopics", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => NamespaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NamespaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NamespaceResource(Client, NamespaceData.DeserializeNamespaceData(e)), NamespaceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNamespaces", "value", "nextLink", cancellationToken); } /// @@ -212,6 +220,54 @@ public virtual Pageable GetPartnerConfigurations(s return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PartnerConfigurationResource(Client, PartnerConfigurationData.DeserializePartnerConfigurationData(e)), PartnerConfigurationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPartnerConfigurations", "value", "nextLink", cancellationToken); } + /// + /// List all the partner destinations under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerDestinations + /// + /// + /// Operation Id + /// PartnerDestinations_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPartnerDestinationsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerDestinationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerDestinationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PartnerDestinationResource(Client, PartnerDestinationData.DeserializePartnerDestinationData(e)), PartnerDestinationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPartnerDestinations", "value", "nextLink", cancellationToken); + } + + /// + /// List all the partner destinations under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerDestinations + /// + /// + /// Operation Id + /// PartnerDestinations_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPartnerDestinations(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerDestinationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerDestinationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PartnerDestinationResource(Client, PartnerDestinationData.DeserializePartnerDestinationData(e)), PartnerDestinationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPartnerDestinations", "value", "nextLink", cancellationToken); + } + /// /// List all the partner namespaces under an Azure subscription. /// @@ -403,5 +459,53 @@ public virtual Pageable GetSystemTopics(string filter = nul HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SystemTopicRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SystemTopicResource(Client, SystemTopicData.DeserializeSystemTopicData(e)), SystemTopicClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSystemTopics", "value", "nextLink", cancellationToken); } + + /// + /// List all the topics under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics + /// + /// + /// Operation Id + /// Topics_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEventGridTopicsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridTopicTopicsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridTopicTopicsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventGridTopicResource(Client, EventGridTopicData.DeserializeEventGridTopicData(e)), EventGridTopicTopicsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEventGridTopics", "value", "nextLink", cancellationToken); + } + + /// + /// List all the topics under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics + /// + /// + /// Operation Id + /// Topics_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEventGridTopics(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridTopicTopicsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridTopicTopicsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventGridTopicResource(Client, EventGridTopicData.DeserializeEventGridTopicData(e)), EventGridTopicTopicsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEventGridTopics", "value", "nextLink", cancellationToken); + } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/CaCertificateOperationSource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/CaCertificateOperationSource.cs new file mode 100644 index 000000000000..93f135752874 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/CaCertificateOperationSource.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.EventGrid +{ + internal class CaCertificateOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal CaCertificateOperationSource(ArmClient client) + { + _client = client; + } + + CaCertificateResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = CaCertificateData.DeserializeCaCertificateData(document.RootElement); + return new CaCertificateResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = CaCertificateData.DeserializeCaCertificateData(document.RootElement); + return new CaCertificateResource(_client, data); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/ClientGroupOperationSource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/ClientGroupOperationSource.cs new file mode 100644 index 000000000000..47b587381d8f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/ClientGroupOperationSource.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.EventGrid +{ + internal class ClientGroupOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ClientGroupOperationSource(ArmClient client) + { + _client = client; + } + + ClientGroupResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ClientGroupData.DeserializeClientGroupData(document.RootElement); + return new ClientGroupResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ClientGroupData.DeserializeClientGroupData(document.RootElement); + return new ClientGroupResource(_client, data); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/ClientOperationSource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/ClientOperationSource.cs new file mode 100644 index 000000000000..21cb95df6a28 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/ClientOperationSource.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.EventGrid +{ + internal class ClientOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ClientOperationSource(ArmClient client) + { + _client = client; + } + + ClientResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ClientData.DeserializeClientData(document.RootElement); + return new ClientResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ClientData.DeserializeClientData(document.RootElement); + return new ClientResource(_client, data); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/NamespaceOperationSource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/NamespaceOperationSource.cs new file mode 100644 index 000000000000..f6225800eab7 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/NamespaceOperationSource.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.EventGrid +{ + internal class NamespaceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NamespaceOperationSource(ArmClient client) + { + _client = client; + } + + NamespaceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = NamespaceData.DeserializeNamespaceData(document.RootElement); + return new NamespaceResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = NamespaceData.DeserializeNamespaceData(document.RootElement); + return new NamespaceResource(_client, data); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/NamespaceSharedAccessKeysOperationSource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/NamespaceSharedAccessKeysOperationSource.cs new file mode 100644 index 000000000000..9916f6859050 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/NamespaceSharedAccessKeysOperationSource.cs @@ -0,0 +1,31 @@ +// 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.EventGrid.Models; + +namespace Azure.ResourceManager.EventGrid +{ + internal class NamespaceSharedAccessKeysOperationSource : IOperationSource + { + NamespaceSharedAccessKeys IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return NamespaceSharedAccessKeys.DeserializeNamespaceSharedAccessKeys(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return NamespaceSharedAccessKeys.DeserializeNamespaceSharedAccessKeys(document.RootElement); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/NamespaceTopicOperationSource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/NamespaceTopicOperationSource.cs new file mode 100644 index 000000000000..9176a8175c06 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/NamespaceTopicOperationSource.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.EventGrid +{ + internal class NamespaceTopicOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NamespaceTopicOperationSource(ArmClient client) + { + _client = client; + } + + NamespaceTopicResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = NamespaceTopicData.DeserializeNamespaceTopicData(document.RootElement); + return new NamespaceTopicResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = NamespaceTopicData.DeserializeNamespaceTopicData(document.RootElement); + return new NamespaceTopicResource(_client, data); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/PartnerDestinationOperationSource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/PartnerDestinationOperationSource.cs new file mode 100644 index 000000000000..fdc95fc24803 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/PartnerDestinationOperationSource.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.EventGrid +{ + internal class PartnerDestinationOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal PartnerDestinationOperationSource(ArmClient client) + { + _client = client; + } + + PartnerDestinationResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = PartnerDestinationData.DeserializePartnerDestinationData(document.RootElement); + return new PartnerDestinationResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = PartnerDestinationData.DeserializePartnerDestinationData(document.RootElement); + return new PartnerDestinationResource(_client, data); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/PermissionBindingOperationSource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/PermissionBindingOperationSource.cs new file mode 100644 index 000000000000..f78ba20d9d7c --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/PermissionBindingOperationSource.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.EventGrid +{ + internal class PermissionBindingOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal PermissionBindingOperationSource(ArmClient client) + { + _client = client; + } + + PermissionBindingResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = PermissionBindingData.DeserializePermissionBindingData(document.RootElement); + return new PermissionBindingResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = PermissionBindingData.DeserializePermissionBindingData(document.RootElement); + return new PermissionBindingResource(_client, data); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/SubscriptionOperationSource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/SubscriptionOperationSource.cs new file mode 100644 index 000000000000..261f269ae5cc --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/SubscriptionOperationSource.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.EventGrid +{ + internal class SubscriptionOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SubscriptionOperationSource(ArmClient client) + { + _client = client; + } + + SubscriptionResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = SubscriptionData.DeserializeSubscriptionData(document.RootElement); + return new SubscriptionResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = SubscriptionData.DeserializeSubscriptionData(document.RootElement); + return new SubscriptionResource(_client, data); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/TopicSpaceOperationSource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/TopicSpaceOperationSource.cs new file mode 100644 index 000000000000..db97a3d20bb4 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/LongRunningOperation/TopicSpaceOperationSource.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.EventGrid +{ + internal class TopicSpaceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal TopicSpaceOperationSource(ArmClient client) + { + _client = client; + } + + TopicSpaceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = TopicSpaceData.DeserializeTopicSpaceData(document.RootElement); + return new TopicSpaceResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = TopicSpaceData.DeserializeTopicSpaceData(document.RootElement); + return new TopicSpaceResource(_client, data); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/AlternativeAuthenticationNameSource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/AlternativeAuthenticationNameSource.cs new file mode 100644 index 000000000000..fb7e59c3339c --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/AlternativeAuthenticationNameSource.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The AlternativeAuthenticationNameSource. + public readonly partial struct AlternativeAuthenticationNameSource : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AlternativeAuthenticationNameSource(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ClientCertificateSubjectValue = "ClientCertificateSubject"; + private const string ClientCertificateDnsValue = "ClientCertificateDns"; + private const string ClientCertificateUriValue = "ClientCertificateUri"; + private const string ClientCertificateIPValue = "ClientCertificateIp"; + private const string ClientCertificateEmailValue = "ClientCertificateEmail"; + + /// ClientCertificateSubject. + public static AlternativeAuthenticationNameSource ClientCertificateSubject { get; } = new AlternativeAuthenticationNameSource(ClientCertificateSubjectValue); + /// ClientCertificateDns. + public static AlternativeAuthenticationNameSource ClientCertificateDns { get; } = new AlternativeAuthenticationNameSource(ClientCertificateDnsValue); + /// ClientCertificateUri. + public static AlternativeAuthenticationNameSource ClientCertificateUri { get; } = new AlternativeAuthenticationNameSource(ClientCertificateUriValue); + /// ClientCertificateIp. + public static AlternativeAuthenticationNameSource ClientCertificateIP { get; } = new AlternativeAuthenticationNameSource(ClientCertificateIPValue); + /// ClientCertificateEmail. + public static AlternativeAuthenticationNameSource ClientCertificateEmail { get; } = new AlternativeAuthenticationNameSource(ClientCertificateEmailValue); + /// Determines if two values are the same. + public static bool operator ==(AlternativeAuthenticationNameSource left, AlternativeAuthenticationNameSource right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AlternativeAuthenticationNameSource left, AlternativeAuthenticationNameSource right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AlternativeAuthenticationNameSource(string value) => new AlternativeAuthenticationNameSource(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AlternativeAuthenticationNameSource other && Equals(other); + /// + public bool Equals(AlternativeAuthenticationNameSource 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/AzureADPartnerClientAuthentication.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/AzureADPartnerClientAuthentication.Serialization.cs new file mode 100644 index 000000000000..099de3942cdc --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/AzureADPartnerClientAuthentication.Serialization.cs @@ -0,0 +1,83 @@ +// 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.EventGrid.Models +{ + public partial class AzureADPartnerClientAuthentication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("clientAuthenticationType"u8); + writer.WriteStringValue(ClientAuthenticationType.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(AzureActiveDirectoryTenantId)) + { + writer.WritePropertyName("azureActiveDirectoryTenantId"u8); + writer.WriteStringValue(AzureActiveDirectoryTenantId); + } + if (Optional.IsDefined(AzureActiveDirectoryApplicationIdOrUri)) + { + writer.WritePropertyName("azureActiveDirectoryApplicationIdOrUri"u8); + writer.WriteStringValue(AzureActiveDirectoryApplicationIdOrUri.AbsoluteUri); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static AzureADPartnerClientAuthentication DeserializeAzureADPartnerClientAuthentication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PartnerClientAuthenticationType clientAuthenticationType = default; + Optional azureActiveDirectoryTenantId = default; + Optional azureActiveDirectoryApplicationIdOrUri = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clientAuthenticationType"u8)) + { + clientAuthenticationType = new PartnerClientAuthenticationType(property.Value.GetString()); + 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("azureActiveDirectoryTenantId"u8)) + { + azureActiveDirectoryTenantId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("azureActiveDirectoryApplicationIdOrUri"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azureActiveDirectoryApplicationIdOrUri = new Uri(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new AzureADPartnerClientAuthentication(clientAuthenticationType, azureActiveDirectoryTenantId.Value, azureActiveDirectoryApplicationIdOrUri.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/AzureADPartnerClientAuthentication.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/AzureADPartnerClientAuthentication.cs new file mode 100644 index 000000000000..b00c101f8f67 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/AzureADPartnerClientAuthentication.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Azure Active Directory Partner Client Authentication. + public partial class AzureADPartnerClientAuthentication : PartnerClientAuthentication + { + /// Initializes a new instance of AzureADPartnerClientAuthentication. + public AzureADPartnerClientAuthentication() + { + ClientAuthenticationType = PartnerClientAuthenticationType.AzureAD; + } + + /// Initializes a new instance of AzureADPartnerClientAuthentication. + /// Type of client authentication. + /// The Azure Active Directory Tenant ID to get the access token that will be included as the bearer token in delivery requests. + /// The Azure Active Directory Application ID or URI to get the access token that will be included as the bearer token in delivery requests. + internal AzureADPartnerClientAuthentication(PartnerClientAuthenticationType clientAuthenticationType, string azureActiveDirectoryTenantId, Uri azureActiveDirectoryApplicationIdOrUri) : base(clientAuthenticationType) + { + AzureActiveDirectoryTenantId = azureActiveDirectoryTenantId; + AzureActiveDirectoryApplicationIdOrUri = azureActiveDirectoryApplicationIdOrUri; + ClientAuthenticationType = clientAuthenticationType; + } + + /// The Azure Active Directory Tenant ID to get the access token that will be included as the bearer token in delivery requests. + public string AzureActiveDirectoryTenantId { get; set; } + /// The Azure Active Directory Application ID or URI to get the access token that will be included as the bearer token in delivery requests. + public Uri AzureActiveDirectoryApplicationIdOrUri { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/BoolEqualsFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/BoolEqualsFilter.Serialization.cs new file mode 100644 index 000000000000..8b3569b91c7b --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/BoolEqualsFilter.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class BoolEqualsFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteBooleanValue(Value.Value); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static BoolEqualsFilter DeserializeBoolEqualsFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional value = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new BoolEqualsFilter(operatorType, key.Value, Optional.ToNullable(value)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/BoolEqualsFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/BoolEqualsFilter.cs new file mode 100644 index 000000000000..e5f556e6c864 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/BoolEqualsFilter.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// BoolEquals Filter. + public partial class BoolEqualsFilter : Filter + { + /// Initializes a new instance of BoolEqualsFilter. + public BoolEqualsFilter() + { + OperatorType = FilterOperatorType.BoolEquals; + } + + /// Initializes a new instance of BoolEqualsFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The boolean filter value. + internal BoolEqualsFilter(FilterOperatorType operatorType, string key, bool? value) : base(operatorType, key) + { + Value = value; + OperatorType = operatorType; + } + + /// The boolean filter value. + public bool? Value { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/CaCertificateData.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/CaCertificateData.Serialization.cs new file mode 100644 index 000000000000..2a07b8cba992 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/CaCertificateData.Serialization.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + public partial class CaCertificateData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(EncodedCertificate)) + { + writer.WritePropertyName("encodedCertificate"u8); + writer.WriteStringValue(EncodedCertificate); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static CaCertificateData DeserializeCaCertificateData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional description = default; + Optional encodedCertificate = default; + Optional issueTimeInUtc = default; + Optional expiryTimeInUtc = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + 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("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("encodedCertificate"u8)) + { + encodedCertificate = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("issueTimeInUtc"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + issueTimeInUtc = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("expiryTimeInUtc"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiryTimeInUtc = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new CaCertificateProvisioningState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new CaCertificateData(id, name, type, systemData.Value, description.Value, encodedCertificate.Value, Optional.ToNullable(issueTimeInUtc), Optional.ToNullable(expiryTimeInUtc), Optional.ToNullable(provisioningState)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/CaCertificateProvisioningState.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/CaCertificateProvisioningState.cs new file mode 100644 index 000000000000..f72f4c03aca4 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/CaCertificateProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Provisioning state of the CA Certificate resource. + public readonly partial struct CaCertificateProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CaCertificateProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string SucceededValue = "Succeeded"; + private const string CanceledValue = "Canceled"; + private const string FailedValue = "Failed"; + private const string DeletedValue = "Deleted"; + + /// Creating. + public static CaCertificateProvisioningState Creating { get; } = new CaCertificateProvisioningState(CreatingValue); + /// Updating. + public static CaCertificateProvisioningState Updating { get; } = new CaCertificateProvisioningState(UpdatingValue); + /// Deleting. + public static CaCertificateProvisioningState Deleting { get; } = new CaCertificateProvisioningState(DeletingValue); + /// Succeeded. + public static CaCertificateProvisioningState Succeeded { get; } = new CaCertificateProvisioningState(SucceededValue); + /// Canceled. + public static CaCertificateProvisioningState Canceled { get; } = new CaCertificateProvisioningState(CanceledValue); + /// Failed. + public static CaCertificateProvisioningState Failed { get; } = new CaCertificateProvisioningState(FailedValue); + /// Deleted. + public static CaCertificateProvisioningState Deleted { get; } = new CaCertificateProvisioningState(DeletedValue); + /// Determines if two values are the same. + public static bool operator ==(CaCertificateProvisioningState left, CaCertificateProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CaCertificateProvisioningState left, CaCertificateProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CaCertificateProvisioningState(string value) => new CaCertificateProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CaCertificateProvisioningState other && Equals(other); + /// + public bool Equals(CaCertificateProvisioningState 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/CaCertificatesListResult.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/CaCertificatesListResult.Serialization.cs new file mode 100644 index 000000000000..a04bb03c1581 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/CaCertificatesListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + internal partial class CaCertificatesListResult + { + internal static CaCertificatesListResult DeserializeCaCertificatesListResult(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(CaCertificateData.DeserializeCaCertificateData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new CaCertificatesListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/CaCertificatesListResult.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/CaCertificatesListResult.cs new file mode 100644 index 000000000000..3c1c37a9a71a --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/CaCertificatesListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Result of the List CA Certificate operation. + internal partial class CaCertificatesListResult + { + /// Initializes a new instance of CaCertificatesListResult. + internal CaCertificatesListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of CaCertificatesListResult. + /// A collection of CA Certificate. + /// A link for the next page of CA Certificate. + internal CaCertificatesListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A collection of CA Certificate. + public IReadOnlyList Value { get; } + /// A link for the next page of CA Certificate. + public string NextLink { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientAuthentication.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientAuthentication.Serialization.cs new file mode 100644 index 000000000000..0a2f92ed067f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientAuthentication.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class ClientAuthentication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(CertificateThumbprint)) + { + writer.WritePropertyName("certificateThumbprint"u8); + writer.WriteObjectValue(CertificateThumbprint); + } + if (Optional.IsDefined(CertificateSubject)) + { + writer.WritePropertyName("certificateSubject"u8); + writer.WriteObjectValue(CertificateSubject); + } + writer.WriteEndObject(); + } + + internal static ClientAuthentication DeserializeClientAuthentication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional certificateThumbprint = default; + Optional certificateSubject = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("certificateThumbprint"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + certificateThumbprint = ClientCertificateThumbprint.DeserializeClientCertificateThumbprint(property.Value); + continue; + } + if (property.NameEquals("certificateSubject"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + certificateSubject = ClientCertificateSubjectDistinguishedName.DeserializeClientCertificateSubjectDistinguishedName(property.Value); + continue; + } + } + return new ClientAuthentication(certificateThumbprint.Value, certificateSubject.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientAuthentication.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientAuthentication.cs new file mode 100644 index 000000000000..505f1d6af97f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientAuthentication.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The Authentication properties for the client. + public partial class ClientAuthentication + { + /// Initializes a new instance of ClientAuthentication. + public ClientAuthentication() + { + } + + /// Initializes a new instance of ClientAuthentication. + /// The self signed certificate's thumbprints data used for authentication. + /// The CA certificate subject name used for authentication. + internal ClientAuthentication(ClientCertificateThumbprint certificateThumbprint, ClientCertificateSubjectDistinguishedName certificateSubject) + { + CertificateThumbprint = certificateThumbprint; + CertificateSubject = certificateSubject; + } + + /// The self signed certificate's thumbprints data used for authentication. + public ClientCertificateThumbprint CertificateThumbprint { get; set; } + /// The CA certificate subject name used for authentication. + public ClientCertificateSubjectDistinguishedName CertificateSubject { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientAuthenticationSettings.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientAuthenticationSettings.Serialization.cs new file mode 100644 index 000000000000..19b87f11be30 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientAuthenticationSettings.Serialization.cs @@ -0,0 +1,59 @@ +// 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.EventGrid.Models +{ + internal partial class ClientAuthenticationSettings : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(AlternativeAuthenticationNameSources)) + { + writer.WritePropertyName("alternativeAuthenticationNameSources"u8); + writer.WriteStartArray(); + foreach (var item in AlternativeAuthenticationNameSources) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static ClientAuthenticationSettings DeserializeClientAuthenticationSettings(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> alternativeAuthenticationNameSources = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("alternativeAuthenticationNameSources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AlternativeAuthenticationNameSource(item.GetString())); + } + alternativeAuthenticationNameSources = array; + continue; + } + } + return new ClientAuthenticationSettings(Optional.ToList(alternativeAuthenticationNameSources)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientAuthenticationSettings.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientAuthenticationSettings.cs new file mode 100644 index 000000000000..963f174c6cf2 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientAuthenticationSettings.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Client authentication settings for namespace resource. + internal partial class ClientAuthenticationSettings + { + /// Initializes a new instance of ClientAuthenticationSettings. + public ClientAuthenticationSettings() + { + AlternativeAuthenticationNameSources = new ChangeTrackingList(); + } + + /// Initializes a new instance of ClientAuthenticationSettings. + /// Alternative authentication name sources related to client authentication settings for namespace resource. + internal ClientAuthenticationSettings(IList alternativeAuthenticationNameSources) + { + AlternativeAuthenticationNameSources = alternativeAuthenticationNameSources; + } + + /// Alternative authentication name sources related to client authentication settings for namespace resource. + public IList AlternativeAuthenticationNameSources { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateAuthentication.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateAuthentication.Serialization.cs new file mode 100644 index 000000000000..6cd5767d47c7 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateAuthentication.Serialization.cs @@ -0,0 +1,74 @@ +// 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.EventGrid.Models +{ + public partial class ClientCertificateAuthentication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ValidationScheme)) + { + writer.WritePropertyName("validationScheme"u8); + writer.WriteStringValue(ValidationScheme.Value.ToString()); + } + if (Optional.IsCollectionDefined(AllowedThumbprints)) + { + writer.WritePropertyName("allowedThumbprints"u8); + writer.WriteStartArray(); + foreach (var item in AllowedThumbprints) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static ClientCertificateAuthentication DeserializeClientCertificateAuthentication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional validationScheme = default; + Optional> allowedThumbprints = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("validationScheme"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + validationScheme = new ClientCertificateValidationScheme(property.Value.GetString()); + continue; + } + if (property.NameEquals("allowedThumbprints"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + allowedThumbprints = array; + continue; + } + } + return new ClientCertificateAuthentication(Optional.ToNullable(validationScheme), Optional.ToList(allowedThumbprints)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateAuthentication.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateAuthentication.cs new file mode 100644 index 000000000000..b73561104dda --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateAuthentication.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The certificate authentication properties for the client. + public partial class ClientCertificateAuthentication + { + /// Initializes a new instance of ClientCertificateAuthentication. + public ClientCertificateAuthentication() + { + AllowedThumbprints = new ChangeTrackingList(); + } + + /// Initializes a new instance of ClientCertificateAuthentication. + /// The validation scheme used to authenticate the client. Default value is SubjectMatchesAuthenticationName. + /// The list of thumbprints that are allowed during client authentication. This property is required only if the validationScheme is 'ThumbprintMatch'. + internal ClientCertificateAuthentication(ClientCertificateValidationScheme? validationScheme, IList allowedThumbprints) + { + ValidationScheme = validationScheme; + AllowedThumbprints = allowedThumbprints; + } + + /// The validation scheme used to authenticate the client. Default value is SubjectMatchesAuthenticationName. + public ClientCertificateValidationScheme? ValidationScheme { get; set; } + /// The list of thumbprints that are allowed during client authentication. This property is required only if the validationScheme is 'ThumbprintMatch'. + public IList AllowedThumbprints { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateSubjectDistinguishedName.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateSubjectDistinguishedName.Serialization.cs new file mode 100644 index 000000000000..76dbda8fa59c --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateSubjectDistinguishedName.Serialization.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class ClientCertificateSubjectDistinguishedName : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(CommonName)) + { + writer.WritePropertyName("commonName"u8); + writer.WriteStringValue(CommonName); + } + if (Optional.IsDefined(Organization)) + { + writer.WritePropertyName("organization"u8); + writer.WriteStringValue(Organization); + } + if (Optional.IsDefined(OrganizationUnit)) + { + writer.WritePropertyName("organizationUnit"u8); + writer.WriteStringValue(OrganizationUnit); + } + if (Optional.IsDefined(CountryCode)) + { + writer.WritePropertyName("countryCode"u8); + writer.WriteStringValue(CountryCode); + } + writer.WriteEndObject(); + } + + internal static ClientCertificateSubjectDistinguishedName DeserializeClientCertificateSubjectDistinguishedName(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional commonName = default; + Optional organization = default; + Optional organizationUnit = default; + Optional countryCode = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("commonName"u8)) + { + commonName = property.Value.GetString(); + continue; + } + if (property.NameEquals("organization"u8)) + { + organization = property.Value.GetString(); + continue; + } + if (property.NameEquals("organizationUnit"u8)) + { + organizationUnit = property.Value.GetString(); + continue; + } + if (property.NameEquals("countryCode"u8)) + { + countryCode = property.Value.GetString(); + continue; + } + } + return new ClientCertificateSubjectDistinguishedName(commonName.Value, organization.Value, organizationUnit.Value, countryCode.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateSubjectDistinguishedName.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateSubjectDistinguishedName.cs new file mode 100644 index 000000000000..0e3487e040d8 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateSubjectDistinguishedName.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// + /// CA certificate subject distinguished name information used by service to authenticate clients. + /// For more information, see https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x500distinguishedname?view=net-6.0#remarks + /// + public partial class ClientCertificateSubjectDistinguishedName + { + /// Initializes a new instance of ClientCertificateSubjectDistinguishedName. + public ClientCertificateSubjectDistinguishedName() + { + } + + /// Initializes a new instance of ClientCertificateSubjectDistinguishedName. + /// The common name field in the subject name. The allowed limit is 64 characters and it should be specified. + /// The organization field in the subject name. If present, the allowed limit is 64 characters. + /// The organization unit field in the subject name. If present, the allowed limit is 32 characters. + /// The country code field in the subject name. If present, the country code should be represented by two-letter code defined in ISO 2166-1 (alpha-2). For example: 'US'. + internal ClientCertificateSubjectDistinguishedName(string commonName, string organization, string organizationUnit, string countryCode) + { + CommonName = commonName; + Organization = organization; + OrganizationUnit = organizationUnit; + CountryCode = countryCode; + } + + /// The common name field in the subject name. The allowed limit is 64 characters and it should be specified. + public string CommonName { get; set; } + /// The organization field in the subject name. If present, the allowed limit is 64 characters. + public string Organization { get; set; } + /// The organization unit field in the subject name. If present, the allowed limit is 32 characters. + public string OrganizationUnit { get; set; } + /// The country code field in the subject name. If present, the country code should be represented by two-letter code defined in ISO 2166-1 (alpha-2). For example: 'US'. + public string CountryCode { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateThumbprint.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateThumbprint.Serialization.cs new file mode 100644 index 000000000000..621feff18cda --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateThumbprint.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class ClientCertificateThumbprint : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Primary)) + { + writer.WritePropertyName("primary"u8); + writer.WriteStringValue(Primary); + } + if (Optional.IsDefined(Secondary)) + { + writer.WritePropertyName("secondary"u8); + writer.WriteStringValue(Secondary); + } + writer.WriteEndObject(); + } + + internal static ClientCertificateThumbprint DeserializeClientCertificateThumbprint(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional primary = default; + Optional secondary = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("primary"u8)) + { + primary = property.Value.GetString(); + continue; + } + if (property.NameEquals("secondary"u8)) + { + secondary = property.Value.GetString(); + continue; + } + } + return new ClientCertificateThumbprint(primary.Value, secondary.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateThumbprint.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateThumbprint.cs new file mode 100644 index 000000000000..4b1e0137f51a --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateThumbprint.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Thumbprints are used by the service to validate the device permission when authentication is done using self signed certificate. + public partial class ClientCertificateThumbprint + { + /// Initializes a new instance of ClientCertificateThumbprint. + public ClientCertificateThumbprint() + { + } + + /// Initializes a new instance of ClientCertificateThumbprint. + /// The primary thumbprint used for validation. + /// The secondary thumbprint used for validation. + internal ClientCertificateThumbprint(string primary, string secondary) + { + Primary = primary; + Secondary = secondary; + } + + /// The primary thumbprint used for validation. + public string Primary { get; set; } + /// The secondary thumbprint used for validation. + public string Secondary { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateValidationScheme.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateValidationScheme.cs new file mode 100644 index 000000000000..f52087c1807e --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientCertificateValidationScheme.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The validation scheme used to authenticate the client. Default value is SubjectMatchesAuthenticationName. + public readonly partial struct ClientCertificateValidationScheme : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ClientCertificateValidationScheme(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SubjectMatchesAuthenticationNameValue = "SubjectMatchesAuthenticationName"; + private const string DnsMatchesAuthenticationNameValue = "DnsMatchesAuthenticationName"; + private const string UriMatchesAuthenticationNameValue = "UriMatchesAuthenticationName"; + private const string IPMatchesAuthenticationNameValue = "IpMatchesAuthenticationName"; + private const string EmailMatchesAuthenticationNameValue = "EmailMatchesAuthenticationName"; + private const string ThumbprintMatchValue = "ThumbprintMatch"; + + /// SubjectMatchesAuthenticationName. + public static ClientCertificateValidationScheme SubjectMatchesAuthenticationName { get; } = new ClientCertificateValidationScheme(SubjectMatchesAuthenticationNameValue); + /// DnsMatchesAuthenticationName. + public static ClientCertificateValidationScheme DnsMatchesAuthenticationName { get; } = new ClientCertificateValidationScheme(DnsMatchesAuthenticationNameValue); + /// UriMatchesAuthenticationName. + public static ClientCertificateValidationScheme UriMatchesAuthenticationName { get; } = new ClientCertificateValidationScheme(UriMatchesAuthenticationNameValue); + /// IpMatchesAuthenticationName. + public static ClientCertificateValidationScheme IPMatchesAuthenticationName { get; } = new ClientCertificateValidationScheme(IPMatchesAuthenticationNameValue); + /// EmailMatchesAuthenticationName. + public static ClientCertificateValidationScheme EmailMatchesAuthenticationName { get; } = new ClientCertificateValidationScheme(EmailMatchesAuthenticationNameValue); + /// ThumbprintMatch. + public static ClientCertificateValidationScheme ThumbprintMatch { get; } = new ClientCertificateValidationScheme(ThumbprintMatchValue); + /// Determines if two values are the same. + public static bool operator ==(ClientCertificateValidationScheme left, ClientCertificateValidationScheme right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ClientCertificateValidationScheme left, ClientCertificateValidationScheme right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ClientCertificateValidationScheme(string value) => new ClientCertificateValidationScheme(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ClientCertificateValidationScheme other && Equals(other); + /// + public bool Equals(ClientCertificateValidationScheme 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientData.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientData.Serialization.cs new file mode 100644 index 000000000000..c76242420cfb --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientData.Serialization.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + public partial class ClientData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(AuthenticationName)) + { + writer.WritePropertyName("authenticationName"u8); + writer.WriteStringValue(AuthenticationName); + } + if (Optional.IsDefined(Authentication)) + { + writer.WritePropertyName("authentication"u8); + writer.WriteObjectValue(Authentication); + } + if (Optional.IsDefined(ClientCertificateAuthentication)) + { + writer.WritePropertyName("clientCertificateAuthentication"u8); + writer.WriteObjectValue(ClientCertificateAuthentication); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsCollectionDefined(Attributes)) + { + writer.WritePropertyName("attributes"u8); + writer.WriteStartObject(); + foreach (var item in Attributes) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ClientData DeserializeClientData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional description = default; + Optional authenticationName = default; + Optional authentication = default; + Optional clientCertificateAuthentication = default; + Optional state = default; + Optional> attributes = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + 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("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("authenticationName"u8)) + { + authenticationName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("authentication"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authentication = ClientAuthentication.DeserializeClientAuthentication(property0.Value); + continue; + } + if (property0.NameEquals("clientCertificateAuthentication"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clientCertificateAuthentication = ClientCertificateAuthentication.DeserializeClientCertificateAuthentication(property0.Value); + continue; + } + if (property0.NameEquals("state"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new ClientState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("attributes"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + if (property1.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property1.Name, null); + } + else + { + dictionary.Add(property1.Name, BinaryData.FromString(property1.Value.GetRawText())); + } + } + attributes = dictionary; + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ClientProvisioningState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new ClientData(id, name, type, systemData.Value, description.Value, authenticationName.Value, authentication.Value, clientCertificateAuthentication.Value, Optional.ToNullable(state), Optional.ToDictionary(attributes), Optional.ToNullable(provisioningState)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientGroupData.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientGroupData.Serialization.cs new file mode 100644 index 000000000000..9bb042b075bb --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientGroupData.Serialization.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + public partial class ClientGroupData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Query)) + { + writer.WritePropertyName("query"u8); + writer.WriteStringValue(Query); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ClientGroupData DeserializeClientGroupData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional description = default; + Optional query = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + 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("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("query"u8)) + { + query = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ClientGroupProvisioningState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new ClientGroupData(id, name, type, systemData.Value, description.Value, query.Value, Optional.ToNullable(provisioningState)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientGroupProvisioningState.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientGroupProvisioningState.cs new file mode 100644 index 000000000000..2550b5f67835 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientGroupProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Provisioning state of the ClientGroup resource. + public readonly partial struct ClientGroupProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ClientGroupProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string SucceededValue = "Succeeded"; + private const string CanceledValue = "Canceled"; + private const string FailedValue = "Failed"; + private const string DeletedValue = "Deleted"; + + /// Creating. + public static ClientGroupProvisioningState Creating { get; } = new ClientGroupProvisioningState(CreatingValue); + /// Updating. + public static ClientGroupProvisioningState Updating { get; } = new ClientGroupProvisioningState(UpdatingValue); + /// Deleting. + public static ClientGroupProvisioningState Deleting { get; } = new ClientGroupProvisioningState(DeletingValue); + /// Succeeded. + public static ClientGroupProvisioningState Succeeded { get; } = new ClientGroupProvisioningState(SucceededValue); + /// Canceled. + public static ClientGroupProvisioningState Canceled { get; } = new ClientGroupProvisioningState(CanceledValue); + /// Failed. + public static ClientGroupProvisioningState Failed { get; } = new ClientGroupProvisioningState(FailedValue); + /// Deleted. + public static ClientGroupProvisioningState Deleted { get; } = new ClientGroupProvisioningState(DeletedValue); + /// Determines if two values are the same. + public static bool operator ==(ClientGroupProvisioningState left, ClientGroupProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ClientGroupProvisioningState left, ClientGroupProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ClientGroupProvisioningState(string value) => new ClientGroupProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ClientGroupProvisioningState other && Equals(other); + /// + public bool Equals(ClientGroupProvisioningState 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientGroupsListResult.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientGroupsListResult.Serialization.cs new file mode 100644 index 000000000000..d39cd4c75e69 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientGroupsListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + internal partial class ClientGroupsListResult + { + internal static ClientGroupsListResult DeserializeClientGroupsListResult(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(ClientGroupData.DeserializeClientGroupData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ClientGroupsListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientGroupsListResult.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientGroupsListResult.cs new file mode 100644 index 000000000000..c5c0944418a0 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientGroupsListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Result of the List Client Group operation. + internal partial class ClientGroupsListResult + { + /// Initializes a new instance of ClientGroupsListResult. + internal ClientGroupsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ClientGroupsListResult. + /// A collection of Client Group. + /// A link for the next page of Client Group. + internal ClientGroupsListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A collection of Client Group. + public IReadOnlyList Value { get; } + /// A link for the next page of Client Group. + public string NextLink { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientProvisioningState.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientProvisioningState.cs new file mode 100644 index 000000000000..d242bca997a0 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Provisioning state of the Client resource. + public readonly partial struct ClientProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ClientProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string SucceededValue = "Succeeded"; + private const string CanceledValue = "Canceled"; + private const string FailedValue = "Failed"; + private const string DeletedValue = "Deleted"; + + /// Creating. + public static ClientProvisioningState Creating { get; } = new ClientProvisioningState(CreatingValue); + /// Updating. + public static ClientProvisioningState Updating { get; } = new ClientProvisioningState(UpdatingValue); + /// Deleting. + public static ClientProvisioningState Deleting { get; } = new ClientProvisioningState(DeletingValue); + /// Succeeded. + public static ClientProvisioningState Succeeded { get; } = new ClientProvisioningState(SucceededValue); + /// Canceled. + public static ClientProvisioningState Canceled { get; } = new ClientProvisioningState(CanceledValue); + /// Failed. + public static ClientProvisioningState Failed { get; } = new ClientProvisioningState(FailedValue); + /// Deleted. + public static ClientProvisioningState Deleted { get; } = new ClientProvisioningState(DeletedValue); + /// Determines if two values are the same. + public static bool operator ==(ClientProvisioningState left, ClientProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ClientProvisioningState left, ClientProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ClientProvisioningState(string value) => new ClientProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ClientProvisioningState other && Equals(other); + /// + public bool Equals(ClientProvisioningState 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientState.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientState.cs new file mode 100644 index 000000000000..ab5ab23abb59 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Indicates if the client is enabled or not. Default value is Enabled. + public readonly partial struct ClientState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ClientState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static ClientState Enabled { get; } = new ClientState(EnabledValue); + /// Disabled. + public static ClientState Disabled { get; } = new ClientState(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(ClientState left, ClientState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ClientState left, ClientState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ClientState(string value) => new ClientState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ClientState other && Equals(other); + /// + public bool Equals(ClientState 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientsListResult.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientsListResult.Serialization.cs new file mode 100644 index 000000000000..bca88cb5079e --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientsListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + internal partial class ClientsListResult + { + internal static ClientsListResult DeserializeClientsListResult(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(ClientData.DeserializeClientData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ClientsListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientsListResult.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientsListResult.cs new file mode 100644 index 000000000000..f5786320eaba --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ClientsListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Result of the List Client operation. + internal partial class ClientsListResult + { + /// Initializes a new instance of ClientsListResult. + internal ClientsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ClientsListResult. + /// A collection of Client. + /// A link for the next page of Client. + internal ClientsListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A collection of Client. + public IReadOnlyList Value { get; } + /// A link for the next page of Client. + public string NextLink { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliveryConfiguration.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliveryConfiguration.Serialization.cs new file mode 100644 index 000000000000..82d34de1a46a --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliveryConfiguration.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class DeliveryConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DeliveryMode)) + { + writer.WritePropertyName("deliveryMode"u8); + writer.WriteStringValue(DeliveryMode.Value.ToString()); + } + if (Optional.IsDefined(Queue)) + { + writer.WritePropertyName("queue"u8); + writer.WriteObjectValue(Queue); + } + writer.WriteEndObject(); + } + + internal static DeliveryConfiguration DeserializeDeliveryConfiguration(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional deliveryMode = default; + Optional queue = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deliveryMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deliveryMode = new DeliveryMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("queue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + queue = QueueInfo.DeserializeQueueInfo(property.Value); + continue; + } + } + return new DeliveryConfiguration(Optional.ToNullable(deliveryMode), queue.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliveryConfiguration.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliveryConfiguration.cs new file mode 100644 index 000000000000..1e92fb62b94a --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliveryConfiguration.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Properties of the delivery configuration information of the event subscription. + public partial class DeliveryConfiguration + { + /// Initializes a new instance of DeliveryConfiguration. + public DeliveryConfiguration() + { + } + + /// Initializes a new instance of DeliveryConfiguration. + /// Delivery mode of the event subscription. + /// This property should be populated when deliveryMode is queue and represents information about the queue subscription. + internal DeliveryConfiguration(DeliveryMode? deliveryMode, QueueInfo queue) + { + DeliveryMode = deliveryMode; + Queue = queue; + } + + /// Delivery mode of the event subscription. + public DeliveryMode? DeliveryMode { get; set; } + /// This property should be populated when deliveryMode is queue and represents information about the queue subscription. + public QueueInfo Queue { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliveryMode.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliveryMode.cs new file mode 100644 index 000000000000..ebd0e1ed2749 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliveryMode.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Delivery mode of the event subscription. + public readonly partial struct DeliveryMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeliveryMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string QueueValue = "Queue"; + + /// Queue. + public static DeliveryMode Queue { get; } = new DeliveryMode(QueueValue); + /// Determines if two values are the same. + public static bool operator ==(DeliveryMode left, DeliveryMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeliveryMode left, DeliveryMode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DeliveryMode(string value) => new DeliveryMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeliveryMode other && Equals(other); + /// + public bool Equals(DeliveryMode 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliverySchema.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliverySchema.cs new file mode 100644 index 000000000000..c51b5524b865 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliverySchema.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The event delivery schema for the event subscription. + public readonly partial struct DeliverySchema : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeliverySchema(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CloudEventSchemaV10Value = "CloudEventSchemaV1_0"; + + /// CloudEventSchemaV1_0. + public static DeliverySchema CloudEventSchemaV10 { get; } = new DeliverySchema(CloudEventSchemaV10Value); + /// Determines if two values are the same. + public static bool operator ==(DeliverySchema left, DeliverySchema right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeliverySchema left, DeliverySchema right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DeliverySchema(string value) => new DeliverySchema(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeliverySchema other && Equals(other); + /// + public bool Equals(DeliverySchema 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliveryWithResourceIdentity.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliveryWithResourceIdentity.cs index a5a8193e3a07..896b5dd91664 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliveryWithResourceIdentity.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DeliveryWithResourceIdentity.cs @@ -21,7 +21,7 @@ public DeliveryWithResourceIdentity() /// Information about the destination where events have to be delivered for the event subscription. /// Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , and . + /// The available derived classes include , , , , , , and . /// internal DeliveryWithResourceIdentity(EventSubscriptionIdentity identity, EventSubscriptionDestination destination) { @@ -35,7 +35,7 @@ internal DeliveryWithResourceIdentity(EventSubscriptionIdentity identity, EventS /// Information about the destination where events have to be delivered for the event subscription. /// Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , and . + /// The available derived classes include , , , , , , and . /// public EventSubscriptionDestination Destination { get; set; } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DynamicRoutingEnrichment.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DynamicRoutingEnrichment.Serialization.cs new file mode 100644 index 000000000000..891b8598c36a --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DynamicRoutingEnrichment.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class DynamicRoutingEnrichment : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + writer.WriteEndObject(); + } + + internal static DynamicRoutingEnrichment DeserializeDynamicRoutingEnrichment(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional key = default; + Optional value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + } + return new DynamicRoutingEnrichment(key.Value, value.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DynamicRoutingEnrichment.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DynamicRoutingEnrichment.cs new file mode 100644 index 000000000000..410508974472 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/DynamicRoutingEnrichment.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The DynamicRoutingEnrichment. + public partial class DynamicRoutingEnrichment + { + /// Initializes a new instance of DynamicRoutingEnrichment. + public DynamicRoutingEnrichment() + { + } + + /// Initializes a new instance of DynamicRoutingEnrichment. + /// Dynamic routing enrichment key. + /// Dynamic routing enrichment value. + internal DynamicRoutingEnrichment(string key, string value) + { + Key = key; + Value = value; + } + + /// Dynamic routing enrichment key. + public string Key { get; set; } + /// Dynamic routing enrichment value. + public string Value { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EndpointType.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EndpointType.cs index ea804db8d689..4975b9926628 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EndpointType.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EndpointType.cs @@ -29,6 +29,7 @@ public EndpointType(string value) private const string ServiceBusQueueValue = "ServiceBusQueue"; private const string ServiceBusTopicValue = "ServiceBusTopic"; private const string AzureFunctionValue = "AzureFunction"; + private const string PartnerDestinationValue = "PartnerDestination"; /// WebHook. public static EndpointType WebHook { get; } = new EndpointType(WebHookValue); @@ -44,6 +45,8 @@ public EndpointType(string value) public static EndpointType ServiceBusTopic { get; } = new EndpointType(ServiceBusTopicValue); /// AzureFunction. public static EndpointType AzureFunction { get; } = new EndpointType(AzureFunctionValue); + /// PartnerDestination. + public static EndpointType PartnerDestination { get; } = new EndpointType(PartnerDestinationValue); /// Determines if two values are the same. public static bool operator ==(EndpointType left, EndpointType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridDomainData.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridDomainData.Serialization.cs index 5bf5bcd7de5a..889739b6e3c9 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridDomainData.Serialization.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridDomainData.Serialization.cs @@ -19,6 +19,11 @@ public partial class EventGridDomainData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku); + } if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); @@ -39,11 +44,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Location); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); + if (Optional.IsDefined(MinimumTlsVersionAllowed)) + { + writer.WritePropertyName("minimumTlsVersionAllowed"u8); + writer.WriteStringValue(MinimumTlsVersionAllowed.Value.ToString()); + } if (Optional.IsDefined(InputSchema)) { writer.WritePropertyName("inputSchema"u8); writer.WriteStringValue(InputSchema.Value.ToString()); } + if (Optional.IsDefined(EventTypeInfo)) + { + writer.WritePropertyName("eventTypeInfo"u8); + writer.WriteObjectValue(EventTypeInfo); + } if (Optional.IsDefined(InputSchemaMapping)) { writer.WritePropertyName("inputSchemaMapping"u8); @@ -94,6 +109,7 @@ internal static EventGridDomainData DeserializeEventGridDomainData(JsonElement e { return null; } + Optional sku = default; Optional identity = default; Optional> tags = default; AzureLocation location = default; @@ -103,8 +119,10 @@ internal static EventGridDomainData DeserializeEventGridDomainData(JsonElement e Optional systemData = default; Optional> privateEndpointConnections = default; Optional provisioningState = default; + Optional minimumTlsVersionAllowed = default; Optional endpoint = default; Optional inputSchema = default; + Optional eventTypeInfo = default; Optional inputSchemaMapping = default; Optional metricResourceId = default; Optional publicNetworkAccess = default; @@ -115,6 +133,15 @@ internal static EventGridDomainData DeserializeEventGridDomainData(JsonElement e Optional dataResidencyBoundary = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = ResourceSku.DeserializeResourceSku(property.Value); + continue; + } if (property.NameEquals("identity"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -199,6 +226,15 @@ internal static EventGridDomainData DeserializeEventGridDomainData(JsonElement e provisioningState = new EventGridDomainProvisioningState(property0.Value.GetString()); continue; } + if (property0.NameEquals("minimumTlsVersionAllowed"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minimumTlsVersionAllowed = new TlsVersion(property0.Value.GetString()); + continue; + } if (property0.NameEquals("endpoint"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -217,6 +253,15 @@ internal static EventGridDomainData DeserializeEventGridDomainData(JsonElement e inputSchema = new EventGridInputSchema(property0.Value.GetString()); continue; } + if (property0.NameEquals("eventTypeInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eventTypeInfo = PartnerTopicEventTypeInfo.DeserializePartnerTopicEventTypeInfo(property0.Value); + continue; + } if (property0.NameEquals("inputSchemaMapping"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -294,7 +339,7 @@ internal static EventGridDomainData DeserializeEventGridDomainData(JsonElement e continue; } } - return new EventGridDomainData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, Optional.ToList(privateEndpointConnections), Optional.ToNullable(provisioningState), endpoint.Value, Optional.ToNullable(inputSchema), inputSchemaMapping.Value, metricResourceId.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToList(inboundIPRules), Optional.ToNullable(disableLocalAuth), Optional.ToNullable(autoCreateTopicWithFirstSubscription), Optional.ToNullable(autoDeleteTopicWithLastSubscription), Optional.ToNullable(dataResidencyBoundary)); + return new EventGridDomainData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, identity, Optional.ToList(privateEndpointConnections), Optional.ToNullable(provisioningState), Optional.ToNullable(minimumTlsVersionAllowed), endpoint.Value, Optional.ToNullable(inputSchema), eventTypeInfo.Value, inputSchemaMapping.Value, metricResourceId.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToList(inboundIPRules), Optional.ToNullable(disableLocalAuth), Optional.ToNullable(autoCreateTopicWithFirstSubscription), Optional.ToNullable(autoDeleteTopicWithLastSubscription), Optional.ToNullable(dataResidencyBoundary)); } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridDomainPatch.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridDomainPatch.Serialization.cs index b56dc4dd2a53..a147cf64c7af 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridDomainPatch.Serialization.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridDomainPatch.Serialization.cs @@ -31,6 +31,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("identity"u8); JsonSerializer.Serialize(writer, Identity); } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(PublicNetworkAccess)) @@ -48,6 +53,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(MinimumTlsVersionAllowed)) + { + writer.WritePropertyName("minimumTlsVersionAllowed"u8); + writer.WriteStringValue(MinimumTlsVersionAllowed.Value.ToString()); + } if (Optional.IsDefined(IsLocalAuthDisabled)) { writer.WritePropertyName("disableLocalAuth"u8); @@ -68,6 +78,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("dataResidencyBoundary"u8); writer.WriteStringValue(DataResidencyBoundary.Value.ToString()); } + if (Optional.IsDefined(EventTypeInfo)) + { + writer.WritePropertyName("eventTypeInfo"u8); + writer.WriteObjectValue(EventTypeInfo); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridDomainPatch.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridDomainPatch.cs index 654a2542ca11..9d9d71b78adc 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridDomainPatch.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridDomainPatch.cs @@ -25,6 +25,20 @@ public EventGridDomainPatch() public IDictionary Tags { get; } /// Identity information for the resource. public ManagedServiceIdentity Identity { get; set; } + /// The Sku pricing tier for the domain. + internal ResourceSku Sku { get; set; } + /// The Sku name of the resource. The possible values are: Basic or Premium. + public EventGridSku? SkuName + { + get => Sku is null ? default : Sku.Name; + set + { + if (Sku is null) + Sku = new ResourceSku(); + Sku.Name = value; + } + } + /// /// This determines if traffic is allowed over public network. By default it is enabled. /// You can further restrict to specific IPs by configuring <seealso cref="P:Microsoft.Azure.Events.ResourceProvider.Common.Contracts.DomainUpdateParameterProperties.InboundIpRules" /> @@ -32,6 +46,8 @@ public EventGridDomainPatch() public EventGridPublicNetworkAccess? PublicNetworkAccess { get; set; } /// This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. public IList InboundIPRules { get; } + /// Minimum TLS version of the publisher allowed to publish to this domain. + public TlsVersion? MinimumTlsVersionAllowed { get; set; } /// This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the domain. public bool? IsLocalAuthDisabled { get; set; } /// @@ -56,5 +72,7 @@ public EventGridDomainPatch() public bool? AutoDeleteTopicWithLastSubscription { get; set; } /// The data residency boundary for the domain. public DataResidencyBoundary? DataResidencyBoundary { get; set; } + /// The eventTypeInfo for the domain. + public PartnerTopicEventTypeInfo EventTypeInfo { get; set; } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridSku.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridSku.cs new file mode 100644 index 000000000000..1e69c97494f1 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridSku.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The Sku name of the resource. The possible values are: Basic or Premium. + public readonly partial struct EventGridSku : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EventGridSku(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BasicValue = "Basic"; + private const string PremiumValue = "Premium"; + + /// Basic. + public static EventGridSku Basic { get; } = new EventGridSku(BasicValue); + /// Premium. + public static EventGridSku Premium { get; } = new EventGridSku(PremiumValue); + /// Determines if two values are the same. + public static bool operator ==(EventGridSku left, EventGridSku right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EventGridSku left, EventGridSku right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EventGridSku(string value) => new EventGridSku(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EventGridSku other && Equals(other); + /// + public bool Equals(EventGridSku 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridSkuName.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridSkuName.cs new file mode 100644 index 000000000000..51b784304615 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridSkuName.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The name of the SKU. + public readonly partial struct EventGridSkuName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EventGridSkuName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StandardValue = "Standard"; + + /// Standard. + public static EventGridSkuName Standard { get; } = new EventGridSkuName(StandardValue); + /// Determines if two values are the same. + public static bool operator ==(EventGridSkuName left, EventGridSkuName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EventGridSkuName left, EventGridSkuName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EventGridSkuName(string value) => new EventGridSkuName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EventGridSkuName other && Equals(other); + /// + public bool Equals(EventGridSkuName 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridSubscriptionPatch.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridSubscriptionPatch.cs index bc5ed15a99e8..d4845fcef8f6 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridSubscriptionPatch.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridSubscriptionPatch.cs @@ -24,7 +24,7 @@ public EventGridSubscriptionPatch() /// Information about the destination where events have to be delivered for the event subscription. /// Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , and . + /// The available derived classes include , , , , , , and . /// public EventSubscriptionDestination Destination { get; set; } /// diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridTopicData.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridTopicData.Serialization.cs index 4ae465f741fe..bc25345342f1 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridTopicData.Serialization.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridTopicData.Serialization.cs @@ -11,6 +11,7 @@ using Azure.Core; using Azure.ResourceManager.EventGrid.Models; using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.EventGrid { @@ -19,11 +20,26 @@ public partial class EventGridTopicData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku); + } if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); JsonSerializer.Serialize(writer, Identity); } + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.Value.ToString()); + } + if (Optional.IsDefined(ExtendedLocation)) + { + writer.WritePropertyName("extendedLocation"u8); + JsonSerializer.Serialize(writer, ExtendedLocation); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -39,6 +55,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Location); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); + if (Optional.IsDefined(EventTypeInfo)) + { + writer.WritePropertyName("eventTypeInfo"u8); + writer.WriteObjectValue(EventTypeInfo); + } + if (Optional.IsDefined(MinimumTlsVersionAllowed)) + { + writer.WritePropertyName("minimumTlsVersionAllowed"u8); + writer.WriteStringValue(MinimumTlsVersionAllowed.Value.ToString()); + } if (Optional.IsDefined(InputSchema)) { writer.WritePropertyName("inputSchema"u8); @@ -84,7 +110,10 @@ internal static EventGridTopicData DeserializeEventGridTopicData(JsonElement ele { return null; } + Optional sku = default; Optional identity = default; + Optional kind = default; + Optional extendedLocation = default; Optional> tags = default; AzureLocation location = default; ResourceIdentifier id = default; @@ -94,6 +123,8 @@ internal static EventGridTopicData DeserializeEventGridTopicData(JsonElement ele Optional> privateEndpointConnections = default; Optional provisioningState = default; Optional endpoint = default; + Optional eventTypeInfo = default; + Optional minimumTlsVersionAllowed = default; Optional inputSchema = default; Optional inputSchemaMapping = default; Optional metricResourceId = default; @@ -103,6 +134,15 @@ internal static EventGridTopicData DeserializeEventGridTopicData(JsonElement ele Optional dataResidencyBoundary = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = ResourceSku.DeserializeResourceSku(property.Value); + continue; + } if (property.NameEquals("identity"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -112,6 +152,24 @@ internal static EventGridTopicData DeserializeEventGridTopicData(JsonElement ele identity = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (property.NameEquals("kind"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kind = new ResourceKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("extendedLocation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + extendedLocation = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } if (property.NameEquals("tags"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -196,6 +254,24 @@ internal static EventGridTopicData DeserializeEventGridTopicData(JsonElement ele endpoint = new Uri(property0.Value.GetString()); continue; } + if (property0.NameEquals("eventTypeInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eventTypeInfo = PartnerTopicEventTypeInfo.DeserializePartnerTopicEventTypeInfo(property0.Value); + continue; + } + if (property0.NameEquals("minimumTlsVersionAllowed"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minimumTlsVersionAllowed = new TlsVersion(property0.Value.GetString()); + continue; + } if (property0.NameEquals("inputSchema"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -264,7 +340,7 @@ internal static EventGridTopicData DeserializeEventGridTopicData(JsonElement ele continue; } } - return new EventGridTopicData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, Optional.ToList(privateEndpointConnections), Optional.ToNullable(provisioningState), endpoint.Value, Optional.ToNullable(inputSchema), inputSchemaMapping.Value, metricResourceId.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToList(inboundIPRules), Optional.ToNullable(disableLocalAuth), Optional.ToNullable(dataResidencyBoundary)); + return new EventGridTopicData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, identity, Optional.ToNullable(kind), extendedLocation, Optional.ToList(privateEndpointConnections), Optional.ToNullable(provisioningState), endpoint.Value, eventTypeInfo.Value, Optional.ToNullable(minimumTlsVersionAllowed), Optional.ToNullable(inputSchema), inputSchemaMapping.Value, metricResourceId.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToList(inboundIPRules), Optional.ToNullable(disableLocalAuth), Optional.ToNullable(dataResidencyBoundary)); } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridTopicPatch.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridTopicPatch.Serialization.cs index a1ba27d47ba6..a67371f398eb 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridTopicPatch.Serialization.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridTopicPatch.Serialization.cs @@ -31,6 +31,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("identity"u8); JsonSerializer.Serialize(writer, Identity); } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(PublicNetworkAccess)) @@ -48,6 +53,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(MinimumTlsVersionAllowed)) + { + writer.WritePropertyName("minimumTlsVersionAllowed"u8); + writer.WriteStringValue(MinimumTlsVersionAllowed.Value.ToString()); + } if (Optional.IsDefined(IsLocalAuthDisabled)) { writer.WritePropertyName("disableLocalAuth"u8); @@ -58,6 +68,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("dataResidencyBoundary"u8); writer.WriteStringValue(DataResidencyBoundary.Value.ToString()); } + if (Optional.IsDefined(EventTypeInfo)) + { + writer.WritePropertyName("eventTypeInfo"u8); + writer.WriteObjectValue(EventTypeInfo); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridTopicPatch.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridTopicPatch.cs index 8737859ae9e2..f601dec9f208 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridTopicPatch.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventGridTopicPatch.cs @@ -25,6 +25,20 @@ public EventGridTopicPatch() public IDictionary Tags { get; } /// Topic resource identity information. public ManagedServiceIdentity Identity { get; set; } + /// The Sku pricing tier for the topic. + internal ResourceSku Sku { get; set; } + /// The Sku name of the resource. The possible values are: Basic or Premium. + public EventGridSku? SkuName + { + get => Sku is null ? default : Sku.Name; + set + { + if (Sku is null) + Sku = new ResourceSku(); + Sku.Name = value; + } + } + /// /// This determines if traffic is allowed over public network. By default it is enabled. /// You can further restrict to specific IPs by configuring <seealso cref="P:Microsoft.Azure.Events.ResourceProvider.Common.Contracts.TopicUpdateParameterProperties.InboundIpRules" /> @@ -32,9 +46,13 @@ public EventGridTopicPatch() public EventGridPublicNetworkAccess? PublicNetworkAccess { get; set; } /// This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. public IList InboundIPRules { get; } + /// Minimum TLS version of the publisher allowed to publish to this domain. + public TlsVersion? MinimumTlsVersionAllowed { get; set; } /// This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the topic. public bool? IsLocalAuthDisabled { get; set; } /// The data residency boundary for the topic. public DataResidencyBoundary? DataResidencyBoundary { get; set; } + /// The eventTypeInfo for the topic. + public PartnerTopicEventTypeInfo EventTypeInfo { get; set; } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventInputSchema.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventInputSchema.cs new file mode 100644 index 000000000000..fdbb28207357 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventInputSchema.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// This determines the format that is expected for incoming events published to the topic. + public readonly partial struct EventInputSchema : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EventInputSchema(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CloudEventSchemaV10Value = "CloudEventSchemaV1_0"; + + /// CloudEventSchemaV1_0. + public static EventInputSchema CloudEventSchemaV10 { get; } = new EventInputSchema(CloudEventSchemaV10Value); + /// Determines if two values are the same. + public static bool operator ==(EventInputSchema left, EventInputSchema right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EventInputSchema left, EventInputSchema right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EventInputSchema(string value) => new EventInputSchema(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EventInputSchema other && Equals(other); + /// + public bool Equals(EventInputSchema 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventSubscriptionDestination.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventSubscriptionDestination.Serialization.cs index a2e761147651..ec5dadb637c4 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventSubscriptionDestination.Serialization.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventSubscriptionDestination.Serialization.cs @@ -33,6 +33,7 @@ internal static EventSubscriptionDestination DeserializeEventSubscriptionDestina case "AzureFunction": return AzureFunctionEventSubscriptionDestination.DeserializeAzureFunctionEventSubscriptionDestination(element); case "EventHub": return EventHubEventSubscriptionDestination.DeserializeEventHubEventSubscriptionDestination(element); case "HybridConnection": return HybridConnectionEventSubscriptionDestination.DeserializeHybridConnectionEventSubscriptionDestination(element); + case "PartnerDestination": return PartnerEventSubscriptionDestination.DeserializePartnerEventSubscriptionDestination(element); case "ServiceBusQueue": return ServiceBusQueueEventSubscriptionDestination.DeserializeServiceBusQueueEventSubscriptionDestination(element); case "ServiceBusTopic": return ServiceBusTopicEventSubscriptionDestination.DeserializeServiceBusTopicEventSubscriptionDestination(element); case "StorageQueue": return StorageQueueEventSubscriptionDestination.DeserializeStorageQueueEventSubscriptionDestination(element); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventSubscriptionDestination.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventSubscriptionDestination.cs index 43297be6e165..9c50399816f0 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventSubscriptionDestination.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/EventSubscriptionDestination.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.EventGrid.Models /// /// Information about the destination for an event subscription. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , and . + /// The available derived classes include , , , , , , and . /// public abstract partial class EventSubscriptionDestination { diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/Filter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/Filter.Serialization.cs new file mode 100644 index 000000000000..be646792d58c --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/Filter.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class Filter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static Filter DeserializeFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("operatorType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "BoolEquals": return BoolEqualsFilter.DeserializeBoolEqualsFilter(element); + case "IsNotNull": return IsNotNullFilter.DeserializeIsNotNullFilter(element); + case "IsNullOrUndefined": return IsNullOrUndefinedFilter.DeserializeIsNullOrUndefinedFilter(element); + case "NumberGreaterThan": return NumberGreaterThanFilter.DeserializeNumberGreaterThanFilter(element); + case "NumberGreaterThanOrEquals": return NumberGreaterThanOrEqualsFilter.DeserializeNumberGreaterThanOrEqualsFilter(element); + case "NumberIn": return NumberInFilter.DeserializeNumberInFilter(element); + case "NumberInRange": return NumberInRangeFilter.DeserializeNumberInRangeFilter(element); + case "NumberLessThan": return NumberLessThanFilter.DeserializeNumberLessThanFilter(element); + case "NumberLessThanOrEquals": return NumberLessThanOrEqualsFilter.DeserializeNumberLessThanOrEqualsFilter(element); + case "NumberNotIn": return NumberNotInFilter.DeserializeNumberNotInFilter(element); + case "NumberNotInRange": return NumberNotInRangeFilter.DeserializeNumberNotInRangeFilter(element); + case "StringBeginsWith": return StringBeginsWithFilter.DeserializeStringBeginsWithFilter(element); + case "StringContains": return StringContainsFilter.DeserializeStringContainsFilter(element); + case "StringEndsWith": return StringEndsWithFilter.DeserializeStringEndsWithFilter(element); + case "StringIn": return StringInFilter.DeserializeStringInFilter(element); + case "StringNotBeginsWith": return StringNotBeginsWithFilter.DeserializeStringNotBeginsWithFilter(element); + case "StringNotContains": return StringNotContainsFilter.DeserializeStringNotContainsFilter(element); + case "StringNotEndsWith": return StringNotEndsWithFilter.DeserializeStringNotEndsWithFilter(element); + case "StringNotIn": return StringNotInFilter.DeserializeStringNotInFilter(element); + } + } + return UnknownFilter.DeserializeUnknownFilter(element); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/Filter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/Filter.cs new file mode 100644 index 000000000000..f9fa0356f9ff --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/Filter.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// + /// This is the base type that represents a filter. To configure a filter, do not directly instantiate an object of this class. Instead, instantiate + /// an object of a derived class such as BoolEqualsFilter, NumberInFilter, StringEqualsFilter etc depending on the type of the key based on + /// which you want to filter. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , , , , , , and . + /// + public abstract partial class Filter + { + /// Initializes a new instance of Filter. + protected Filter() + { + } + + /// Initializes a new instance of Filter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + internal Filter(FilterOperatorType operatorType, string key) + { + OperatorType = operatorType; + Key = key; + } + + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + internal FilterOperatorType OperatorType { get; set; } + /// The field/property in the event based on which you want to filter. + public string Key { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/FilterOperatorType.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/FilterOperatorType.cs new file mode 100644 index 000000000000..a5d515ccd3ca --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/FilterOperatorType.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + internal readonly partial struct FilterOperatorType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FilterOperatorType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NumberInValue = "NumberIn"; + private const string NumberNotInValue = "NumberNotIn"; + private const string NumberLessThanValue = "NumberLessThan"; + private const string NumberGreaterThanValue = "NumberGreaterThan"; + private const string NumberLessThanOrEqualsValue = "NumberLessThanOrEquals"; + private const string NumberGreaterThanOrEqualsValue = "NumberGreaterThanOrEquals"; + private const string BoolEqualsValue = "BoolEquals"; + private const string StringInValue = "StringIn"; + private const string StringNotInValue = "StringNotIn"; + private const string StringBeginsWithValue = "StringBeginsWith"; + private const string StringEndsWithValue = "StringEndsWith"; + private const string StringContainsValue = "StringContains"; + private const string NumberInRangeValue = "NumberInRange"; + private const string NumberNotInRangeValue = "NumberNotInRange"; + private const string StringNotBeginsWithValue = "StringNotBeginsWith"; + private const string StringNotEndsWithValue = "StringNotEndsWith"; + private const string StringNotContainsValue = "StringNotContains"; + private const string IsNullOrUndefinedValue = "IsNullOrUndefined"; + private const string IsNotNullValue = "IsNotNull"; + + /// NumberIn. + public static FilterOperatorType NumberIn { get; } = new FilterOperatorType(NumberInValue); + /// NumberNotIn. + public static FilterOperatorType NumberNotIn { get; } = new FilterOperatorType(NumberNotInValue); + /// NumberLessThan. + public static FilterOperatorType NumberLessThan { get; } = new FilterOperatorType(NumberLessThanValue); + /// NumberGreaterThan. + public static FilterOperatorType NumberGreaterThan { get; } = new FilterOperatorType(NumberGreaterThanValue); + /// NumberLessThanOrEquals. + public static FilterOperatorType NumberLessThanOrEquals { get; } = new FilterOperatorType(NumberLessThanOrEqualsValue); + /// NumberGreaterThanOrEquals. + public static FilterOperatorType NumberGreaterThanOrEquals { get; } = new FilterOperatorType(NumberGreaterThanOrEqualsValue); + /// BoolEquals. + public static FilterOperatorType BoolEquals { get; } = new FilterOperatorType(BoolEqualsValue); + /// StringIn. + public static FilterOperatorType StringIn { get; } = new FilterOperatorType(StringInValue); + /// StringNotIn. + public static FilterOperatorType StringNotIn { get; } = new FilterOperatorType(StringNotInValue); + /// StringBeginsWith. + public static FilterOperatorType StringBeginsWith { get; } = new FilterOperatorType(StringBeginsWithValue); + /// StringEndsWith. + public static FilterOperatorType StringEndsWith { get; } = new FilterOperatorType(StringEndsWithValue); + /// StringContains. + public static FilterOperatorType StringContains { get; } = new FilterOperatorType(StringContainsValue); + /// NumberInRange. + public static FilterOperatorType NumberInRange { get; } = new FilterOperatorType(NumberInRangeValue); + /// NumberNotInRange. + public static FilterOperatorType NumberNotInRange { get; } = new FilterOperatorType(NumberNotInRangeValue); + /// StringNotBeginsWith. + public static FilterOperatorType StringNotBeginsWith { get; } = new FilterOperatorType(StringNotBeginsWithValue); + /// StringNotEndsWith. + public static FilterOperatorType StringNotEndsWith { get; } = new FilterOperatorType(StringNotEndsWithValue); + /// StringNotContains. + public static FilterOperatorType StringNotContains { get; } = new FilterOperatorType(StringNotContainsValue); + /// IsNullOrUndefined. + public static FilterOperatorType IsNullOrUndefined { get; } = new FilterOperatorType(IsNullOrUndefinedValue); + /// IsNotNull. + public static FilterOperatorType IsNotNull { get; } = new FilterOperatorType(IsNotNullValue); + /// Determines if two values are the same. + public static bool operator ==(FilterOperatorType left, FilterOperatorType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FilterOperatorType left, FilterOperatorType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator FilterOperatorType(string value) => new FilterOperatorType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FilterOperatorType other && Equals(other); + /// + public bool Equals(FilterOperatorType 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/FiltersConfiguration.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/FiltersConfiguration.Serialization.cs new file mode 100644 index 000000000000..eedda71fef18 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/FiltersConfiguration.Serialization.cs @@ -0,0 +1,84 @@ +// 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.EventGrid.Models +{ + public partial class FiltersConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(IncludedEventTypes)) + { + writer.WritePropertyName("includedEventTypes"u8); + writer.WriteStartArray(); + foreach (var item in IncludedEventTypes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Filters)) + { + writer.WritePropertyName("filters"u8); + writer.WriteStartArray(); + foreach (var item in Filters) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static FiltersConfiguration DeserializeFiltersConfiguration(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> includedEventTypes = default; + Optional> filters = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("includedEventTypes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + includedEventTypes = array; + continue; + } + if (property.NameEquals("filters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Filter.DeserializeFilter(item)); + } + filters = array; + continue; + } + } + return new FiltersConfiguration(Optional.ToList(includedEventTypes), Optional.ToList(filters)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/FiltersConfiguration.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/FiltersConfiguration.cs new file mode 100644 index 000000000000..d366de31127c --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/FiltersConfiguration.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Filters configuration for the Event Subscription. + public partial class FiltersConfiguration + { + /// Initializes a new instance of FiltersConfiguration. + public FiltersConfiguration() + { + IncludedEventTypes = new ChangeTrackingList(); + Filters = new ChangeTrackingList(); + } + + /// Initializes a new instance of FiltersConfiguration. + /// A list of applicable event types that need to be part of the event subscription. If it is desired to subscribe to all default event types, set the IncludedEventTypes to null. + /// + /// An array of filters that are used for filtering event subscriptions. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , , , , , , and . + /// + internal FiltersConfiguration(IList includedEventTypes, IList filters) + { + IncludedEventTypes = includedEventTypes; + Filters = filters; + } + + /// A list of applicable event types that need to be part of the event subscription. If it is desired to subscribe to all default event types, set the IncludedEventTypes to null. + public IList IncludedEventTypes { get; } + /// + /// An array of filters that are used for filtering event subscriptions. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , , , , , , and . + /// + public IList Filters { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/IsNotNullFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/IsNotNullFilter.Serialization.cs new file mode 100644 index 000000000000..db8a93723f15 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/IsNotNullFilter.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class IsNotNullFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static IsNotNullFilter DeserializeIsNotNullFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new IsNotNullFilter(operatorType, key.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/IsNotNullFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/IsNotNullFilter.cs new file mode 100644 index 000000000000..12455309802c --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/IsNotNullFilter.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// IsNotNull Filter. + public partial class IsNotNullFilter : Filter + { + /// Initializes a new instance of IsNotNullFilter. + public IsNotNullFilter() + { + OperatorType = FilterOperatorType.IsNotNull; + } + + /// Initializes a new instance of IsNotNullFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + internal IsNotNullFilter(FilterOperatorType operatorType, string key) : base(operatorType, key) + { + OperatorType = operatorType; + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/IsNullOrUndefinedFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/IsNullOrUndefinedFilter.Serialization.cs new file mode 100644 index 000000000000..b1be1c81b225 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/IsNullOrUndefinedFilter.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class IsNullOrUndefinedFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static IsNullOrUndefinedFilter DeserializeIsNullOrUndefinedFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new IsNullOrUndefinedFilter(operatorType, key.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/IsNullOrUndefinedFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/IsNullOrUndefinedFilter.cs new file mode 100644 index 000000000000..ee00193260e8 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/IsNullOrUndefinedFilter.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// IsNullOrUndefined Filter. + public partial class IsNullOrUndefinedFilter : Filter + { + /// Initializes a new instance of IsNullOrUndefinedFilter. + public IsNullOrUndefinedFilter() + { + OperatorType = FilterOperatorType.IsNullOrUndefined; + } + + /// Initializes a new instance of IsNullOrUndefinedFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + internal IsNullOrUndefinedFilter(FilterOperatorType operatorType, string key) : base(operatorType, key) + { + OperatorType = operatorType; + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceData.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceData.Serialization.cs new file mode 100644 index 000000000000..141d0728ca5f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceData.Serialization.cs @@ -0,0 +1,278 @@ +// 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.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + public partial class NamespaceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + JsonSerializer.Serialize(writer, Identity); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(PrivateEndpointConnections)) + { + writer.WritePropertyName("privateEndpointConnections"u8); + writer.WriteStartArray(); + foreach (var item in PrivateEndpointConnections) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(TopicsConfiguration)) + { + writer.WritePropertyName("topicsConfiguration"u8); + writer.WriteObjectValue(TopicsConfiguration); + } + if (Optional.IsDefined(TopicSpacesConfiguration)) + { + writer.WritePropertyName("topicSpacesConfiguration"u8); + writer.WriteObjectValue(TopicSpacesConfiguration); + } + if (Optional.IsDefined(IsZoneRedundant)) + { + writer.WritePropertyName("isZoneRedundant"u8); + writer.WriteBooleanValue(IsZoneRedundant.Value); + } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } + if (Optional.IsCollectionDefined(InboundIPRules)) + { + writer.WritePropertyName("inboundIpRules"u8); + writer.WriteStartArray(); + foreach (var item in InboundIPRules) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(MinimumTlsVersionAllowed)) + { + writer.WritePropertyName("minimumTlsVersionAllowed"u8); + writer.WriteStringValue(MinimumTlsVersionAllowed.Value.ToString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static NamespaceData DeserializeNamespaceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sku = default; + Optional identity = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional> privateEndpointConnections = default; + Optional provisioningState = default; + Optional topicsConfiguration = default; + Optional topicSpacesConfiguration = default; + Optional isZoneRedundant = default; + Optional publicNetworkAccess = default; + Optional> inboundIPRules = default; + Optional minimumTlsVersionAllowed = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = NamespaceSku.DeserializeNamespaceSku(property.Value); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("privateEndpointConnections"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(EventGridPrivateEndpointConnectionData.DeserializeEventGridPrivateEndpointConnectionData(item)); + } + privateEndpointConnections = array; + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new NamespaceProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("topicsConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + topicsConfiguration = TopicsConfiguration.DeserializeTopicsConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("topicSpacesConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + topicSpacesConfiguration = TopicSpacesConfiguration.DeserializeTopicSpacesConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("isZoneRedundant"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isZoneRedundant = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("publicNetworkAccess"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new EventGridPublicNetworkAccess(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("inboundIpRules"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(EventGridInboundIPRule.DeserializeEventGridInboundIPRule(item)); + } + inboundIPRules = array; + continue; + } + if (property0.NameEquals("minimumTlsVersionAllowed"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minimumTlsVersionAllowed = new TlsVersion(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new NamespaceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, identity, Optional.ToList(privateEndpointConnections), Optional.ToNullable(provisioningState), topicsConfiguration.Value, topicSpacesConfiguration.Value, Optional.ToNullable(isZoneRedundant), Optional.ToNullable(publicNetworkAccess), Optional.ToList(inboundIPRules), Optional.ToNullable(minimumTlsVersionAllowed)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespacePatch.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespacePatch.Serialization.cs new file mode 100644 index 000000000000..b38e55746759 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespacePatch.Serialization.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class NamespacePatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + JsonSerializer.Serialize(writer, Identity); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(TopicSpacesConfiguration)) + { + writer.WritePropertyName("topicSpacesConfiguration"u8); + writer.WriteObjectValue(TopicSpacesConfiguration); + } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } + if (Optional.IsCollectionDefined(InboundIPRules)) + { + writer.WritePropertyName("inboundIpRules"u8); + writer.WriteStartArray(); + foreach (var item in InboundIPRules) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespacePatch.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespacePatch.cs new file mode 100644 index 000000000000..e5ef3097d008 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespacePatch.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Properties to update namespace. + public partial class NamespacePatch + { + /// Initializes a new instance of NamespacePatch. + public NamespacePatch() + { + Tags = new ChangeTrackingDictionary(); + InboundIPRules = new ChangeTrackingList(); + } + + /// Tags of the namespace resource. + public IDictionary Tags { get; } + /// Namespace resource identity information. + public ManagedServiceIdentity Identity { get; set; } + /// Represents available Sku pricing tiers. + public NamespaceSku Sku { get; set; } + /// Topic spaces configuration properties that can be updated. + public UpdateTopicSpacesConfigurationInfo TopicSpacesConfiguration { get; set; } + /// + /// This determines if traffic is allowed over public network. By default it is enabled. + /// You can further restrict to specific IPs by configuring <seealso cref="P:Microsoft.Azure.Events.ResourceProvider.Common.Contracts.PubSub.NamespaceUpdateParameterProperties.InboundIpRules" /> + /// + public EventGridPublicNetworkAccess? PublicNetworkAccess { get; set; } + /// This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + public IList InboundIPRules { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceProvisioningState.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceProvisioningState.cs new file mode 100644 index 000000000000..7eb397a8ee76 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceProvisioningState.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Provisioning state of the namespace resource. + public readonly partial struct NamespaceProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NamespaceProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string SucceededValue = "Succeeded"; + private const string CanceledValue = "Canceled"; + private const string FailedValue = "Failed"; + private const string DeletedValue = "Deleted"; + private const string DeleteFailedValue = "DeleteFailed"; + private const string CreateFailedValue = "CreateFailed"; + private const string UpdatedFailedValue = "UpdatedFailed"; + + /// Creating. + public static NamespaceProvisioningState Creating { get; } = new NamespaceProvisioningState(CreatingValue); + /// Updating. + public static NamespaceProvisioningState Updating { get; } = new NamespaceProvisioningState(UpdatingValue); + /// Deleting. + public static NamespaceProvisioningState Deleting { get; } = new NamespaceProvisioningState(DeletingValue); + /// Succeeded. + public static NamespaceProvisioningState Succeeded { get; } = new NamespaceProvisioningState(SucceededValue); + /// Canceled. + public static NamespaceProvisioningState Canceled { get; } = new NamespaceProvisioningState(CanceledValue); + /// Failed. + public static NamespaceProvisioningState Failed { get; } = new NamespaceProvisioningState(FailedValue); + /// Deleted. + public static NamespaceProvisioningState Deleted { get; } = new NamespaceProvisioningState(DeletedValue); + /// DeleteFailed. + public static NamespaceProvisioningState DeleteFailed { get; } = new NamespaceProvisioningState(DeleteFailedValue); + /// CreateFailed. + public static NamespaceProvisioningState CreateFailed { get; } = new NamespaceProvisioningState(CreateFailedValue); + /// UpdatedFailed. + public static NamespaceProvisioningState UpdatedFailed { get; } = new NamespaceProvisioningState(UpdatedFailedValue); + /// Determines if two values are the same. + public static bool operator ==(NamespaceProvisioningState left, NamespaceProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NamespaceProvisioningState left, NamespaceProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NamespaceProvisioningState(string value) => new NamespaceProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NamespaceProvisioningState other && Equals(other); + /// + public bool Equals(NamespaceProvisioningState 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceRegenerateKeyContent.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceRegenerateKeyContent.Serialization.cs new file mode 100644 index 000000000000..b239566e6e92 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceRegenerateKeyContent.Serialization.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class NamespaceRegenerateKeyContent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("keyName"u8); + writer.WriteStringValue(KeyName); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceRegenerateKeyContent.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceRegenerateKeyContent.cs new file mode 100644 index 000000000000..49ad732da052 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceRegenerateKeyContent.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Namespace regenerate share access key request. + public partial class NamespaceRegenerateKeyContent + { + /// Initializes a new instance of NamespaceRegenerateKeyContent. + /// Key name to regenerate key1 or key2. + /// is null. + public NamespaceRegenerateKeyContent(string keyName) + { + Argument.AssertNotNull(keyName, nameof(keyName)); + + KeyName = keyName; + } + + /// Key name to regenerate key1 or key2. + public string KeyName { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceSharedAccessKeys.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceSharedAccessKeys.Serialization.cs new file mode 100644 index 000000000000..af28e290b070 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceSharedAccessKeys.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class NamespaceSharedAccessKeys + { + internal static NamespaceSharedAccessKeys DeserializeNamespaceSharedAccessKeys(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional key1 = default; + Optional key2 = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key1"u8)) + { + key1 = property.Value.GetString(); + continue; + } + if (property.NameEquals("key2"u8)) + { + key2 = property.Value.GetString(); + continue; + } + } + return new NamespaceSharedAccessKeys(key1.Value, key2.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceSharedAccessKeys.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceSharedAccessKeys.cs new file mode 100644 index 000000000000..b1edf8f70214 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceSharedAccessKeys.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Shared access keys of the Namespace. + public partial class NamespaceSharedAccessKeys + { + /// Initializes a new instance of NamespaceSharedAccessKeys. + internal NamespaceSharedAccessKeys() + { + } + + /// Initializes a new instance of NamespaceSharedAccessKeys. + /// Shared access key1 for the namespace. + /// Shared access key2 for the namespace. + internal NamespaceSharedAccessKeys(string key1, string key2) + { + Key1 = key1; + Key2 = key2; + } + + /// Shared access key1 for the namespace. + public string Key1 { get; } + /// Shared access key2 for the namespace. + public string Key2 { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceSku.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceSku.Serialization.cs new file mode 100644 index 000000000000..5693896e55bf --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceSku.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class NamespaceSku : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name.Value.ToString()); + } + if (Optional.IsDefined(Capacity)) + { + writer.WritePropertyName("capacity"u8); + writer.WriteNumberValue(Capacity.Value); + } + writer.WriteEndObject(); + } + + internal static NamespaceSku DeserializeNamespaceSku(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional capacity = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = new EventGridSkuName(property.Value.GetString()); + continue; + } + if (property.NameEquals("capacity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capacity = property.Value.GetInt32(); + continue; + } + } + return new NamespaceSku(Optional.ToNullable(name), Optional.ToNullable(capacity)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceSku.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceSku.cs new file mode 100644 index 000000000000..e326eca0f2b3 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceSku.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Represents available Sku pricing tiers. + public partial class NamespaceSku + { + /// Initializes a new instance of NamespaceSku. + public NamespaceSku() + { + } + + /// Initializes a new instance of NamespaceSku. + /// The name of the SKU. + /// + /// Specifies the number of Throughput Units that defines the capacity for the namespace. The property default value is + /// 1 which signifies 1 Throughput Unit = 1MB/s ingress and 2MB/s egress per namespace. Min capacity is 1 and + /// max allowed capacity is 20. + /// + internal NamespaceSku(EventGridSkuName? name, int? capacity) + { + Name = name; + Capacity = capacity; + } + + /// The name of the SKU. + public EventGridSkuName? Name { get; set; } + /// + /// Specifies the number of Throughput Units that defines the capacity for the namespace. The property default value is + /// 1 which signifies 1 Throughput Unit = 1MB/s ingress and 2MB/s egress per namespace. Min capacity is 1 and + /// max allowed capacity is 20. + /// + public int? Capacity { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicData.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicData.Serialization.cs new file mode 100644 index 000000000000..cc12978f077b --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicData.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + public partial class NamespaceTopicData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(PublisherType)) + { + writer.WritePropertyName("publisherType"u8); + writer.WriteStringValue(PublisherType.Value.ToString()); + } + if (Optional.IsDefined(InputSchema)) + { + writer.WritePropertyName("inputSchema"u8); + writer.WriteStringValue(InputSchema.Value.ToString()); + } + if (Optional.IsDefined(EventRetentionInDays)) + { + writer.WritePropertyName("eventRetentionInDays"u8); + writer.WriteNumberValue(EventRetentionInDays.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static NamespaceTopicData DeserializeNamespaceTopicData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional provisioningState = default; + Optional publisherType = default; + Optional inputSchema = default; + Optional eventRetentionInDays = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new NamespaceTopicProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("publisherType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisherType = new PublisherType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("inputSchema"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + inputSchema = new EventInputSchema(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("eventRetentionInDays"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eventRetentionInDays = property0.Value.GetInt32(); + continue; + } + } + continue; + } + } + return new NamespaceTopicData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(publisherType), Optional.ToNullable(inputSchema), Optional.ToNullable(eventRetentionInDays)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicPatch.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicPatch.Serialization.cs new file mode 100644 index 000000000000..f4fbf30e9e38 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicPatch.Serialization.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class NamespaceTopicPatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(EventRetentionInDays)) + { + writer.WritePropertyName("eventRetentionInDays"u8); + writer.WriteNumberValue(EventRetentionInDays.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicPatch.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicPatch.cs new file mode 100644 index 000000000000..7a661c18a47f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicPatch.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Properties of the namespace topic update. + public partial class NamespaceTopicPatch + { + /// Initializes a new instance of NamespaceTopicPatch. + public NamespaceTopicPatch() + { + } + + /// + /// Event retention for the namespace topic expressed in days. The property default value is 1 day. + /// Min event retention duration value is 1 day and max event retention duration value is 1 day. + /// + public int? EventRetentionInDays { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicProvisioningState.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicProvisioningState.cs new file mode 100644 index 000000000000..4fa49042f1e9 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicProvisioningState.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Provisioning state of the namespace topic. + public readonly partial struct NamespaceTopicProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NamespaceTopicProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string SucceededValue = "Succeeded"; + private const string CanceledValue = "Canceled"; + private const string FailedValue = "Failed"; + private const string DeletedValue = "Deleted"; + private const string DeleteFailedValue = "DeleteFailed"; + private const string CreateFailedValue = "CreateFailed"; + private const string UpdatedFailedValue = "UpdatedFailed"; + + /// Creating. + public static NamespaceTopicProvisioningState Creating { get; } = new NamespaceTopicProvisioningState(CreatingValue); + /// Updating. + public static NamespaceTopicProvisioningState Updating { get; } = new NamespaceTopicProvisioningState(UpdatingValue); + /// Deleting. + public static NamespaceTopicProvisioningState Deleting { get; } = new NamespaceTopicProvisioningState(DeletingValue); + /// Succeeded. + public static NamespaceTopicProvisioningState Succeeded { get; } = new NamespaceTopicProvisioningState(SucceededValue); + /// Canceled. + public static NamespaceTopicProvisioningState Canceled { get; } = new NamespaceTopicProvisioningState(CanceledValue); + /// Failed. + public static NamespaceTopicProvisioningState Failed { get; } = new NamespaceTopicProvisioningState(FailedValue); + /// Deleted. + public static NamespaceTopicProvisioningState Deleted { get; } = new NamespaceTopicProvisioningState(DeletedValue); + /// DeleteFailed. + public static NamespaceTopicProvisioningState DeleteFailed { get; } = new NamespaceTopicProvisioningState(DeleteFailedValue); + /// CreateFailed. + public static NamespaceTopicProvisioningState CreateFailed { get; } = new NamespaceTopicProvisioningState(CreateFailedValue); + /// UpdatedFailed. + public static NamespaceTopicProvisioningState UpdatedFailed { get; } = new NamespaceTopicProvisioningState(UpdatedFailedValue); + /// Determines if two values are the same. + public static bool operator ==(NamespaceTopicProvisioningState left, NamespaceTopicProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NamespaceTopicProvisioningState left, NamespaceTopicProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NamespaceTopicProvisioningState(string value) => new NamespaceTopicProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NamespaceTopicProvisioningState other && Equals(other); + /// + public bool Equals(NamespaceTopicProvisioningState 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicsListResult.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicsListResult.Serialization.cs new file mode 100644 index 000000000000..8a3acf59581e --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicsListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + internal partial class NamespaceTopicsListResult + { + internal static NamespaceTopicsListResult DeserializeNamespaceTopicsListResult(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(NamespaceTopicData.DeserializeNamespaceTopicData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new NamespaceTopicsListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicsListResult.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicsListResult.cs new file mode 100644 index 000000000000..07de30dbce70 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespaceTopicsListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Result of the List namespace topics operation. + internal partial class NamespaceTopicsListResult + { + /// Initializes a new instance of NamespaceTopicsListResult. + internal NamespaceTopicsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of NamespaceTopicsListResult. + /// A collection of namespace topics. + /// A link for the next page of namespace topics. + internal NamespaceTopicsListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A collection of namespace topics. + public IReadOnlyList Value { get; } + /// A link for the next page of namespace topics. + public string NextLink { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespacesListResult.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespacesListResult.Serialization.cs new file mode 100644 index 000000000000..ea6b5dc53455 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespacesListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + internal partial class NamespacesListResult + { + internal static NamespacesListResult DeserializeNamespacesListResult(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(NamespaceData.DeserializeNamespaceData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new NamespacesListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespacesListResult.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespacesListResult.cs new file mode 100644 index 000000000000..e87afadc8c7d --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NamespacesListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Result of the List Namespaces operation. + internal partial class NamespacesListResult + { + /// Initializes a new instance of NamespacesListResult. + internal NamespacesListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of NamespacesListResult. + /// A collection of namespaces. + /// A link for the next page of namespaces. + internal NamespacesListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A collection of namespaces. + public IReadOnlyList Value { get; } + /// A link for the next page of namespaces. + public string NextLink { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberGreaterThanFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberGreaterThanFilter.Serialization.cs new file mode 100644 index 000000000000..bb8a930e658b --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberGreaterThanFilter.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class NumberGreaterThanFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value.Value); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static NumberGreaterThanFilter DeserializeNumberGreaterThanFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional value = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new NumberGreaterThanFilter(operatorType, key.Value, Optional.ToNullable(value)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberGreaterThanFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberGreaterThanFilter.cs new file mode 100644 index 000000000000..53596cd07da5 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberGreaterThanFilter.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// NumberGreaterThan Filter. + public partial class NumberGreaterThanFilter : Filter + { + /// Initializes a new instance of NumberGreaterThanFilter. + public NumberGreaterThanFilter() + { + OperatorType = FilterOperatorType.NumberGreaterThan; + } + + /// Initializes a new instance of NumberGreaterThanFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The filter value. + internal NumberGreaterThanFilter(FilterOperatorType operatorType, string key, double? value) : base(operatorType, key) + { + Value = value; + OperatorType = operatorType; + } + + /// The filter value. + public double? Value { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberGreaterThanOrEqualsFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberGreaterThanOrEqualsFilter.Serialization.cs new file mode 100644 index 000000000000..87e69a4151a2 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberGreaterThanOrEqualsFilter.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class NumberGreaterThanOrEqualsFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value.Value); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static NumberGreaterThanOrEqualsFilter DeserializeNumberGreaterThanOrEqualsFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional value = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new NumberGreaterThanOrEqualsFilter(operatorType, key.Value, Optional.ToNullable(value)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberGreaterThanOrEqualsFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberGreaterThanOrEqualsFilter.cs new file mode 100644 index 000000000000..6f1334f6159a --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberGreaterThanOrEqualsFilter.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// NumberGreaterThanOrEquals Filter. + public partial class NumberGreaterThanOrEqualsFilter : Filter + { + /// Initializes a new instance of NumberGreaterThanOrEqualsFilter. + public NumberGreaterThanOrEqualsFilter() + { + OperatorType = FilterOperatorType.NumberGreaterThanOrEquals; + } + + /// Initializes a new instance of NumberGreaterThanOrEqualsFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The filter value. + internal NumberGreaterThanOrEqualsFilter(FilterOperatorType operatorType, string key, double? value) : base(operatorType, key) + { + Value = value; + OperatorType = operatorType; + } + + /// The filter value. + public double? Value { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberInFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberInFilter.Serialization.cs new file mode 100644 index 000000000000..caa30099b7dc --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberInFilter.Serialization.cs @@ -0,0 +1,78 @@ +// 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.EventGrid.Models +{ + public partial class NumberInFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteNumberValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static NumberInFilter DeserializeNumberInFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> values = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetDouble()); + } + values = array; + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new NumberInFilter(operatorType, key.Value, Optional.ToList(values)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberInFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberInFilter.cs new file mode 100644 index 000000000000..d353feae4a35 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberInFilter.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// NumberIn Filter. + public partial class NumberInFilter : Filter + { + /// Initializes a new instance of NumberInFilter. + public NumberInFilter() + { + Values = new ChangeTrackingList(); + OperatorType = FilterOperatorType.NumberIn; + } + + /// Initializes a new instance of NumberInFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The set of filter values. + internal NumberInFilter(FilterOperatorType operatorType, string key, IList values) : base(operatorType, key) + { + Values = values; + OperatorType = operatorType; + } + + /// The set of filter values. + public IList Values { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberInRangeFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberInRangeFilter.Serialization.cs new file mode 100644 index 000000000000..0c87129dc773 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberInRangeFilter.Serialization.cs @@ -0,0 +1,100 @@ +// 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.EventGrid.Models +{ + public partial class NumberInRangeFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStartArray(); + foreach (var item0 in item) + { + writer.WriteNumberValue(item0); + } + writer.WriteEndArray(); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static NumberInRangeFilter DeserializeNumberInRangeFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional>> values = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List> array = new List>(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + List array0 = new List(); + foreach (var item0 in item.EnumerateArray()) + { + array0.Add(item0.GetDouble()); + } + array.Add(array0); + } + } + values = array; + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new NumberInRangeFilter(operatorType, key.Value, Optional.ToList(values)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberInRangeFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberInRangeFilter.cs new file mode 100644 index 000000000000..a12ed4d478e2 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberInRangeFilter.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// NumberInRange Filter. + public partial class NumberInRangeFilter : Filter + { + /// Initializes a new instance of NumberInRangeFilter. + public NumberInRangeFilter() + { + Values = new ChangeTrackingList>(); + OperatorType = FilterOperatorType.NumberInRange; + } + + /// Initializes a new instance of NumberInRangeFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The set of filter values. + internal NumberInRangeFilter(FilterOperatorType operatorType, string key, IList> values) : base(operatorType, key) + { + Values = values; + OperatorType = operatorType; + } + + /// The set of filter values. + public IList> Values { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberLessThanFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberLessThanFilter.Serialization.cs new file mode 100644 index 000000000000..2612d85e2978 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberLessThanFilter.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class NumberLessThanFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value.Value); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static NumberLessThanFilter DeserializeNumberLessThanFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional value = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new NumberLessThanFilter(operatorType, key.Value, Optional.ToNullable(value)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberLessThanFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberLessThanFilter.cs new file mode 100644 index 000000000000..cf80bf454f30 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberLessThanFilter.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// NumberLessThan Filter. + public partial class NumberLessThanFilter : Filter + { + /// Initializes a new instance of NumberLessThanFilter. + public NumberLessThanFilter() + { + OperatorType = FilterOperatorType.NumberLessThan; + } + + /// Initializes a new instance of NumberLessThanFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The filter value. + internal NumberLessThanFilter(FilterOperatorType operatorType, string key, double? value) : base(operatorType, key) + { + Value = value; + OperatorType = operatorType; + } + + /// The filter value. + public double? Value { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberLessThanOrEqualsFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberLessThanOrEqualsFilter.Serialization.cs new file mode 100644 index 000000000000..22aec45cdc36 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberLessThanOrEqualsFilter.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class NumberLessThanOrEqualsFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value.Value); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static NumberLessThanOrEqualsFilter DeserializeNumberLessThanOrEqualsFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional value = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new NumberLessThanOrEqualsFilter(operatorType, key.Value, Optional.ToNullable(value)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberLessThanOrEqualsFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberLessThanOrEqualsFilter.cs new file mode 100644 index 000000000000..70e05231f709 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberLessThanOrEqualsFilter.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// NumberLessThanOrEquals Filter. + public partial class NumberLessThanOrEqualsFilter : Filter + { + /// Initializes a new instance of NumberLessThanOrEqualsFilter. + public NumberLessThanOrEqualsFilter() + { + OperatorType = FilterOperatorType.NumberLessThanOrEquals; + } + + /// Initializes a new instance of NumberLessThanOrEqualsFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The filter value. + internal NumberLessThanOrEqualsFilter(FilterOperatorType operatorType, string key, double? value) : base(operatorType, key) + { + Value = value; + OperatorType = operatorType; + } + + /// The filter value. + public double? Value { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberNotInFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberNotInFilter.Serialization.cs new file mode 100644 index 000000000000..bcd8fe859ee1 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberNotInFilter.Serialization.cs @@ -0,0 +1,78 @@ +// 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.EventGrid.Models +{ + public partial class NumberNotInFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteNumberValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static NumberNotInFilter DeserializeNumberNotInFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> values = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetDouble()); + } + values = array; + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new NumberNotInFilter(operatorType, key.Value, Optional.ToList(values)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberNotInFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberNotInFilter.cs new file mode 100644 index 000000000000..9e048d7570de --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberNotInFilter.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// NumberNotIn Filter. + public partial class NumberNotInFilter : Filter + { + /// Initializes a new instance of NumberNotInFilter. + public NumberNotInFilter() + { + Values = new ChangeTrackingList(); + OperatorType = FilterOperatorType.NumberNotIn; + } + + /// Initializes a new instance of NumberNotInFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The set of filter values. + internal NumberNotInFilter(FilterOperatorType operatorType, string key, IList values) : base(operatorType, key) + { + Values = values; + OperatorType = operatorType; + } + + /// The set of filter values. + public IList Values { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberNotInRangeFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberNotInRangeFilter.Serialization.cs new file mode 100644 index 000000000000..5e2411559173 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberNotInRangeFilter.Serialization.cs @@ -0,0 +1,100 @@ +// 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.EventGrid.Models +{ + public partial class NumberNotInRangeFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStartArray(); + foreach (var item0 in item) + { + writer.WriteNumberValue(item0); + } + writer.WriteEndArray(); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static NumberNotInRangeFilter DeserializeNumberNotInRangeFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional>> values = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List> array = new List>(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + List array0 = new List(); + foreach (var item0 in item.EnumerateArray()) + { + array0.Add(item0.GetDouble()); + } + array.Add(array0); + } + } + values = array; + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new NumberNotInRangeFilter(operatorType, key.Value, Optional.ToList(values)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberNotInRangeFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberNotInRangeFilter.cs new file mode 100644 index 000000000000..ac6357a08d30 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/NumberNotInRangeFilter.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// NumberNotInRange Filter. + public partial class NumberNotInRangeFilter : Filter + { + /// Initializes a new instance of NumberNotInRangeFilter. + public NumberNotInRangeFilter() + { + Values = new ChangeTrackingList>(); + OperatorType = FilterOperatorType.NumberNotInRange; + } + + /// Initializes a new instance of NumberNotInRangeFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The set of filter values. + internal NumberNotInRangeFilter(FilterOperatorType operatorType, string key, IList> values) : base(operatorType, key) + { + Values = values; + OperatorType = operatorType; + } + + /// The set of filter values. + public IList> Values { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerClientAuthentication.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerClientAuthentication.Serialization.cs new file mode 100644 index 000000000000..c83ee0df852b --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerClientAuthentication.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class PartnerClientAuthentication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("clientAuthenticationType"u8); + writer.WriteStringValue(ClientAuthenticationType.ToString()); + writer.WriteEndObject(); + } + + internal static PartnerClientAuthentication DeserializePartnerClientAuthentication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("clientAuthenticationType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AzureAD": return AzureADPartnerClientAuthentication.DeserializeAzureADPartnerClientAuthentication(element); + } + } + return UnknownPartnerClientAuthentication.DeserializeUnknownPartnerClientAuthentication(element); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerClientAuthentication.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerClientAuthentication.cs new file mode 100644 index 000000000000..2dc66dd9bc01 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerClientAuthentication.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// + /// Partner client authentication + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public abstract partial class PartnerClientAuthentication + { + /// Initializes a new instance of PartnerClientAuthentication. + protected PartnerClientAuthentication() + { + } + + /// Initializes a new instance of PartnerClientAuthentication. + /// Type of client authentication. + internal PartnerClientAuthentication(PartnerClientAuthenticationType clientAuthenticationType) + { + ClientAuthenticationType = clientAuthenticationType; + } + + /// Type of client authentication. + internal PartnerClientAuthenticationType ClientAuthenticationType { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerClientAuthenticationType.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerClientAuthenticationType.cs new file mode 100644 index 000000000000..32113e6d3be9 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerClientAuthenticationType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Type of client authentication. + internal readonly partial struct PartnerClientAuthenticationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PartnerClientAuthenticationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AzureADValue = "AzureAD"; + + /// AzureAD. + public static PartnerClientAuthenticationType AzureAD { get; } = new PartnerClientAuthenticationType(AzureADValue); + /// Determines if two values are the same. + public static bool operator ==(PartnerClientAuthenticationType left, PartnerClientAuthenticationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PartnerClientAuthenticationType left, PartnerClientAuthenticationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PartnerClientAuthenticationType(string value) => new PartnerClientAuthenticationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PartnerClientAuthenticationType other && Equals(other); + /// + public bool Equals(PartnerClientAuthenticationType 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationActivationState.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationActivationState.cs new file mode 100644 index 000000000000..d03d00db05f1 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationActivationState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Activation state of the partner destination. + public readonly partial struct PartnerDestinationActivationState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PartnerDestinationActivationState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NeverActivatedValue = "NeverActivated"; + private const string ActivatedValue = "Activated"; + + /// NeverActivated. + public static PartnerDestinationActivationState NeverActivated { get; } = new PartnerDestinationActivationState(NeverActivatedValue); + /// Activated. + public static PartnerDestinationActivationState Activated { get; } = new PartnerDestinationActivationState(ActivatedValue); + /// Determines if two values are the same. + public static bool operator ==(PartnerDestinationActivationState left, PartnerDestinationActivationState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PartnerDestinationActivationState left, PartnerDestinationActivationState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PartnerDestinationActivationState(string value) => new PartnerDestinationActivationState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PartnerDestinationActivationState other && Equals(other); + /// + public bool Equals(PartnerDestinationActivationState 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationData.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationData.Serialization.cs new file mode 100644 index 000000000000..c0175f32887f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationData.Serialization.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + public partial class PartnerDestinationData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(PartnerRegistrationImmutableId)) + { + writer.WritePropertyName("partnerRegistrationImmutableId"u8); + writer.WriteStringValue(PartnerRegistrationImmutableId.Value); + } + if (Optional.IsDefined(EndpointServiceContext)) + { + writer.WritePropertyName("endpointServiceContext"u8); + writer.WriteStringValue(EndpointServiceContext); + } + if (Optional.IsDefined(ExpirationTimeIfNotActivatedUtc)) + { + writer.WritePropertyName("expirationTimeIfNotActivatedUtc"u8); + writer.WriteStringValue(ExpirationTimeIfNotActivatedUtc.Value, "O"); + } + if (Optional.IsDefined(ActivationState)) + { + writer.WritePropertyName("activationState"u8); + writer.WriteStringValue(ActivationState.Value.ToString()); + } + if (Optional.IsDefined(EndpointBaseUri)) + { + writer.WritePropertyName("endpointBaseUrl"u8); + writer.WriteStringValue(EndpointBaseUri.AbsoluteUri); + } + if (Optional.IsDefined(MessageForActivation)) + { + writer.WritePropertyName("messageForActivation"u8); + writer.WriteStringValue(MessageForActivation); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static PartnerDestinationData DeserializePartnerDestinationData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional partnerRegistrationImmutableId = default; + Optional endpointServiceContext = default; + Optional expirationTimeIfNotActivatedUtc = default; + Optional provisioningState = default; + Optional activationState = default; + Optional endpointBaseUri = default; + Optional messageForActivation = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("partnerRegistrationImmutableId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + partnerRegistrationImmutableId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("endpointServiceContext"u8)) + { + endpointServiceContext = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("expirationTimeIfNotActivatedUtc"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expirationTimeIfNotActivatedUtc = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new PartnerDestinationProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("activationState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + activationState = new PartnerDestinationActivationState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("endpointBaseUrl"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endpointBaseUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("messageForActivation"u8)) + { + messageForActivation = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new PartnerDestinationData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(partnerRegistrationImmutableId), endpointServiceContext.Value, Optional.ToNullable(expirationTimeIfNotActivatedUtc), Optional.ToNullable(provisioningState), Optional.ToNullable(activationState), endpointBaseUri.Value, messageForActivation.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationInfo.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationInfo.Serialization.cs new file mode 100644 index 000000000000..704ec3211b3e --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationInfo.Serialization.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class PartnerDestinationInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(AzureSubscriptionId)) + { + writer.WritePropertyName("azureSubscriptionId"u8); + writer.WriteStringValue(AzureSubscriptionId); + } + if (Optional.IsDefined(ResourceGroupName)) + { + writer.WritePropertyName("resourceGroupName"u8); + writer.WriteStringValue(ResourceGroupName); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("endpointType"u8); + writer.WriteStringValue(EndpointType.ToString()); + if (Optional.IsDefined(EndpointServiceContext)) + { + writer.WritePropertyName("endpointServiceContext"u8); + writer.WriteStringValue(EndpointServiceContext); + } + if (Optional.IsCollectionDefined(ResourceMoveChangeHistory)) + { + writer.WritePropertyName("resourceMoveChangeHistory"u8); + writer.WriteStartArray(); + foreach (var item in ResourceMoveChangeHistory) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static PartnerDestinationInfo DeserializePartnerDestinationInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("endpointType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "WebHook": return WebhookPartnerDestinationInfo.DeserializeWebhookPartnerDestinationInfo(element); + } + } + return UnknownPartnerDestinationInfo.DeserializeUnknownPartnerDestinationInfo(element); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationInfo.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationInfo.cs new file mode 100644 index 000000000000..cab10e01055e --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationInfo.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// + /// Properties of the corresponding partner destination of a Channel. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public abstract partial class PartnerDestinationInfo + { + /// Initializes a new instance of PartnerDestinationInfo. + protected PartnerDestinationInfo() + { + ResourceMoveChangeHistory = new ChangeTrackingList(); + } + + /// Initializes a new instance of PartnerDestinationInfo. + /// + /// Azure subscription ID of the subscriber. The partner destination associated with the channel will be + /// created under this Azure subscription. + /// + /// + /// Azure Resource Group of the subscriber. The partner destination associated with the channel will be + /// created under this resource group. + /// + /// Name of the partner destination associated with the channel. + /// Type of the endpoint for the partner destination. + /// Additional context of the partner destination endpoint. + /// Change history of the resource move. + internal PartnerDestinationInfo(string azureSubscriptionId, string resourceGroupName, string name, PartnerEndpointType endpointType, string endpointServiceContext, IList resourceMoveChangeHistory) + { + AzureSubscriptionId = azureSubscriptionId; + ResourceGroupName = resourceGroupName; + Name = name; + EndpointType = endpointType; + EndpointServiceContext = endpointServiceContext; + ResourceMoveChangeHistory = resourceMoveChangeHistory; + } + + /// + /// Azure subscription ID of the subscriber. The partner destination associated with the channel will be + /// created under this Azure subscription. + /// + public string AzureSubscriptionId { get; set; } + /// + /// Azure Resource Group of the subscriber. The partner destination associated with the channel will be + /// created under this resource group. + /// + public string ResourceGroupName { get; set; } + /// Name of the partner destination associated with the channel. + public string Name { get; set; } + /// Type of the endpoint for the partner destination. + internal PartnerEndpointType EndpointType { get; set; } + /// Additional context of the partner destination endpoint. + public string EndpointServiceContext { get; set; } + /// Change history of the resource move. + public IList ResourceMoveChangeHistory { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationPatch.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationPatch.Serialization.cs new file mode 100644 index 000000000000..ee957586c818 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationPatch.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class PartnerDestinationPatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationPatch.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationPatch.cs new file mode 100644 index 000000000000..06b0b71eef10 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationPatch.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Properties of the Partner Destination that can be updated. + public partial class PartnerDestinationPatch + { + /// Initializes a new instance of PartnerDestinationPatch. + public PartnerDestinationPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Tags of the Partner Destination resource. + public IDictionary Tags { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationProvisioningState.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationProvisioningState.cs new file mode 100644 index 000000000000..d6bd92715881 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Provisioning state of the partner destination. + public readonly partial struct PartnerDestinationProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PartnerDestinationProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string SucceededValue = "Succeeded"; + private const string CanceledValue = "Canceled"; + private const string FailedValue = "Failed"; + private const string IdleDueToMirroredChannelResourceDeletionValue = "IdleDueToMirroredChannelResourceDeletion"; + + /// Creating. + public static PartnerDestinationProvisioningState Creating { get; } = new PartnerDestinationProvisioningState(CreatingValue); + /// Updating. + public static PartnerDestinationProvisioningState Updating { get; } = new PartnerDestinationProvisioningState(UpdatingValue); + /// Deleting. + public static PartnerDestinationProvisioningState Deleting { get; } = new PartnerDestinationProvisioningState(DeletingValue); + /// Succeeded. + public static PartnerDestinationProvisioningState Succeeded { get; } = new PartnerDestinationProvisioningState(SucceededValue); + /// Canceled. + public static PartnerDestinationProvisioningState Canceled { get; } = new PartnerDestinationProvisioningState(CanceledValue); + /// Failed. + public static PartnerDestinationProvisioningState Failed { get; } = new PartnerDestinationProvisioningState(FailedValue); + /// IdleDueToMirroredChannelResourceDeletion. + public static PartnerDestinationProvisioningState IdleDueToMirroredChannelResourceDeletion { get; } = new PartnerDestinationProvisioningState(IdleDueToMirroredChannelResourceDeletionValue); + /// Determines if two values are the same. + public static bool operator ==(PartnerDestinationProvisioningState left, PartnerDestinationProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PartnerDestinationProvisioningState left, PartnerDestinationProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PartnerDestinationProvisioningState(string value) => new PartnerDestinationProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PartnerDestinationProvisioningState other && Equals(other); + /// + public bool Equals(PartnerDestinationProvisioningState 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationsListResult.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationsListResult.Serialization.cs new file mode 100644 index 000000000000..574cfcf71fd3 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationsListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + internal partial class PartnerDestinationsListResult + { + internal static PartnerDestinationsListResult DeserializePartnerDestinationsListResult(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(PartnerDestinationData.DeserializePartnerDestinationData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new PartnerDestinationsListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationsListResult.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationsListResult.cs new file mode 100644 index 000000000000..50f1651ca003 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerDestinationsListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Result of the List Partner Destinations operation. + internal partial class PartnerDestinationsListResult + { + /// Initializes a new instance of PartnerDestinationsListResult. + internal PartnerDestinationsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of PartnerDestinationsListResult. + /// A collection of partner destinations. + /// A link for the next page of partner destinations. + internal PartnerDestinationsListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A collection of partner destinations. + public IReadOnlyList Value { get; } + /// A link for the next page of partner destinations. + public string NextLink { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerEndpointType.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerEndpointType.cs new file mode 100644 index 000000000000..5dc561516c58 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerEndpointType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Type of the endpoint for the partner destination. + internal readonly partial struct PartnerEndpointType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PartnerEndpointType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string WebHookValue = "WebHook"; + + /// WebHook. + public static PartnerEndpointType WebHook { get; } = new PartnerEndpointType(WebHookValue); + /// Determines if two values are the same. + public static bool operator ==(PartnerEndpointType left, PartnerEndpointType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PartnerEndpointType left, PartnerEndpointType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PartnerEndpointType(string value) => new PartnerEndpointType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PartnerEndpointType other && Equals(other); + /// + public bool Equals(PartnerEndpointType 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerEventSubscriptionDestination.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerEventSubscriptionDestination.Serialization.cs new file mode 100644 index 000000000000..25b6ac856df5 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerEventSubscriptionDestination.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class PartnerEventSubscriptionDestination : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("endpointType"u8); + writer.WriteStringValue(EndpointType.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static PartnerEventSubscriptionDestination DeserializePartnerEventSubscriptionDestination(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EndpointType endpointType = default; + Optional resourceId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("endpointType"u8)) + { + endpointType = new EndpointType(property.Value.GetString()); + 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("resourceId"u8)) + { + resourceId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new PartnerEventSubscriptionDestination(endpointType, resourceId.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerEventSubscriptionDestination.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerEventSubscriptionDestination.cs new file mode 100644 index 000000000000..b353f21a029f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerEventSubscriptionDestination.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The PartnerEventSubscriptionDestination. + public partial class PartnerEventSubscriptionDestination : EventSubscriptionDestination + { + /// Initializes a new instance of PartnerEventSubscriptionDestination. + public PartnerEventSubscriptionDestination() + { + EndpointType = EndpointType.PartnerDestination; + } + + /// Initializes a new instance of PartnerEventSubscriptionDestination. + /// Type of the endpoint for the event subscription destination. + /// The Azure Resource Id that represents the endpoint of a Partner Destination of an event subscription. + internal PartnerEventSubscriptionDestination(EndpointType endpointType, string resourceId) : base(endpointType) + { + ResourceId = resourceId; + EndpointType = endpointType; + } + + /// The Azure Resource Id that represents the endpoint of a Partner Destination of an event subscription. + public string ResourceId { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelData.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelData.Serialization.cs index eedc82ec6d5e..17d103c16aa4 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelData.Serialization.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelData.Serialization.cs @@ -30,6 +30,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("partnerTopicInfo"u8); writer.WriteObjectValue(PartnerTopicInfo); } + if (Optional.IsDefined(PartnerDestinationInfo)) + { + writer.WritePropertyName("partnerDestinationInfo"u8); + writer.WriteObjectValue(PartnerDestinationInfo); + } if (Optional.IsDefined(MessageForActivation)) { writer.WritePropertyName("messageForActivation"u8); @@ -66,6 +71,7 @@ internal static PartnerNamespaceChannelData DeserializePartnerNamespaceChannelDa Optional systemData = default; Optional channelType = default; Optional partnerTopicInfo = default; + Optional partnerDestinationInfo = default; Optional messageForActivation = default; Optional provisioningState = default; Optional readinessState = default; @@ -123,6 +129,15 @@ internal static PartnerNamespaceChannelData DeserializePartnerNamespaceChannelDa partnerTopicInfo = PartnerTopicInfo.DeserializePartnerTopicInfo(property0.Value); continue; } + if (property0.NameEquals("partnerDestinationInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + partnerDestinationInfo = PartnerDestinationInfo.DeserializePartnerDestinationInfo(property0.Value); + continue; + } if (property0.NameEquals("messageForActivation"u8)) { messageForActivation = property0.Value.GetString(); @@ -159,7 +174,7 @@ internal static PartnerNamespaceChannelData DeserializePartnerNamespaceChannelDa continue; } } - return new PartnerNamespaceChannelData(id, name, type, systemData.Value, Optional.ToNullable(channelType), partnerTopicInfo.Value, messageForActivation.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(readinessState), Optional.ToNullable(expirationTimeIfNotActivatedUtc)); + return new PartnerNamespaceChannelData(id, name, type, systemData.Value, Optional.ToNullable(channelType), partnerTopicInfo.Value, partnerDestinationInfo.Value, messageForActivation.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(readinessState), Optional.ToNullable(expirationTimeIfNotActivatedUtc)); } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelPatch.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelPatch.Serialization.cs index aa62a79f792b..0b975009b4a2 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelPatch.Serialization.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelPatch.Serialization.cs @@ -22,6 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("expirationTimeIfNotActivatedUtc"u8); writer.WriteStringValue(ExpireOnIfNotActivated.Value, "O"); } + if (Optional.IsDefined(PartnerDestinationInfo)) + { + writer.WritePropertyName("partnerDestinationInfo"u8); + writer.WriteObjectValue(PartnerDestinationInfo); + } if (Optional.IsDefined(PartnerTopicInfo)) { writer.WritePropertyName("partnerTopicInfo"u8); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelPatch.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelPatch.cs index ef9fdfdb1acb..ed783b8d6f85 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelPatch.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelPatch.cs @@ -22,6 +22,12 @@ public PartnerNamespaceChannelPatch() /// the channel and corresponding partner topic or partner destination are deleted. /// public DateTimeOffset? ExpireOnIfNotActivated { get; set; } + /// + /// Partner destination properties which can be updated if the channel is of type PartnerDestination. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public PartnerUpdateDestinationInfo PartnerDestinationInfo { get; set; } /// Partner topic properties which can be updated if the channel is of type PartnerTopic. internal PartnerUpdateTopicInfo PartnerTopicInfo { get; set; } /// Event type info for the partner topic. diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelProvisioningState.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelProvisioningState.cs index f6f4d4998e1e..aa1a7b214994 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelProvisioningState.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelProvisioningState.cs @@ -29,6 +29,7 @@ public PartnerNamespaceChannelProvisioningState(string value) private const string CanceledValue = "Canceled"; private const string FailedValue = "Failed"; private const string IdleDueToMirroredPartnerTopicDeletionValue = "IdleDueToMirroredPartnerTopicDeletion"; + private const string IdleDueToMirroredPartnerDestinationDeletionValue = "IdleDueToMirroredPartnerDestinationDeletion"; /// Creating. public static PartnerNamespaceChannelProvisioningState Creating { get; } = new PartnerNamespaceChannelProvisioningState(CreatingValue); @@ -44,6 +45,8 @@ public PartnerNamespaceChannelProvisioningState(string value) public static PartnerNamespaceChannelProvisioningState Failed { get; } = new PartnerNamespaceChannelProvisioningState(FailedValue); /// IdleDueToMirroredPartnerTopicDeletion. public static PartnerNamespaceChannelProvisioningState IdleDueToMirroredPartnerTopicDeletion { get; } = new PartnerNamespaceChannelProvisioningState(IdleDueToMirroredPartnerTopicDeletionValue); + /// IdleDueToMirroredPartnerDestinationDeletion. + public static PartnerNamespaceChannelProvisioningState IdleDueToMirroredPartnerDestinationDeletion { get; } = new PartnerNamespaceChannelProvisioningState(IdleDueToMirroredPartnerDestinationDeletionValue); /// Determines if two values are the same. public static bool operator ==(PartnerNamespaceChannelProvisioningState left, PartnerNamespaceChannelProvisioningState right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelType.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelType.cs index b4cb114d540b..5620e9733cf8 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelType.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceChannelType.cs @@ -23,9 +23,12 @@ public PartnerNamespaceChannelType(string value) } private const string PartnerTopicValue = "PartnerTopic"; + private const string PartnerDestinationValue = "PartnerDestination"; /// PartnerTopic. public static PartnerNamespaceChannelType PartnerTopic { get; } = new PartnerNamespaceChannelType(PartnerTopicValue); + /// PartnerDestination. + public static PartnerNamespaceChannelType PartnerDestination { get; } = new PartnerNamespaceChannelType(PartnerDestinationValue); /// Determines if two values are the same. public static bool operator ==(PartnerNamespaceChannelType left, PartnerNamespaceChannelType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceData.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceData.Serialization.cs index 95bf9ea5536a..fbb9408a8a6c 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceData.Serialization.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespaceData.Serialization.cs @@ -39,6 +39,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("partnerRegistrationFullyQualifiedId"u8); writer.WriteStringValue(PartnerRegistrationFullyQualifiedId); } + if (Optional.IsDefined(MinimumTlsVersionAllowed)) + { + writer.WritePropertyName("minimumTlsVersionAllowed"u8); + writer.WriteStringValue(MinimumTlsVersionAllowed.Value.ToString()); + } if (Optional.IsDefined(PublicNetworkAccess)) { writer.WritePropertyName("publicNetworkAccess"u8); @@ -83,6 +88,7 @@ internal static PartnerNamespaceData DeserializePartnerNamespaceData(JsonElement Optional> privateEndpointConnections = default; Optional provisioningState = default; Optional partnerRegistrationFullyQualifiedId = default; + Optional minimumTlsVersionAllowed = default; Optional endpoint = default; Optional publicNetworkAccess = default; Optional> inboundIPRules = default; @@ -174,6 +180,15 @@ internal static PartnerNamespaceData DeserializePartnerNamespaceData(JsonElement partnerRegistrationFullyQualifiedId = new ResourceIdentifier(property0.Value.GetString()); continue; } + if (property0.NameEquals("minimumTlsVersionAllowed"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minimumTlsVersionAllowed = new TlsVersion(property0.Value.GetString()); + continue; + } if (property0.NameEquals("endpoint"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -228,7 +243,7 @@ internal static PartnerNamespaceData DeserializePartnerNamespaceData(JsonElement continue; } } - return new PartnerNamespaceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(privateEndpointConnections), Optional.ToNullable(provisioningState), partnerRegistrationFullyQualifiedId.Value, endpoint.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToList(inboundIPRules), Optional.ToNullable(disableLocalAuth), Optional.ToNullable(partnerTopicRoutingMode)); + return new PartnerNamespaceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(privateEndpointConnections), Optional.ToNullable(provisioningState), partnerRegistrationFullyQualifiedId.Value, Optional.ToNullable(minimumTlsVersionAllowed), endpoint.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToList(inboundIPRules), Optional.ToNullable(disableLocalAuth), Optional.ToNullable(partnerTopicRoutingMode)); } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespacePatch.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespacePatch.Serialization.cs index 52c86c43ce5e..9c1a374c44e6 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespacePatch.Serialization.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespacePatch.Serialization.cs @@ -43,6 +43,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(MinimumTlsVersionAllowed)) + { + writer.WritePropertyName("minimumTlsVersionAllowed"u8); + writer.WriteStringValue(MinimumTlsVersionAllowed.Value.ToString()); + } if (Optional.IsDefined(IsLocalAuthDisabled)) { writer.WritePropertyName("disableLocalAuth"u8); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespacePatch.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespacePatch.cs index 6a4c7d15f0d4..585c1abbf391 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespacePatch.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerNamespacePatch.cs @@ -29,6 +29,8 @@ public PartnerNamespacePatch() public EventGridPublicNetworkAccess? PublicNetworkAccess { get; set; } /// This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. public IList InboundIPRules { get; } + /// Minimum TLS version of the publisher allowed to publish to this domain. + public TlsVersion? MinimumTlsVersionAllowed { get; set; } /// This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the partner namespace. public bool? IsLocalAuthDisabled { get; set; } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerUpdateDestinationInfo.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerUpdateDestinationInfo.Serialization.cs new file mode 100644 index 000000000000..cf8d2f2d9a8d --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerUpdateDestinationInfo.Serialization.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class PartnerUpdateDestinationInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("endpointType"u8); + writer.WriteStringValue(EndpointType.ToString()); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerUpdateDestinationInfo.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerUpdateDestinationInfo.cs new file mode 100644 index 000000000000..7c9c0821a28f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PartnerUpdateDestinationInfo.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// + /// Properties of the corresponding partner destination of a Channel. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public abstract partial class PartnerUpdateDestinationInfo + { + /// Initializes a new instance of PartnerUpdateDestinationInfo. + protected PartnerUpdateDestinationInfo() + { + } + + /// Type of the endpoint for the partner destination. + internal PartnerEndpointType EndpointType { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PermissionBindingData.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PermissionBindingData.Serialization.cs new file mode 100644 index 000000000000..dcce6138e4c3 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PermissionBindingData.Serialization.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + public partial class PermissionBindingData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(TopicSpaceName)) + { + writer.WritePropertyName("topicSpaceName"u8); + writer.WriteStringValue(TopicSpaceName); + } + if (Optional.IsDefined(Permission)) + { + writer.WritePropertyName("permission"u8); + writer.WriteStringValue(Permission.Value.ToString()); + } + if (Optional.IsDefined(ClientGroupName)) + { + writer.WritePropertyName("clientGroupName"u8); + writer.WriteStringValue(ClientGroupName); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static PermissionBindingData DeserializePermissionBindingData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional description = default; + Optional topicSpaceName = default; + Optional permission = default; + Optional clientGroupName = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + 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("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("topicSpaceName"u8)) + { + topicSpaceName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("permission"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + permission = new PermissionType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("clientGroupName"u8)) + { + clientGroupName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new PermissionBindingProvisioningState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new PermissionBindingData(id, name, type, systemData.Value, description.Value, topicSpaceName.Value, Optional.ToNullable(permission), clientGroupName.Value, Optional.ToNullable(provisioningState)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PermissionBindingProvisioningState.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PermissionBindingProvisioningState.cs new file mode 100644 index 000000000000..63ea07b5139f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PermissionBindingProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Provisioning state of the PermissionBinding resource. + public readonly partial struct PermissionBindingProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PermissionBindingProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string SucceededValue = "Succeeded"; + private const string CanceledValue = "Canceled"; + private const string FailedValue = "Failed"; + private const string DeletedValue = "Deleted"; + + /// Creating. + public static PermissionBindingProvisioningState Creating { get; } = new PermissionBindingProvisioningState(CreatingValue); + /// Updating. + public static PermissionBindingProvisioningState Updating { get; } = new PermissionBindingProvisioningState(UpdatingValue); + /// Deleting. + public static PermissionBindingProvisioningState Deleting { get; } = new PermissionBindingProvisioningState(DeletingValue); + /// Succeeded. + public static PermissionBindingProvisioningState Succeeded { get; } = new PermissionBindingProvisioningState(SucceededValue); + /// Canceled. + public static PermissionBindingProvisioningState Canceled { get; } = new PermissionBindingProvisioningState(CanceledValue); + /// Failed. + public static PermissionBindingProvisioningState Failed { get; } = new PermissionBindingProvisioningState(FailedValue); + /// Deleted. + public static PermissionBindingProvisioningState Deleted { get; } = new PermissionBindingProvisioningState(DeletedValue); + /// Determines if two values are the same. + public static bool operator ==(PermissionBindingProvisioningState left, PermissionBindingProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PermissionBindingProvisioningState left, PermissionBindingProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PermissionBindingProvisioningState(string value) => new PermissionBindingProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PermissionBindingProvisioningState other && Equals(other); + /// + public bool Equals(PermissionBindingProvisioningState 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PermissionBindingsListResult.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PermissionBindingsListResult.Serialization.cs new file mode 100644 index 000000000000..74e462cc88b8 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PermissionBindingsListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + internal partial class PermissionBindingsListResult + { + internal static PermissionBindingsListResult DeserializePermissionBindingsListResult(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(PermissionBindingData.DeserializePermissionBindingData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new PermissionBindingsListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PermissionBindingsListResult.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PermissionBindingsListResult.cs new file mode 100644 index 000000000000..72e756bb71fd --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PermissionBindingsListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Result of the List Permission Binding operation. + internal partial class PermissionBindingsListResult + { + /// Initializes a new instance of PermissionBindingsListResult. + internal PermissionBindingsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of PermissionBindingsListResult. + /// A collection of Permission Binding. + /// A link for the next page of Permission Binding. + internal PermissionBindingsListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A collection of Permission Binding. + public IReadOnlyList Value { get; } + /// A link for the next page of Permission Binding. + public string NextLink { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PermissionType.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PermissionType.cs new file mode 100644 index 000000000000..1c0b84925a6d --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PermissionType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The allowed permission. + public readonly partial struct PermissionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PermissionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PublisherValue = "Publisher"; + private const string SubscriberValue = "Subscriber"; + + /// Publisher. + public static PermissionType Publisher { get; } = new PermissionType(PublisherValue); + /// Subscriber. + public static PermissionType Subscriber { get; } = new PermissionType(SubscriberValue); + /// Determines if two values are the same. + public static bool operator ==(PermissionType left, PermissionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PermissionType left, PermissionType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PermissionType(string value) => new PermissionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PermissionType other && Equals(other); + /// + public bool Equals(PermissionType 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PublisherType.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PublisherType.cs new file mode 100644 index 000000000000..9b25c8e1d90a --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/PublisherType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Publisher type of the namespace topic. + public readonly partial struct PublisherType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PublisherType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CustomValue = "Custom"; + + /// Custom. + public static PublisherType Custom { get; } = new PublisherType(CustomValue); + /// Determines if two values are the same. + public static bool operator ==(PublisherType left, PublisherType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PublisherType left, PublisherType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PublisherType(string value) => new PublisherType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PublisherType other && Equals(other); + /// + public bool Equals(PublisherType 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/QueueInfo.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/QueueInfo.Serialization.cs new file mode 100644 index 000000000000..201e0be69c60 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/QueueInfo.Serialization.cs @@ -0,0 +1,94 @@ +// 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.EventGrid.Models +{ + public partial class QueueInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ReceiveLockDurationInSeconds)) + { + writer.WritePropertyName("receiveLockDurationInSeconds"u8); + writer.WriteNumberValue(ReceiveLockDurationInSeconds.Value); + } + if (Optional.IsDefined(MaxDeliveryCount)) + { + writer.WritePropertyName("maxDeliveryCount"u8); + writer.WriteNumberValue(MaxDeliveryCount.Value); + } + if (Optional.IsDefined(DeadLetterDestinationWithResourceIdentity)) + { + writer.WritePropertyName("deadLetterDestinationWithResourceIdentity"u8); + writer.WriteObjectValue(DeadLetterDestinationWithResourceIdentity); + } + if (Optional.IsDefined(EventTimeToLive)) + { + writer.WritePropertyName("eventTimeToLive"u8); + writer.WriteStringValue(EventTimeToLive.Value, "P"); + } + writer.WriteEndObject(); + } + + internal static QueueInfo DeserializeQueueInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional receiveLockDurationInSeconds = default; + Optional maxDeliveryCount = default; + Optional deadLetterDestinationWithResourceIdentity = default; + Optional eventTimeToLive = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("receiveLockDurationInSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + receiveLockDurationInSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maxDeliveryCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxDeliveryCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("deadLetterDestinationWithResourceIdentity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deadLetterDestinationWithResourceIdentity = DeadLetterWithResourceIdentity.DeserializeDeadLetterWithResourceIdentity(property.Value); + continue; + } + if (property.NameEquals("eventTimeToLive"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eventTimeToLive = property.Value.GetTimeSpan("P"); + continue; + } + } + return new QueueInfo(Optional.ToNullable(receiveLockDurationInSeconds), Optional.ToNullable(maxDeliveryCount), deadLetterDestinationWithResourceIdentity.Value, Optional.ToNullable(eventTimeToLive)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/QueueInfo.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/QueueInfo.cs new file mode 100644 index 000000000000..da3dddc7126f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/QueueInfo.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Properties of the Queue info for event subscription. + public partial class QueueInfo + { + /// Initializes a new instance of QueueInfo. + public QueueInfo() + { + } + + /// Initializes a new instance of QueueInfo. + /// + /// Maximum period in seconds in which once the message is in received (by the client) state and waiting to be accepted, released or rejected. + /// If this time elapsed after a message has been received by the client and not transitioned into accepted (not processed), released or rejected, + /// the message is available for redelivery. This is an optional field, where default is 60 seconds, minimum is 60 seconds and maximum is 300 seconds. + /// + /// The maximum delivery count of the events. + /// + /// The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. + /// Uses the managed identity setup on the parent resource (namely, topic) to acquire the authentication tokens being used during delivery / dead-lettering. + /// + /// + /// Time span duration in ISO 8601 format that determines how long messages are available to the subscription from the time the message was published. + /// This duration value is expressed using the following format: \'P(n)Y(n)M(n)DT(n)H(n)M(n)S\', where: + /// - (n) is replaced by the value of each time element that follows the (n). + /// - P is the duration (or Period) designator and is always placed at the beginning of the duration. + /// - Y is the year designator, and it follows the value for the number of years. + /// - M is the month designator, and it follows the value for the number of months. + /// - W is the week designator, and it follows the value for the number of weeks. + /// - D is the day designator, and it follows the value for the number of days. + /// - T is the time designator, and it precedes the time components. + /// - H is the hour designator, and it follows the value for the number of hours. + /// - M is the minute designator, and it follows the value for the number of minutes. + /// - S is the second designator, and it follows the value for the number of seconds. + /// This duration value cannot be set greater than the topic’s EventRetentionInDays. It is is an optional field where its minimum value is 1 minute, and its maximum is determined + /// by topic’s EventRetentionInDays value. The followings are examples of valid values: + /// - \'P0DT23H12M\' or \'PT23H12M\': for duration of 23 hours and 12 minutes. + /// - \'P1D\' or \'P1DT0H0M0S\': for duration of 1 day. + /// + internal QueueInfo(int? receiveLockDurationInSeconds, int? maxDeliveryCount, DeadLetterWithResourceIdentity deadLetterDestinationWithResourceIdentity, TimeSpan? eventTimeToLive) + { + ReceiveLockDurationInSeconds = receiveLockDurationInSeconds; + MaxDeliveryCount = maxDeliveryCount; + DeadLetterDestinationWithResourceIdentity = deadLetterDestinationWithResourceIdentity; + EventTimeToLive = eventTimeToLive; + } + + /// + /// Maximum period in seconds in which once the message is in received (by the client) state and waiting to be accepted, released or rejected. + /// If this time elapsed after a message has been received by the client and not transitioned into accepted (not processed), released or rejected, + /// the message is available for redelivery. This is an optional field, where default is 60 seconds, minimum is 60 seconds and maximum is 300 seconds. + /// + public int? ReceiveLockDurationInSeconds { get; set; } + /// The maximum delivery count of the events. + public int? MaxDeliveryCount { get; set; } + /// + /// The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. + /// Uses the managed identity setup on the parent resource (namely, topic) to acquire the authentication tokens being used during delivery / dead-lettering. + /// + public DeadLetterWithResourceIdentity DeadLetterDestinationWithResourceIdentity { get; set; } + /// + /// Time span duration in ISO 8601 format that determines how long messages are available to the subscription from the time the message was published. + /// This duration value is expressed using the following format: \'P(n)Y(n)M(n)DT(n)H(n)M(n)S\', where: + /// - (n) is replaced by the value of each time element that follows the (n). + /// - P is the duration (or Period) designator and is always placed at the beginning of the duration. + /// - Y is the year designator, and it follows the value for the number of years. + /// - M is the month designator, and it follows the value for the number of months. + /// - W is the week designator, and it follows the value for the number of weeks. + /// - D is the day designator, and it follows the value for the number of days. + /// - T is the time designator, and it precedes the time components. + /// - H is the hour designator, and it follows the value for the number of hours. + /// - M is the minute designator, and it follows the value for the number of minutes. + /// - S is the second designator, and it follows the value for the number of seconds. + /// This duration value cannot be set greater than the topic’s EventRetentionInDays. It is is an optional field where its minimum value is 1 minute, and its maximum is determined + /// by topic’s EventRetentionInDays value. The followings are examples of valid values: + /// - \'P0DT23H12M\' or \'PT23H12M\': for duration of 23 hours and 12 minutes. + /// - \'P1D\' or \'P1DT0H0M0S\': for duration of 1 day. + /// + public TimeSpan? EventTimeToLive { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ResourceKind.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ResourceKind.cs new file mode 100644 index 000000000000..a9d9fb415fc0 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ResourceKind.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Kind of the resource. + public readonly partial struct ResourceKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResourceKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AzureValue = "Azure"; + private const string AzureArcValue = "AzureArc"; + + /// Azure. + public static ResourceKind Azure { get; } = new ResourceKind(AzureValue); + /// AzureArc. + public static ResourceKind AzureArc { get; } = new ResourceKind(AzureArcValue); + /// Determines if two values are the same. + public static bool operator ==(ResourceKind left, ResourceKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResourceKind left, ResourceKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ResourceKind(string value) => new ResourceKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResourceKind other && Equals(other); + /// + public bool Equals(ResourceKind 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ResourceMoveChangeHistory.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ResourceMoveChangeHistory.Serialization.cs new file mode 100644 index 000000000000..26908ffc7516 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ResourceMoveChangeHistory.Serialization.cs @@ -0,0 +1,71 @@ +// 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.EventGrid.Models +{ + public partial class ResourceMoveChangeHistory : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(AzureSubscriptionId)) + { + writer.WritePropertyName("azureSubscriptionId"u8); + writer.WriteStringValue(AzureSubscriptionId); + } + if (Optional.IsDefined(ResourceGroupName)) + { + writer.WritePropertyName("resourceGroupName"u8); + writer.WriteStringValue(ResourceGroupName); + } + if (Optional.IsDefined(ChangedTimeUtc)) + { + writer.WritePropertyName("changedTimeUtc"u8); + writer.WriteStringValue(ChangedTimeUtc.Value, "O"); + } + writer.WriteEndObject(); + } + + internal static ResourceMoveChangeHistory DeserializeResourceMoveChangeHistory(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional azureSubscriptionId = default; + Optional resourceGroupName = default; + Optional changedTimeUtc = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azureSubscriptionId"u8)) + { + azureSubscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGroupName"u8)) + { + resourceGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("changedTimeUtc"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + changedTimeUtc = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new ResourceMoveChangeHistory(azureSubscriptionId.Value, resourceGroupName.Value, Optional.ToNullable(changedTimeUtc)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ResourceMoveChangeHistory.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ResourceMoveChangeHistory.cs new file mode 100644 index 000000000000..09813b76f901 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ResourceMoveChangeHistory.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The change history of the resource move. + public partial class ResourceMoveChangeHistory + { + /// Initializes a new instance of ResourceMoveChangeHistory. + public ResourceMoveChangeHistory() + { + } + + /// Initializes a new instance of ResourceMoveChangeHistory. + /// Azure subscription ID of the resource. + /// Azure Resource Group of the resource. + /// UTC timestamp of when the resource was changed. + internal ResourceMoveChangeHistory(string azureSubscriptionId, string resourceGroupName, DateTimeOffset? changedTimeUtc) + { + AzureSubscriptionId = azureSubscriptionId; + ResourceGroupName = resourceGroupName; + ChangedTimeUtc = changedTimeUtc; + } + + /// Azure subscription ID of the resource. + public string AzureSubscriptionId { get; set; } + /// Azure Resource Group of the resource. + public string ResourceGroupName { get; set; } + /// UTC timestamp of when the resource was changed. + public DateTimeOffset? ChangedTimeUtc { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ResourceSku.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ResourceSku.Serialization.cs new file mode 100644 index 000000000000..2d800346d03a --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ResourceSku.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + internal partial class ResourceSku : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static ResourceSku DeserializeResourceSku(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = new EventGridSku(property.Value.GetString()); + continue; + } + } + return new ResourceSku(Optional.ToNullable(name)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ResourceSku.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ResourceSku.cs new file mode 100644 index 000000000000..29eece3feb15 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/ResourceSku.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Describes an EventGrid Resource Sku. + internal partial class ResourceSku + { + /// Initializes a new instance of ResourceSku. + public ResourceSku() + { + } + + /// Initializes a new instance of ResourceSku. + /// The Sku name of the resource. The possible values are: Basic or Premium. + internal ResourceSku(EventGridSku? name) + { + Name = name; + } + + /// The Sku name of the resource. The possible values are: Basic or Premium. + public EventGridSku? Name { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/RoutingEnrichments.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/RoutingEnrichments.Serialization.cs new file mode 100644 index 000000000000..afc9fd7c077d --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/RoutingEnrichments.Serialization.cs @@ -0,0 +1,84 @@ +// 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.EventGrid.Models +{ + public partial class RoutingEnrichments : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Static)) + { + writer.WritePropertyName("static"u8); + writer.WriteStartArray(); + foreach (var item in Static) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Dynamic)) + { + writer.WritePropertyName("dynamic"u8); + writer.WriteStartArray(); + foreach (var item in Dynamic) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static RoutingEnrichments DeserializeRoutingEnrichments(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> @static = default; + Optional> @dynamic = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("static"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StaticRoutingEnrichment.DeserializeStaticRoutingEnrichment(item)); + } + @static = array; + continue; + } + if (property.NameEquals("dynamic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DynamicRoutingEnrichment.DeserializeDynamicRoutingEnrichment(item)); + } + @dynamic = array; + continue; + } + } + return new RoutingEnrichments(Optional.ToList(@static), Optional.ToList(@dynamic)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/RoutingEnrichments.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/RoutingEnrichments.cs new file mode 100644 index 000000000000..d398be022987 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/RoutingEnrichments.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; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The RoutingEnrichments. + public partial class RoutingEnrichments + { + /// Initializes a new instance of RoutingEnrichments. + public RoutingEnrichments() + { + Static = new ChangeTrackingList(); + Dynamic = new ChangeTrackingList(); + } + + /// Initializes a new instance of RoutingEnrichments. + /// + /// + internal RoutingEnrichments(IList @static, IList @dynamic) + { + Static = @static; + Dynamic = @dynamic; + } + + /// Gets the static. + public IList Static { get; } + /// Gets the dynamic. + public IList Dynamic { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/RoutingIdentityInfo.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/RoutingIdentityInfo.Serialization.cs new file mode 100644 index 000000000000..d5ae7e8d0ab4 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/RoutingIdentityInfo.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.EventGrid.Models +{ + public partial class RoutingIdentityInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(IdentityType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(IdentityType.Value.ToString()); + } + if (Optional.IsDefined(UserAssignedIdentity)) + { + writer.WritePropertyName("userAssignedIdentity"u8); + writer.WriteStringValue(UserAssignedIdentity); + } + writer.WriteEndObject(); + } + + internal static RoutingIdentityInfo DeserializeRoutingIdentityInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional type = default; + Optional userAssignedIdentity = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new RoutingIdentityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("userAssignedIdentity"u8)) + { + userAssignedIdentity = property.Value.GetString(); + continue; + } + } + return new RoutingIdentityInfo(Optional.ToNullable(type), userAssignedIdentity.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/RoutingIdentityInfo.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/RoutingIdentityInfo.cs new file mode 100644 index 000000000000..e9e1e1122bfe --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/RoutingIdentityInfo.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Routing identity info for topic spaces configuration. + public partial class RoutingIdentityInfo + { + /// Initializes a new instance of RoutingIdentityInfo. + public RoutingIdentityInfo() + { + } + + /// Initializes a new instance of RoutingIdentityInfo. + /// + /// + internal RoutingIdentityInfo(RoutingIdentityType? identityType, string userAssignedIdentity) + { + IdentityType = identityType; + UserAssignedIdentity = userAssignedIdentity; + } + + /// Gets or sets the identity type. + public RoutingIdentityType? IdentityType { get; set; } + /// Gets or sets the user assigned identity. + public string UserAssignedIdentity { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/RoutingIdentityType.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/RoutingIdentityType.cs new file mode 100644 index 000000000000..5f75c2534621 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/RoutingIdentityType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The RoutingIdentityType. + public readonly partial struct RoutingIdentityType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RoutingIdentityType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string SystemAssignedValue = "SystemAssigned"; + private const string UserAssignedValue = "UserAssigned"; + + /// None. + public static RoutingIdentityType None { get; } = new RoutingIdentityType(NoneValue); + /// SystemAssigned. + public static RoutingIdentityType SystemAssigned { get; } = new RoutingIdentityType(SystemAssignedValue); + /// UserAssigned. + public static RoutingIdentityType UserAssigned { get; } = new RoutingIdentityType(UserAssignedValue); + /// Determines if two values are the same. + public static bool operator ==(RoutingIdentityType left, RoutingIdentityType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RoutingIdentityType left, RoutingIdentityType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RoutingIdentityType(string value) => new RoutingIdentityType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RoutingIdentityType other && Equals(other); + /// + public bool Equals(RoutingIdentityType 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StaticRoutingEnrichment.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StaticRoutingEnrichment.Serialization.cs new file mode 100644 index 000000000000..322a2eb1e289 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StaticRoutingEnrichment.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.EventGrid.Models +{ + public partial class StaticRoutingEnrichment : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + if (Optional.IsDefined(ValueType)) + { + writer.WritePropertyName("valueType"u8); + writer.WriteStringValue(ValueType.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static StaticRoutingEnrichment DeserializeStaticRoutingEnrichment(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional key = default; + Optional valueType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("valueType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + valueType = new StaticRoutingEnrichmentType(property.Value.GetString()); + continue; + } + } + return new StaticRoutingEnrichment(key.Value, Optional.ToNullable(valueType)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StaticRoutingEnrichment.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StaticRoutingEnrichment.cs new file mode 100644 index 000000000000..a96891c1b3ad --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StaticRoutingEnrichment.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The StaticRoutingEnrichment. + public partial class StaticRoutingEnrichment + { + /// Initializes a new instance of StaticRoutingEnrichment. + public StaticRoutingEnrichment() + { + } + + /// Initializes a new instance of StaticRoutingEnrichment. + /// Static routing enrichment key. + /// Static routing enrichment value type. For e.g. this property value can be 'String'. + internal StaticRoutingEnrichment(string key, StaticRoutingEnrichmentType? valueType) + { + Key = key; + ValueType = valueType; + } + + /// Static routing enrichment key. + public string Key { get; set; } + /// Static routing enrichment value type. For e.g. this property value can be 'String'. + public StaticRoutingEnrichmentType? ValueType { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StaticRoutingEnrichmentType.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StaticRoutingEnrichmentType.cs new file mode 100644 index 000000000000..d2c50329ee38 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StaticRoutingEnrichmentType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Static routing enrichment value type. For e.g. this property value can be 'String'. + public readonly partial struct StaticRoutingEnrichmentType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public StaticRoutingEnrichmentType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StringValue = "String"; + + /// String. + public static StaticRoutingEnrichmentType String { get; } = new StaticRoutingEnrichmentType(StringValue); + /// Determines if two values are the same. + public static bool operator ==(StaticRoutingEnrichmentType left, StaticRoutingEnrichmentType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(StaticRoutingEnrichmentType left, StaticRoutingEnrichmentType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator StaticRoutingEnrichmentType(string value) => new StaticRoutingEnrichmentType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is StaticRoutingEnrichmentType other && Equals(other); + /// + public bool Equals(StaticRoutingEnrichmentType 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StorageQueueEventSubscriptionDestination.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StorageQueueEventSubscriptionDestination.cs index 0bedc75072f3..ca544683d495 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StorageQueueEventSubscriptionDestination.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StorageQueueEventSubscriptionDestination.cs @@ -22,7 +22,7 @@ public StorageQueueEventSubscriptionDestination() /// Type of the endpoint for the event subscription destination. /// The Azure Resource ID of the storage account that contains the queue that is the destination of an event subscription. /// The name of the Storage queue under a storage account that is the destination of an event subscription. - /// Storage queue message time to live in seconds. + /// Storage queue message time to live in seconds. This value cannot be zero or negative with the exception of using -1 to indicate that the Time To Live of the message is Infinite. internal StorageQueueEventSubscriptionDestination(EndpointType endpointType, ResourceIdentifier resourceId, string queueName, long? queueMessageTimeToLiveInSeconds) : base(endpointType) { ResourceId = resourceId; @@ -35,7 +35,7 @@ internal StorageQueueEventSubscriptionDestination(EndpointType endpointType, Res public ResourceIdentifier ResourceId { get; set; } /// The name of the Storage queue under a storage account that is the destination of an event subscription. public string QueueName { get; set; } - /// Storage queue message time to live in seconds. + /// Storage queue message time to live in seconds. This value cannot be zero or negative with the exception of using -1 to indicate that the Time To Live of the message is Infinite. public long? QueueMessageTimeToLiveInSeconds { get; set; } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringBeginsWithFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringBeginsWithFilter.Serialization.cs new file mode 100644 index 000000000000..46d2daff558d --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringBeginsWithFilter.Serialization.cs @@ -0,0 +1,78 @@ +// 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.EventGrid.Models +{ + public partial class StringBeginsWithFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static StringBeginsWithFilter DeserializeStringBeginsWithFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> values = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new StringBeginsWithFilter(operatorType, key.Value, Optional.ToList(values)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringBeginsWithFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringBeginsWithFilter.cs new file mode 100644 index 000000000000..67182ce1b0b2 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringBeginsWithFilter.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// StringBeginsWith Filter. + public partial class StringBeginsWithFilter : Filter + { + /// Initializes a new instance of StringBeginsWithFilter. + public StringBeginsWithFilter() + { + Values = new ChangeTrackingList(); + OperatorType = FilterOperatorType.StringBeginsWith; + } + + /// Initializes a new instance of StringBeginsWithFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The set of filter values. + internal StringBeginsWithFilter(FilterOperatorType operatorType, string key, IList values) : base(operatorType, key) + { + Values = values; + OperatorType = operatorType; + } + + /// The set of filter values. + public IList Values { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringContainsFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringContainsFilter.Serialization.cs new file mode 100644 index 000000000000..d60a6463c19f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringContainsFilter.Serialization.cs @@ -0,0 +1,78 @@ +// 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.EventGrid.Models +{ + public partial class StringContainsFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static StringContainsFilter DeserializeStringContainsFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> values = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new StringContainsFilter(operatorType, key.Value, Optional.ToList(values)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringContainsFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringContainsFilter.cs new file mode 100644 index 000000000000..46dd3ac64ead --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringContainsFilter.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// StringContains Filter. + public partial class StringContainsFilter : Filter + { + /// Initializes a new instance of StringContainsFilter. + public StringContainsFilter() + { + Values = new ChangeTrackingList(); + OperatorType = FilterOperatorType.StringContains; + } + + /// Initializes a new instance of StringContainsFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The set of filter values. + internal StringContainsFilter(FilterOperatorType operatorType, string key, IList values) : base(operatorType, key) + { + Values = values; + OperatorType = operatorType; + } + + /// The set of filter values. + public IList Values { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringEndsWithFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringEndsWithFilter.Serialization.cs new file mode 100644 index 000000000000..13b9a59927ad --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringEndsWithFilter.Serialization.cs @@ -0,0 +1,78 @@ +// 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.EventGrid.Models +{ + public partial class StringEndsWithFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static StringEndsWithFilter DeserializeStringEndsWithFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> values = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new StringEndsWithFilter(operatorType, key.Value, Optional.ToList(values)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringEndsWithFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringEndsWithFilter.cs new file mode 100644 index 000000000000..2913713382f9 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringEndsWithFilter.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// StringEndsWith Filter. + public partial class StringEndsWithFilter : Filter + { + /// Initializes a new instance of StringEndsWithFilter. + public StringEndsWithFilter() + { + Values = new ChangeTrackingList(); + OperatorType = FilterOperatorType.StringEndsWith; + } + + /// Initializes a new instance of StringEndsWithFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The set of filter values. + internal StringEndsWithFilter(FilterOperatorType operatorType, string key, IList values) : base(operatorType, key) + { + Values = values; + OperatorType = operatorType; + } + + /// The set of filter values. + public IList Values { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringInFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringInFilter.Serialization.cs new file mode 100644 index 000000000000..c81e53a300a5 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringInFilter.Serialization.cs @@ -0,0 +1,78 @@ +// 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.EventGrid.Models +{ + public partial class StringInFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static StringInFilter DeserializeStringInFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> values = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new StringInFilter(operatorType, key.Value, Optional.ToList(values)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringInFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringInFilter.cs new file mode 100644 index 000000000000..ac72ed93b4e8 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringInFilter.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// StringIn Filter. + public partial class StringInFilter : Filter + { + /// Initializes a new instance of StringInFilter. + public StringInFilter() + { + Values = new ChangeTrackingList(); + OperatorType = FilterOperatorType.StringIn; + } + + /// Initializes a new instance of StringInFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The set of filter values. + internal StringInFilter(FilterOperatorType operatorType, string key, IList values) : base(operatorType, key) + { + Values = values; + OperatorType = operatorType; + } + + /// The set of filter values. + public IList Values { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotBeginsWithFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotBeginsWithFilter.Serialization.cs new file mode 100644 index 000000000000..4a69bb70b6ea --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotBeginsWithFilter.Serialization.cs @@ -0,0 +1,78 @@ +// 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.EventGrid.Models +{ + public partial class StringNotBeginsWithFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static StringNotBeginsWithFilter DeserializeStringNotBeginsWithFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> values = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new StringNotBeginsWithFilter(operatorType, key.Value, Optional.ToList(values)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotBeginsWithFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotBeginsWithFilter.cs new file mode 100644 index 000000000000..b38ff7b5aac5 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotBeginsWithFilter.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// StringNotBeginsWith Filter. + public partial class StringNotBeginsWithFilter : Filter + { + /// Initializes a new instance of StringNotBeginsWithFilter. + public StringNotBeginsWithFilter() + { + Values = new ChangeTrackingList(); + OperatorType = FilterOperatorType.StringNotBeginsWith; + } + + /// Initializes a new instance of StringNotBeginsWithFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The set of filter values. + internal StringNotBeginsWithFilter(FilterOperatorType operatorType, string key, IList values) : base(operatorType, key) + { + Values = values; + OperatorType = operatorType; + } + + /// The set of filter values. + public IList Values { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotContainsFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotContainsFilter.Serialization.cs new file mode 100644 index 000000000000..b5924a8f4246 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotContainsFilter.Serialization.cs @@ -0,0 +1,78 @@ +// 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.EventGrid.Models +{ + public partial class StringNotContainsFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static StringNotContainsFilter DeserializeStringNotContainsFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> values = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new StringNotContainsFilter(operatorType, key.Value, Optional.ToList(values)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotContainsFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotContainsFilter.cs new file mode 100644 index 000000000000..2220f912633d --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotContainsFilter.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// StringNotContains Filter. + public partial class StringNotContainsFilter : Filter + { + /// Initializes a new instance of StringNotContainsFilter. + public StringNotContainsFilter() + { + Values = new ChangeTrackingList(); + OperatorType = FilterOperatorType.StringNotContains; + } + + /// Initializes a new instance of StringNotContainsFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The set of filter values. + internal StringNotContainsFilter(FilterOperatorType operatorType, string key, IList values) : base(operatorType, key) + { + Values = values; + OperatorType = operatorType; + } + + /// The set of filter values. + public IList Values { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotEndsWithFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotEndsWithFilter.Serialization.cs new file mode 100644 index 000000000000..6a4258551555 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotEndsWithFilter.Serialization.cs @@ -0,0 +1,78 @@ +// 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.EventGrid.Models +{ + public partial class StringNotEndsWithFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static StringNotEndsWithFilter DeserializeStringNotEndsWithFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> values = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new StringNotEndsWithFilter(operatorType, key.Value, Optional.ToList(values)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotEndsWithFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotEndsWithFilter.cs new file mode 100644 index 000000000000..048073f3830c --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotEndsWithFilter.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// StringNotEndsWith Filter. + public partial class StringNotEndsWithFilter : Filter + { + /// Initializes a new instance of StringNotEndsWithFilter. + public StringNotEndsWithFilter() + { + Values = new ChangeTrackingList(); + OperatorType = FilterOperatorType.StringNotEndsWith; + } + + /// Initializes a new instance of StringNotEndsWithFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The set of filter values. + internal StringNotEndsWithFilter(FilterOperatorType operatorType, string key, IList values) : base(operatorType, key) + { + Values = values; + OperatorType = operatorType; + } + + /// The set of filter values. + public IList Values { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotInFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotInFilter.Serialization.cs new file mode 100644 index 000000000000..f05e698f76ca --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotInFilter.Serialization.cs @@ -0,0 +1,78 @@ +// 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.EventGrid.Models +{ + public partial class StringNotInFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static StringNotInFilter DeserializeStringNotInFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> values = default; + FilterOperatorType operatorType = default; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new StringNotInFilter(operatorType, key.Value, Optional.ToList(values)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotInFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotInFilter.cs new file mode 100644 index 000000000000..9af1c88146f2 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/StringNotInFilter.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// StringNotIn Filter. + public partial class StringNotInFilter : Filter + { + /// Initializes a new instance of StringNotInFilter. + public StringNotInFilter() + { + Values = new ChangeTrackingList(); + OperatorType = FilterOperatorType.StringNotIn; + } + + /// Initializes a new instance of StringNotInFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + /// The set of filter values. + internal StringNotInFilter(FilterOperatorType operatorType, string key, IList values) : base(operatorType, key) + { + Values = values; + OperatorType = operatorType; + } + + /// The set of filter values. + public IList Values { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionData.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionData.Serialization.cs new file mode 100644 index 000000000000..c76caea85336 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionData.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + public partial class SubscriptionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(DeliveryConfiguration)) + { + writer.WritePropertyName("deliveryConfiguration"u8); + writer.WriteObjectValue(DeliveryConfiguration); + } + if (Optional.IsDefined(EventDeliverySchema)) + { + writer.WritePropertyName("eventDeliverySchema"u8); + writer.WriteStringValue(EventDeliverySchema.Value.ToString()); + } + if (Optional.IsDefined(FiltersConfiguration)) + { + writer.WritePropertyName("filtersConfiguration"u8); + writer.WriteObjectValue(FiltersConfiguration); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SubscriptionData DeserializeSubscriptionData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional provisioningState = default; + Optional deliveryConfiguration = default; + Optional eventDeliverySchema = default; + Optional filtersConfiguration = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new SubscriptionProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("deliveryConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deliveryConfiguration = DeliveryConfiguration.DeserializeDeliveryConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("eventDeliverySchema"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eventDeliverySchema = new DeliverySchema(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("filtersConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filtersConfiguration = FiltersConfiguration.DeserializeFiltersConfiguration(property0.Value); + continue; + } + } + continue; + } + } + return new SubscriptionData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), deliveryConfiguration.Value, Optional.ToNullable(eventDeliverySchema), filtersConfiguration.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionPatch.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionPatch.Serialization.cs new file mode 100644 index 000000000000..5cc4e06cda35 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionPatch.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class SubscriptionPatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(DeliveryConfiguration)) + { + writer.WritePropertyName("deliveryConfiguration"u8); + writer.WriteObjectValue(DeliveryConfiguration); + } + if (Optional.IsDefined(EventDeliverySchema)) + { + writer.WritePropertyName("eventDeliverySchema"u8); + writer.WriteStringValue(EventDeliverySchema.Value.ToString()); + } + if (Optional.IsDefined(FiltersConfiguration)) + { + writer.WritePropertyName("filtersConfiguration"u8); + writer.WriteObjectValue(FiltersConfiguration); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionPatch.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionPatch.cs new file mode 100644 index 000000000000..72456ac97932 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionPatch.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Properties of the Event Subscription update. + public partial class SubscriptionPatch + { + /// Initializes a new instance of SubscriptionPatch. + public SubscriptionPatch() + { + } + + /// Information about the delivery configuration of the event subscription. + public DeliveryConfiguration DeliveryConfiguration { get; set; } + /// The event delivery schema for the event subscription. + public DeliverySchema? EventDeliverySchema { get; set; } + /// Information about the filter for the event subscription. + public FiltersConfiguration FiltersConfiguration { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionProvisioningState.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionProvisioningState.cs new file mode 100644 index 000000000000..aadfcf3622ca --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionProvisioningState.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Provisioning state of the event subscription. + public readonly partial struct SubscriptionProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SubscriptionProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string SucceededValue = "Succeeded"; + private const string CanceledValue = "Canceled"; + private const string FailedValue = "Failed"; + private const string AwaitingManualActionValue = "AwaitingManualAction"; + private const string DeletedValue = "Deleted"; + private const string DeleteFailedValue = "DeleteFailed"; + private const string CreateFailedValue = "CreateFailed"; + private const string UpdatedFailedValue = "UpdatedFailed"; + + /// Creating. + public static SubscriptionProvisioningState Creating { get; } = new SubscriptionProvisioningState(CreatingValue); + /// Updating. + public static SubscriptionProvisioningState Updating { get; } = new SubscriptionProvisioningState(UpdatingValue); + /// Deleting. + public static SubscriptionProvisioningState Deleting { get; } = new SubscriptionProvisioningState(DeletingValue); + /// Succeeded. + public static SubscriptionProvisioningState Succeeded { get; } = new SubscriptionProvisioningState(SucceededValue); + /// Canceled. + public static SubscriptionProvisioningState Canceled { get; } = new SubscriptionProvisioningState(CanceledValue); + /// Failed. + public static SubscriptionProvisioningState Failed { get; } = new SubscriptionProvisioningState(FailedValue); + /// AwaitingManualAction. + public static SubscriptionProvisioningState AwaitingManualAction { get; } = new SubscriptionProvisioningState(AwaitingManualActionValue); + /// Deleted. + public static SubscriptionProvisioningState Deleted { get; } = new SubscriptionProvisioningState(DeletedValue); + /// DeleteFailed. + public static SubscriptionProvisioningState DeleteFailed { get; } = new SubscriptionProvisioningState(DeleteFailedValue); + /// CreateFailed. + public static SubscriptionProvisioningState CreateFailed { get; } = new SubscriptionProvisioningState(CreateFailedValue); + /// UpdatedFailed. + public static SubscriptionProvisioningState UpdatedFailed { get; } = new SubscriptionProvisioningState(UpdatedFailedValue); + /// Determines if two values are the same. + public static bool operator ==(SubscriptionProvisioningState left, SubscriptionProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SubscriptionProvisioningState left, SubscriptionProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SubscriptionProvisioningState(string value) => new SubscriptionProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SubscriptionProvisioningState other && Equals(other); + /// + public bool Equals(SubscriptionProvisioningState 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionsListResult.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionsListResult.Serialization.cs new file mode 100644 index 000000000000..2f4c42052584 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionsListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + internal partial class SubscriptionsListResult + { + internal static SubscriptionsListResult DeserializeSubscriptionsListResult(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(SubscriptionData.DeserializeSubscriptionData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new SubscriptionsListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionsListResult.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionsListResult.cs new file mode 100644 index 000000000000..fa4f9c805be1 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/SubscriptionsListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Result of the List event subscriptions operation. + internal partial class SubscriptionsListResult + { + /// Initializes a new instance of SubscriptionsListResult. + internal SubscriptionsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SubscriptionsListResult. + /// A collection of Subscriptions. + /// A link for the next page of event subscriptions. + internal SubscriptionsListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A collection of Subscriptions. + public IReadOnlyList Value { get; } + /// A link for the next page of event subscriptions. + public string NextLink { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TlsVersion.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TlsVersion.cs new file mode 100644 index 000000000000..b726dfbc5f2f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TlsVersion.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Minimum TLS version of the publisher allowed to publish to this domain. + public readonly partial struct TlsVersion : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TlsVersion(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string One0Value = "1.0"; + private const string One1Value = "1.1"; + private const string One2Value = "1.2"; + + /// 1.0. + public static TlsVersion One0 { get; } = new TlsVersion(One0Value); + /// 1.1. + public static TlsVersion One1 { get; } = new TlsVersion(One1Value); + /// 1.2. + public static TlsVersion One2 { get; } = new TlsVersion(One2Value); + /// Determines if two values are the same. + public static bool operator ==(TlsVersion left, TlsVersion right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TlsVersion left, TlsVersion right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TlsVersion(string value) => new TlsVersion(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TlsVersion other && Equals(other); + /// + public bool Equals(TlsVersion 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicRegenerateKeyContent.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicRegenerateKeyRequest.Serialization.cs similarity index 88% rename from sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicRegenerateKeyContent.Serialization.cs rename to sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicRegenerateKeyRequest.Serialization.cs index c0e4ce29b6df..5f22ec0937d8 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicRegenerateKeyContent.Serialization.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicRegenerateKeyRequest.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.EventGrid.Models { - public partial class TopicRegenerateKeyContent : IUtf8JsonSerializable + public partial class TopicRegenerateKeyRequest : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicRegenerateKeyContent.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicRegenerateKeyRequest.cs similarity index 85% rename from sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicRegenerateKeyContent.cs rename to sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicRegenerateKeyRequest.cs index 3c54006071b3..cd4f536adf95 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicRegenerateKeyContent.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicRegenerateKeyRequest.cs @@ -11,12 +11,12 @@ namespace Azure.ResourceManager.EventGrid.Models { /// Topic regenerate share access key request. - public partial class TopicRegenerateKeyContent + public partial class TopicRegenerateKeyRequest { - /// Initializes a new instance of TopicRegenerateKeyContent. + /// Initializes a new instance of TopicRegenerateKeyRequest. /// Key name to regenerate key1 or key2. /// is null. - public TopicRegenerateKeyContent(string keyName) + public TopicRegenerateKeyRequest(string keyName) { Argument.AssertNotNull(keyName, nameof(keyName)); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpaceData.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpaceData.Serialization.cs new file mode 100644 index 000000000000..435483b27e97 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpaceData.Serialization.cs @@ -0,0 +1,125 @@ +// 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.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + public partial class TopicSpaceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(TopicTemplates)) + { + writer.WritePropertyName("topicTemplates"u8); + writer.WriteStartArray(); + foreach (var item in TopicTemplates) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static TopicSpaceData DeserializeTopicSpaceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional description = default; + Optional> topicTemplates = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + 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("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("topicTemplates"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + topicTemplates = array; + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new TopicSpaceProvisioningState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new TopicSpaceData(id, name, type, systemData.Value, description.Value, Optional.ToList(topicTemplates), Optional.ToNullable(provisioningState)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpaceProvisioningState.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpaceProvisioningState.cs new file mode 100644 index 000000000000..0136cbb4a905 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpaceProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Provisioning state of the TopicSpace resource. + public readonly partial struct TopicSpaceProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TopicSpaceProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string SucceededValue = "Succeeded"; + private const string CanceledValue = "Canceled"; + private const string FailedValue = "Failed"; + private const string DeletedValue = "Deleted"; + + /// Creating. + public static TopicSpaceProvisioningState Creating { get; } = new TopicSpaceProvisioningState(CreatingValue); + /// Updating. + public static TopicSpaceProvisioningState Updating { get; } = new TopicSpaceProvisioningState(UpdatingValue); + /// Deleting. + public static TopicSpaceProvisioningState Deleting { get; } = new TopicSpaceProvisioningState(DeletingValue); + /// Succeeded. + public static TopicSpaceProvisioningState Succeeded { get; } = new TopicSpaceProvisioningState(SucceededValue); + /// Canceled. + public static TopicSpaceProvisioningState Canceled { get; } = new TopicSpaceProvisioningState(CanceledValue); + /// Failed. + public static TopicSpaceProvisioningState Failed { get; } = new TopicSpaceProvisioningState(FailedValue); + /// Deleted. + public static TopicSpaceProvisioningState Deleted { get; } = new TopicSpaceProvisioningState(DeletedValue); + /// Determines if two values are the same. + public static bool operator ==(TopicSpaceProvisioningState left, TopicSpaceProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TopicSpaceProvisioningState left, TopicSpaceProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TopicSpaceProvisioningState(string value) => new TopicSpaceProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TopicSpaceProvisioningState other && Equals(other); + /// + public bool Equals(TopicSpaceProvisioningState 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpacesConfiguration.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpacesConfiguration.Serialization.cs new file mode 100644 index 000000000000..afbfc9ae878f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpacesConfiguration.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class TopicSpacesConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(RouteTopicResourceId)) + { + writer.WritePropertyName("routeTopicResourceId"u8); + writer.WriteStringValue(RouteTopicResourceId); + } + if (Optional.IsDefined(RoutingEnrichments)) + { + writer.WritePropertyName("routingEnrichments"u8); + writer.WriteObjectValue(RoutingEnrichments); + } + if (Optional.IsDefined(ClientAuthentication)) + { + writer.WritePropertyName("clientAuthentication"u8); + writer.WriteObjectValue(ClientAuthentication); + } + if (Optional.IsDefined(MaximumSessionExpiryInHours)) + { + writer.WritePropertyName("maximumSessionExpiryInHours"u8); + writer.WriteNumberValue(MaximumSessionExpiryInHours.Value); + } + if (Optional.IsDefined(MaximumClientSessionsPerAuthenticationName)) + { + writer.WritePropertyName("maximumClientSessionsPerAuthenticationName"u8); + writer.WriteNumberValue(MaximumClientSessionsPerAuthenticationName.Value); + } + if (Optional.IsDefined(RoutingIdentityInfo)) + { + writer.WritePropertyName("routingIdentityInfo"u8); + writer.WriteObjectValue(RoutingIdentityInfo); + } + writer.WriteEndObject(); + } + + internal static TopicSpacesConfiguration DeserializeTopicSpacesConfiguration(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional state = default; + Optional routeTopicResourceId = default; + Optional hostname = default; + Optional routingEnrichments = default; + Optional clientAuthentication = default; + Optional maximumSessionExpiryInHours = default; + Optional maximumClientSessionsPerAuthenticationName = default; + Optional routingIdentityInfo = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new TopicSpacesConfigurationState(property.Value.GetString()); + continue; + } + if (property.NameEquals("routeTopicResourceId"u8)) + { + routeTopicResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("hostname"u8)) + { + hostname = property.Value.GetString(); + continue; + } + if (property.NameEquals("routingEnrichments"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + routingEnrichments = RoutingEnrichments.DeserializeRoutingEnrichments(property.Value); + continue; + } + if (property.NameEquals("clientAuthentication"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clientAuthentication = ClientAuthenticationSettings.DeserializeClientAuthenticationSettings(property.Value); + continue; + } + if (property.NameEquals("maximumSessionExpiryInHours"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maximumSessionExpiryInHours = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maximumClientSessionsPerAuthenticationName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maximumClientSessionsPerAuthenticationName = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("routingIdentityInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + routingIdentityInfo = RoutingIdentityInfo.DeserializeRoutingIdentityInfo(property.Value); + continue; + } + } + return new TopicSpacesConfiguration(Optional.ToNullable(state), routeTopicResourceId.Value, hostname.Value, routingEnrichments.Value, clientAuthentication.Value, Optional.ToNullable(maximumSessionExpiryInHours), Optional.ToNullable(maximumClientSessionsPerAuthenticationName), routingIdentityInfo.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpacesConfiguration.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpacesConfiguration.cs new file mode 100644 index 000000000000..ad5997e0813a --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpacesConfiguration.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Properties of the Topic Spaces Configuration. + public partial class TopicSpacesConfiguration + { + /// Initializes a new instance of TopicSpacesConfiguration. + public TopicSpacesConfiguration() + { + } + + /// Initializes a new instance of TopicSpacesConfiguration. + /// Indicate if Topic Spaces Configuration is enabled for the namespace. Default is Disabled. + /// + /// Fully qualified Azure Resource Id for the Event Grid Topic to which events will be routed to from TopicSpaces under a namespace. + /// This property should be in the following format '/subscriptions/{subId}/resourcegroups/{resourceGroupName}/providers/microsoft.EventGrid/topics/{topicName}'. + /// This topic should reside in the same region where namespace is located. + /// + /// The endpoint for the topic spaces configuration. This is a read-only property. + /// Routing enrichments for topic spaces configuration. + /// Client authentication settings for topic spaces configuration. + /// + /// The maximum session expiry in hours. The property default value is 1 hour. + /// Min allowed value is 1 hour and max allowed value is 8 hours. + /// + /// + /// The maximum number of sessions per authentication name. The property default value is 1. + /// Min allowed value is 1 and max allowed value is 100. + /// + /// Routing identity info for topic spaces configuration. + internal TopicSpacesConfiguration(TopicSpacesConfigurationState? state, string routeTopicResourceId, string hostname, RoutingEnrichments routingEnrichments, ClientAuthenticationSettings clientAuthentication, int? maximumSessionExpiryInHours, int? maximumClientSessionsPerAuthenticationName, RoutingIdentityInfo routingIdentityInfo) + { + State = state; + RouteTopicResourceId = routeTopicResourceId; + Hostname = hostname; + RoutingEnrichments = routingEnrichments; + ClientAuthentication = clientAuthentication; + MaximumSessionExpiryInHours = maximumSessionExpiryInHours; + MaximumClientSessionsPerAuthenticationName = maximumClientSessionsPerAuthenticationName; + RoutingIdentityInfo = routingIdentityInfo; + } + + /// Indicate if Topic Spaces Configuration is enabled for the namespace. Default is Disabled. + public TopicSpacesConfigurationState? State { get; set; } + /// + /// Fully qualified Azure Resource Id for the Event Grid Topic to which events will be routed to from TopicSpaces under a namespace. + /// This property should be in the following format '/subscriptions/{subId}/resourcegroups/{resourceGroupName}/providers/microsoft.EventGrid/topics/{topicName}'. + /// This topic should reside in the same region where namespace is located. + /// + public string RouteTopicResourceId { get; set; } + /// The endpoint for the topic spaces configuration. This is a read-only property. + public string Hostname { get; } + /// Routing enrichments for topic spaces configuration. + public RoutingEnrichments RoutingEnrichments { get; set; } + /// Client authentication settings for topic spaces configuration. + internal ClientAuthenticationSettings ClientAuthentication { get; set; } + /// Alternative authentication name sources related to client authentication settings for namespace resource. + public IList AlternativeAuthenticationNameSources + { + get + { + if (ClientAuthentication is null) + ClientAuthentication = new ClientAuthenticationSettings(); + return ClientAuthentication.AlternativeAuthenticationNameSources; + } + } + + /// + /// The maximum session expiry in hours. The property default value is 1 hour. + /// Min allowed value is 1 hour and max allowed value is 8 hours. + /// + public int? MaximumSessionExpiryInHours { get; set; } + /// + /// The maximum number of sessions per authentication name. The property default value is 1. + /// Min allowed value is 1 and max allowed value is 100. + /// + public int? MaximumClientSessionsPerAuthenticationName { get; set; } + /// Routing identity info for topic spaces configuration. + public RoutingIdentityInfo RoutingIdentityInfo { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpacesConfigurationState.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpacesConfigurationState.cs new file mode 100644 index 000000000000..1bb9ec629027 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpacesConfigurationState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Indicate if Topic Spaces Configuration is enabled for the namespace. Default is Disabled. + public readonly partial struct TopicSpacesConfigurationState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TopicSpacesConfigurationState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DisabledValue = "Disabled"; + private const string EnabledValue = "Enabled"; + + /// Disabled. + public static TopicSpacesConfigurationState Disabled { get; } = new TopicSpacesConfigurationState(DisabledValue); + /// Enabled. + public static TopicSpacesConfigurationState Enabled { get; } = new TopicSpacesConfigurationState(EnabledValue); + /// Determines if two values are the same. + public static bool operator ==(TopicSpacesConfigurationState left, TopicSpacesConfigurationState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TopicSpacesConfigurationState left, TopicSpacesConfigurationState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TopicSpacesConfigurationState(string value) => new TopicSpacesConfigurationState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TopicSpacesConfigurationState other && Equals(other); + /// + public bool Equals(TopicSpacesConfigurationState 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpacesListResult.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpacesListResult.Serialization.cs new file mode 100644 index 000000000000..254330334e39 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpacesListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + internal partial class TopicSpacesListResult + { + internal static TopicSpacesListResult DeserializeTopicSpacesListResult(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(TopicSpaceData.DeserializeTopicSpaceData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new TopicSpacesListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpacesListResult.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpacesListResult.cs new file mode 100644 index 000000000000..0629b8566620 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicSpacesListResult.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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Result of the List Topic Space operation. + internal partial class TopicSpacesListResult + { + /// Initializes a new instance of TopicSpacesListResult. + internal TopicSpacesListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of TopicSpacesListResult. + /// A collection of Topic Space. + /// A link for the next page of Topic Space. + internal TopicSpacesListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A collection of Topic Space. + public IReadOnlyList Value { get; } + /// A link for the next page of Topic Space. + public string NextLink { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicTypeData.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicTypeData.Serialization.cs index ac8211495c4a..96eef529d222 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicTypeData.Serialization.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicTypeData.Serialization.cs @@ -70,6 +70,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(AreRegionalAndGlobalSourcesSupported)) + { + writer.WritePropertyName("areRegionalAndGlobalSourcesSupported"u8); + writer.WriteBooleanValue(AreRegionalAndGlobalSourcesSupported.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -92,6 +97,7 @@ internal static TopicTypeData DeserializeTopicTypeData(JsonElement element) Optional> supportedLocations = default; Optional sourceResourceFormat = default; Optional> supportedScopesForSource = default; + Optional areRegionalAndGlobalSourcesSupported = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -193,11 +199,20 @@ internal static TopicTypeData DeserializeTopicTypeData(JsonElement element) supportedScopesForSource = array; continue; } + if (property0.NameEquals("areRegionalAndGlobalSourcesSupported"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + areRegionalAndGlobalSourcesSupported = property0.Value.GetBoolean(); + continue; + } } continue; } } - return new TopicTypeData(id, name, type, systemData.Value, provider.Value, displayName.Value, description.Value, Optional.ToNullable(resourceRegionType), Optional.ToNullable(provisioningState), Optional.ToList(supportedLocations), sourceResourceFormat.Value, Optional.ToList(supportedScopesForSource)); + return new TopicTypeData(id, name, type, systemData.Value, provider.Value, displayName.Value, description.Value, Optional.ToNullable(resourceRegionType), Optional.ToNullable(provisioningState), Optional.ToList(supportedLocations), sourceResourceFormat.Value, Optional.ToList(supportedScopesForSource), Optional.ToNullable(areRegionalAndGlobalSourcesSupported)); } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicsConfiguration.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicsConfiguration.Serialization.cs new file mode 100644 index 000000000000..39423821c839 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicsConfiguration.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + internal partial class TopicsConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static TopicsConfiguration DeserializeTopicsConfiguration(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional hostname = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("hostname"u8)) + { + hostname = property.Value.GetString(); + continue; + } + } + return new TopicsConfiguration(hostname.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicsConfiguration.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicsConfiguration.cs new file mode 100644 index 000000000000..8ed0e013c47d --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/TopicsConfiguration.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Properties of the Topics Configuration. + internal partial class TopicsConfiguration + { + /// Initializes a new instance of TopicsConfiguration. + public TopicsConfiguration() + { + } + + /// Initializes a new instance of TopicsConfiguration. + /// The hostname for the topics configuration. This is a read-only property. + internal TopicsConfiguration(string hostname) + { + Hostname = hostname; + } + + /// The hostname for the topics configuration. This is a read-only property. + public string Hostname { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownFilter.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownFilter.Serialization.cs new file mode 100644 index 000000000000..3fbec5ac1e6c --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownFilter.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + internal partial class UnknownFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("operatorType"u8); + writer.WriteStringValue(OperatorType.ToString()); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WriteEndObject(); + } + + internal static UnknownFilter DeserializeUnknownFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FilterOperatorType operatorType = "Unknown"; + Optional key = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("operatorType"u8)) + { + operatorType = new FilterOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + } + return new UnknownFilter(operatorType, key.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownFilter.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownFilter.cs new file mode 100644 index 000000000000..7b2f22f44a11 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownFilter.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The UnknownFilter. + internal partial class UnknownFilter : Filter + { + /// Initializes a new instance of UnknownFilter. + /// The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + /// The field/property in the event based on which you want to filter. + internal UnknownFilter(FilterOperatorType operatorType, string key) : base(operatorType, key) + { + OperatorType = operatorType; + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownPartnerClientAuthentication.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownPartnerClientAuthentication.Serialization.cs new file mode 100644 index 000000000000..8c1cf250e407 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownPartnerClientAuthentication.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + internal partial class UnknownPartnerClientAuthentication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("clientAuthenticationType"u8); + writer.WriteStringValue(ClientAuthenticationType.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownPartnerClientAuthentication DeserializeUnknownPartnerClientAuthentication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PartnerClientAuthenticationType clientAuthenticationType = "Unknown"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clientAuthenticationType"u8)) + { + clientAuthenticationType = new PartnerClientAuthenticationType(property.Value.GetString()); + continue; + } + } + return new UnknownPartnerClientAuthentication(clientAuthenticationType); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownPartnerClientAuthentication.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownPartnerClientAuthentication.cs new file mode 100644 index 000000000000..7187be58233f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownPartnerClientAuthentication.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The UnknownPartnerClientAuthentication. + internal partial class UnknownPartnerClientAuthentication : PartnerClientAuthentication + { + /// Initializes a new instance of UnknownPartnerClientAuthentication. + /// Type of client authentication. + internal UnknownPartnerClientAuthentication(PartnerClientAuthenticationType clientAuthenticationType) : base(clientAuthenticationType) + { + ClientAuthenticationType = clientAuthenticationType; + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownPartnerDestinationInfo.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownPartnerDestinationInfo.Serialization.cs new file mode 100644 index 000000000000..9dcfad4387f8 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownPartnerDestinationInfo.Serialization.cs @@ -0,0 +1,111 @@ +// 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.EventGrid.Models +{ + internal partial class UnknownPartnerDestinationInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(AzureSubscriptionId)) + { + writer.WritePropertyName("azureSubscriptionId"u8); + writer.WriteStringValue(AzureSubscriptionId); + } + if (Optional.IsDefined(ResourceGroupName)) + { + writer.WritePropertyName("resourceGroupName"u8); + writer.WriteStringValue(ResourceGroupName); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("endpointType"u8); + writer.WriteStringValue(EndpointType.ToString()); + if (Optional.IsDefined(EndpointServiceContext)) + { + writer.WritePropertyName("endpointServiceContext"u8); + writer.WriteStringValue(EndpointServiceContext); + } + if (Optional.IsCollectionDefined(ResourceMoveChangeHistory)) + { + writer.WritePropertyName("resourceMoveChangeHistory"u8); + writer.WriteStartArray(); + foreach (var item in ResourceMoveChangeHistory) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static UnknownPartnerDestinationInfo DeserializeUnknownPartnerDestinationInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional azureSubscriptionId = default; + Optional resourceGroupName = default; + Optional name = default; + PartnerEndpointType endpointType = "Unknown"; + Optional endpointServiceContext = default; + Optional> resourceMoveChangeHistory = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azureSubscriptionId"u8)) + { + azureSubscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGroupName"u8)) + { + resourceGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("endpointType"u8)) + { + endpointType = new PartnerEndpointType(property.Value.GetString()); + continue; + } + if (property.NameEquals("endpointServiceContext"u8)) + { + endpointServiceContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceMoveChangeHistory"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.ResourceMoveChangeHistory.DeserializeResourceMoveChangeHistory(item)); + } + resourceMoveChangeHistory = array; + continue; + } + } + return new UnknownPartnerDestinationInfo(azureSubscriptionId.Value, resourceGroupName.Value, name.Value, endpointType, endpointServiceContext.Value, Optional.ToList(resourceMoveChangeHistory)); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownPartnerDestinationInfo.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownPartnerDestinationInfo.cs new file mode 100644 index 000000000000..b05746d9eb72 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UnknownPartnerDestinationInfo.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// The UnknownPartnerDestinationInfo. + internal partial class UnknownPartnerDestinationInfo : PartnerDestinationInfo + { + /// Initializes a new instance of UnknownPartnerDestinationInfo. + /// + /// Azure subscription ID of the subscriber. The partner destination associated with the channel will be + /// created under this Azure subscription. + /// + /// + /// Azure Resource Group of the subscriber. The partner destination associated with the channel will be + /// created under this resource group. + /// + /// Name of the partner destination associated with the channel. + /// Type of the endpoint for the partner destination. + /// Additional context of the partner destination endpoint. + /// Change history of the resource move. + internal UnknownPartnerDestinationInfo(string azureSubscriptionId, string resourceGroupName, string name, PartnerEndpointType endpointType, string endpointServiceContext, IList resourceMoveChangeHistory) : base(azureSubscriptionId, resourceGroupName, name, endpointType, endpointServiceContext, resourceMoveChangeHistory) + { + EndpointType = endpointType; + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UpdateTopicSpacesConfigurationInfo.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UpdateTopicSpacesConfigurationInfo.Serialization.cs new file mode 100644 index 000000000000..61a944f97798 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UpdateTopicSpacesConfigurationInfo.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class UpdateTopicSpacesConfigurationInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(RouteTopicResourceId)) + { + writer.WritePropertyName("routeTopicResourceId"u8); + writer.WriteStringValue(RouteTopicResourceId); + } + if (Optional.IsDefined(RoutingEnrichments)) + { + writer.WritePropertyName("routingEnrichments"u8); + writer.WriteObjectValue(RoutingEnrichments); + } + if (Optional.IsDefined(ClientAuthentication)) + { + writer.WritePropertyName("clientAuthentication"u8); + writer.WriteObjectValue(ClientAuthentication); + } + if (Optional.IsDefined(MaximumSessionExpiryInHours)) + { + writer.WritePropertyName("maximumSessionExpiryInHours"u8); + writer.WriteNumberValue(MaximumSessionExpiryInHours.Value); + } + if (Optional.IsDefined(MaximumClientSessionsPerAuthenticationName)) + { + writer.WritePropertyName("maximumClientSessionsPerAuthenticationName"u8); + writer.WriteNumberValue(MaximumClientSessionsPerAuthenticationName.Value); + } + if (Optional.IsDefined(RoutingIdentityInfo)) + { + writer.WritePropertyName("routingIdentityInfo"u8); + writer.WriteObjectValue(RoutingIdentityInfo); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UpdateTopicSpacesConfigurationInfo.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UpdateTopicSpacesConfigurationInfo.cs new file mode 100644 index 000000000000..05d6f515e84d --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/UpdateTopicSpacesConfigurationInfo.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Properties of the topic spaces configuration info of a namespace. + public partial class UpdateTopicSpacesConfigurationInfo + { + /// Initializes a new instance of UpdateTopicSpacesConfigurationInfo. + public UpdateTopicSpacesConfigurationInfo() + { + } + + /// Indicate if Topic Spaces Configuration is enabled for the namespace. Default is Disabled. + public TopicSpacesConfigurationState? State { get; set; } + /// This property is used to specify custom topic to which events will be routed to from topic spaces configuration under namespace. + public string RouteTopicResourceId { get; set; } + /// Routing enrichments for topic spaces configuration. + public RoutingEnrichments RoutingEnrichments { get; set; } + /// Client authentication settings for topic spaces configuration. + internal ClientAuthenticationSettings ClientAuthentication { get; set; } + /// Alternative authentication name sources related to client authentication settings for namespace resource. + public IList AlternativeAuthenticationNameSources + { + get + { + if (ClientAuthentication is null) + ClientAuthentication = new ClientAuthenticationSettings(); + return ClientAuthentication.AlternativeAuthenticationNameSources; + } + } + + /// + /// The maximum session expiry in hours. The property default value is 1 hour. + /// Min allowed value is 1 hour and max allowed value is 8 hours. + /// + public int? MaximumSessionExpiryInHours { get; set; } + /// + /// The maximum number of sessions per authentication name. The property default value is 1. + /// Min allowed value is 1 and max allowed value is 100. + /// + public int? MaximumClientSessionsPerAuthenticationName { get; set; } + /// Routing identity info for topic spaces configuration. + public RoutingIdentityInfo RoutingIdentityInfo { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/VerifiedPartnerData.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/VerifiedPartnerData.Serialization.cs index 121e9c10aa42..99e3395e1830 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/VerifiedPartnerData.Serialization.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/VerifiedPartnerData.Serialization.cs @@ -40,6 +40,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("partnerTopicDetails"u8); writer.WriteObjectValue(PartnerTopicDetails); } + if (Optional.IsDefined(PartnerDestinationDetails)) + { + writer.WritePropertyName("partnerDestinationDetails"u8); + writer.WriteObjectValue(PartnerDestinationDetails); + } if (Optional.IsDefined(ProvisioningState)) { writer.WritePropertyName("provisioningState"u8); @@ -63,6 +68,7 @@ internal static VerifiedPartnerData DeserializeVerifiedPartnerData(JsonElement e Optional organizationName = default; Optional partnerDisplayName = default; Optional partnerTopicDetails = default; + Optional partnerDestinationDetails = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { @@ -127,6 +133,15 @@ internal static VerifiedPartnerData DeserializeVerifiedPartnerData(JsonElement e partnerTopicDetails = PartnerDetails.DeserializePartnerDetails(property0.Value); continue; } + if (property0.NameEquals("partnerDestinationDetails"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + partnerDestinationDetails = PartnerDetails.DeserializePartnerDetails(property0.Value); + continue; + } if (property0.NameEquals("provisioningState"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -140,7 +155,7 @@ internal static VerifiedPartnerData DeserializeVerifiedPartnerData(JsonElement e continue; } } - return new VerifiedPartnerData(id, name, type, systemData.Value, Optional.ToNullable(partnerRegistrationImmutableId), organizationName.Value, partnerDisplayName.Value, partnerTopicDetails.Value, Optional.ToNullable(provisioningState)); + return new VerifiedPartnerData(id, name, type, systemData.Value, Optional.ToNullable(partnerRegistrationImmutableId), organizationName.Value, partnerDisplayName.Value, partnerTopicDetails.Value, partnerDestinationDetails.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebHookEventSubscriptionDestination.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebHookEventSubscriptionDestination.Serialization.cs index 084e031ebed4..3a1a2ccb1dfe 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebHookEventSubscriptionDestination.Serialization.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebHookEventSubscriptionDestination.Serialization.cs @@ -56,6 +56,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(MinimumTlsVersionAllowed)) + { + writer.WritePropertyName("minimumTlsVersionAllowed"u8); + writer.WriteStringValue(MinimumTlsVersionAllowed.Value.ToString()); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -74,6 +79,7 @@ internal static WebHookEventSubscriptionDestination DeserializeWebHookEventSubsc Optional azureActiveDirectoryTenantId = default; Optional azureActiveDirectoryApplicationIdOrUri = default; Optional> deliveryAttributeMappings = default; + Optional minimumTlsVersionAllowed = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("endpointType"u8)) @@ -154,11 +160,20 @@ internal static WebHookEventSubscriptionDestination DeserializeWebHookEventSubsc deliveryAttributeMappings = array; continue; } + if (property0.NameEquals("minimumTlsVersionAllowed"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minimumTlsVersionAllowed = new TlsVersion(property0.Value.GetString()); + continue; + } } continue; } } - return new WebHookEventSubscriptionDestination(endpointType, endpointUri.Value, endpointBaseUri.Value, Optional.ToNullable(maxEventsPerBatch), Optional.ToNullable(preferredBatchSizeInKilobytes), Optional.ToNullable(azureActiveDirectoryTenantId), azureActiveDirectoryApplicationIdOrUri.Value, Optional.ToList(deliveryAttributeMappings)); + return new WebHookEventSubscriptionDestination(endpointType, endpointUri.Value, endpointBaseUri.Value, Optional.ToNullable(maxEventsPerBatch), Optional.ToNullable(preferredBatchSizeInKilobytes), Optional.ToNullable(azureActiveDirectoryTenantId), azureActiveDirectoryApplicationIdOrUri.Value, Optional.ToList(deliveryAttributeMappings), Optional.ToNullable(minimumTlsVersionAllowed)); } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebHookEventSubscriptionDestination.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebHookEventSubscriptionDestination.cs index 01ad5469daee..6fb7984cd942 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebHookEventSubscriptionDestination.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebHookEventSubscriptionDestination.cs @@ -34,7 +34,8 @@ public WebHookEventSubscriptionDestination() /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// - internal WebHookEventSubscriptionDestination(EndpointType endpointType, Uri endpoint, Uri baseEndpoint, int? maxEventsPerBatch, int? preferredBatchSizeInKilobytes, Guid? azureActiveDirectoryTenantId, string uriOrAzureActiveDirectoryApplicationId, IList deliveryAttributeMappings) : base(endpointType) + /// Minimum TLS version that should be supported by webhook endpoint. + internal WebHookEventSubscriptionDestination(EndpointType endpointType, Uri endpoint, Uri baseEndpoint, int? maxEventsPerBatch, int? preferredBatchSizeInKilobytes, Guid? azureActiveDirectoryTenantId, string uriOrAzureActiveDirectoryApplicationId, IList deliveryAttributeMappings, TlsVersion? minimumTlsVersionAllowed) : base(endpointType) { Endpoint = endpoint; BaseEndpoint = baseEndpoint; @@ -43,6 +44,7 @@ internal WebHookEventSubscriptionDestination(EndpointType endpointType, Uri endp AzureActiveDirectoryTenantId = azureActiveDirectoryTenantId; UriOrAzureActiveDirectoryApplicationId = uriOrAzureActiveDirectoryApplicationId; DeliveryAttributeMappings = deliveryAttributeMappings; + MinimumTlsVersionAllowed = minimumTlsVersionAllowed; EndpointType = endpointType; } @@ -64,5 +66,7 @@ internal WebHookEventSubscriptionDestination(EndpointType endpointType, Uri endp /// The available derived classes include and . /// public IList DeliveryAttributeMappings { get; } + /// Minimum TLS version that should be supported by webhook endpoint. + public TlsVersion? MinimumTlsVersionAllowed { get; set; } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebhookPartnerDestinationInfo.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebhookPartnerDestinationInfo.Serialization.cs new file mode 100644 index 000000000000..0f5442fa15e9 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebhookPartnerDestinationInfo.Serialization.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class WebhookPartnerDestinationInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(AzureSubscriptionId)) + { + writer.WritePropertyName("azureSubscriptionId"u8); + writer.WriteStringValue(AzureSubscriptionId); + } + if (Optional.IsDefined(ResourceGroupName)) + { + writer.WritePropertyName("resourceGroupName"u8); + writer.WriteStringValue(ResourceGroupName); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("endpointType"u8); + writer.WriteStringValue(EndpointType.ToString()); + if (Optional.IsDefined(EndpointServiceContext)) + { + writer.WritePropertyName("endpointServiceContext"u8); + writer.WriteStringValue(EndpointServiceContext); + } + if (Optional.IsCollectionDefined(ResourceMoveChangeHistory)) + { + writer.WritePropertyName("resourceMoveChangeHistory"u8); + writer.WriteStartArray(); + foreach (var item in ResourceMoveChangeHistory) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(EndpointUri)) + { + writer.WritePropertyName("endpointUrl"u8); + writer.WriteStringValue(EndpointUri.AbsoluteUri); + } + if (Optional.IsDefined(EndpointBaseUri)) + { + writer.WritePropertyName("endpointBaseUrl"u8); + writer.WriteStringValue(EndpointBaseUri.AbsoluteUri); + } + if (Optional.IsDefined(ClientAuthentication)) + { + writer.WritePropertyName("clientAuthentication"u8); + writer.WriteObjectValue(ClientAuthentication); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static WebhookPartnerDestinationInfo DeserializeWebhookPartnerDestinationInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional azureSubscriptionId = default; + Optional resourceGroupName = default; + Optional name = default; + PartnerEndpointType endpointType = default; + Optional endpointServiceContext = default; + Optional> resourceMoveChangeHistory = default; + Optional endpointUri = default; + Optional endpointBaseUri = default; + Optional clientAuthentication = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azureSubscriptionId"u8)) + { + azureSubscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGroupName"u8)) + { + resourceGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("endpointType"u8)) + { + endpointType = new PartnerEndpointType(property.Value.GetString()); + continue; + } + if (property.NameEquals("endpointServiceContext"u8)) + { + endpointServiceContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceMoveChangeHistory"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.ResourceMoveChangeHistory.DeserializeResourceMoveChangeHistory(item)); + } + resourceMoveChangeHistory = array; + 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("endpointUrl"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endpointUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("endpointBaseUrl"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endpointBaseUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("clientAuthentication"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clientAuthentication = PartnerClientAuthentication.DeserializePartnerClientAuthentication(property0.Value); + continue; + } + } + continue; + } + } + return new WebhookPartnerDestinationInfo(azureSubscriptionId.Value, resourceGroupName.Value, name.Value, endpointType, endpointServiceContext.Value, Optional.ToList(resourceMoveChangeHistory), endpointUri.Value, endpointBaseUri.Value, clientAuthentication.Value); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebhookPartnerDestinationInfo.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebhookPartnerDestinationInfo.cs new file mode 100644 index 000000000000..3b2a43b6a141 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebhookPartnerDestinationInfo.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Information about the WebHook of the partner destination. + public partial class WebhookPartnerDestinationInfo : PartnerDestinationInfo + { + /// Initializes a new instance of WebhookPartnerDestinationInfo. + public WebhookPartnerDestinationInfo() + { + EndpointType = PartnerEndpointType.WebHook; + } + + /// Initializes a new instance of WebhookPartnerDestinationInfo. + /// + /// Azure subscription ID of the subscriber. The partner destination associated with the channel will be + /// created under this Azure subscription. + /// + /// + /// Azure Resource Group of the subscriber. The partner destination associated with the channel will be + /// created under this resource group. + /// + /// Name of the partner destination associated with the channel. + /// Type of the endpoint for the partner destination. + /// Additional context of the partner destination endpoint. + /// Change history of the resource move. + /// The URL that represents the endpoint of the partner destination. + /// The base URL that represents the endpoint of the partner destination. + /// + /// Partner client authentication + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + internal WebhookPartnerDestinationInfo(string azureSubscriptionId, string resourceGroupName, string name, PartnerEndpointType endpointType, string endpointServiceContext, IList resourceMoveChangeHistory, Uri endpointUri, Uri endpointBaseUri, PartnerClientAuthentication clientAuthentication) : base(azureSubscriptionId, resourceGroupName, name, endpointType, endpointServiceContext, resourceMoveChangeHistory) + { + EndpointUri = endpointUri; + EndpointBaseUri = endpointBaseUri; + ClientAuthentication = clientAuthentication; + EndpointType = endpointType; + } + + /// The URL that represents the endpoint of the partner destination. + public Uri EndpointUri { get; set; } + /// The base URL that represents the endpoint of the partner destination. + public Uri EndpointBaseUri { get; set; } + /// + /// Partner client authentication + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public PartnerClientAuthentication ClientAuthentication { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebhookUpdatePartnerDestinationInfo.Serialization.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebhookUpdatePartnerDestinationInfo.Serialization.cs new file mode 100644 index 000000000000..88b609e30f05 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebhookUpdatePartnerDestinationInfo.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EventGrid.Models +{ + public partial class WebhookUpdatePartnerDestinationInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("endpointType"u8); + writer.WriteStringValue(EndpointType.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(EndpointUri)) + { + writer.WritePropertyName("endpointUrl"u8); + writer.WriteStringValue(EndpointUri.AbsoluteUri); + } + if (Optional.IsDefined(EndpointBaseUri)) + { + writer.WritePropertyName("endpointBaseUrl"u8); + writer.WriteStringValue(EndpointBaseUri.AbsoluteUri); + } + if (Optional.IsDefined(ClientAuthentication)) + { + writer.WritePropertyName("clientAuthentication"u8); + writer.WriteObjectValue(ClientAuthentication); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebhookUpdatePartnerDestinationInfo.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebhookUpdatePartnerDestinationInfo.cs new file mode 100644 index 000000000000..940cbf5a2844 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Models/WebhookUpdatePartnerDestinationInfo.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.EventGrid.Models +{ + /// Information about the update of the WebHook of the partner destination. + public partial class WebhookUpdatePartnerDestinationInfo : PartnerUpdateDestinationInfo + { + /// Initializes a new instance of WebhookUpdatePartnerDestinationInfo. + public WebhookUpdatePartnerDestinationInfo() + { + EndpointType = PartnerEndpointType.WebHook; + } + + /// The URL that represents the endpoint of the partner destination. + public Uri EndpointUri { get; set; } + /// The base URL that represents the endpoint of the partner destination. + public Uri EndpointBaseUri { get; set; } + /// + /// Partner client authentication + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public PartnerClientAuthentication ClientAuthentication { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceCollection.cs new file mode 100644 index 000000000000..7841d353e98b --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceCollection.cs @@ -0,0 +1,345 @@ +// 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.Resources; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// 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 GetNamespaces method from an instance of . + /// + public partial class NamespaceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _namespaceClientDiagnostics; + private readonly NamespacesRestOperations _namespaceRestClient; + + /// Initializes a new instance of the class for mocking. + protected NamespaceCollection() + { + } + + /// 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 NamespaceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _namespaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", NamespaceResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NamespaceResource.ResourceType, out string namespaceApiVersion); + _namespaceRestClient = new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, namespaceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Asynchronously creates or updates a new namespace with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_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. + /// Name of the namespace. + /// Namespace information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string namespaceName, NamespaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _namespaceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, data, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new NamespaceOperationSource(Client), _namespaceClientDiagnostics, Pipeline, _namespaceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Asynchronously creates or updates a new namespace with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_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. + /// Name of the namespace. + /// Namespace information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string namespaceName, NamespaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _namespaceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, data, cancellationToken); + var operation = new EventGridArmOperation(new NamespaceOperationSource(Client), _namespaceClientDiagnostics, Pipeline, _namespaceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// Name of the namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceCollection.Get"); + scope.Start(); + try + { + var response = await _namespaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// Name of the namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceCollection.Get"); + scope.Start(); + try + { + var response = _namespaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all the namespaces under a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces + /// + /// + /// Operation Id + /// Namespaces_ListByResourceGroup + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _namespaceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _namespaceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, top); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NamespaceResource(Client, NamespaceData.DeserializeNamespaceData(e)), _namespaceClientDiagnostics, Pipeline, "NamespaceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List all the namespaces under a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces + /// + /// + /// Operation Id + /// Namespaces_ListByResourceGroup + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _namespaceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _namespaceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, top); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NamespaceResource(Client, NamespaceData.DeserializeNamespaceData(e)), _namespaceClientDiagnostics, Pipeline, "NamespaceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// Name of the namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceCollection.Exists"); + scope.Start(); + try + { + var response = await _namespaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, 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.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// Name of the namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceCollection.Exists"); + scope.Start(); + try + { + var response = _namespaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceData.cs new file mode 100644 index 000000000000..5b62e751c96a --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceData.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// A class representing the Namespace data model. + /// Namespace resource. + /// + public partial class NamespaceData : TrackedResourceData + { + /// Initializes a new instance of NamespaceData. + /// The location. + public NamespaceData(AzureLocation location) : base(location) + { + PrivateEndpointConnections = new ChangeTrackingList(); + InboundIPRules = new ChangeTrackingList(); + } + + /// Initializes a new instance of NamespaceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Represents available Sku pricing tiers. + /// Identity information for the Namespace resource. + /// + /// Provisioning state of the namespace resource. + /// Topics configuration information for the namespace resource. + /// Topic spaces configuration information for the namespace resource. + /// + /// Allows the user to specify if the service is zone-redundant. This is a required property and user needs to specify this value explicitly. + /// Once specified, this property cannot be updated. + /// + /// + /// This determines if traffic is allowed over public network. By default it is enabled. + /// You can further restrict to specific IPs by configuring <seealso cref="P:Microsoft.Azure.Events.ResourceProvider.Common.Contracts.PubSub.NamespaceProperties.InboundIpRules" /> + /// + /// This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + /// Minimum TLS version of the publisher allowed to publish to this namespace. Only TLS version 1.2 is supported. + internal NamespaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NamespaceSku sku, ManagedServiceIdentity identity, IList privateEndpointConnections, NamespaceProvisioningState? provisioningState, TopicsConfiguration topicsConfiguration, TopicSpacesConfiguration topicSpacesConfiguration, bool? isZoneRedundant, EventGridPublicNetworkAccess? publicNetworkAccess, IList inboundIPRules, TlsVersion? minimumTlsVersionAllowed) : base(id, name, resourceType, systemData, tags, location) + { + Sku = sku; + Identity = identity; + PrivateEndpointConnections = privateEndpointConnections; + ProvisioningState = provisioningState; + TopicsConfiguration = topicsConfiguration; + TopicSpacesConfiguration = topicSpacesConfiguration; + IsZoneRedundant = isZoneRedundant; + PublicNetworkAccess = publicNetworkAccess; + InboundIPRules = inboundIPRules; + MinimumTlsVersionAllowed = minimumTlsVersionAllowed; + } + + /// Represents available Sku pricing tiers. + public NamespaceSku Sku { get; set; } + /// Identity information for the Namespace resource. + public ManagedServiceIdentity Identity { get; set; } + /// Gets the private endpoint connections. + public IList PrivateEndpointConnections { get; } + /// Provisioning state of the namespace resource. + public NamespaceProvisioningState? ProvisioningState { get; } + /// Topics configuration information for the namespace resource. + internal TopicsConfiguration TopicsConfiguration { get; set; } + /// The hostname for the topics configuration. This is a read-only property. + public string TopicsHostname + { + get => TopicsConfiguration is null ? default : TopicsConfiguration.Hostname; + } + + /// Topic spaces configuration information for the namespace resource. + public TopicSpacesConfiguration TopicSpacesConfiguration { get; set; } + /// + /// Allows the user to specify if the service is zone-redundant. This is a required property and user needs to specify this value explicitly. + /// Once specified, this property cannot be updated. + /// + public bool? IsZoneRedundant { get; set; } + /// + /// This determines if traffic is allowed over public network. By default it is enabled. + /// You can further restrict to specific IPs by configuring <seealso cref="P:Microsoft.Azure.Events.ResourceProvider.Common.Contracts.PubSub.NamespaceProperties.InboundIpRules" /> + /// + public EventGridPublicNetworkAccess? PublicNetworkAccess { get; set; } + /// This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + public IList InboundIPRules { get; } + /// Minimum TLS version of the publisher allowed to publish to this namespace. Only TLS version 1.2 is supported. + public TlsVersion? MinimumTlsVersionAllowed { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceResource.cs new file mode 100644 index 000000000000..bfb4e33f7cec --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceResource.cs @@ -0,0 +1,1064 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// A Class representing a Namespace 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 GetNamespaceResource method. + /// Otherwise you can get one from its parent resource using the GetNamespace method. + /// + public partial class NamespaceResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _namespaceClientDiagnostics; + private readonly NamespacesRestOperations _namespaceRestClient; + private readonly NamespaceData _data; + + /// Initializes a new instance of the class for mocking. + protected NamespaceResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NamespaceResource(ArmClient client, NamespaceData 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 NamespaceResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _namespaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string namespaceApiVersion); + _namespaceRestClient = new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, namespaceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.EventGrid/namespaces"; + + /// 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 NamespaceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of CaCertificateResources in the Namespace. + /// An object representing collection of CaCertificateResources and their operations over a CaCertificateResource. + public virtual CaCertificateCollection GetCaCertificates() + { + return GetCachedClient(Client => new CaCertificateCollection(Client, Id)); + } + + /// + /// Get properties of a CA certificate. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_Get + /// + /// + /// + /// Name of the CA certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetCaCertificateAsync(string caCertificateName, CancellationToken cancellationToken = default) + { + return await GetCaCertificates().GetAsync(caCertificateName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a CA certificate. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_Get + /// + /// + /// + /// Name of the CA certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetCaCertificate(string caCertificateName, CancellationToken cancellationToken = default) + { + return GetCaCertificates().Get(caCertificateName, cancellationToken); + } + + /// Gets a collection of ClientGroupResources in the Namespace. + /// An object representing collection of ClientGroupResources and their operations over a ClientGroupResource. + public virtual ClientGroupCollection GetClientGroups() + { + return GetCachedClient(Client => new ClientGroupCollection(Client, Id)); + } + + /// + /// Get properties of a client group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_Get + /// + /// + /// + /// Name of the client group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetClientGroupAsync(string clientGroupName, CancellationToken cancellationToken = default) + { + return await GetClientGroups().GetAsync(clientGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a client group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_Get + /// + /// + /// + /// Name of the client group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetClientGroup(string clientGroupName, CancellationToken cancellationToken = default) + { + return GetClientGroups().Get(clientGroupName, cancellationToken); + } + + /// Gets a collection of ClientResources in the Namespace. + /// An object representing collection of ClientResources and their operations over a ClientResource. + public virtual ClientCollection GetClients() + { + return GetCachedClient(Client => new ClientCollection(Client, Id)); + } + + /// + /// Get properties of a client. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_Get + /// + /// + /// + /// Name of the client. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetClientAsync(string clientName, CancellationToken cancellationToken = default) + { + return await GetClients().GetAsync(clientName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a client. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_Get + /// + /// + /// + /// Name of the client. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetClient(string clientName, CancellationToken cancellationToken = default) + { + return GetClients().Get(clientName, cancellationToken); + } + + /// Gets a collection of NamespaceTopicResources in the Namespace. + /// An object representing collection of NamespaceTopicResources and their operations over a NamespaceTopicResource. + public virtual NamespaceTopicCollection GetNamespaceTopics() + { + return GetCachedClient(Client => new NamespaceTopicCollection(Client, Id)); + } + + /// + /// Get properties of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_Get + /// + /// + /// + /// Name of the namespace topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetNamespaceTopicAsync(string topicName, CancellationToken cancellationToken = default) + { + return await GetNamespaceTopics().GetAsync(topicName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_Get + /// + /// + /// + /// Name of the namespace topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetNamespaceTopic(string topicName, CancellationToken cancellationToken = default) + { + return GetNamespaceTopics().Get(topicName, cancellationToken); + } + + /// Gets a collection of PermissionBindingResources in the Namespace. + /// An object representing collection of PermissionBindingResources and their operations over a PermissionBindingResource. + public virtual PermissionBindingCollection GetPermissionBindings() + { + return GetCachedClient(Client => new PermissionBindingCollection(Client, Id)); + } + + /// + /// Get properties of a permission binding. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_Get + /// + /// + /// + /// Name of the permission binding. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetPermissionBindingAsync(string permissionBindingName, CancellationToken cancellationToken = default) + { + return await GetPermissionBindings().GetAsync(permissionBindingName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a permission binding. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_Get + /// + /// + /// + /// Name of the permission binding. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetPermissionBinding(string permissionBindingName, CancellationToken cancellationToken = default) + { + return GetPermissionBindings().Get(permissionBindingName, cancellationToken); + } + + /// Gets a collection of TopicSpaceResources in the Namespace. + /// An object representing collection of TopicSpaceResources and their operations over a TopicSpaceResource. + public virtual TopicSpaceCollection GetTopicSpaces() + { + return GetCachedClient(Client => new TopicSpaceCollection(Client, Id)); + } + + /// + /// Get properties of a topic space. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_Get + /// + /// + /// + /// Name of the Topic space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetTopicSpaceAsync(string topicSpaceName, CancellationToken cancellationToken = default) + { + return await GetTopicSpaces().GetAsync(topicSpaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a topic space. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_Get + /// + /// + /// + /// Name of the Topic space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetTopicSpace(string topicSpaceName, CancellationToken cancellationToken = default) + { + return GetTopicSpaces().Get(topicSpaceName, cancellationToken); + } + + /// + /// Get properties of a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.Get"); + scope.Start(); + try + { + var response = await _namespaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.Get"); + scope.Start(); + try + { + var response = _namespaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete existing namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.Delete"); + scope.Start(); + try + { + var response = await _namespaceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(_namespaceClientDiagnostics, Pipeline, _namespaceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete existing namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.Delete"); + scope.Start(); + try + { + var response = _namespaceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new EventGridArmOperation(_namespaceClientDiagnostics, Pipeline, _namespaceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Asynchronously updates a namespace with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Update + /// + /// + /// + /// 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. + /// Namespace update information. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, NamespacePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.Update"); + scope.Start(); + try + { + var response = await _namespaceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new NamespaceOperationSource(Client), _namespaceClientDiagnostics, Pipeline, _namespaceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Asynchronously updates a namespace with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Update + /// + /// + /// + /// 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. + /// Namespace update information. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, NamespacePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.Update"); + scope.Start(); + try + { + var response = _namespaceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new EventGridArmOperation(new NamespaceOperationSource(Client), _namespaceClientDiagnostics, Pipeline, _namespaceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List the two keys used to publish to a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/listKeys + /// + /// + /// Operation Id + /// Namespaces_ListSharedAccessKeys + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetSharedAccessKeysAsync(CancellationToken cancellationToken = default) + { + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.GetSharedAccessKeys"); + scope.Start(); + try + { + var response = await _namespaceRestClient.ListSharedAccessKeysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List the two keys used to publish to a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/listKeys + /// + /// + /// Operation Id + /// Namespaces_ListSharedAccessKeys + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetSharedAccessKeys(CancellationToken cancellationToken = default) + { + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.GetSharedAccessKeys"); + scope.Start(); + try + { + var response = _namespaceRestClient.ListSharedAccessKeys(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerate a shared access key for a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/regenerateKey + /// + /// + /// Operation Id + /// Namespaces_RegenerateKey + /// + /// + /// + /// 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. + /// Request body to regenerate key. + /// The cancellation token to use. + /// is null. + public virtual async Task> RegenerateKeyAsync(WaitUntil waitUntil, NamespaceRegenerateKeyContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.RegenerateKey"); + scope.Start(); + try + { + var response = await _namespaceRestClient.RegenerateKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new NamespaceSharedAccessKeysOperationSource(), _namespaceClientDiagnostics, Pipeline, _namespaceRestClient.CreateRegenerateKeyRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerate a shared access key for a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/regenerateKey + /// + /// + /// Operation Id + /// Namespaces_RegenerateKey + /// + /// + /// + /// 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. + /// Request body to regenerate key. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation RegenerateKey(WaitUntil waitUntil, NamespaceRegenerateKeyContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.RegenerateKey"); + scope.Start(); + try + { + var response = _namespaceRestClient.RegenerateKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new EventGridArmOperation(new NamespaceSharedAccessKeysOperationSource(), _namespaceClientDiagnostics, Pipeline, _namespaceRestClient.CreateRegenerateKeyRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _namespaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NamespaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new NamespacePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _namespaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new NamespaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new NamespacePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _namespaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NamespaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new NamespacePatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _namespaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new NamespaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new NamespacePatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _namespaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NamespaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new NamespacePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _namespaceClientDiagnostics.CreateScope("NamespaceResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _namespaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new NamespaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new NamespacePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicCollection.cs new file mode 100644 index 000000000000..a55f15cbca19 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicCollection.cs @@ -0,0 +1,344 @@ +// 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; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// 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 GetNamespaceTopics method from an instance of . + /// + public partial class NamespaceTopicCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _namespaceTopicClientDiagnostics; + private readonly NamespaceTopicsRestOperations _namespaceTopicRestClient; + + /// Initializes a new instance of the class for mocking. + protected NamespaceTopicCollection() + { + } + + /// 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 NamespaceTopicCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _namespaceTopicClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", NamespaceTopicResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NamespaceTopicResource.ResourceType, out string namespaceTopicApiVersion); + _namespaceTopicRestClient = new NamespaceTopicsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, namespaceTopicApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NamespaceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NamespaceResource.ResourceType), nameof(id)); + } + + /// + /// Asynchronously creates a new namespace topic with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_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. + /// Name of the namespace topic. + /// Namespace topic information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string topicName, NamespaceTopicData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _namespaceTopicRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicName, data, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new NamespaceTopicOperationSource(Client), _namespaceTopicClientDiagnostics, Pipeline, _namespaceTopicRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Asynchronously creates a new namespace topic with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_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. + /// Name of the namespace topic. + /// Namespace topic information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string topicName, NamespaceTopicData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _namespaceTopicRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicName, data, cancellationToken); + var operation = new EventGridArmOperation(new NamespaceTopicOperationSource(Client), _namespaceTopicClientDiagnostics, Pipeline, _namespaceTopicRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_Get + /// + /// + /// + /// Name of the namespace topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicCollection.Get"); + scope.Start(); + try + { + var response = await _namespaceTopicRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceTopicResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_Get + /// + /// + /// + /// Name of the namespace topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicCollection.Get"); + scope.Start(); + try + { + var response = _namespaceTopicRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceTopicResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all the namespace topics under a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics + /// + /// + /// Operation Id + /// NamespaceTopics_ListByNamespace + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _namespaceTopicRestClient.CreateListByNamespaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _namespaceTopicRestClient.CreateListByNamespaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NamespaceTopicResource(Client, NamespaceTopicData.DeserializeNamespaceTopicData(e)), _namespaceTopicClientDiagnostics, Pipeline, "NamespaceTopicCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List all the namespace topics under a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics + /// + /// + /// Operation Id + /// NamespaceTopics_ListByNamespace + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _namespaceTopicRestClient.CreateListByNamespaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _namespaceTopicRestClient.CreateListByNamespaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NamespaceTopicResource(Client, NamespaceTopicData.DeserializeNamespaceTopicData(e)), _namespaceTopicClientDiagnostics, Pipeline, "NamespaceTopicCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_Get + /// + /// + /// + /// Name of the namespace topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicCollection.Exists"); + scope.Start(); + try + { + var response = await _namespaceTopicRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicName, 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.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_Get + /// + /// + /// + /// Name of the namespace topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicCollection.Exists"); + scope.Start(); + try + { + var response = _namespaceTopicRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicName, 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicData.cs new file mode 100644 index 000000000000..be8b4d58e09f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicData.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// A class representing the NamespaceTopic data model. + /// Namespace topic details. + /// + public partial class NamespaceTopicData : ResourceData + { + /// Initializes a new instance of NamespaceTopicData. + public NamespaceTopicData() + { + } + + /// Initializes a new instance of NamespaceTopicData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Provisioning state of the namespace topic. + /// Publisher type of the namespace topic. + /// This determines the format that is expected for incoming events published to the topic. + /// + /// Event retention for the namespace topic expressed in days. The property default value is 1 day. + /// Min event retention duration value is 1 day and max event retention duration value is 1 day. + /// + internal NamespaceTopicData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, NamespaceTopicProvisioningState? provisioningState, PublisherType? publisherType, EventInputSchema? inputSchema, int? eventRetentionInDays) : base(id, name, resourceType, systemData) + { + ProvisioningState = provisioningState; + PublisherType = publisherType; + InputSchema = inputSchema; + EventRetentionInDays = eventRetentionInDays; + } + + /// Provisioning state of the namespace topic. + public NamespaceTopicProvisioningState? ProvisioningState { get; } + /// Publisher type of the namespace topic. + public PublisherType? PublisherType { get; set; } + /// This determines the format that is expected for incoming events published to the topic. + public EventInputSchema? InputSchema { get; set; } + /// + /// Event retention for the namespace topic expressed in days. The property default value is 1 day. + /// Min event retention duration value is 1 day and max event retention duration value is 1 day. + /// + public int? EventRetentionInDays { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicResource.cs new file mode 100644 index 000000000000..c82d494f4bfe --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicResource.cs @@ -0,0 +1,487 @@ +// 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.EventGrid.Models; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// A Class representing a NamespaceTopic 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 GetNamespaceTopicResource method. + /// Otherwise you can get one from its parent resource using the GetNamespaceTopic method. + /// + public partial class NamespaceTopicResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string topicName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _namespaceTopicClientDiagnostics; + private readonly NamespaceTopicsRestOperations _namespaceTopicRestClient; + private readonly NamespaceTopicData _data; + + /// Initializes a new instance of the class for mocking. + protected NamespaceTopicResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NamespaceTopicResource(ArmClient client, NamespaceTopicData 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 NamespaceTopicResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _namespaceTopicClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string namespaceTopicApiVersion); + _namespaceTopicRestClient = new NamespaceTopicsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, namespaceTopicApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.EventGrid/namespaces/topics"; + + /// 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 NamespaceTopicData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of SubscriptionResources in the NamespaceTopic. + /// An object representing collection of SubscriptionResources and their operations over a SubscriptionResource. + public virtual SubscriptionCollection GetSubscriptions() + { + return GetCachedClient(Client => new SubscriptionCollection(Client, Id)); + } + + /// + /// Get properties of an event subscription of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetSubscriptionAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + return await GetSubscriptions().GetAsync(eventSubscriptionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of an event subscription of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetSubscription(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + return GetSubscriptions().Get(eventSubscriptionName, cancellationToken); + } + + /// + /// Get properties of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicResource.Get"); + scope.Start(); + try + { + var response = await _namespaceTopicRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceTopicResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicResource.Get"); + scope.Start(); + try + { + var response = _namespaceTopicRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NamespaceTopicResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete existing namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicResource.Delete"); + scope.Start(); + try + { + var response = await _namespaceTopicRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(_namespaceTopicClientDiagnostics, Pipeline, _namespaceTopicRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete existing namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicResource.Delete"); + scope.Start(); + try + { + var response = _namespaceTopicRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new EventGridArmOperation(_namespaceTopicClientDiagnostics, Pipeline, _namespaceTopicRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Asynchronously updates a namespace topic with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_Update + /// + /// + /// + /// 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. + /// Namespace topic update information. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, NamespaceTopicPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicResource.Update"); + scope.Start(); + try + { + var response = await _namespaceTopicRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new NamespaceTopicOperationSource(Client), _namespaceTopicClientDiagnostics, Pipeline, _namespaceTopicRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Asynchronously updates a namespace topic with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_Update + /// + /// + /// + /// 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. + /// Namespace topic update information. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, NamespaceTopicPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicResource.Update"); + scope.Start(); + try + { + var response = _namespaceTopicRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); + var operation = new EventGridArmOperation(new NamespaceTopicOperationSource(Client), _namespaceTopicClientDiagnostics, Pipeline, _namespaceTopicRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List the two keys used to publish to a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/listKeys + /// + /// + /// Operation Id + /// NamespaceTopics_ListSharedAccessKeys + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetSharedAccessKeysAsync(CancellationToken cancellationToken = default) + { + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicResource.GetSharedAccessKeys"); + scope.Start(); + try + { + var response = await _namespaceTopicRestClient.ListSharedAccessKeysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List the two keys used to publish to a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/listKeys + /// + /// + /// Operation Id + /// NamespaceTopics_ListSharedAccessKeys + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetSharedAccessKeys(CancellationToken cancellationToken = default) + { + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicResource.GetSharedAccessKeys"); + scope.Start(); + try + { + var response = _namespaceTopicRestClient.ListSharedAccessKeys(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerate a shared access key for a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/regenerateKey + /// + /// + /// Operation Id + /// NamespaceTopics_RegenerateKey + /// + /// + /// + /// 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. + /// Request body to regenerate key. + /// The cancellation token to use. + /// is null. + public virtual async Task> RegenerateKeyAsync(WaitUntil waitUntil, TopicRegenerateKeyRequest regenerateKeyRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(regenerateKeyRequest, nameof(regenerateKeyRequest)); + + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicResource.RegenerateKey"); + scope.Start(); + try + { + var response = await _namespaceTopicRestClient.RegenerateKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, regenerateKeyRequest, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new TopicSharedAccessKeysOperationSource(), _namespaceTopicClientDiagnostics, Pipeline, _namespaceTopicRestClient.CreateRegenerateKeyRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, regenerateKeyRequest).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerate a shared access key for a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/regenerateKey + /// + /// + /// Operation Id + /// NamespaceTopics_RegenerateKey + /// + /// + /// + /// 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. + /// Request body to regenerate key. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation RegenerateKey(WaitUntil waitUntil, TopicRegenerateKeyRequest regenerateKeyRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(regenerateKeyRequest, nameof(regenerateKeyRequest)); + + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicResource.RegenerateKey"); + scope.Start(); + try + { + var response = _namespaceTopicRestClient.RegenerateKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, regenerateKeyRequest, cancellationToken); + var operation = new EventGridArmOperation(new TopicSharedAccessKeysOperationSource(), _namespaceTopicClientDiagnostics, Pipeline, _namespaceTopicRestClient.CreateRegenerateKeyRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, regenerateKeyRequest).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationCollection.cs new file mode 100644 index 000000000000..26f82f66379f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationCollection.cs @@ -0,0 +1,345 @@ +// 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.Resources; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// 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 GetPartnerDestinations method from an instance of . + /// + public partial class PartnerDestinationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _partnerDestinationClientDiagnostics; + private readonly PartnerDestinationsRestOperations _partnerDestinationRestClient; + + /// Initializes a new instance of the class for mocking. + protected PartnerDestinationCollection() + { + } + + /// 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 PartnerDestinationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _partnerDestinationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", PartnerDestinationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(PartnerDestinationResource.ResourceType, out string partnerDestinationApiVersion); + _partnerDestinationRestClient = new PartnerDestinationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, partnerDestinationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Asynchronously creates a new partner destination with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_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. + /// Name of the partner destination. + /// Partner destination create information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string partnerDestinationName, PartnerDestinationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _partnerDestinationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, partnerDestinationName, data, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new PartnerDestinationOperationSource(Client), _partnerDestinationClientDiagnostics, Pipeline, _partnerDestinationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, partnerDestinationName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Asynchronously creates a new partner destination with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_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. + /// Name of the partner destination. + /// Partner destination create information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string partnerDestinationName, PartnerDestinationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _partnerDestinationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, partnerDestinationName, data, cancellationToken); + var operation = new EventGridArmOperation(new PartnerDestinationOperationSource(Client), _partnerDestinationClientDiagnostics, Pipeline, _partnerDestinationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, partnerDestinationName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a partner destination. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// Name of the partner destination. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string partnerDestinationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationCollection.Get"); + scope.Start(); + try + { + var response = await _partnerDestinationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, partnerDestinationName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PartnerDestinationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a partner destination. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// Name of the partner destination. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string partnerDestinationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationCollection.Get"); + scope.Start(); + try + { + var response = _partnerDestinationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, partnerDestinationName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PartnerDestinationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all the partner destinations under a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations + /// + /// + /// Operation Id + /// PartnerDestinations_ListByResourceGroup + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _partnerDestinationRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _partnerDestinationRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, top); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PartnerDestinationResource(Client, PartnerDestinationData.DeserializePartnerDestinationData(e)), _partnerDestinationClientDiagnostics, Pipeline, "PartnerDestinationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List all the partner destinations under a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations + /// + /// + /// Operation Id + /// PartnerDestinations_ListByResourceGroup + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _partnerDestinationRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _partnerDestinationRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, top); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PartnerDestinationResource(Client, PartnerDestinationData.DeserializePartnerDestinationData(e)), _partnerDestinationClientDiagnostics, Pipeline, "PartnerDestinationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// Name of the partner destination. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string partnerDestinationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationCollection.Exists"); + scope.Start(); + try + { + var response = await _partnerDestinationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, partnerDestinationName, 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.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// Name of the partner destination. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string partnerDestinationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationCollection.Exists"); + scope.Start(); + try + { + var response = _partnerDestinationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, partnerDestinationName, 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationData.cs new file mode 100644 index 000000000000..b61f2490d0c8 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationData.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// A class representing the PartnerDestination data model. + /// Event Grid Partner Destination. + /// + public partial class PartnerDestinationData : TrackedResourceData + { + /// Initializes a new instance of PartnerDestinationData. + /// The location. + public PartnerDestinationData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of PartnerDestinationData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The immutable Id of the corresponding partner registration. + /// Endpoint context associated with this partner destination. + /// + /// Expiration time of the partner destination. If this timer expires and the partner destination was never activated, + /// the partner destination and corresponding channel are deleted. + /// + /// Provisioning state of the partner destination. + /// Activation state of the partner destination. + /// Endpoint Base URL of the partner destination. + /// Context or helpful message that can be used during the approval process. + internal PartnerDestinationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, Guid? partnerRegistrationImmutableId, string endpointServiceContext, DateTimeOffset? expirationTimeIfNotActivatedUtc, PartnerDestinationProvisioningState? provisioningState, PartnerDestinationActivationState? activationState, Uri endpointBaseUri, string messageForActivation) : base(id, name, resourceType, systemData, tags, location) + { + PartnerRegistrationImmutableId = partnerRegistrationImmutableId; + EndpointServiceContext = endpointServiceContext; + ExpirationTimeIfNotActivatedUtc = expirationTimeIfNotActivatedUtc; + ProvisioningState = provisioningState; + ActivationState = activationState; + EndpointBaseUri = endpointBaseUri; + MessageForActivation = messageForActivation; + } + + /// The immutable Id of the corresponding partner registration. + public Guid? PartnerRegistrationImmutableId { get; set; } + /// Endpoint context associated with this partner destination. + public string EndpointServiceContext { get; set; } + /// + /// Expiration time of the partner destination. If this timer expires and the partner destination was never activated, + /// the partner destination and corresponding channel are deleted. + /// + public DateTimeOffset? ExpirationTimeIfNotActivatedUtc { get; set; } + /// Provisioning state of the partner destination. + public PartnerDestinationProvisioningState? ProvisioningState { get; } + /// Activation state of the partner destination. + public PartnerDestinationActivationState? ActivationState { get; set; } + /// Endpoint Base URL of the partner destination. + public Uri EndpointBaseUri { get; set; } + /// Context or helpful message that can be used during the approval process. + public string MessageForActivation { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationResource.cs new file mode 100644 index 000000000000..7c1c4c5cb994 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationResource.cs @@ -0,0 +1,670 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// A Class representing a PartnerDestination 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 GetPartnerDestinationResource method. + /// Otherwise you can get one from its parent resource using the GetPartnerDestination method. + /// + public partial class PartnerDestinationResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string partnerDestinationName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _partnerDestinationClientDiagnostics; + private readonly PartnerDestinationsRestOperations _partnerDestinationRestClient; + private readonly PartnerDestinationData _data; + + /// Initializes a new instance of the class for mocking. + protected PartnerDestinationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal PartnerDestinationResource(ArmClient client, PartnerDestinationData 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 PartnerDestinationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _partnerDestinationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string partnerDestinationApiVersion); + _partnerDestinationRestClient = new PartnerDestinationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, partnerDestinationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.EventGrid/partnerDestinations"; + + /// 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 PartnerDestinationData 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)); + } + + /// + /// Get properties of a partner destination. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationResource.Get"); + scope.Start(); + try + { + var response = await _partnerDestinationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PartnerDestinationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a partner destination. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationResource.Get"); + scope.Start(); + try + { + var response = _partnerDestinationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PartnerDestinationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete existing partner destination. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationResource.Delete"); + scope.Start(); + try + { + var response = await _partnerDestinationRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(_partnerDestinationClientDiagnostics, Pipeline, _partnerDestinationRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete existing partner destination. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationResource.Delete"); + scope.Start(); + try + { + var response = _partnerDestinationRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new EventGridArmOperation(_partnerDestinationClientDiagnostics, Pipeline, _partnerDestinationRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Asynchronously updates a partner destination with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Update + /// + /// + /// + /// 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. + /// Partner destination update information. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PartnerDestinationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationResource.Update"); + scope.Start(); + try + { + var response = await _partnerDestinationRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new PartnerDestinationOperationSource(Client), _partnerDestinationClientDiagnostics, Pipeline, _partnerDestinationRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Asynchronously updates a partner destination with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Update + /// + /// + /// + /// 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. + /// Partner destination update information. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PartnerDestinationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationResource.Update"); + scope.Start(); + try + { + var response = _partnerDestinationRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new EventGridArmOperation(new PartnerDestinationOperationSource(Client), _partnerDestinationClientDiagnostics, Pipeline, _partnerDestinationRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Activate a newly created partner destination. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}/activate + /// + /// + /// Operation Id + /// PartnerDestinations_Activate + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> ActivateAsync(CancellationToken cancellationToken = default) + { + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationResource.Activate"); + scope.Start(); + try + { + var response = await _partnerDestinationRestClient.ActivateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PartnerDestinationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Activate a newly created partner destination. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}/activate + /// + /// + /// Operation Id + /// PartnerDestinations_Activate + /// + /// + /// + /// The cancellation token to use. + public virtual Response Activate(CancellationToken cancellationToken = default) + { + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationResource.Activate"); + scope.Start(); + try + { + var response = _partnerDestinationRestClient.Activate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PartnerDestinationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _partnerDestinationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PartnerDestinationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new PartnerDestinationPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _partnerDestinationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PartnerDestinationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new PartnerDestinationPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _partnerDestinationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PartnerDestinationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new PartnerDestinationPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _partnerDestinationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PartnerDestinationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new PartnerDestinationPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _partnerDestinationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PartnerDestinationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new PartnerDestinationPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _partnerDestinationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PartnerDestinationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new PartnerDestinationPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceChannelData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceChannelData.cs index 18bfcd79b600..b2e03bc0562e 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceChannelData.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceChannelData.cs @@ -30,6 +30,11 @@ public PartnerNamespaceChannelData() /// The systemData. /// The type of the event channel which represents the direction flow of events. /// This property should be populated when channelType is PartnerTopic and represents information about the partner topic resource corresponding to the channel. + /// + /// This property should be populated when channelType is PartnerDestination and represents information about the partner destination resource corresponding to the channel. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// /// Context or helpful message that can be used during the approval process by the subscriber. /// Provisioning state of the channel. /// The readiness state of the corresponding partner topic. @@ -37,10 +42,11 @@ public PartnerNamespaceChannelData() /// Expiration time of the channel. If this timer expires while the corresponding partner topic is never activated, /// the channel and corresponding partner topic are deleted. /// - internal PartnerNamespaceChannelData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PartnerNamespaceChannelType? channelType, PartnerTopicInfo partnerTopicInfo, string messageForActivation, PartnerNamespaceChannelProvisioningState? provisioningState, PartnerTopicReadinessState? readinessState, DateTimeOffset? expireOnIfNotActivated) : base(id, name, resourceType, systemData) + internal PartnerNamespaceChannelData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PartnerNamespaceChannelType? channelType, PartnerTopicInfo partnerTopicInfo, PartnerDestinationInfo partnerDestinationInfo, string messageForActivation, PartnerNamespaceChannelProvisioningState? provisioningState, PartnerTopicReadinessState? readinessState, DateTimeOffset? expireOnIfNotActivated) : base(id, name, resourceType, systemData) { ChannelType = channelType; PartnerTopicInfo = partnerTopicInfo; + PartnerDestinationInfo = partnerDestinationInfo; MessageForActivation = messageForActivation; ProvisioningState = provisioningState; ReadinessState = readinessState; @@ -51,6 +57,12 @@ internal PartnerNamespaceChannelData(ResourceIdentifier id, string name, Resourc public PartnerNamespaceChannelType? ChannelType { get; set; } /// This property should be populated when channelType is PartnerTopic and represents information about the partner topic resource corresponding to the channel. public PartnerTopicInfo PartnerTopicInfo { get; set; } + /// + /// This property should be populated when channelType is PartnerDestination and represents information about the partner destination resource corresponding to the channel. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public PartnerDestinationInfo PartnerDestinationInfo { get; set; } /// Context or helpful message that can be used during the approval process by the subscriber. public string MessageForActivation { get; set; } /// Provisioning state of the channel. diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceData.cs index b69a61f13c92..bca2da5af413 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceData.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceData.cs @@ -40,6 +40,7 @@ public PartnerNamespaceData(AzureLocation location) : base(location) /// The fully qualified ARM Id of the partner registration that should be associated with this partner namespace. This takes the following format: /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}. /// + /// Minimum TLS version of the publisher allowed to publish to this partner namespace. /// Endpoint for the partner namespace. /// /// This determines if traffic is allowed over public network. By default it is enabled. @@ -51,11 +52,12 @@ public PartnerNamespaceData(AzureLocation location) : base(location) /// This determines if events published to this partner namespace should use the source attribute in the event payload /// or use the channel name in the header when matching to the partner topic. If none is specified, source attribute routing will be used to match the partner topic. /// - internal PartnerNamespaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IReadOnlyList privateEndpointConnections, PartnerNamespaceProvisioningState? provisioningState, ResourceIdentifier partnerRegistrationFullyQualifiedId, Uri endpoint, EventGridPublicNetworkAccess? publicNetworkAccess, IList inboundIPRules, bool? isLocalAuthDisabled, PartnerTopicRoutingMode? partnerTopicRoutingMode) : base(id, name, resourceType, systemData, tags, location) + internal PartnerNamespaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IReadOnlyList privateEndpointConnections, PartnerNamespaceProvisioningState? provisioningState, ResourceIdentifier partnerRegistrationFullyQualifiedId, TlsVersion? minimumTlsVersionAllowed, Uri endpoint, EventGridPublicNetworkAccess? publicNetworkAccess, IList inboundIPRules, bool? isLocalAuthDisabled, PartnerTopicRoutingMode? partnerTopicRoutingMode) : base(id, name, resourceType, systemData, tags, location) { PrivateEndpointConnections = privateEndpointConnections; ProvisioningState = provisioningState; PartnerRegistrationFullyQualifiedId = partnerRegistrationFullyQualifiedId; + MinimumTlsVersionAllowed = minimumTlsVersionAllowed; Endpoint = endpoint; PublicNetworkAccess = publicNetworkAccess; InboundIPRules = inboundIPRules; @@ -72,6 +74,8 @@ internal PartnerNamespaceData(ResourceIdentifier id, string name, ResourceType r /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}. /// public ResourceIdentifier PartnerRegistrationFullyQualifiedId { get; set; } + /// Minimum TLS version of the publisher allowed to publish to this partner namespace. + public TlsVersion? MinimumTlsVersionAllowed { get; set; } /// Endpoint for the partner namespace. public Uri Endpoint { get; } /// diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespacePrivateLinkResourceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespacePrivateLinkResourceCollection.cs index 702d4a380089..ba9c74f60fbc 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespacePrivateLinkResourceCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespacePrivateLinkResourceCollection.cs @@ -66,7 +66,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -103,7 +103,7 @@ public virtual async Task> GetAsyn /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -128,7 +128,7 @@ public virtual Response Get(string privateL } /// - /// List all the private link resources under a topic, domain, or partner namespace. + /// List all the private link resources under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -152,7 +152,7 @@ public virtual AsyncPageable GetAllAsync(st } /// - /// List all the private link resources under a topic, domain, or partner namespace. + /// List all the private link resources under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -188,7 +188,7 @@ public virtual Pageable GetAll(string filte /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -223,7 +223,7 @@ public virtual async Task> ExistsAsync(string privateLinkResource /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceResource.cs index 25392e7531f5..eca2ad2a02e8 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceResource.cs @@ -150,7 +150,7 @@ public virtual EventGridPartnerNamespacePrivateEndpointConnectionCollection GetE } /// - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -173,7 +173,7 @@ public virtual async Task - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// /// /// Request Path @@ -215,7 +215,7 @@ public virtual PartnerNamespacePrivateLinkResourceCollection GetPartnerNamespace /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -238,7 +238,7 @@ public virtual async Task> GetPart /// /// /// - /// The name of private link resource. + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PermissionBindingCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PermissionBindingCollection.cs new file mode 100644 index 000000000000..aa2ae2ab544e --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PermissionBindingCollection.cs @@ -0,0 +1,344 @@ +// 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; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// 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 GetPermissionBindings method from an instance of . + /// + public partial class PermissionBindingCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _permissionBindingClientDiagnostics; + private readonly PermissionBindingsRestOperations _permissionBindingRestClient; + + /// Initializes a new instance of the class for mocking. + protected PermissionBindingCollection() + { + } + + /// 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 PermissionBindingCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _permissionBindingClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", PermissionBindingResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(PermissionBindingResource.ResourceType, out string permissionBindingApiVersion); + _permissionBindingRestClient = new PermissionBindingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, permissionBindingApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NamespaceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NamespaceResource.ResourceType), nameof(id)); + } + + /// + /// Create or update a permission binding with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_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 permission binding name. + /// Permission binding information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string permissionBindingName, PermissionBindingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(permissionBindingName, nameof(permissionBindingName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _permissionBindingClientDiagnostics.CreateScope("PermissionBindingCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _permissionBindingRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, permissionBindingName, data, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new PermissionBindingOperationSource(Client), _permissionBindingClientDiagnostics, Pipeline, _permissionBindingRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, permissionBindingName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a permission binding with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_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 permission binding name. + /// Permission binding information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string permissionBindingName, PermissionBindingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(permissionBindingName, nameof(permissionBindingName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _permissionBindingClientDiagnostics.CreateScope("PermissionBindingCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _permissionBindingRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, permissionBindingName, data, cancellationToken); + var operation = new EventGridArmOperation(new PermissionBindingOperationSource(Client), _permissionBindingClientDiagnostics, Pipeline, _permissionBindingRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, permissionBindingName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a permission binding. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_Get + /// + /// + /// + /// Name of the permission binding. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string permissionBindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(permissionBindingName, nameof(permissionBindingName)); + + using var scope = _permissionBindingClientDiagnostics.CreateScope("PermissionBindingCollection.Get"); + scope.Start(); + try + { + var response = await _permissionBindingRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, permissionBindingName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PermissionBindingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a permission binding. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_Get + /// + /// + /// + /// Name of the permission binding. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string permissionBindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(permissionBindingName, nameof(permissionBindingName)); + + using var scope = _permissionBindingClientDiagnostics.CreateScope("PermissionBindingCollection.Get"); + scope.Start(); + try + { + var response = _permissionBindingRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, permissionBindingName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PermissionBindingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get all the permission bindings under a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings + /// + /// + /// Operation Id + /// PermissionBindings_ListByNamespace + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _permissionBindingRestClient.CreateListByNamespaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _permissionBindingRestClient.CreateListByNamespaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PermissionBindingResource(Client, PermissionBindingData.DeserializePermissionBindingData(e)), _permissionBindingClientDiagnostics, Pipeline, "PermissionBindingCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get all the permission bindings under a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings + /// + /// + /// Operation Id + /// PermissionBindings_ListByNamespace + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _permissionBindingRestClient.CreateListByNamespaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _permissionBindingRestClient.CreateListByNamespaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PermissionBindingResource(Client, PermissionBindingData.DeserializePermissionBindingData(e)), _permissionBindingClientDiagnostics, Pipeline, "PermissionBindingCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_Get + /// + /// + /// + /// Name of the permission binding. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string permissionBindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(permissionBindingName, nameof(permissionBindingName)); + + using var scope = _permissionBindingClientDiagnostics.CreateScope("PermissionBindingCollection.Exists"); + scope.Start(); + try + { + var response = await _permissionBindingRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, permissionBindingName, 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.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_Get + /// + /// + /// + /// Name of the permission binding. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string permissionBindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(permissionBindingName, nameof(permissionBindingName)); + + using var scope = _permissionBindingClientDiagnostics.CreateScope("PermissionBindingCollection.Exists"); + scope.Start(); + try + { + var response = _permissionBindingRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, permissionBindingName, 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PermissionBindingData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PermissionBindingData.cs new file mode 100644 index 000000000000..15b4224d4347 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PermissionBindingData.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// A class representing the PermissionBinding data model. + /// The Permission binding resource. + /// + public partial class PermissionBindingData : ResourceData + { + /// Initializes a new instance of PermissionBindingData. + public PermissionBindingData() + { + } + + /// Initializes a new instance of PermissionBindingData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Description for the Permission Binding resource. + /// + /// The name of the Topic Space resource that the permission is bound to. + /// The Topic space needs to be a resource under the same namespace the permission binding is a part of. + /// + /// The allowed permission. + /// + /// The name of the client group resource that the permission is bound to. + /// The client group needs to be a resource under the same namespace the permission binding is a part of. + /// + /// Provisioning state of the PermissionBinding resource. + internal PermissionBindingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string topicSpaceName, PermissionType? permission, string clientGroupName, PermissionBindingProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + { + Description = description; + TopicSpaceName = topicSpaceName; + Permission = permission; + ClientGroupName = clientGroupName; + ProvisioningState = provisioningState; + } + + /// Description for the Permission Binding resource. + public string Description { get; set; } + /// + /// The name of the Topic Space resource that the permission is bound to. + /// The Topic space needs to be a resource under the same namespace the permission binding is a part of. + /// + public string TopicSpaceName { get; set; } + /// The allowed permission. + public PermissionType? Permission { get; set; } + /// + /// The name of the client group resource that the permission is bound to. + /// The client group needs to be a resource under the same namespace the permission binding is a part of. + /// + public string ClientGroupName { get; set; } + /// Provisioning state of the PermissionBinding resource. + public PermissionBindingProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PermissionBindingResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PermissionBindingResource.cs new file mode 100644 index 000000000000..c0f555aaaa87 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PermissionBindingResource.cs @@ -0,0 +1,297 @@ +// 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.EventGrid +{ + /// + /// A Class representing a PermissionBinding 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 GetPermissionBindingResource method. + /// Otherwise you can get one from its parent resource using the GetPermissionBinding method. + /// + public partial class PermissionBindingResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string permissionBindingName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _permissionBindingClientDiagnostics; + private readonly PermissionBindingsRestOperations _permissionBindingRestClient; + private readonly PermissionBindingData _data; + + /// Initializes a new instance of the class for mocking. + protected PermissionBindingResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal PermissionBindingResource(ArmClient client, PermissionBindingData 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 PermissionBindingResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _permissionBindingClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string permissionBindingApiVersion); + _permissionBindingRestClient = new PermissionBindingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, permissionBindingApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.EventGrid/namespaces/permissionBindings"; + + /// 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 PermissionBindingData 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)); + } + + /// + /// Get properties of a permission binding. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _permissionBindingClientDiagnostics.CreateScope("PermissionBindingResource.Get"); + scope.Start(); + try + { + var response = await _permissionBindingRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PermissionBindingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a permission binding. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _permissionBindingClientDiagnostics.CreateScope("PermissionBindingResource.Get"); + scope.Start(); + try + { + var response = _permissionBindingRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PermissionBindingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete an existing permission binding. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _permissionBindingClientDiagnostics.CreateScope("PermissionBindingResource.Delete"); + scope.Start(); + try + { + var response = await _permissionBindingRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(_permissionBindingClientDiagnostics, Pipeline, _permissionBindingRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete an existing permission binding. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _permissionBindingClientDiagnostics.CreateScope("PermissionBindingResource.Delete"); + scope.Start(); + try + { + var response = _permissionBindingRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new EventGridArmOperation(_permissionBindingClientDiagnostics, Pipeline, _permissionBindingRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a permission binding with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_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. + /// Permission binding information. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PermissionBindingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _permissionBindingClientDiagnostics.CreateScope("PermissionBindingResource.Update"); + scope.Start(); + try + { + var response = await _permissionBindingRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new PermissionBindingOperationSource(Client), _permissionBindingClientDiagnostics, Pipeline, _permissionBindingRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a permission binding with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_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. + /// Permission binding information. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PermissionBindingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _permissionBindingClientDiagnostics.CreateScope("PermissionBindingResource.Update"); + scope.Start(); + try + { + var response = _permissionBindingRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new EventGridArmOperation(new PermissionBindingOperationSource(Client), _permissionBindingClientDiagnostics, Pipeline, _permissionBindingRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/CaCertificatesRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/CaCertificatesRestOperations.cs new file mode 100644 index 000000000000..337c7e737527 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/CaCertificatesRestOperations.cs @@ -0,0 +1,461 @@ +// 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.EventGrid.Models; + +namespace Azure.ResourceManager.EventGrid +{ + internal partial class CaCertificatesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of CaCertificatesRestOperations. + /// 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 CaCertificatesRestOperations(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-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string namespaceName, string caCertificateName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/caCertificates/", false); + uri.AppendPath(caCertificateName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get properties of a CA certificate. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the CA certificate. + /// 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 namespaceName, string caCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(caCertificateName, nameof(caCertificateName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, caCertificateName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CaCertificateData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CaCertificateData.DeserializeCaCertificateData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((CaCertificateData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get properties of a CA certificate. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the CA certificate. + /// 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 namespaceName, string caCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(caCertificateName, nameof(caCertificateName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, caCertificateName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CaCertificateData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CaCertificateData.DeserializeCaCertificateData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((CaCertificateData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, string caCertificateName, CaCertificateData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/caCertificates/", false); + uri.AppendPath(caCertificateName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update a CA certificate with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The CA certificate name. + /// CA certificate information. + /// 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 namespaceName, string caCertificateName, CaCertificateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(caCertificateName, nameof(caCertificateName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, caCertificateName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update a CA certificate with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The CA certificate name. + /// CA certificate information. + /// 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 namespaceName, string caCertificateName, CaCertificateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(caCertificateName, nameof(caCertificateName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, caCertificateName, data); + _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 namespaceName, string caCertificateName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/caCertificates/", false); + uri.AppendPath(caCertificateName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete an existing CA certificate. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the CA certificate. + /// 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 namespaceName, string caCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(caCertificateName, nameof(caCertificateName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, caCertificateName); + 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); + } + } + + /// Delete an existing CA certificate. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the CA certificate. + /// 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 namespaceName, string caCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(caCertificateName, nameof(caCertificateName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, caCertificateName); + _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 CreateListByNamespaceRequest(string subscriptionId, string resourceGroupName, string namespaceName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/caCertificates", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all the CA certificates under a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNamespaceAsync(string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceRequest(subscriptionId, resourceGroupName, namespaceName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CaCertificatesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CaCertificatesListResult.DeserializeCaCertificatesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the CA certificates under a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNamespace(string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceRequest(subscriptionId, resourceGroupName, namespaceName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CaCertificatesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CaCertificatesListResult.DeserializeCaCertificatesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNamespaceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all the CA certificates under a namespace. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNamespaceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CaCertificatesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CaCertificatesListResult.DeserializeCaCertificatesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the CA certificates under a namespace. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNamespaceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CaCertificatesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CaCertificatesListResult.DeserializeCaCertificatesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/ChannelsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/ChannelsRestOperations.cs index 34a35515f5cb..326339489852 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/ChannelsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/ChannelsRestOperations.cs @@ -33,7 +33,7 @@ public ChannelsRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/ClientGroupsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/ClientGroupsRestOperations.cs new file mode 100644 index 000000000000..74efa7e03304 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/ClientGroupsRestOperations.cs @@ -0,0 +1,461 @@ +// 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.EventGrid.Models; + +namespace Azure.ResourceManager.EventGrid +{ + internal partial class ClientGroupsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ClientGroupsRestOperations. + /// 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 ClientGroupsRestOperations(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-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string namespaceName, string clientGroupName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/clientGroups/", false); + uri.AppendPath(clientGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get properties of a client group. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the client group. + /// 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 namespaceName, string clientGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(clientGroupName, nameof(clientGroupName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, clientGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ClientGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ClientGroupData.DeserializeClientGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ClientGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get properties of a client group. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the client group. + /// 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 namespaceName, string clientGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(clientGroupName, nameof(clientGroupName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, clientGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ClientGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ClientGroupData.DeserializeClientGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ClientGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, string clientGroupName, ClientGroupData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/clientGroups/", false); + uri.AppendPath(clientGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update a client group with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The client group name. + /// Client group information. + /// 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 namespaceName, string clientGroupName, ClientGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(clientGroupName, nameof(clientGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, clientGroupName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update a client group with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The client group name. + /// Client group information. + /// 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 namespaceName, string clientGroupName, ClientGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(clientGroupName, nameof(clientGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, clientGroupName, data); + _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 namespaceName, string clientGroupName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/clientGroups/", false); + uri.AppendPath(clientGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete an existing client group. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the client group. + /// 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 namespaceName, string clientGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(clientGroupName, nameof(clientGroupName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, clientGroupName); + 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); + } + } + + /// Delete an existing client group. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the client group. + /// 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 namespaceName, string clientGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(clientGroupName, nameof(clientGroupName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, clientGroupName); + _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 CreateListByNamespaceRequest(string subscriptionId, string resourceGroupName, string namespaceName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/clientGroups", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all the client groups under a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNamespaceAsync(string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceRequest(subscriptionId, resourceGroupName, namespaceName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ClientGroupsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ClientGroupsListResult.DeserializeClientGroupsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the client groups under a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNamespace(string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceRequest(subscriptionId, resourceGroupName, namespaceName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ClientGroupsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ClientGroupsListResult.DeserializeClientGroupsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNamespaceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all the client groups under a namespace. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNamespaceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ClientGroupsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ClientGroupsListResult.DeserializeClientGroupsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the client groups under a namespace. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNamespaceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ClientGroupsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ClientGroupsListResult.DeserializeClientGroupsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/ClientsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/ClientsRestOperations.cs new file mode 100644 index 000000000000..4ce3b779e001 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/ClientsRestOperations.cs @@ -0,0 +1,461 @@ +// 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.EventGrid.Models; + +namespace Azure.ResourceManager.EventGrid +{ + internal partial class ClientsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ClientsRestOperations. + /// 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 ClientsRestOperations(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-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string namespaceName, string clientName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/clients/", false); + uri.AppendPath(clientName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get properties of a client. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the client. + /// 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 namespaceName, string clientName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(clientName, nameof(clientName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, clientName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ClientData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ClientData.DeserializeClientData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ClientData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get properties of a client. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the client. + /// 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 namespaceName, string clientName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(clientName, nameof(clientName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, clientName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ClientData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ClientData.DeserializeClientData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ClientData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, string clientName, ClientData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/clients/", false); + uri.AppendPath(clientName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update a client with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The client name. + /// Client information. + /// 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 namespaceName, string clientName, ClientData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(clientName, nameof(clientName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, clientName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update a client with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The client name. + /// Client information. + /// 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 namespaceName, string clientName, ClientData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(clientName, nameof(clientName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, clientName, data); + _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 namespaceName, string clientName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/clients/", false); + uri.AppendPath(clientName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete an existing client. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the client. + /// 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 namespaceName, string clientName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(clientName, nameof(clientName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, clientName); + 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); + } + } + + /// Delete an existing client. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the client. + /// 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 namespaceName, string clientName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(clientName, nameof(clientName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, clientName); + _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 CreateListByNamespaceRequest(string subscriptionId, string resourceGroupName, string namespaceName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/clients", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all the permission bindings under a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNamespaceAsync(string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceRequest(subscriptionId, resourceGroupName, namespaceName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ClientsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ClientsListResult.DeserializeClientsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the permission bindings under a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNamespace(string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceRequest(subscriptionId, resourceGroupName, namespaceName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ClientsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ClientsListResult.DeserializeClientsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNamespaceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all the permission bindings under a namespace. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNamespaceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ClientsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ClientsListResult.DeserializeClientsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the permission bindings under a namespace. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNamespaceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ClientsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ClientsListResult.DeserializeClientsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainEventSubscriptionsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainEventSubscriptionsRestOperations.cs index 8c9f967037b1..bfbcd5c54ddb 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainEventSubscriptionsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainEventSubscriptionsRestOperations.cs @@ -33,7 +33,7 @@ public DomainEventSubscriptionsRestOperations(HttpPipeline pipeline, string appl { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -63,7 +63,7 @@ internal HttpMessage CreateGetDeliveryAttributesRequest(string subscriptionId, s /// Get all delivery attributes for an event subscription for domain. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// Name of the domain topic. + /// Name of the domain. /// Name of the event subscription. /// The cancellation token to use. /// , , or is null. @@ -94,7 +94,7 @@ public async Task> GetDeliveryAttributesAs /// Get all delivery attributes for an event subscription for domain. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// Name of the domain topic. + /// Name of the domain. /// Name of the event subscription. /// The cancellation token to use. /// , , or is null. @@ -147,7 +147,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// Get properties of an event subscription of a domain. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// Name of the partner topic. + /// Name of the domain. /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. /// The cancellation token to use. /// , , or is null. @@ -180,7 +180,7 @@ public async Task> GetAsync(string subscript /// Get properties of an event subscription of a domain. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// Name of the partner topic. + /// Name of the domain. /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. /// The cancellation token to use. /// , , or is null. diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainTopicEventSubscriptionsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainTopicEventSubscriptionsRestOperations.cs index afcf507657ce..bcba7bb4f231 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainTopicEventSubscriptionsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainTopicEventSubscriptionsRestOperations.cs @@ -33,10 +33,101 @@ public DomainTopicEventSubscriptionsRestOperations(HttpPipeline pipeline, string { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } + internal HttpMessage CreateGetDeliveryAttributesRequest(string subscriptionId, string resourceGroupName, string domainName, string topicName, string eventSubscriptionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/domains/", false); + uri.AppendPath(domainName, true); + uri.AppendPath("/topics/", false); + uri.AppendPath(topicName, true); + uri.AppendPath("/eventSubscriptions/", false); + uri.AppendPath(eventSubscriptionName, true); + uri.AppendPath("/getDeliveryAttributes", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all delivery attributes for an event subscription for domain topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the top level domain. + /// Name of the domain topic. + /// Name of the event subscription. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetDeliveryAttributesAsync(string subscriptionId, string resourceGroupName, string domainName, string topicName, string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var message = CreateGetDeliveryAttributesRequest(subscriptionId, resourceGroupName, domainName, topicName, eventSubscriptionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeliveryAttributeListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeliveryAttributeListResult.DeserializeDeliveryAttributeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all delivery attributes for an event subscription for domain topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the top level domain. + /// Name of the domain topic. + /// Name of the event subscription. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetDeliveryAttributes(string subscriptionId, string resourceGroupName, string domainName, string topicName, string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var message = CreateGetDeliveryAttributesRequest(subscriptionId, resourceGroupName, domainName, topicName, eventSubscriptionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeliveryAttributeListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeliveryAttributeListResult.DeserializeDeliveryAttributeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string domainName, string topicName, string eventSubscriptionName) { var message = _pipeline.CreateMessage(); @@ -580,97 +671,6 @@ public Response List(string subscriptionId, string } } - internal HttpMessage CreateGetDeliveryAttributesRequest(string subscriptionId, string resourceGroupName, string domainName, string topicName, string eventSubscriptionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EventGrid/domains/", false); - uri.AppendPath(domainName, true); - uri.AppendPath("/topics/", false); - uri.AppendPath(topicName, true); - uri.AppendPath("/eventSubscriptions/", false); - uri.AppendPath(eventSubscriptionName, true); - uri.AppendPath("/getDeliveryAttributes", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get all delivery attributes for an event subscription for domain topic. - /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group within the user's subscription. - /// Name of the top level domain. - /// Name of the domain topic. - /// Name of the event subscription. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> GetDeliveryAttributesAsync(string subscriptionId, string resourceGroupName, string domainName, string topicName, string eventSubscriptionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); - Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); - Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); - - using var message = CreateGetDeliveryAttributesRequest(subscriptionId, resourceGroupName, domainName, topicName, eventSubscriptionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DeliveryAttributeListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DeliveryAttributeListResult.DeserializeDeliveryAttributeListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get all delivery attributes for an event subscription for domain topic. - /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group within the user's subscription. - /// Name of the top level domain. - /// Name of the domain topic. - /// Name of the event subscription. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response GetDeliveryAttributes(string subscriptionId, string resourceGroupName, string domainName, string topicName, string eventSubscriptionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); - Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); - Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); - - using var message = CreateGetDeliveryAttributesRequest(subscriptionId, resourceGroupName, domainName, topicName, eventSubscriptionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DeliveryAttributeListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DeliveryAttributeListResult.DeserializeDeliveryAttributeListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string domainName, string topicName, string filter, int? top) { var message = _pipeline.CreateMessage(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainTopicsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainTopicsRestOperations.cs index 1d94973e380a..3bb774dfb217 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainTopicsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainTopicsRestOperations.cs @@ -33,7 +33,7 @@ public DomainTopicsRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainsRestOperations.cs index c3ff6d2cc73f..085de4b6017c 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/DomainsRestOperations.cs @@ -33,7 +33,7 @@ public DomainsRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/EventSubscriptionsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/EventSubscriptionsRestOperations.cs index 763f03f4c656..a1abe7d0514f 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/EventSubscriptionsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/EventSubscriptionsRestOperations.cs @@ -33,10 +33,83 @@ public EventSubscriptionsRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } + internal HttpMessage CreateGetDeliveryAttributesRequest(string scope, string eventSubscriptionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.EventGrid/eventSubscriptions/", false); + uri.AppendPath(eventSubscriptionName, true); + uri.AppendPath("/getDeliveryAttributes", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all delivery attributes for an event subscription. + /// The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. + /// Name of the event subscription. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> GetDeliveryAttributesAsync(string scope, string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var message = CreateGetDeliveryAttributesRequest(scope, eventSubscriptionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeliveryAttributeListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeliveryAttributeListResult.DeserializeDeliveryAttributeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all delivery attributes for an event subscription. + /// The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. + /// Name of the event subscription. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response GetDeliveryAttributes(string scope, string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var message = CreateGetDeliveryAttributesRequest(scope, eventSubscriptionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeliveryAttributeListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeliveryAttributeListResult.DeserializeDeliveryAttributeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateGetRequest(string scope, string eventSubscriptionName) { var message = _pipeline.CreateMessage(); @@ -1287,79 +1360,6 @@ public Response ListByDomainTopic(string subscript } } - internal HttpMessage CreateGetDeliveryAttributesRequest(string scope, string eventSubscriptionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); - uri.AppendPath("/providers/Microsoft.EventGrid/eventSubscriptions/", false); - uri.AppendPath(eventSubscriptionName, true); - uri.AppendPath("/getDeliveryAttributes", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get all delivery attributes for an event subscription. - /// The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. - /// Name of the event subscription. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> GetDeliveryAttributesAsync(string scope, string eventSubscriptionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(scope, nameof(scope)); - Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); - - using var message = CreateGetDeliveryAttributesRequest(scope, eventSubscriptionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DeliveryAttributeListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DeliveryAttributeListResult.DeserializeDeliveryAttributeListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get all delivery attributes for an event subscription. - /// The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. - /// Name of the event subscription. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response GetDeliveryAttributes(string scope, string eventSubscriptionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(scope, nameof(scope)); - Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); - - using var message = CreateGetDeliveryAttributesRequest(scope, eventSubscriptionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DeliveryAttributeListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DeliveryAttributeListResult.DeserializeDeliveryAttributeListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - internal HttpMessage CreateListGlobalBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string filter, int? top) { var message = _pipeline.CreateMessage(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/ExtensionTopicsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/ExtensionTopicsRestOperations.cs index 1f9e760841be..7c692bee203e 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/ExtensionTopicsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/ExtensionTopicsRestOperations.cs @@ -32,7 +32,7 @@ public ExtensionTopicsRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/NamespaceTopicEventSubscriptionsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/NamespaceTopicEventSubscriptionsRestOperations.cs new file mode 100644 index 000000000000..4eba99a82da9 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/NamespaceTopicEventSubscriptionsRestOperations.cs @@ -0,0 +1,579 @@ +// 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.EventGrid.Models; + +namespace Azure.ResourceManager.EventGrid +{ + internal partial class NamespaceTopicEventSubscriptionsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of NamespaceTopicEventSubscriptionsRestOperations. + /// 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 NamespaceTopicEventSubscriptionsRestOperations(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-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string eventSubscriptionName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topics/", false); + uri.AppendPath(topicName, true); + uri.AppendPath("/eventSubscriptions/", false); + uri.AppendPath(eventSubscriptionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get properties of an event subscription of a namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// 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 namespaceName, string topicName, string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, topicName, eventSubscriptionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionData.DeserializeSubscriptionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SubscriptionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get properties of an event subscription of a namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// 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 namespaceName, string topicName, string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, topicName, eventSubscriptionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionData.DeserializeSubscriptionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SubscriptionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string eventSubscriptionName, SubscriptionData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topics/", false); + uri.AppendPath(topicName, true); + uri.AppendPath("/eventSubscriptions/", false); + uri.AppendPath(eventSubscriptionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Asynchronously creates or updates an event subscription of a namespace topic with the specified parameters. Existing event subscriptions will be updated with this API. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// Event subscription properties containing the delivery mode, filter information, and others. + /// 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 namespaceName, string topicName, string eventSubscriptionName, SubscriptionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, topicName, eventSubscriptionName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Asynchronously creates or updates an event subscription of a namespace topic with the specified parameters. Existing event subscriptions will be updated with this API. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// Event subscription properties containing the delivery mode, filter information, and others. + /// 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 namespaceName, string topicName, string eventSubscriptionName, SubscriptionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, topicName, eventSubscriptionName, data); + _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 namespaceName, string topicName, string eventSubscriptionName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topics/", false); + uri.AppendPath(topicName, true); + uri.AppendPath("/eventSubscriptions/", false); + uri.AppendPath(eventSubscriptionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete an existing event subscription of a namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// 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 namespaceName, string topicName, string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, topicName, eventSubscriptionName); + 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); + } + } + + /// Delete an existing event subscription of a namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// 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 namespaceName, string topicName, string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, topicName, eventSubscriptionName); + _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 CreateUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string eventSubscriptionName, SubscriptionPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topics/", false); + uri.AppendPath(topicName, true); + uri.AppendPath("/eventSubscriptions/", false); + uri.AppendPath(eventSubscriptionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update an existing event subscription of a namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// Updated event subscription information. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string eventSubscriptionName, SubscriptionPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, topicName, eventSubscriptionName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update an existing event subscription of a namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// Updated event subscription information. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string eventSubscriptionName, SubscriptionPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, topicName, eventSubscriptionName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNamespaceTopicRequest(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topics/", false); + uri.AppendPath(topicName, true); + uri.AppendPath("/eventSubscriptions", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List event subscriptions that belong to a specific namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByNamespaceTopicAsync(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var message = CreateListByNamespaceTopicRequest(subscriptionId, resourceGroupName, namespaceName, topicName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionsListResult.DeserializeSubscriptionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List event subscriptions that belong to a specific namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByNamespaceTopic(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var message = CreateListByNamespaceTopicRequest(subscriptionId, resourceGroupName, namespaceName, topicName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionsListResult.DeserializeSubscriptionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNamespaceTopicNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List event subscriptions that belong to a specific namespace topic. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByNamespaceTopicNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var message = CreateListByNamespaceTopicNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, topicName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionsListResult.DeserializeSubscriptionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List event subscriptions that belong to a specific namespace topic. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByNamespaceTopicNextPage(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var message = CreateListByNamespaceTopicNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, topicName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionsListResult.DeserializeSubscriptionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/NamespaceTopicsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/NamespaceTopicsRestOperations.cs new file mode 100644 index 000000000000..5f4bf3e0dfd2 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/NamespaceTopicsRestOperations.cs @@ -0,0 +1,715 @@ +// 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.EventGrid.Models; + +namespace Azure.ResourceManager.EventGrid +{ + internal partial class NamespaceTopicsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of NamespaceTopicsRestOperations. + /// 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 NamespaceTopicsRestOperations(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-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string namespaceName, string topicName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topics/", false); + uri.AppendPath(topicName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get properties of a namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// 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 namespaceName, string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, topicName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamespaceTopicData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NamespaceTopicData.DeserializeNamespaceTopicData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NamespaceTopicData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get properties of a namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// 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 namespaceName, string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, topicName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamespaceTopicData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NamespaceTopicData.DeserializeNamespaceTopicData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NamespaceTopicData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, NamespaceTopicData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topics/", false); + uri.AppendPath(topicName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Asynchronously creates a new namespace topic with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// Namespace topic information. + /// 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 namespaceName, string topicName, NamespaceTopicData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, topicName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Asynchronously creates a new namespace topic with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// Namespace topic information. + /// 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 namespaceName, string topicName, NamespaceTopicData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, topicName, data); + _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 namespaceName, string topicName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topics/", false); + uri.AppendPath(topicName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete existing namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the topic. + /// 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 namespaceName, string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, topicName); + 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); + } + } + + /// Delete existing namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the topic. + /// 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 namespaceName, string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, topicName); + _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 CreateUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, NamespaceTopicPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topics/", false); + uri.AppendPath(topicName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Asynchronously updates a namespace topic with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// Namespace topic update information. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, NamespaceTopicPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, topicName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Asynchronously updates a namespace topic with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the namespace topic. + /// Namespace topic update information. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, NamespaceTopicPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, topicName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNamespaceRequest(string subscriptionId, string resourceGroupName, string namespaceName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topics", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the namespace topics under a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNamespaceAsync(string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceRequest(subscriptionId, resourceGroupName, namespaceName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamespaceTopicsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NamespaceTopicsListResult.DeserializeNamespaceTopicsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the namespace topics under a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNamespace(string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceRequest(subscriptionId, resourceGroupName, namespaceName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamespaceTopicsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NamespaceTopicsListResult.DeserializeNamespaceTopicsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListSharedAccessKeysRequest(string subscriptionId, string resourceGroupName, string namespaceName, string topicName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topics/", false); + uri.AppendPath(topicName, true); + uri.AppendPath("/listKeys", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List the two keys used to publish to a namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the topic. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListSharedAccessKeysAsync(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var message = CreateListSharedAccessKeysRequest(subscriptionId, resourceGroupName, namespaceName, topicName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TopicSharedAccessKeys value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TopicSharedAccessKeys.DeserializeTopicSharedAccessKeys(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the two keys used to publish to a namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the topic. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListSharedAccessKeys(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var message = CreateListSharedAccessKeysRequest(subscriptionId, resourceGroupName, namespaceName, topicName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TopicSharedAccessKeys value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TopicSharedAccessKeys.DeserializeTopicSharedAccessKeys(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, TopicRegenerateKeyRequest regenerateKeyRequest) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topics/", false); + uri.AppendPath(topicName, true); + uri.AppendPath("/regenerateKey", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(regenerateKeyRequest); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Regenerate a shared access key for a namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the topic. + /// Request body to regenerate key. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task RegenerateKeyAsync(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, TopicRegenerateKeyRequest regenerateKeyRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNull(regenerateKeyRequest, nameof(regenerateKeyRequest)); + + using var message = CreateRegenerateKeyRequest(subscriptionId, resourceGroupName, namespaceName, topicName, regenerateKeyRequest); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Regenerate a shared access key for a namespace topic. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the topic. + /// Request body to regenerate key. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response RegenerateKey(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, TopicRegenerateKeyRequest regenerateKeyRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + Argument.AssertNotNull(regenerateKeyRequest, nameof(regenerateKeyRequest)); + + using var message = CreateRegenerateKeyRequest(subscriptionId, resourceGroupName, namespaceName, topicName, regenerateKeyRequest); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNamespaceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the namespace topics under a namespace. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNamespaceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamespaceTopicsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NamespaceTopicsListResult.DeserializeNamespaceTopicsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the namespace topics under a namespace. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNamespaceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamespaceTopicsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NamespaceTopicsListResult.DeserializeNamespaceTopicsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/NamespacesRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/NamespacesRestOperations.cs new file mode 100644 index 000000000000..2c82ee2c2f96 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/NamespacesRestOperations.cs @@ -0,0 +1,820 @@ +// 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.EventGrid.Models; + +namespace Azure.ResourceManager.EventGrid +{ + internal partial class NamespacesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of NamespacesRestOperations. + /// 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 NamespacesRestOperations(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-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string namespaceName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get properties of a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// 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 namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamespaceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NamespaceData.DeserializeNamespaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NamespaceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get properties of a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// 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 namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamespaceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NamespaceData.DeserializeNamespaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NamespaceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, NamespaceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Asynchronously creates or updates a new namespace with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Namespace information. + /// 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 namespaceName, NamespaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Asynchronously creates or updates a new namespace with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Namespace information. + /// 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 namespaceName, NamespaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, data); + _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 namespaceName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete existing namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// 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 namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName); + 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); + } + } + + /// Delete existing namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// 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 namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName); + _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 CreateUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, NamespacePatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Asynchronously updates a namespace with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Namespace update information. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string namespaceName, NamespacePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Asynchronously updates a namespace with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Namespace update information. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string namespaceName, NamespacePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, namespaceName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the namespaces under an Azure subscription. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamespacesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NamespacesListResult.DeserializeNamespacesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the namespaces under an Azure subscription. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamespacesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NamespacesListResult.DeserializeNamespacesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the namespaces under a resource group. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamespacesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NamespacesListResult.DeserializeNamespacesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the namespaces under a resource group. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamespacesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NamespacesListResult.DeserializeNamespacesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListSharedAccessKeysRequest(string subscriptionId, string resourceGroupName, string namespaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/listKeys", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List the two keys used to publish to a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListSharedAccessKeysAsync(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListSharedAccessKeysRequest(subscriptionId, resourceGroupName, namespaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamespaceSharedAccessKeys value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NamespaceSharedAccessKeys.DeserializeNamespaceSharedAccessKeys(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the two keys used to publish to a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListSharedAccessKeys(string subscriptionId, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListSharedAccessKeysRequest(subscriptionId, resourceGroupName, namespaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamespaceSharedAccessKeys value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NamespaceSharedAccessKeys.DeserializeNamespaceSharedAccessKeys(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string resourceGroupName, string namespaceName, NamespaceRegenerateKeyContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/regenerateKey", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Regenerate a shared access key for a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the Namespace. + /// Request body to regenerate key. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task RegenerateKeyAsync(string subscriptionId, string resourceGroupName, string namespaceName, NamespaceRegenerateKeyContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateRegenerateKeyRequest(subscriptionId, resourceGroupName, namespaceName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Regenerate a shared access key for a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the Namespace. + /// Request body to regenerate key. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response RegenerateKey(string subscriptionId, string resourceGroupName, string namespaceName, NamespaceRegenerateKeyContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateRegenerateKeyRequest(subscriptionId, resourceGroupName, namespaceName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the namespaces under an Azure subscription. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamespacesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NamespacesListResult.DeserializeNamespacesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the namespaces under an Azure subscription. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamespacesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NamespacesListResult.DeserializeNamespacesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the namespaces under a resource group. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamespacesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NamespacesListResult.DeserializeNamespacesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the namespaces under a resource group. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamespacesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NamespacesListResult.DeserializeNamespacesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerConfigurationsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerConfigurationsRestOperations.cs index d6d55b6e5e69..2e5e1b02c998 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerConfigurationsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerConfigurationsRestOperations.cs @@ -33,7 +33,7 @@ public PartnerConfigurationsRestOperations(HttpPipeline pipeline, string applica { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerDestinationsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerDestinationsRestOperations.cs new file mode 100644 index 000000000000..52262c617bfb --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerDestinationsRestOperations.cs @@ -0,0 +1,743 @@ +// 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.EventGrid.Models; + +namespace Azure.ResourceManager.EventGrid +{ + internal partial class PartnerDestinationsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PartnerDestinationsRestOperations. + /// 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 PartnerDestinationsRestOperations(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-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string partnerDestinationName) + { + 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.EventGrid/partnerDestinations/", false); + uri.AppendPath(partnerDestinationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get properties of a partner destination. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the partner destination. + /// 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 partnerDestinationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, partnerDestinationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PartnerDestinationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PartnerDestinationData.DeserializePartnerDestinationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PartnerDestinationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get properties of a partner destination. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the partner destination. + /// 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 partnerDestinationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, partnerDestinationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PartnerDestinationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PartnerDestinationData.DeserializePartnerDestinationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PartnerDestinationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string partnerDestinationName, PartnerDestinationData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/partnerDestinations/", false); + uri.AppendPath(partnerDestinationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Asynchronously creates a new partner destination with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the partner destination. + /// Partner destination create information. + /// 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 partnerDestinationName, PartnerDestinationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, partnerDestinationName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Asynchronously creates a new partner destination with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the partner destination. + /// Partner destination create information. + /// 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 partnerDestinationName, PartnerDestinationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, partnerDestinationName, data); + _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 partnerDestinationName) + { + 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.EventGrid/partnerDestinations/", false); + uri.AppendPath(partnerDestinationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete existing partner destination. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the partner destination. + /// 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 partnerDestinationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, partnerDestinationName); + 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); + } + } + + /// Delete existing partner destination. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the partner destination. + /// 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 partnerDestinationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, partnerDestinationName); + _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 CreateUpdateRequest(string subscriptionId, string resourceGroupName, string partnerDestinationName, PartnerDestinationPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/partnerDestinations/", false); + uri.AppendPath(partnerDestinationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Asynchronously updates a partner destination with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the partner destination. + /// Partner destination update information. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string partnerDestinationName, PartnerDestinationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, partnerDestinationName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Asynchronously updates a partner destination with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the partner destination. + /// Partner destination update information. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string partnerDestinationName, PartnerDestinationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, partnerDestinationName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.EventGrid/partnerDestinations", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the partner destinations under an Azure subscription. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PartnerDestinationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PartnerDestinationsListResult.DeserializePartnerDestinationsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the partner destinations under an Azure subscription. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PartnerDestinationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PartnerDestinationsListResult.DeserializePartnerDestinationsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/partnerDestinations", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the partner destinations under a resource group. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PartnerDestinationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PartnerDestinationsListResult.DeserializePartnerDestinationsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the partner destinations under a resource group. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PartnerDestinationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PartnerDestinationsListResult.DeserializePartnerDestinationsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateActivateRequest(string subscriptionId, string resourceGroupName, string partnerDestinationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/partnerDestinations/", false); + uri.AppendPath(partnerDestinationName, true); + uri.AppendPath("/activate", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Activate a newly created partner destination. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the partner destination. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ActivateAsync(string subscriptionId, string resourceGroupName, string partnerDestinationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + + using var message = CreateActivateRequest(subscriptionId, resourceGroupName, partnerDestinationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PartnerDestinationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PartnerDestinationData.DeserializePartnerDestinationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Activate a newly created partner destination. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the partner destination. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Activate(string subscriptionId, string resourceGroupName, string partnerDestinationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + + using var message = CreateActivateRequest(subscriptionId, resourceGroupName, partnerDestinationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PartnerDestinationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PartnerDestinationData.DeserializePartnerDestinationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the partner destinations under an Azure subscription. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PartnerDestinationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PartnerDestinationsListResult.DeserializePartnerDestinationsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the partner destinations under an Azure subscription. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PartnerDestinationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PartnerDestinationsListResult.DeserializePartnerDestinationsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the partner destinations under a resource group. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PartnerDestinationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PartnerDestinationsListResult.DeserializePartnerDestinationsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the partner destinations under a resource group. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PartnerDestinationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PartnerDestinationsListResult.DeserializePartnerDestinationsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerNamespacesRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerNamespacesRestOperations.cs index 90e6b86f7c04..1c9cfab0a6d2 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerNamespacesRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerNamespacesRestOperations.cs @@ -33,7 +33,7 @@ public PartnerNamespacesRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerRegistrationsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerRegistrationsRestOperations.cs index d31c3d178e68..633dd9b310d3 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerRegistrationsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerRegistrationsRestOperations.cs @@ -33,7 +33,7 @@ public PartnerRegistrationsRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerTopicEventSubscriptionsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerTopicEventSubscriptionsRestOperations.cs index c8e1d6c6b048..b66c92999670 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerTopicEventSubscriptionsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerTopicEventSubscriptionsRestOperations.cs @@ -33,7 +33,7 @@ public PartnerTopicEventSubscriptionsRestOperations(HttpPipeline pipeline, strin { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerTopicsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerTopicsRestOperations.cs index a64a53c51fcb..8bf46dc68dc0 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerTopicsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PartnerTopicsRestOperations.cs @@ -33,7 +33,7 @@ public PartnerTopicsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PermissionBindingsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PermissionBindingsRestOperations.cs new file mode 100644 index 000000000000..83d64b7e2bbf --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PermissionBindingsRestOperations.cs @@ -0,0 +1,461 @@ +// 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.EventGrid.Models; + +namespace Azure.ResourceManager.EventGrid +{ + internal partial class PermissionBindingsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PermissionBindingsRestOperations. + /// 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 PermissionBindingsRestOperations(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-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string namespaceName, string permissionBindingName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/permissionBindings/", false); + uri.AppendPath(permissionBindingName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get properties of a permission binding. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the permission binding. + /// 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 namespaceName, string permissionBindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(permissionBindingName, nameof(permissionBindingName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, permissionBindingName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PermissionBindingData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PermissionBindingData.DeserializePermissionBindingData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PermissionBindingData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get properties of a permission binding. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the permission binding. + /// 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 namespaceName, string permissionBindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(permissionBindingName, nameof(permissionBindingName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, permissionBindingName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PermissionBindingData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PermissionBindingData.DeserializePermissionBindingData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PermissionBindingData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, string permissionBindingName, PermissionBindingData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/permissionBindings/", false); + uri.AppendPath(permissionBindingName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update a permission binding with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The permission binding name. + /// Permission binding information. + /// 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 namespaceName, string permissionBindingName, PermissionBindingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(permissionBindingName, nameof(permissionBindingName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, permissionBindingName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update a permission binding with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The permission binding name. + /// Permission binding information. + /// 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 namespaceName, string permissionBindingName, PermissionBindingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(permissionBindingName, nameof(permissionBindingName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, permissionBindingName, data); + _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 namespaceName, string permissionBindingName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/permissionBindings/", false); + uri.AppendPath(permissionBindingName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete an existing permission binding. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the permission binding. + /// 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 namespaceName, string permissionBindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(permissionBindingName, nameof(permissionBindingName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, permissionBindingName); + 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); + } + } + + /// Delete an existing permission binding. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the permission binding. + /// 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 namespaceName, string permissionBindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(permissionBindingName, nameof(permissionBindingName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, permissionBindingName); + _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 CreateListByNamespaceRequest(string subscriptionId, string resourceGroupName, string namespaceName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/permissionBindings", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all the permission bindings under a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNamespaceAsync(string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceRequest(subscriptionId, resourceGroupName, namespaceName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PermissionBindingsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PermissionBindingsListResult.DeserializePermissionBindingsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the permission bindings under a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNamespace(string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceRequest(subscriptionId, resourceGroupName, namespaceName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PermissionBindingsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PermissionBindingsListResult.DeserializePermissionBindingsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNamespaceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all the permission bindings under a namespace. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNamespaceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PermissionBindingsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PermissionBindingsListResult.DeserializePermissionBindingsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the permission bindings under a namespace. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNamespaceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PermissionBindingsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PermissionBindingsListResult.DeserializePermissionBindingsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 55bfe4aa8253..b46344dc3e10 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -33,7 +33,7 @@ public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -61,11 +61,11 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou return message; } - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). /// The name of the private endpoint connection connection. /// The cancellation token to use. /// , , or is null. @@ -95,11 +95,11 @@ public async Task> GetAsync(str } } - /// Get a specific private endpoint connection under a topic, domain, or partner namespace. + /// Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). /// The name of the private endpoint connection connection. /// The cancellation token to use. /// , , or is null. @@ -160,8 +160,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// Update a specific private endpoint connection under a topic, domain or partner namespace. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). /// The name of the private endpoint connection connection. /// The private endpoint connection object to update. /// The cancellation token to use. @@ -190,8 +190,8 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr /// Update a specific private endpoint connection under a topic, domain or partner namespace. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). /// The name of the private endpoint connection connection. /// The private endpoint connection object to update. /// The cancellation token to use. @@ -240,11 +240,11 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG return message; } - /// Delete a specific private endpoint connection under a topic, domain, or partner namespace. + /// Delete a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). /// The name of the private endpoint connection connection. /// The cancellation token to use. /// , , or is null. @@ -268,11 +268,11 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } } - /// Delete a specific private endpoint connection under a topic, domain, or partner namespace. + /// Delete a specific private endpoint connection under a topic, domain, or partner namespace or namespace. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). /// The name of the private endpoint connection connection. /// The cancellation token to use. /// , , or is null. @@ -327,11 +327,11 @@ internal HttpMessage CreateListByResourceRequest(string subscriptionId, string r return message; } - /// Get all private endpoint connections under a topic, domain, or partner namespace. + /// Get all private endpoint connections under a topic, domain, or partner namespace or namespace. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. @@ -359,11 +359,11 @@ public async Task> ListBy } } - /// Get all private endpoint connections under a topic, domain, or partner namespace. + /// Get all private endpoint connections under a topic, domain, or partner namespace or namespace. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. @@ -405,12 +405,12 @@ internal HttpMessage CreateListByResourceNextPageRequest(string nextLink, string return message; } - /// Get all private endpoint connections under a topic, domain, or partner namespace. + /// Get all private endpoint connections under a topic, domain, or partner namespace or namespace. /// The URL to the next page of results. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. @@ -439,12 +439,12 @@ public async Task> ListBy } } - /// Get all private endpoint connections under a topic, domain, or partner namespace. + /// Get all private endpoint connections under a topic, domain, or partner namespace or namespace. /// The URL to the next page of results. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs index 9b1d34fd4870..871610a1f70c 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs @@ -33,7 +33,7 @@ public PrivateLinkResourcesRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -64,9 +64,9 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// Get properties of a private link resource. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). - /// The name of private link resource. + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -98,9 +98,9 @@ public async Task> GetAsync(string su /// Get properties of a private link resource. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). - /// The name of private link resource. + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -160,11 +160,11 @@ internal HttpMessage CreateListByResourceRequest(string subscriptionId, string r return message; } - /// List all the private link resources under a topic, domain, or partner namespace. + /// List all the private link resources under a topic, domain, or partner namespace or namespace. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace or namespace name). /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. @@ -192,11 +192,11 @@ public async Task> ListByResourceAsync( } } - /// List all the private link resources under a topic, domain, or partner namespace. + /// List all the private link resources under a topic, domain, or partner namespace or namespace. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace or namespace name). /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. @@ -238,12 +238,12 @@ internal HttpMessage CreateListByResourceNextPageRequest(string nextLink, string return message; } - /// List all the private link resources under a topic, domain, or partner namespace. + /// List all the private link resources under a topic, domain, or partner namespace or namespace. /// The URL to the next page of results. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace or namespace name). /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. @@ -272,12 +272,12 @@ public async Task> ListByResourceNextPa } } - /// List all the private link resources under a topic, domain, or partner namespace. + /// List all the private link resources under a topic, domain, or partner namespace or namespace. /// The URL to the next page of results. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. - /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). + /// The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. + /// The name of the parent resource (namely, either, the topic name, domain name, or partner namespace or namespace name). /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. /// The cancellation token to use. diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/SystemTopicEventSubscriptionsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/SystemTopicEventSubscriptionsRestOperations.cs index be5fa50fc9ad..603f4052cfb5 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/SystemTopicEventSubscriptionsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/SystemTopicEventSubscriptionsRestOperations.cs @@ -33,10 +33,95 @@ public SystemTopicEventSubscriptionsRestOperations(HttpPipeline pipeline, string { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } + internal HttpMessage CreateGetDeliveryAttributesRequest(string subscriptionId, string resourceGroupName, string systemTopicName, string eventSubscriptionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/systemTopics/", false); + uri.AppendPath(systemTopicName, true); + uri.AppendPath("/eventSubscriptions/", false); + uri.AppendPath(eventSubscriptionName, true); + uri.AppendPath("/getDeliveryAttributes", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all delivery attributes for an event subscription. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the system topic. + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetDeliveryAttributesAsync(string subscriptionId, string resourceGroupName, string systemTopicName, string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(systemTopicName, nameof(systemTopicName)); + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var message = CreateGetDeliveryAttributesRequest(subscriptionId, resourceGroupName, systemTopicName, eventSubscriptionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeliveryAttributeListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeliveryAttributeListResult.DeserializeDeliveryAttributeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all delivery attributes for an event subscription. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the system topic. + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetDeliveryAttributes(string subscriptionId, string resourceGroupName, string systemTopicName, string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(systemTopicName, nameof(systemTopicName)); + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var message = CreateGetDeliveryAttributesRequest(subscriptionId, resourceGroupName, systemTopicName, eventSubscriptionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeliveryAttributeListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeliveryAttributeListResult.DeserializeDeliveryAttributeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string systemTopicName, string eventSubscriptionName) { var message = _pipeline.CreateMessage(); @@ -542,91 +627,6 @@ public Response ListBySystemTopic(string subscript } } - internal HttpMessage CreateGetDeliveryAttributesRequest(string subscriptionId, string resourceGroupName, string systemTopicName, string eventSubscriptionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EventGrid/systemTopics/", false); - uri.AppendPath(systemTopicName, true); - uri.AppendPath("/eventSubscriptions/", false); - uri.AppendPath(eventSubscriptionName, true); - uri.AppendPath("/getDeliveryAttributes", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get all delivery attributes for an event subscription. - /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group within the user's subscription. - /// Name of the system topic. - /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetDeliveryAttributesAsync(string subscriptionId, string resourceGroupName, string systemTopicName, string eventSubscriptionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(systemTopicName, nameof(systemTopicName)); - Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); - - using var message = CreateGetDeliveryAttributesRequest(subscriptionId, resourceGroupName, systemTopicName, eventSubscriptionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DeliveryAttributeListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DeliveryAttributeListResult.DeserializeDeliveryAttributeListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get all delivery attributes for an event subscription. - /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group within the user's subscription. - /// Name of the system topic. - /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response GetDeliveryAttributes(string subscriptionId, string resourceGroupName, string systemTopicName, string eventSubscriptionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(systemTopicName, nameof(systemTopicName)); - Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); - - using var message = CreateGetDeliveryAttributesRequest(subscriptionId, resourceGroupName, systemTopicName, eventSubscriptionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DeliveryAttributeListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DeliveryAttributeListResult.DeserializeDeliveryAttributeListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - internal HttpMessage CreateListBySystemTopicNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string systemTopicName, string filter, int? top) { var message = _pipeline.CreateMessage(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/SystemTopicsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/SystemTopicsRestOperations.cs index 7ba7b122ddd0..681b2ff4b742 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/SystemTopicsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/SystemTopicsRestOperations.cs @@ -33,7 +33,7 @@ public SystemTopicsRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/TopicEventSubscriptionsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/TopicEventSubscriptionsRestOperations.cs index 570f9bad4d12..40f431481923 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/TopicEventSubscriptionsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/TopicEventSubscriptionsRestOperations.cs @@ -33,7 +33,7 @@ public TopicEventSubscriptionsRestOperations(HttpPipeline pipeline, string appli { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -63,7 +63,7 @@ internal HttpMessage CreateGetDeliveryAttributesRequest(string subscriptionId, s /// Get all delivery attributes for an event subscription for topic. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// Name of the domain topic. + /// Name of the topic. /// Name of the event subscription. /// The cancellation token to use. /// , , or is null. @@ -94,7 +94,7 @@ public async Task> GetDeliveryAttributesAs /// Get all delivery attributes for an event subscription for topic. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// Name of the domain topic. + /// Name of the topic. /// Name of the event subscription. /// The cancellation token to use. /// , , or is null. @@ -147,7 +147,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// Get properties of an event subscription of a topic. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// Name of the partner topic. + /// Name of the topic. /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. /// The cancellation token to use. /// , , or is null. @@ -180,7 +180,7 @@ public async Task> GetAsync(string subscript /// Get properties of an event subscription of a topic. /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. - /// Name of the partner topic. + /// Name of the topic. /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. /// The cancellation token to use. /// , , or is null. diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/TopicSpacesRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/TopicSpacesRestOperations.cs new file mode 100644 index 000000000000..e73561c2626f --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/TopicSpacesRestOperations.cs @@ -0,0 +1,461 @@ +// 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.EventGrid.Models; + +namespace Azure.ResourceManager.EventGrid +{ + internal partial class TopicSpacesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of TopicSpacesRestOperations. + /// 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 TopicSpacesRestOperations(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-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string namespaceName, string topicSpaceName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topicSpaces/", false); + uri.AppendPath(topicSpaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get properties of a topic space. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the Topic space. + /// 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 namespaceName, string topicSpaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicSpaceName, nameof(topicSpaceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, topicSpaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TopicSpaceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TopicSpaceData.DeserializeTopicSpaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TopicSpaceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get properties of a topic space. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the Topic space. + /// 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 namespaceName, string topicSpaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicSpaceName, nameof(topicSpaceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, namespaceName, topicSpaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TopicSpaceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TopicSpaceData.DeserializeTopicSpaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TopicSpaceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string namespaceName, string topicSpaceName, TopicSpaceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topicSpaces/", false); + uri.AppendPath(topicSpaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update a topic space with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The topic space name. + /// Topic space information. + /// 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 namespaceName, string topicSpaceName, TopicSpaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicSpaceName, nameof(topicSpaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, topicSpaceName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update a topic space with the specified parameters. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The topic space name. + /// Topic space information. + /// 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 namespaceName, string topicSpaceName, TopicSpaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicSpaceName, nameof(topicSpaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, namespaceName, topicSpaceName, data); + _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 namespaceName, string topicSpaceName) + { + 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.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topicSpaces/", false); + uri.AppendPath(topicSpaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete an existing topic space. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the Topic space. + /// 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 namespaceName, string topicSpaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicSpaceName, nameof(topicSpaceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, topicSpaceName); + 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); + } + } + + /// Delete an existing topic space. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// Name of the Topic space. + /// 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 namespaceName, string topicSpaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(topicSpaceName, nameof(topicSpaceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, namespaceName, topicSpaceName); + _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 CreateListByNamespaceRequest(string subscriptionId, string resourceGroupName, string namespaceName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EventGrid/namespaces/", false); + uri.AppendPath(namespaceName, true); + uri.AppendPath("/topicSpaces", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all the topic spaces under a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNamespaceAsync(string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceRequest(subscriptionId, resourceGroupName, namespaceName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TopicSpacesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TopicSpacesListResult.DeserializeTopicSpacesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the topic spaces under a namespace. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNamespace(string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceRequest(subscriptionId, resourceGroupName, namespaceName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TopicSpacesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TopicSpacesListResult.DeserializeTopicSpacesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNamespaceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all the topic spaces under a namespace. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNamespaceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TopicSpacesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TopicSpacesListResult.DeserializeTopicSpacesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the topic spaces under a namespace. + /// The URL to the next page of results. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group within the user's subscription. + /// Name of the namespace. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNamespaceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string namespaceName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var message = CreateListByNamespaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, namespaceName, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TopicSpacesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TopicSpacesListResult.DeserializeTopicSpacesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/TopicTypesRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/TopicTypesRestOperations.cs index 1b4d8179649d..86c84463f5aa 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/TopicTypesRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/TopicTypesRestOperations.cs @@ -33,7 +33,7 @@ public TopicTypesRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/TopicsRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/TopicsRestOperations.cs index ce788e37dc08..b58e26371e43 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/TopicsRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/TopicsRestOperations.cs @@ -33,7 +33,7 @@ public TopicsRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -585,7 +585,7 @@ public Response ListSharedAccessKeys(string subscriptionI } } - internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string resourceGroupName, string topicName, TopicRegenerateKeyContent content) + internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string resourceGroupName, string topicName, TopicRegenerateKeyRequest regenerateKeyRequest) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -603,9 +603,9 @@ internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string re request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(regenerateKeyRequest); + request.Content = content; _userAgent.Apply(message); return message; } @@ -614,18 +614,18 @@ internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string re /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. /// Name of the topic. - /// Request body to regenerate key. + /// Request body to regenerate key. /// The cancellation token to use. - /// , , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task RegenerateKeyAsync(string subscriptionId, string resourceGroupName, string topicName, TopicRegenerateKeyContent content, CancellationToken cancellationToken = default) + public async Task RegenerateKeyAsync(string subscriptionId, string resourceGroupName, string topicName, TopicRegenerateKeyRequest regenerateKeyRequest, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(regenerateKeyRequest, nameof(regenerateKeyRequest)); - using var message = CreateRegenerateKeyRequest(subscriptionId, resourceGroupName, topicName, content); + using var message = CreateRegenerateKeyRequest(subscriptionId, resourceGroupName, topicName, regenerateKeyRequest); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -641,18 +641,18 @@ public async Task RegenerateKeyAsync(string subscriptionId, string res /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group within the user's subscription. /// Name of the topic. - /// Request body to regenerate key. + /// Request body to regenerate key. /// The cancellation token to use. - /// , , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response RegenerateKey(string subscriptionId, string resourceGroupName, string topicName, TopicRegenerateKeyContent content, CancellationToken cancellationToken = default) + public Response RegenerateKey(string subscriptionId, string resourceGroupName, string topicName, TopicRegenerateKeyRequest regenerateKeyRequest, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(regenerateKeyRequest, nameof(regenerateKeyRequest)); - using var message = CreateRegenerateKeyRequest(subscriptionId, resourceGroupName, topicName, content); + using var message = CreateRegenerateKeyRequest(subscriptionId, resourceGroupName, topicName, regenerateKeyRequest); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/VerifiedPartnersRestOperations.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/VerifiedPartnersRestOperations.cs index e53eb8b934b7..7e1a978a9e29 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/VerifiedPartnersRestOperations.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/RestOperations/VerifiedPartnersRestOperations.cs @@ -33,7 +33,7 @@ public VerifiedPartnersRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-06-15"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SubscriptionCollection.cs new file mode 100644 index 000000000000..b8eef750ce98 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SubscriptionCollection.cs @@ -0,0 +1,344 @@ +// 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; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// 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 GetSubscriptions method from an instance of . + /// + public partial class SubscriptionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics; + private readonly NamespaceTopicEventSubscriptionsRestOperations _subscriptionNamespaceTopicEventSubscriptionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SubscriptionCollection() + { + } + + /// 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 SubscriptionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", SubscriptionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SubscriptionResource.ResourceType, out string subscriptionNamespaceTopicEventSubscriptionsApiVersion); + _subscriptionNamespaceTopicEventSubscriptionsRestClient = new NamespaceTopicEventSubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, subscriptionNamespaceTopicEventSubscriptionsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NamespaceTopicResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NamespaceTopicResource.ResourceType), nameof(id)); + } + + /// + /// Asynchronously creates or updates an event subscription of a namespace topic with the specified parameters. Existing event subscriptions will be updated with this API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_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. + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// Event subscription properties containing the delivery mode, filter information, and others. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string eventSubscriptionName, SubscriptionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics.CreateScope("SubscriptionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _subscriptionNamespaceTopicEventSubscriptionsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, eventSubscriptionName, data, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new SubscriptionOperationSource(Client), _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics, Pipeline, _subscriptionNamespaceTopicEventSubscriptionsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, eventSubscriptionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Asynchronously creates or updates an event subscription of a namespace topic with the specified parameters. Existing event subscriptions will be updated with this API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_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. + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// Event subscription properties containing the delivery mode, filter information, and others. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string eventSubscriptionName, SubscriptionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics.CreateScope("SubscriptionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _subscriptionNamespaceTopicEventSubscriptionsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, eventSubscriptionName, data, cancellationToken); + var operation = new EventGridArmOperation(new SubscriptionOperationSource(Client), _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics, Pipeline, _subscriptionNamespaceTopicEventSubscriptionsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, eventSubscriptionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of an event subscription of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics.CreateScope("SubscriptionCollection.Get"); + scope.Start(); + try + { + var response = await _subscriptionNamespaceTopicEventSubscriptionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, eventSubscriptionName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of an event subscription of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics.CreateScope("SubscriptionCollection.Get"); + scope.Start(); + try + { + var response = _subscriptionNamespaceTopicEventSubscriptionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, eventSubscriptionName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List event subscriptions that belong to a specific namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_ListByNamespaceTopic + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _subscriptionNamespaceTopicEventSubscriptionsRestClient.CreateListByNamespaceTopicRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _subscriptionNamespaceTopicEventSubscriptionsRestClient.CreateListByNamespaceTopicNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SubscriptionResource(Client, SubscriptionData.DeserializeSubscriptionData(e)), _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics, Pipeline, "SubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List event subscriptions that belong to a specific namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_ListByNamespaceTopic + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _subscriptionNamespaceTopicEventSubscriptionsRestClient.CreateListByNamespaceTopicRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _subscriptionNamespaceTopicEventSubscriptionsRestClient.CreateListByNamespaceTopicNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SubscriptionResource(Client, SubscriptionData.DeserializeSubscriptionData(e)), _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics, Pipeline, "SubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics.CreateScope("SubscriptionCollection.Exists"); + scope.Start(); + try + { + var response = await _subscriptionNamespaceTopicEventSubscriptionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, eventSubscriptionName, 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.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics.CreateScope("SubscriptionCollection.Exists"); + scope.Start(); + try + { + var response = _subscriptionNamespaceTopicEventSubscriptionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, eventSubscriptionName, 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SubscriptionData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SubscriptionData.cs new file mode 100644 index 000000000000..2c2eb30179e1 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SubscriptionData.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// A class representing the Subscription data model. + /// Event Subscription. + /// + public partial class SubscriptionData : ResourceData + { + /// Initializes a new instance of SubscriptionData. + public SubscriptionData() + { + } + + /// Initializes a new instance of SubscriptionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Provisioning state of the event subscription. + /// Information about the delivery configuration of the event subscription. + /// The event delivery schema for the event subscription. + /// Information about the filter for the event subscription. + internal SubscriptionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubscriptionProvisioningState? provisioningState, DeliveryConfiguration deliveryConfiguration, DeliverySchema? eventDeliverySchema, FiltersConfiguration filtersConfiguration) : base(id, name, resourceType, systemData) + { + ProvisioningState = provisioningState; + DeliveryConfiguration = deliveryConfiguration; + EventDeliverySchema = eventDeliverySchema; + FiltersConfiguration = filtersConfiguration; + } + + /// Provisioning state of the event subscription. + public SubscriptionProvisioningState? ProvisioningState { get; } + /// Information about the delivery configuration of the event subscription. + public DeliveryConfiguration DeliveryConfiguration { get; set; } + /// The event delivery schema for the event subscription. + public DeliverySchema? EventDeliverySchema { get; set; } + /// Information about the filter for the event subscription. + public FiltersConfiguration FiltersConfiguration { get; set; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SubscriptionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SubscriptionResource.cs new file mode 100644 index 000000000000..8ad9b63fe4c3 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SubscriptionResource.cs @@ -0,0 +1,298 @@ +// 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.EventGrid.Models; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// A Class representing a Subscription 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 GetSubscriptionResource method. + /// Otherwise you can get one from its parent resource using the GetSubscription method. + /// + public partial class SubscriptionResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string eventSubscriptionName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics; + private readonly NamespaceTopicEventSubscriptionsRestOperations _subscriptionNamespaceTopicEventSubscriptionsRestClient; + private readonly SubscriptionData _data; + + /// Initializes a new instance of the class for mocking. + protected SubscriptionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SubscriptionResource(ArmClient client, SubscriptionData 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 SubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string subscriptionNamespaceTopicEventSubscriptionsApiVersion); + _subscriptionNamespaceTopicEventSubscriptionsRestClient = new NamespaceTopicEventSubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, subscriptionNamespaceTopicEventSubscriptionsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.EventGrid/namespaces/topics/eventSubscriptions"; + + /// 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 SubscriptionData 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)); + } + + /// + /// Get properties of an event subscription of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics.CreateScope("SubscriptionResource.Get"); + scope.Start(); + try + { + var response = await _subscriptionNamespaceTopicEventSubscriptionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of an event subscription of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics.CreateScope("SubscriptionResource.Get"); + scope.Start(); + try + { + var response = _subscriptionNamespaceTopicEventSubscriptionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete an existing event subscription of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics.CreateScope("SubscriptionResource.Delete"); + scope.Start(); + try + { + var response = await _subscriptionNamespaceTopicEventSubscriptionsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(_subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics, Pipeline, _subscriptionNamespaceTopicEventSubscriptionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete an existing event subscription of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics.CreateScope("SubscriptionResource.Delete"); + scope.Start(); + try + { + var response = _subscriptionNamespaceTopicEventSubscriptionsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new EventGridArmOperation(_subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics, Pipeline, _subscriptionNamespaceTopicEventSubscriptionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update an existing event subscription of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_Update + /// + /// + /// + /// 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. + /// Updated event subscription information. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, SubscriptionPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics.CreateScope("SubscriptionResource.Update"); + scope.Start(); + try + { + var response = await _subscriptionNamespaceTopicEventSubscriptionsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new SubscriptionOperationSource(Client), _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics, Pipeline, _subscriptionNamespaceTopicEventSubscriptionsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update an existing event subscription of a namespace topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_Update + /// + /// + /// + /// 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. + /// Updated event subscription information. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, SubscriptionPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics.CreateScope("SubscriptionResource.Update"); + scope.Start(); + try + { + var response = _subscriptionNamespaceTopicEventSubscriptionsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); + var operation = new EventGridArmOperation(new SubscriptionOperationSource(Client), _subscriptionNamespaceTopicEventSubscriptionsClientDiagnostics, Pipeline, _subscriptionNamespaceTopicEventSubscriptionsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicEventSubscriptionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicEventSubscriptionResource.cs index 51f16099719a..733d7a6a74cc 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicEventSubscriptionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicEventSubscriptionResource.cs @@ -295,6 +295,48 @@ public virtual ArmOperation Update(WaitUnt } } + /// + /// Get all delivery attributes for an event subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes + /// + /// + /// Operation Id + /// SystemTopicEventSubscriptions_GetDeliveryAttributes + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeliveryAttributesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _systemTopicEventSubscriptionRestClient.CreateGetDeliveryAttributesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, DeliveryAttributeMapping.DeserializeDeliveryAttributeMapping, _systemTopicEventSubscriptionClientDiagnostics, Pipeline, "SystemTopicEventSubscriptionResource.GetDeliveryAttributes", "value", null, cancellationToken); + } + + /// + /// Get all delivery attributes for an event subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes + /// + /// + /// Operation Id + /// SystemTopicEventSubscriptions_GetDeliveryAttributes + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeliveryAttributes(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _systemTopicEventSubscriptionRestClient.CreateGetDeliveryAttributesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return PageableHelpers.CreatePageable(FirstPageRequest, null, DeliveryAttributeMapping.DeserializeDeliveryAttributeMapping, _systemTopicEventSubscriptionClientDiagnostics, Pipeline, "SystemTopicEventSubscriptionResource.GetDeliveryAttributes", "value", null, cancellationToken); + } + /// /// Get the full endpoint URL for an event subscription of a system topic. /// @@ -354,47 +396,5 @@ public virtual Response GetFullUri(CancellationToken c throw; } } - - /// - /// Get all delivery attributes for an event subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes - /// - /// - /// Operation Id - /// SystemTopicEventSubscriptions_GetDeliveryAttributes - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeliveryAttributesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _systemTopicEventSubscriptionRestClient.CreateGetDeliveryAttributesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, DeliveryAttributeMapping.DeserializeDeliveryAttributeMapping, _systemTopicEventSubscriptionClientDiagnostics, Pipeline, "SystemTopicEventSubscriptionResource.GetDeliveryAttributes", "value", null, cancellationToken); - } - - /// - /// Get all delivery attributes for an event subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes - /// - /// - /// Operation Id - /// SystemTopicEventSubscriptions_GetDeliveryAttributes - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeliveryAttributes(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _systemTopicEventSubscriptionRestClient.CreateGetDeliveryAttributesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return PageableHelpers.CreatePageable(FirstPageRequest, null, DeliveryAttributeMapping.DeserializeDeliveryAttributeMapping, _systemTopicEventSubscriptionClientDiagnostics, Pipeline, "SystemTopicEventSubscriptionResource.GetDeliveryAttributes", "value", null, cancellationToken); - } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceCollection.cs new file mode 100644 index 000000000000..48bb443388ad --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceCollection.cs @@ -0,0 +1,344 @@ +// 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; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// 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 GetTopicSpaces method from an instance of . + /// + public partial class TopicSpaceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _topicSpaceClientDiagnostics; + private readonly TopicSpacesRestOperations _topicSpaceRestClient; + + /// Initializes a new instance of the class for mocking. + protected TopicSpaceCollection() + { + } + + /// 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 TopicSpaceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _topicSpaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", TopicSpaceResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(TopicSpaceResource.ResourceType, out string topicSpaceApiVersion); + _topicSpaceRestClient = new TopicSpacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, topicSpaceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NamespaceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NamespaceResource.ResourceType), nameof(id)); + } + + /// + /// Create or update a topic space with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_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 topic space name. + /// Topic space information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string topicSpaceName, TopicSpaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicSpaceName, nameof(topicSpaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _topicSpaceClientDiagnostics.CreateScope("TopicSpaceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _topicSpaceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicSpaceName, data, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new TopicSpaceOperationSource(Client), _topicSpaceClientDiagnostics, Pipeline, _topicSpaceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicSpaceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a topic space with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_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 topic space name. + /// Topic space information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string topicSpaceName, TopicSpaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicSpaceName, nameof(topicSpaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _topicSpaceClientDiagnostics.CreateScope("TopicSpaceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _topicSpaceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicSpaceName, data, cancellationToken); + var operation = new EventGridArmOperation(new TopicSpaceOperationSource(Client), _topicSpaceClientDiagnostics, Pipeline, _topicSpaceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicSpaceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a topic space. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_Get + /// + /// + /// + /// Name of the Topic space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string topicSpaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicSpaceName, nameof(topicSpaceName)); + + using var scope = _topicSpaceClientDiagnostics.CreateScope("TopicSpaceCollection.Get"); + scope.Start(); + try + { + var response = await _topicSpaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicSpaceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TopicSpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a topic space. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_Get + /// + /// + /// + /// Name of the Topic space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string topicSpaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicSpaceName, nameof(topicSpaceName)); + + using var scope = _topicSpaceClientDiagnostics.CreateScope("TopicSpaceCollection.Get"); + scope.Start(); + try + { + var response = _topicSpaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicSpaceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TopicSpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get all the topic spaces under a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces + /// + /// + /// Operation Id + /// TopicSpaces_ListByNamespace + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _topicSpaceRestClient.CreateListByNamespaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _topicSpaceRestClient.CreateListByNamespaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new TopicSpaceResource(Client, TopicSpaceData.DeserializeTopicSpaceData(e)), _topicSpaceClientDiagnostics, Pipeline, "TopicSpaceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get all the topic spaces under a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces + /// + /// + /// Operation Id + /// TopicSpaces_ListByNamespace + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _topicSpaceRestClient.CreateListByNamespaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _topicSpaceRestClient.CreateListByNamespaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new TopicSpaceResource(Client, TopicSpaceData.DeserializeTopicSpaceData(e)), _topicSpaceClientDiagnostics, Pipeline, "TopicSpaceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_Get + /// + /// + /// + /// Name of the Topic space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string topicSpaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicSpaceName, nameof(topicSpaceName)); + + using var scope = _topicSpaceClientDiagnostics.CreateScope("TopicSpaceCollection.Exists"); + scope.Start(); + try + { + var response = await _topicSpaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicSpaceName, 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.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_Get + /// + /// + /// + /// Name of the Topic space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string topicSpaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicSpaceName, nameof(topicSpaceName)); + + using var scope = _topicSpaceClientDiagnostics.CreateScope("TopicSpaceCollection.Exists"); + scope.Start(); + try + { + var response = _topicSpaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicSpaceName, 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/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceData.cs new file mode 100644 index 000000000000..a4404dba4b09 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceData.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.EventGrid +{ + /// + /// A class representing the TopicSpace data model. + /// The Topic space resource. + /// + public partial class TopicSpaceData : ResourceData + { + /// Initializes a new instance of TopicSpaceData. + public TopicSpaceData() + { + TopicTemplates = new ChangeTrackingList(); + } + + /// Initializes a new instance of TopicSpaceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Description for the Topic Space resource. + /// + /// The topic filters in the topic space. + /// Example: "topicTemplates": [ + /// "devices/foo/bar", + /// "devices/topic1/+", + /// "devices/${principal.name}/${principal.attributes.keyName}" ]. + /// + /// Provisioning state of the TopicSpace resource. + internal TopicSpaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, IList topicTemplates, TopicSpaceProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + { + Description = description; + TopicTemplates = topicTemplates; + ProvisioningState = provisioningState; + } + + /// Description for the Topic Space resource. + public string Description { get; set; } + /// + /// The topic filters in the topic space. + /// Example: "topicTemplates": [ + /// "devices/foo/bar", + /// "devices/topic1/+", + /// "devices/${principal.name}/${principal.attributes.keyName}" ]. + /// + public IList TopicTemplates { get; } + /// Provisioning state of the TopicSpace resource. + public TopicSpaceProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceResource.cs new file mode 100644 index 000000000000..617af2f14857 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceResource.cs @@ -0,0 +1,297 @@ +// 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.EventGrid +{ + /// + /// A Class representing a TopicSpace 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 GetTopicSpaceResource method. + /// Otherwise you can get one from its parent resource using the GetTopicSpace method. + /// + public partial class TopicSpaceResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string topicSpaceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _topicSpaceClientDiagnostics; + private readonly TopicSpacesRestOperations _topicSpaceRestClient; + private readonly TopicSpaceData _data; + + /// Initializes a new instance of the class for mocking. + protected TopicSpaceResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal TopicSpaceResource(ArmClient client, TopicSpaceData 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 TopicSpaceResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _topicSpaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EventGrid", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string topicSpaceApiVersion); + _topicSpaceRestClient = new TopicSpacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, topicSpaceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.EventGrid/namespaces/topicSpaces"; + + /// 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 TopicSpaceData 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)); + } + + /// + /// Get properties of a topic space. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _topicSpaceClientDiagnostics.CreateScope("TopicSpaceResource.Get"); + scope.Start(); + try + { + var response = await _topicSpaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TopicSpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get properties of a topic space. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _topicSpaceClientDiagnostics.CreateScope("TopicSpaceResource.Get"); + scope.Start(); + try + { + var response = _topicSpaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TopicSpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete an existing topic space. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _topicSpaceClientDiagnostics.CreateScope("TopicSpaceResource.Delete"); + scope.Start(); + try + { + var response = await _topicSpaceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(_topicSpaceClientDiagnostics, Pipeline, _topicSpaceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete an existing topic space. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _topicSpaceClientDiagnostics.CreateScope("TopicSpaceResource.Delete"); + scope.Start(); + try + { + var response = _topicSpaceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new EventGridArmOperation(_topicSpaceClientDiagnostics, Pipeline, _topicSpaceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a topic space with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_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. + /// Topic space information. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TopicSpaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _topicSpaceClientDiagnostics.CreateScope("TopicSpaceResource.Update"); + scope.Start(); + try + { + var response = await _topicSpaceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new EventGridArmOperation(new TopicSpaceOperationSource(Client), _topicSpaceClientDiagnostics, Pipeline, _topicSpaceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a topic space with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_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. + /// Topic space information. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TopicSpaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _topicSpaceClientDiagnostics.CreateScope("TopicSpaceResource.Update"); + scope.Start(); + try + { + var response = _topicSpaceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new EventGridArmOperation(new TopicSpaceOperationSource(Client), _topicSpaceClientDiagnostics, Pipeline, _topicSpaceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicTypeData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicTypeData.cs index 3acfb56fd5b5..fc0260dab841 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicTypeData.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicTypeData.cs @@ -38,7 +38,8 @@ public TopicTypeData() /// List of locations supported by this topic type. /// Source resource format. /// Supported source scopes. - internal TopicTypeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string provider, string displayName, string description, EventGridResourceRegionType? resourceRegionType, TopicTypeProvisioningState? provisioningState, IList supportedLocations, string sourceResourceFormat, IList supportedScopesForSource) : base(id, name, resourceType, systemData) + /// Flag to indicate that a topic type can support both regional or global system topics. + internal TopicTypeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string provider, string displayName, string description, EventGridResourceRegionType? resourceRegionType, TopicTypeProvisioningState? provisioningState, IList supportedLocations, string sourceResourceFormat, IList supportedScopesForSource, bool? areRegionalAndGlobalSourcesSupported) : base(id, name, resourceType, systemData) { Provider = provider; DisplayName = displayName; @@ -48,6 +49,7 @@ internal TopicTypeData(ResourceIdentifier id, string name, ResourceType resource SupportedLocations = supportedLocations; SourceResourceFormat = sourceResourceFormat; SupportedScopesForSource = supportedScopesForSource; + AreRegionalAndGlobalSourcesSupported = areRegionalAndGlobalSourcesSupported; } /// Namespace of the provider of the topic type. @@ -66,5 +68,7 @@ internal TopicTypeData(ResourceIdentifier id, string name, ResourceType resource public string SourceResourceFormat { get; set; } /// Supported source scopes. public IList SupportedScopesForSource { get; } + /// Flag to indicate that a topic type can support both regional or global system topics. + public bool? AreRegionalAndGlobalSourcesSupported { get; set; } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/VerifiedPartnerData.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/VerifiedPartnerData.cs index 501000013e25..71e39acf3045 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/VerifiedPartnerData.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/VerifiedPartnerData.cs @@ -32,13 +32,15 @@ public VerifiedPartnerData() /// Official name of the Partner. /// Display name of the verified partner. /// Details of the partner topic scenario. + /// Details of the partner destination scenario. /// Provisioning state of the verified partner. - internal VerifiedPartnerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Guid? partnerRegistrationImmutableId, string organizationName, string partnerDisplayName, PartnerDetails partnerTopicDetails, VerifiedPartnerProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + internal VerifiedPartnerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Guid? partnerRegistrationImmutableId, string organizationName, string partnerDisplayName, PartnerDetails partnerTopicDetails, PartnerDetails partnerDestinationDetails, VerifiedPartnerProvisioningState? provisioningState) : base(id, name, resourceType, systemData) { PartnerRegistrationImmutableId = partnerRegistrationImmutableId; OrganizationName = organizationName; PartnerDisplayName = partnerDisplayName; PartnerTopicDetails = partnerTopicDetails; + PartnerDestinationDetails = partnerDestinationDetails; ProvisioningState = provisioningState; } @@ -50,6 +52,8 @@ internal VerifiedPartnerData(ResourceIdentifier id, string name, ResourceType re public string PartnerDisplayName { get; set; } /// Details of the partner topic scenario. public PartnerDetails PartnerTopicDetails { get; set; } + /// Details of the partner destination scenario. + public PartnerDetails PartnerDestinationDetails { get; set; } /// Provisioning state of the verified partner. public VerifiedPartnerProvisioningState? ProvisioningState { get; set; } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/autorest.md b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/autorest.md index 44da997a5567..6c4169fa7505 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/autorest.md +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/autorest.md @@ -9,7 +9,7 @@ generate-model-factory: false csharp: true library-name: EventGrid namespace: Azure.ResourceManager.EventGrid -require: https://github.com/Azure/azure-rest-api-specs/blob/df70965d3a207eb2a628c96aa6ed935edc6b7911/specification/eventgrid/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true skip-csproj: true