diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 4e035831c1436..eba52c7f90fb1 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -986,6 +986,12 @@ # ServiceLabel: %Oracle %Mgmt # ServiceOwners: @v-jamcheung @v-rvilathurs @v-eelhomsi +# PRLabel: %Quota +/sdk/quota/Azure.ResourceManager.*/ @tejasm-microsoft + +# ServiceLabel: %Quota %Mgmt +# ServiceOwners: @tejasm-microsoft + # PRLabel: %Recovery Services Backup /sdk/recoveryservices-backup/Azure.ResourceManager.*/ @Daya-Patil @@ -1001,6 +1007,7 @@ # PRLabel: %Spring App Discovery /sdk/springappdiscovery/Azure.ResourceManager.*/ @sunkun99 @archerzz @ArcturusZhang @ArthurMa1978 + # ServiceLabel: %Spring App Discovery %Mgmt # ServiceOwners: @sunkun99 diff --git a/sdk/quota/Azure.ResourceManager.Quota/Azure.ResourceManager.Quota.sln b/sdk/quota/Azure.ResourceManager.Quota/Azure.ResourceManager.Quota.sln index 1795b95beb046..aad6860fd118a 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/Azure.ResourceManager.Quota.sln +++ b/sdk/quota/Azure.ResourceManager.Quota/Azure.ResourceManager.Quota.sln @@ -44,7 +44,6 @@ Global {41D2F401-C1C8-477F-9FAD-3A7C4ADAB43E}.Release|x86.ActiveCfg = Release|Any CPU {41D2F401-C1C8-477F-9FAD-3A7C4ADAB43E}.Release|x86.Build.0 = Release|Any CPU {1095BB62-9456-4D33-A6CF-18313491CF74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1095BB62-9456-4D33-A6CF-18313491CF74}.Debug|Any CPU.Build.0 = Debug|Any CPU {1095BB62-9456-4D33-A6CF-18313491CF74}.Debug|x64.ActiveCfg = Debug|Any CPU {1095BB62-9456-4D33-A6CF-18313491CF74}.Debug|x64.Build.0 = Debug|Any CPU {1095BB62-9456-4D33-A6CF-18313491CF74}.Debug|x86.ActiveCfg = Debug|Any CPU diff --git a/sdk/quota/Azure.ResourceManager.Quota/CHANGELOG.md b/sdk/quota/Azure.ResourceManager.Quota/CHANGELOG.md index 6e36715741da5..8913fb3ea21e8 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/CHANGELOG.md +++ b/sdk/quota/Azure.ResourceManager.Quota/CHANGELOG.md @@ -1,22 +1,23 @@ # Release History -## 1.1.0-beta.2 (Unreleased) +## 1.1.0-beta.2 (2027-07-23) ### Features Added -- Enable the new model serialization by using the System.ClientModel, refer this [document](https://aka.ms/azsdk/net/mrw) for more details. - -### Breaking Changes - -### Bugs Fixed +- Enabled the new model serialization by using the System.ClientModel, refer this [document](https://aka.ms/azsdk/net/mrw) for more details. +- Added experimental Bicep serialization. +- Upgraded api-version tag from 'package-2023-02-01' to 'package-2023-06-01-preview'. Tag detail available at https://github.com/Azure/azure-rest-api-specs/blob/d1f4d6fcf1bbb2e71a32bb2079de12f17fedf56a/specification/quota/resource-manager/readme.md. ### Other Changes +- Upgraded Azure.Core from 1.36.0 to 1.41.0 +- Upgraded Azure.ResourceManager from 1.9.0 to 1.12.0 + ## 1.1.0-beta.1 (2023-11-29) ### Features Added -- Enable mocking for extension methods, refer this [document](https://aka.ms/azsdk/net/mocking) for more details. +- Enabled mocking for extension methods, refer this [document](https://aka.ms/azsdk/net/mocking) for more details. ### Other Changes @@ -35,8 +36,8 @@ Polishing since last public beta release: ### Features Added -- Enable the model factory feature for model mocking, more information can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-mocking-factory-builder). -- Add support for new version 2023-02-01 +- Enabled the model factory feature for model mocking, more information can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-mocking-factory-builder). +- Added support for new version 2023-02-01. ### Other Changes @@ -72,4 +73,4 @@ This package follows the [new Azure SDK guidelines](https://azure.github.io/azur This package is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). -> NOTE: For more information about unified authentication, please refer to [Microsoft Azure Identity documentation for .NET](https://docs.microsoft.com//dotnet/api/overview/azure/identity-readme?view=azure-dotnet). +> NOTE: For more information about unified authentication, please refer to [Microsoft Azure Identity documentation for .NET](https://docs.microsoft.com//dotnet/api/overview/azure/identity-readme?view=azure-dotnet). \ No newline at end of file diff --git a/sdk/quota/Azure.ResourceManager.Quota/api/Azure.ResourceManager.Quota.netstandard2.0.cs b/sdk/quota/Azure.ResourceManager.Quota/api/Azure.ResourceManager.Quota.netstandard2.0.cs index 62cefacd4e9fd..90c56c7b32406 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/api/Azure.ResourceManager.Quota.netstandard2.0.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/api/Azure.ResourceManager.Quota.netstandard2.0.cs @@ -84,8 +84,319 @@ protected CurrentUsagesBaseResource() { } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class GroupQuotaEnforcementCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected GroupQuotaEnforcementCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.Quota.GroupQuotaEnforcementData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.Quota.GroupQuotaEnforcementData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class GroupQuotaEnforcementData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaEnforcementData() { } + public Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementProperties Properties { get { throw null; } set { } } + Azure.ResourceManager.Quota.GroupQuotaEnforcementData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.GroupQuotaEnforcementData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaEnforcementResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected GroupQuotaEnforcementResource() { } + public virtual Azure.ResourceManager.Quota.GroupQuotaEnforcementData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string groupQuotaName, string resourceProviderName, Azure.Core.AzureLocation location) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Quota.GroupQuotaEnforcementData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.GroupQuotaEnforcementData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Quota.GroupQuotaEnforcementData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Quota.GroupQuotaEnforcementData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class GroupQuotaEntityCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected GroupQuotaEntityCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string groupQuotaName, Azure.ResourceManager.Quota.GroupQuotaEntityData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string groupQuotaName, Azure.ResourceManager.Quota.GroupQuotaEntityData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string groupQuotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string groupQuotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string groupQuotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string groupQuotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string groupQuotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string groupQuotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class GroupQuotaEntityData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaEntityData() { } + public Azure.ResourceManager.Quota.Models.GroupQuotaEntityBase Properties { get { throw null; } set { } } + Azure.ResourceManager.Quota.GroupQuotaEntityData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.GroupQuotaEntityData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaEntityResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected GroupQuotaEntityResource() { } + public virtual Azure.ResourceManager.Quota.GroupQuotaEntityData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdateGroupQuotaLimitsRequest(Azure.WaitUntil waitUntil, string resourceProviderName, string resourceName, Azure.ResourceManager.Quota.GroupQuotaRequestStatusData data = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateGroupQuotaLimitsRequestAsync(Azure.WaitUntil waitUntil, string resourceProviderName, string resourceName, Azure.ResourceManager.Quota.GroupQuotaRequestStatusData data = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string groupQuotaName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetGroupQuotaEnforcement(string resourceProviderName, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGroupQuotaEnforcementAsync(string resourceProviderName, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Quota.GroupQuotaEnforcementCollection GetGroupQuotaEnforcements(string resourceProviderName) { throw null; } + public virtual Azure.Response GetGroupQuotaLimit(string resourceProviderName, string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGroupQuotaLimitAsync(string resourceProviderName, string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Quota.GroupQuotaLimitCollection GetGroupQuotaLimits(string resourceProviderName) { throw null; } + public virtual Azure.Pageable GetGroupQuotaLimitsRequests(string resourceProviderName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetGroupQuotaLimitsRequestsAsync(string resourceProviderName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetGroupQuotaRequestStatus(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGroupQuotaRequestStatusAsync(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Quota.GroupQuotaRequestStatusCollection GetGroupQuotaRequestStatuses() { throw null; } + public virtual Azure.Response GetGroupQuotaSubscription(string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGroupQuotaSubscriptionAsync(string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetGroupQuotaSubscriptionRequestStatus(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGroupQuotaSubscriptionRequestStatusAsync(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Quota.GroupQuotaSubscriptionRequestStatusCollection GetGroupQuotaSubscriptionRequestStatuses() { throw null; } + public virtual Azure.ResourceManager.Quota.GroupQuotaSubscriptionCollection GetGroupQuotaSubscriptions() { throw null; } + public virtual Azure.Pageable GetGroupQuotaUsages(string resourceProviderName, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetGroupQuotaUsagesAsync(string resourceProviderName, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Quota.GroupQuotaEntityData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.GroupQuotaEntityData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Quota.Models.GroupQuotaEntityPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Quota.Models.GroupQuotaEntityPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation UpdateGroupQuotaLimitsRequest(Azure.WaitUntil waitUntil, string resourceProviderName, string resourceName, Azure.ResourceManager.Quota.GroupQuotaRequestStatusData data = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateGroupQuotaLimitsRequestAsync(Azure.WaitUntil waitUntil, string resourceProviderName, string resourceName, Azure.ResourceManager.Quota.GroupQuotaRequestStatusData data = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class GroupQuotaLimitCollection : Azure.ResourceManager.ArmCollection + { + protected GroupQuotaLimitCollection() { } + public virtual Azure.Response Exists(string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class GroupQuotaLimitData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaLimitData() { } + public Azure.ResourceManager.Quota.Models.GroupQuotaDetails Properties { get { throw null; } set { } } + Azure.ResourceManager.Quota.GroupQuotaLimitData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.GroupQuotaLimitData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaLimitResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected GroupQuotaLimitResource() { } + public virtual Azure.ResourceManager.Quota.GroupQuotaLimitData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string groupQuotaName, string resourceProviderName, string resourceName) { throw null; } + public virtual Azure.Response Get(string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Quota.GroupQuotaLimitData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.GroupQuotaLimitData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaRequestStatusCollection : Azure.ResourceManager.ArmCollection + { + protected GroupQuotaRequestStatusCollection() { } + public virtual Azure.Response Exists(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class GroupQuotaRequestStatusData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaRequestStatusData() { } + public Azure.ResourceManager.Quota.Models.GroupQuotaRequestStatusProperties Properties { get { throw null; } set { } } + Azure.ResourceManager.Quota.GroupQuotaRequestStatusData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.GroupQuotaRequestStatusData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaRequestStatusResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected GroupQuotaRequestStatusResource() { } + public virtual Azure.ResourceManager.Quota.GroupQuotaRequestStatusData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string groupQuotaName, string requestId) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Quota.GroupQuotaRequestStatusData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.GroupQuotaRequestStatusData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaSubscriptionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected GroupQuotaSubscriptionCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class GroupQuotaSubscriptionData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaSubscriptionData() { } + public Azure.ResourceManager.Quota.Models.GroupQuotaSubscriptionProperties Properties { get { throw null; } set { } } + Azure.ResourceManager.Quota.GroupQuotaSubscriptionData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.GroupQuotaSubscriptionData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaSubscriptionRequestStatusCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected GroupQuotaSubscriptionRequestStatusCollection() { } + public virtual Azure.Response Exists(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string requestId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class GroupQuotaSubscriptionRequestStatusData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaSubscriptionRequestStatusData() { } + public Azure.ResourceManager.Quota.Models.GroupQuotaSubscriptionRequestStatusProperties Properties { get { throw null; } set { } } + Azure.ResourceManager.Quota.GroupQuotaSubscriptionRequestStatusData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.GroupQuotaSubscriptionRequestStatusData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaSubscriptionRequestStatusResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected GroupQuotaSubscriptionRequestStatusResource() { } + public virtual Azure.ResourceManager.Quota.GroupQuotaSubscriptionRequestStatusData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string groupQuotaName, string requestId) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Quota.GroupQuotaSubscriptionRequestStatusData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.GroupQuotaSubscriptionRequestStatusData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaSubscriptionResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected GroupQuotaSubscriptionResource() { } + public virtual Azure.ResourceManager.Quota.GroupQuotaSubscriptionData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string groupQuotaName, string subscriptionId) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Quota.GroupQuotaSubscriptionData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.GroupQuotaSubscriptionData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class QuotaAllocationRequestStatusCollection : Azure.ResourceManager.ArmCollection + { + protected QuotaAllocationRequestStatusCollection() { } + public virtual Azure.Response Exists(string subscriptionId, string groupQuotaName, string allocationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string subscriptionId, string groupQuotaName, string allocationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string subscriptionId, string groupQuotaName, string allocationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string subscriptionId, string groupQuotaName, string allocationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string subscriptionId, string groupQuotaName, string allocationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string subscriptionId, string groupQuotaName, string allocationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class QuotaAllocationRequestStatusData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public QuotaAllocationRequestStatusData() { } + public string FaultCode { get { throw null; } } + public Azure.ResourceManager.Quota.Models.QuotaRequestStatus? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.Quota.Models.QuotaAllocationRequestBase RequestedResource { get { throw null; } set { } } + public System.DateTimeOffset? RequestSubmittedOn { get { throw null; } } + Azure.ResourceManager.Quota.QuotaAllocationRequestStatusData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.QuotaAllocationRequestStatusData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class QuotaAllocationRequestStatusResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected QuotaAllocationRequestStatusResource() { } + public virtual Azure.ResourceManager.Quota.QuotaAllocationRequestStatusData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string subscriptionId, string groupQuotaName, string allocationId) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Quota.QuotaAllocationRequestStatusData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.QuotaAllocationRequestStatusData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public static partial class QuotaExtensions { + public static Azure.ResourceManager.ArmOperation CreateOrUpdateGroupQuotaSubscriptionAllocationRequest(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, Azure.WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, Azure.ResourceManager.Quota.QuotaAllocationRequestStatusData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> CreateOrUpdateGroupQuotaSubscriptionAllocationRequestAsync(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, Azure.WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, Azure.ResourceManager.Quota.QuotaAllocationRequestStatusData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Response GetCurrentQuotaLimitBase(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetCurrentQuotaLimitBaseAsync(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.Quota.CurrentQuotaLimitBaseResource GetCurrentQuotaLimitBaseResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } @@ -94,12 +405,33 @@ public static partial class QuotaExtensions public static System.Threading.Tasks.Task> GetCurrentUsagesBaseAsync(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.Quota.CurrentUsagesBaseResource GetCurrentUsagesBaseResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Quota.CurrentUsagesBaseCollection GetCurrentUsagesBases(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } + public static Azure.ResourceManager.Quota.GroupQuotaEnforcementResource GetGroupQuotaEnforcementResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Quota.GroupQuotaEntityCollection GetGroupQuotaEntities(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource) { throw null; } + public static Azure.Response GetGroupQuotaEntity(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, string groupQuotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetGroupQuotaEntityAsync(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, string groupQuotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Quota.GroupQuotaEntityResource GetGroupQuotaEntityResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Quota.GroupQuotaLimitResource GetGroupQuotaLimitResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Quota.GroupQuotaRequestStatusResource GetGroupQuotaRequestStatusResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Quota.GroupQuotaSubscriptionRequestStatusResource GetGroupQuotaSubscriptionRequestStatusResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Quota.GroupQuotaSubscriptionResource GetGroupQuotaSubscriptionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetQuotaAllocationRequestStatus(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, string subscriptionId, string groupQuotaName, string allocationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetQuotaAllocationRequestStatusAsync(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, string subscriptionId, string groupQuotaName, string allocationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Quota.QuotaAllocationRequestStatusCollection GetQuotaAllocationRequestStatuses(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource) { throw null; } + public static Azure.Pageable GetQuotaAllocationRequestStatusesByResourceProvider(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, string subscriptionId, string groupQuotaName, string resourceProviderName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetQuotaAllocationRequestStatusesByResourceProviderAsync(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, string subscriptionId, string groupQuotaName, string resourceProviderName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Quota.QuotaAllocationRequestStatusResource GetQuotaAllocationRequestStatusResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.Pageable GetQuotaOperations(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetQuotaOperationsAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Response GetQuotaRequestDetail(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetQuotaRequestDetailAsync(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.Quota.QuotaRequestDetailResource GetQuotaRequestDetailResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Quota.QuotaRequestDetailCollection GetQuotaRequestDetails(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } + public static Azure.Response GetSubscriptionQuotaAllocation(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, string subscriptionId, string groupQuotaName, string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSubscriptionQuotaAllocationAsync(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, string subscriptionId, string groupQuotaName, string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Quota.SubscriptionQuotaAllocationResource GetSubscriptionQuotaAllocationResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Quota.SubscriptionQuotaAllocationCollection GetSubscriptionQuotaAllocations(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, string subscriptionId, string groupQuotaName) { throw null; } + public static Azure.ResourceManager.ArmOperation UpdateGroupQuotaSubscriptionAllocationRequest(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, Azure.WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, Azure.ResourceManager.Quota.QuotaAllocationRequestStatusData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> UpdateGroupQuotaSubscriptionAllocationRequestAsync(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, Azure.WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, Azure.ResourceManager.Quota.QuotaAllocationRequestStatusData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class QuotaRequestDetailCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -145,6 +477,43 @@ protected QuotaRequestDetailResource() { } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class SubscriptionQuotaAllocationCollection : Azure.ResourceManager.ArmCollection + { + protected SubscriptionQuotaAllocationCollection() { } + public virtual Azure.Response Exists(string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SubscriptionQuotaAllocationData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SubscriptionQuotaAllocationData() { } + public Azure.ResourceManager.Quota.Models.SubscriptionQuotaDetails Properties { get { throw null; } set { } } + Azure.ResourceManager.Quota.SubscriptionQuotaAllocationData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.SubscriptionQuotaAllocationData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SubscriptionQuotaAllocationResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SubscriptionQuotaAllocationResource() { } + public virtual Azure.ResourceManager.Quota.SubscriptionQuotaAllocationData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string subscriptionId, string groupQuotaName, string resourceName) { throw null; } + public virtual Azure.Response Get(string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Quota.SubscriptionQuotaAllocationData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.SubscriptionQuotaAllocationData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } } namespace Azure.ResourceManager.Quota.Mocking { @@ -159,10 +528,37 @@ protected MockableQuotaArmClient() { } public virtual System.Threading.Tasks.Task> GetCurrentUsagesBaseAsync(Azure.Core.ResourceIdentifier scope, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Quota.CurrentUsagesBaseResource GetCurrentUsagesBaseResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Quota.CurrentUsagesBaseCollection GetCurrentUsagesBases(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.Quota.GroupQuotaEnforcementResource GetGroupQuotaEnforcementResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Quota.GroupQuotaEntityResource GetGroupQuotaEntityResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Quota.GroupQuotaLimitResource GetGroupQuotaLimitResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Quota.GroupQuotaRequestStatusResource GetGroupQuotaRequestStatusResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Quota.GroupQuotaSubscriptionRequestStatusResource GetGroupQuotaSubscriptionRequestStatusResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Quota.GroupQuotaSubscriptionResource GetGroupQuotaSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Quota.QuotaAllocationRequestStatusResource GetQuotaAllocationRequestStatusResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.Response GetQuotaRequestDetail(Azure.Core.ResourceIdentifier scope, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetQuotaRequestDetailAsync(Azure.Core.ResourceIdentifier scope, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Quota.QuotaRequestDetailResource GetQuotaRequestDetailResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Quota.QuotaRequestDetailCollection GetQuotaRequestDetails(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.Quota.SubscriptionQuotaAllocationResource GetSubscriptionQuotaAllocationResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableQuotaManagementGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableQuotaManagementGroupResource() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdateGroupQuotaSubscriptionAllocationRequest(Azure.WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, Azure.ResourceManager.Quota.QuotaAllocationRequestStatusData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateGroupQuotaSubscriptionAllocationRequestAsync(Azure.WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, Azure.ResourceManager.Quota.QuotaAllocationRequestStatusData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Quota.GroupQuotaEntityCollection GetGroupQuotaEntities() { throw null; } + public virtual Azure.Response GetGroupQuotaEntity(string groupQuotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGroupQuotaEntityAsync(string groupQuotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetQuotaAllocationRequestStatus(string subscriptionId, string groupQuotaName, string allocationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetQuotaAllocationRequestStatusAsync(string subscriptionId, string groupQuotaName, string allocationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Quota.QuotaAllocationRequestStatusCollection GetQuotaAllocationRequestStatuses() { throw null; } + public virtual Azure.Pageable GetQuotaAllocationRequestStatusesByResourceProvider(string subscriptionId, string groupQuotaName, string resourceProviderName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQuotaAllocationRequestStatusesByResourceProviderAsync(string subscriptionId, string groupQuotaName, string resourceProviderName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSubscriptionQuotaAllocation(string subscriptionId, string groupQuotaName, string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSubscriptionQuotaAllocationAsync(string subscriptionId, string groupQuotaName, string resourceName, string filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Quota.SubscriptionQuotaAllocationCollection GetSubscriptionQuotaAllocations(string subscriptionId, string groupQuotaName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation UpdateGroupQuotaSubscriptionAllocationRequest(Azure.WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, Azure.ResourceManager.Quota.QuotaAllocationRequestStatusData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateGroupQuotaSubscriptionAllocationRequestAsync(Azure.WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, Azure.ResourceManager.Quota.QuotaAllocationRequestStatusData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class MockableQuotaTenantResource : Azure.ResourceManager.ArmResource { @@ -177,6 +573,25 @@ public static partial class ArmQuotaModelFactory { public static Azure.ResourceManager.Quota.CurrentQuotaLimitBaseData CurrentQuotaLimitBaseData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Quota.Models.QuotaProperties properties = null) { throw null; } public static Azure.ResourceManager.Quota.CurrentUsagesBaseData CurrentUsagesBaseData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Quota.Models.QuotaUsagesProperties properties = null) { throw null; } + public static Azure.ResourceManager.Quota.Models.GroupQuotaDetails GroupQuotaDetails(string region = null, long? limit = default(long?), string comment = null, string unit = null, long? availableLimit = default(long?), System.Collections.Generic.IEnumerable allocatedToSubscriptionsValue = null, string value = null, string localizedValue = null) { throw null; } + public static Azure.ResourceManager.Quota.GroupQuotaEnforcementData GroupQuotaEnforcementData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementProperties properties = null) { throw null; } + public static Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementProperties GroupQuotaEnforcementProperties(Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementState? enforcementEnabled = default(Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementState?), Azure.ResourceManager.Quota.Models.QuotaRequestStatus? provisioningState = default(Azure.ResourceManager.Quota.Models.QuotaRequestStatus?), string faultCode = null) { throw null; } + public static Azure.ResourceManager.Quota.Models.GroupQuotaEntityBase GroupQuotaEntityBase(string displayName = null, Azure.ResourceManager.Quota.Models.GroupQuotaAdditionalAttributes additionalAttributes = null, Azure.ResourceManager.Quota.Models.QuotaRequestStatus? provisioningState = default(Azure.ResourceManager.Quota.Models.QuotaRequestStatus?)) { throw null; } + public static Azure.ResourceManager.Quota.GroupQuotaEntityData GroupQuotaEntityData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Quota.Models.GroupQuotaEntityBase properties = null) { throw null; } + public static Azure.ResourceManager.Quota.Models.GroupQuotaEntityPatch GroupQuotaEntityPatch(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Quota.Models.GroupQuotasEntityBasePatch properties = null) { throw null; } + public static Azure.ResourceManager.Quota.GroupQuotaLimitData GroupQuotaLimitData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Quota.Models.GroupQuotaDetails properties = null) { throw null; } + public static Azure.ResourceManager.Quota.Models.GroupQuotaRequestBase GroupQuotaRequestBase(long? limit = default(long?), string region = null, string comments = null, string value = null, string localizedValue = null) { throw null; } + public static Azure.ResourceManager.Quota.GroupQuotaRequestStatusData GroupQuotaRequestStatusData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Quota.Models.GroupQuotaRequestStatusProperties properties = null) { throw null; } + public static Azure.ResourceManager.Quota.Models.GroupQuotaRequestStatusProperties GroupQuotaRequestStatusProperties(Azure.ResourceManager.Quota.Models.GroupQuotaRequestBase requestedResource = null, System.DateTimeOffset? requestSubmittedOn = default(System.DateTimeOffset?), Azure.ResourceManager.Quota.Models.QuotaRequestStatus? provisioningState = default(Azure.ResourceManager.Quota.Models.QuotaRequestStatus?), string faultCode = null) { throw null; } + public static Azure.ResourceManager.Quota.Models.GroupQuotaResourceUsages GroupQuotaResourceUsages(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Quota.Models.GroupQuotaUsagesBase properties = null) { throw null; } + public static Azure.ResourceManager.Quota.Models.GroupQuotasEntityBasePatch GroupQuotasEntityBasePatch(string displayName = null, Azure.ResourceManager.Quota.Models.GroupQuotaAdditionalAttributesPatch additionalAttributes = null, Azure.ResourceManager.Quota.Models.QuotaRequestStatus? provisioningState = default(Azure.ResourceManager.Quota.Models.QuotaRequestStatus?)) { throw null; } + public static Azure.ResourceManager.Quota.GroupQuotaSubscriptionData GroupQuotaSubscriptionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Quota.Models.GroupQuotaSubscriptionProperties properties = null) { throw null; } + public static Azure.ResourceManager.Quota.Models.GroupQuotaSubscriptionProperties GroupQuotaSubscriptionProperties(string subscriptionId = null, Azure.ResourceManager.Quota.Models.QuotaRequestStatus? provisioningState = default(Azure.ResourceManager.Quota.Models.QuotaRequestStatus?)) { throw null; } + public static Azure.ResourceManager.Quota.GroupQuotaSubscriptionRequestStatusData GroupQuotaSubscriptionRequestStatusData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Quota.Models.GroupQuotaSubscriptionRequestStatusProperties properties = null) { throw null; } + public static Azure.ResourceManager.Quota.Models.GroupQuotaSubscriptionRequestStatusProperties GroupQuotaSubscriptionRequestStatusProperties(string subscriptionId = null, System.DateTimeOffset? requestSubmitOn = default(System.DateTimeOffset?), Azure.ResourceManager.Quota.Models.QuotaRequestStatus? provisioningState = default(Azure.ResourceManager.Quota.Models.QuotaRequestStatus?)) { throw null; } + public static Azure.ResourceManager.Quota.Models.GroupQuotaUsagesBase GroupQuotaUsagesBase(long? limit = default(long?), long? usages = default(long?), string unit = null, string value = null, string localizedValue = null) { throw null; } + public static Azure.ResourceManager.Quota.Models.QuotaAllocationRequestBase QuotaAllocationRequestBase(long? limit = default(long?), string region = null, string value = null, string localizedValue = null) { throw null; } + public static Azure.ResourceManager.Quota.QuotaAllocationRequestStatusData QuotaAllocationRequestStatusData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Quota.Models.QuotaAllocationRequestBase requestedResource = null, System.DateTimeOffset? requestSubmittedOn = default(System.DateTimeOffset?), Azure.ResourceManager.Quota.Models.QuotaRequestStatus? provisioningState = default(Azure.ResourceManager.Quota.Models.QuotaRequestStatus?), string faultCode = null) { throw null; } public static Azure.ResourceManager.Quota.Models.QuotaOperationDisplay QuotaOperationDisplay(string provider = null, string resource = null, string operation = null, string description = null) { throw null; } public static Azure.ResourceManager.Quota.Models.QuotaOperationResult QuotaOperationResult(string name = null, Azure.ResourceManager.Quota.Models.QuotaOperationDisplay display = null, string origin = null) { throw null; } public static Azure.ResourceManager.Quota.Models.QuotaProperties QuotaProperties(Azure.ResourceManager.Quota.Models.QuotaLimitJsonObject limit = null, string unit = null, Azure.ResourceManager.Quota.Models.QuotaRequestResourceName name = null, string resourceTypeName = null, System.TimeSpan? quotaPeriod = default(System.TimeSpan?), bool? isQuotaApplicable = default(bool?), System.BinaryData properties = null) { throw null; } @@ -186,6 +601,247 @@ public static partial class ArmQuotaModelFactory public static Azure.ResourceManager.Quota.Models.QuotaUsagesObject QuotaUsagesObject(int value = 0, Azure.ResourceManager.Quota.Models.QuotaUsagesType? usagesType = default(Azure.ResourceManager.Quota.Models.QuotaUsagesType?)) { throw null; } public static Azure.ResourceManager.Quota.Models.QuotaUsagesProperties QuotaUsagesProperties(Azure.ResourceManager.Quota.Models.QuotaUsagesObject usages = null, string unit = null, Azure.ResourceManager.Quota.Models.QuotaRequestResourceName name = null, string resourceTypeName = null, System.TimeSpan? quotaPeriod = default(System.TimeSpan?), bool? isQuotaApplicable = default(bool?), System.BinaryData properties = null) { throw null; } public static Azure.ResourceManager.Quota.Models.ServiceErrorDetail ServiceErrorDetail(string code = null, string message = null) { throw null; } + public static Azure.ResourceManager.Quota.Models.SubscriptionAllocatedQuota SubscriptionAllocatedQuota(string subscriptionId = null, long? quotaAllocated = default(long?)) { throw null; } + public static Azure.ResourceManager.Quota.SubscriptionQuotaAllocationData SubscriptionQuotaAllocationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Quota.Models.SubscriptionQuotaDetails properties = null) { throw null; } + public static Azure.ResourceManager.Quota.Models.SubscriptionQuotaDetails SubscriptionQuotaDetails(string region = null, long? limit = default(long?), long? shareableQuota = default(long?), string value = null, string localizedValue = null) { throw null; } + } + public partial class GroupQuotaAdditionalAttributes : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaAdditionalAttributes(Azure.ResourceManager.Quota.Models.GroupQuotaGroupingId groupId) { } + public Azure.ResourceManager.Quota.Models.GroupQuotaEnvironmentType? Environment { get { throw null; } set { } } + public Azure.ResourceManager.Quota.Models.GroupQuotaGroupingId GroupId { get { throw null; } set { } } + Azure.ResourceManager.Quota.Models.GroupQuotaAdditionalAttributes System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.GroupQuotaAdditionalAttributes System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaAdditionalAttributesPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaAdditionalAttributesPatch() { } + public Azure.ResourceManager.Quota.Models.GroupQuotaEnvironmentType? Environment { get { throw null; } set { } } + public Azure.ResourceManager.Quota.Models.GroupQuotaGroupingId GroupId { get { throw null; } set { } } + Azure.ResourceManager.Quota.Models.GroupQuotaAdditionalAttributesPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.GroupQuotaAdditionalAttributesPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaDetails() { } + public System.Collections.Generic.IReadOnlyList AllocatedToSubscriptionsValue { get { throw null; } } + public long? AvailableLimit { get { throw null; } } + public string Comment { get { throw null; } set { } } + public long? Limit { get { throw null; } set { } } + public string LocalizedValue { get { throw null; } } + public string Region { get { throw null; } set { } } + public string Unit { get { throw null; } } + public string Value { get { throw null; } } + Azure.ResourceManager.Quota.Models.GroupQuotaDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.GroupQuotaDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaEnforcementProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaEnforcementProperties() { } + public Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementState? EnforcementEnabled { get { throw null; } set { } } + public string FaultCode { get { throw null; } } + public Azure.ResourceManager.Quota.Models.QuotaRequestStatus? ProvisioningState { get { throw null; } } + Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct GroupQuotaEnforcementState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public GroupQuotaEnforcementState(string value) { throw null; } + public static Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementState Disabled { get { throw null; } } + public static Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementState Enabled { get { throw null; } } + public static Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementState NotAvailable { get { throw null; } } + public bool Equals(Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementState left, Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementState right) { throw null; } + public static implicit operator Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementState left, Azure.ResourceManager.Quota.Models.GroupQuotaEnforcementState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class GroupQuotaEntityBase : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaEntityBase() { } + public Azure.ResourceManager.Quota.Models.GroupQuotaAdditionalAttributes AdditionalAttributes { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public Azure.ResourceManager.Quota.Models.QuotaRequestStatus? ProvisioningState { get { throw null; } } + Azure.ResourceManager.Quota.Models.GroupQuotaEntityBase System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.GroupQuotaEntityBase System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaEntityPatch : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaEntityPatch() { } + public Azure.ResourceManager.Quota.Models.GroupQuotasEntityBasePatch Properties { get { throw null; } set { } } + Azure.ResourceManager.Quota.Models.GroupQuotaEntityPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.GroupQuotaEntityPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct GroupQuotaEnvironmentType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public GroupQuotaEnvironmentType(string value) { throw null; } + public static Azure.ResourceManager.Quota.Models.GroupQuotaEnvironmentType NonProduction { get { throw null; } } + public static Azure.ResourceManager.Quota.Models.GroupQuotaEnvironmentType Production { get { throw null; } } + public bool Equals(Azure.ResourceManager.Quota.Models.GroupQuotaEnvironmentType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Quota.Models.GroupQuotaEnvironmentType left, Azure.ResourceManager.Quota.Models.GroupQuotaEnvironmentType right) { throw null; } + public static implicit operator Azure.ResourceManager.Quota.Models.GroupQuotaEnvironmentType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Quota.Models.GroupQuotaEnvironmentType left, Azure.ResourceManager.Quota.Models.GroupQuotaEnvironmentType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class GroupQuotaGroupingId : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaGroupingId() { } + public Azure.ResourceManager.Quota.Models.GroupQuotaGroupingIdType? GroupingIdType { get { throw null; } set { } } + public string Value { get { throw null; } set { } } + Azure.ResourceManager.Quota.Models.GroupQuotaGroupingId System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.GroupQuotaGroupingId System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct GroupQuotaGroupingIdType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public GroupQuotaGroupingIdType(string value) { throw null; } + public static Azure.ResourceManager.Quota.Models.GroupQuotaGroupingIdType BillingId { get { throw null; } } + public static Azure.ResourceManager.Quota.Models.GroupQuotaGroupingIdType ServiceTreeId { get { throw null; } } + public bool Equals(Azure.ResourceManager.Quota.Models.GroupQuotaGroupingIdType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Quota.Models.GroupQuotaGroupingIdType left, Azure.ResourceManager.Quota.Models.GroupQuotaGroupingIdType right) { throw null; } + public static implicit operator Azure.ResourceManager.Quota.Models.GroupQuotaGroupingIdType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Quota.Models.GroupQuotaGroupingIdType left, Azure.ResourceManager.Quota.Models.GroupQuotaGroupingIdType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class GroupQuotaRequestBase : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaRequestBase() { } + public string Comments { get { throw null; } set { } } + public long? Limit { get { throw null; } set { } } + public string LocalizedValue { get { throw null; } } + public string Region { get { throw null; } set { } } + public string Value { get { throw null; } } + Azure.ResourceManager.Quota.Models.GroupQuotaRequestBase System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.GroupQuotaRequestBase System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaRequestStatusProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaRequestStatusProperties() { } + public string FaultCode { get { throw null; } } + public Azure.ResourceManager.Quota.Models.QuotaRequestStatus? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.Quota.Models.GroupQuotaRequestBase RequestedResource { get { throw null; } set { } } + public System.DateTimeOffset? RequestSubmittedOn { get { throw null; } } + Azure.ResourceManager.Quota.Models.GroupQuotaRequestStatusProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.GroupQuotaRequestStatusProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaResourceUsages : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaResourceUsages() { } + public Azure.ResourceManager.Quota.Models.GroupQuotaUsagesBase Properties { get { throw null; } set { } } + Azure.ResourceManager.Quota.Models.GroupQuotaResourceUsages System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.GroupQuotaResourceUsages System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotasEntityBasePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotasEntityBasePatch() { } + public Azure.ResourceManager.Quota.Models.GroupQuotaAdditionalAttributesPatch AdditionalAttributes { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public Azure.ResourceManager.Quota.Models.QuotaRequestStatus? ProvisioningState { get { throw null; } } + Azure.ResourceManager.Quota.Models.GroupQuotasEntityBasePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.GroupQuotasEntityBasePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaSubscriptionProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaSubscriptionProperties() { } + public Azure.ResourceManager.Quota.Models.QuotaRequestStatus? ProvisioningState { get { throw null; } } + public string SubscriptionId { get { throw null; } } + Azure.ResourceManager.Quota.Models.GroupQuotaSubscriptionProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.GroupQuotaSubscriptionProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaSubscriptionRequestStatusProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaSubscriptionRequestStatusProperties() { } + public Azure.ResourceManager.Quota.Models.QuotaRequestStatus? ProvisioningState { get { throw null; } } + public System.DateTimeOffset? RequestSubmitOn { get { throw null; } set { } } + public string SubscriptionId { get { throw null; } set { } } + Azure.ResourceManager.Quota.Models.GroupQuotaSubscriptionRequestStatusProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.GroupQuotaSubscriptionRequestStatusProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GroupQuotaUsagesBase : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GroupQuotaUsagesBase() { } + public long? Limit { get { throw null; } set { } } + public string LocalizedValue { get { throw null; } } + public string Unit { get { throw null; } } + public long? Usages { get { throw null; } set { } } + public string Value { get { throw null; } set { } } + Azure.ResourceManager.Quota.Models.GroupQuotaUsagesBase System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.GroupQuotaUsagesBase System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class QuotaAllocationRequestBase : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public QuotaAllocationRequestBase() { } + public long? Limit { get { throw null; } set { } } + public string LocalizedValue { get { throw null; } } + public string Region { get { throw null; } set { } } + public string Value { get { throw null; } } + Azure.ResourceManager.Quota.Models.QuotaAllocationRequestBase System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.QuotaAllocationRequestBase System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } public abstract partial class QuotaLimitJsonObject : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -298,6 +954,29 @@ public QuotaRequestResourceName() { } public static bool operator !=(Azure.ResourceManager.Quota.Models.QuotaRequestState left, Azure.ResourceManager.Quota.Models.QuotaRequestState right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct QuotaRequestStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public QuotaRequestStatus(string value) { throw null; } + public static Azure.ResourceManager.Quota.Models.QuotaRequestStatus Accepted { get { throw null; } } + public static Azure.ResourceManager.Quota.Models.QuotaRequestStatus Canceled { get { throw null; } } + public static Azure.ResourceManager.Quota.Models.QuotaRequestStatus Created { get { throw null; } } + public static Azure.ResourceManager.Quota.Models.QuotaRequestStatus Failed { get { throw null; } } + public static Azure.ResourceManager.Quota.Models.QuotaRequestStatus InProgress { get { throw null; } } + public static Azure.ResourceManager.Quota.Models.QuotaRequestStatus Invalid { get { throw null; } } + public static Azure.ResourceManager.Quota.Models.QuotaRequestStatus Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.Quota.Models.QuotaRequestStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Quota.Models.QuotaRequestStatus left, Azure.ResourceManager.Quota.Models.QuotaRequestStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.Quota.Models.QuotaRequestStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Quota.Models.QuotaRequestStatus left, Azure.ResourceManager.Quota.Models.QuotaRequestStatus right) { throw null; } + public override string ToString() { throw null; } + } public partial class QuotaSubRequestDetail : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal QuotaSubRequestDetail() { } @@ -370,4 +1049,29 @@ internal ServiceErrorDetail() { } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class SubscriptionAllocatedQuota : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SubscriptionAllocatedQuota() { } + public long? QuotaAllocated { get { throw null; } } + public string SubscriptionId { get { throw null; } } + Azure.ResourceManager.Quota.Models.SubscriptionAllocatedQuota System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.SubscriptionAllocatedQuota System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SubscriptionQuotaDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SubscriptionQuotaDetails() { } + public long? Limit { get { throw null; } set { } } + public string LocalizedValue { get { throw null; } } + public string Region { get { throw null; } set { } } + public long? ShareableQuota { get { throw null; } } + public string Value { get { throw null; } } + Azure.ResourceManager.Quota.Models.SubscriptionQuotaDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Quota.Models.SubscriptionQuotaDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } } diff --git a/sdk/quota/Azure.ResourceManager.Quota/assets.json b/sdk/quota/Azure.ResourceManager.Quota/assets.json index 73dc8e86b6023..56a5e35433d66 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/assets.json +++ b/sdk/quota/Azure.ResourceManager.Quota/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/quota/Azure.ResourceManager.Quota", - "Tag": "net/quota/Azure.ResourceManager.Quota_253c07d9f8" + "Tag": "net/quota/Azure.ResourceManager.Quota_e87cf161fa" } diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentQuotaLimitBaseCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentQuotaLimitBaseCollection.cs index 1e8f8e7536a0e..ced5a54f3b9a1 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentQuotaLimitBaseCollection.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentQuotaLimitBaseCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_CurrentQuotaLimitBaseCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_QuotasGetRequestForCompute() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getComputeOneSkuQuotaLimit.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getComputeOneSkuQuotaLimit.json // this example is just showing the usage of "Quota_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +52,7 @@ public async Task Get_QuotasGetRequestForCompute() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_QuotasGetRequestForCompute() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getComputeOneSkuQuotaLimit.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getComputeOneSkuQuotaLimit.json // this example is just showing the usage of "Quota_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -80,7 +80,7 @@ public async Task Exists_QuotasGetRequestForCompute() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_QuotasGetRequestForCompute() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getComputeOneSkuQuotaLimit.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getComputeOneSkuQuotaLimit.json // this example is just showing the usage of "Quota_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -120,7 +120,7 @@ public async Task GetIfExists_QuotasGetRequestForCompute() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_QuotasUsagesRequestForNetwork() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getNetworkOneSkuQuotaLimit.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getNetworkOneSkuQuotaLimit.json // this example is just showing the usage of "Quota_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -152,7 +152,7 @@ public async Task Get_QuotasUsagesRequestForNetwork() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_QuotasUsagesRequestForNetwork() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getNetworkOneSkuQuotaLimit.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getNetworkOneSkuQuotaLimit.json // this example is just showing the usage of "Quota_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -180,7 +180,7 @@ public async Task Exists_QuotasUsagesRequestForNetwork() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_QuotasUsagesRequestForNetwork() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getNetworkOneSkuQuotaLimit.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getNetworkOneSkuQuotaLimit.json // this example is just showing the usage of "Quota_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -220,7 +220,7 @@ public async Task GetIfExists_QuotasUsagesRequestForNetwork() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_QuotasPutRequestForNetwork() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/putNetworkOneSkuQuotaRequest.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/putNetworkOneSkuQuotaRequest.json // this example is just showing the usage of "Quota_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -265,7 +265,7 @@ public async Task CreateOrUpdate_QuotasPutRequestForNetwork() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_QuotasPutRequestForNetworkStandardSkuPublicIpAddressesResource() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/putNetworkOneSkuQuotaRequestStandardSkuPublicIpAddresses.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/putNetworkOneSkuQuotaRequestStandardSkuPublicIpAddresses.json // this example is just showing the usage of "Quota_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -310,7 +310,7 @@ public async Task CreateOrUpdate_QuotasPutRequestForNetworkStandardSkuPublicIpAd [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_QuotasPutRequestForCompute() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/putComputeOneSkuQuotaRequest.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/putComputeOneSkuQuotaRequest.json // this example is just showing the usage of "Quota_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -354,7 +354,7 @@ public async Task CreateOrUpdate_QuotasPutRequestForCompute() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_QuotasRequestForMachineLearningServicesLowPriorityResource() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/putMachineLearningServicesQuotaRequestLowPriority.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/putMachineLearningServicesQuotaRequestLowPriority.json // this example is just showing the usage of "Quota_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -399,7 +399,7 @@ public async Task CreateOrUpdate_QuotasRequestForMachineLearningServicesLowPrior [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_QuotasListQuotaLimitsForCompute() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getComputeQuotaLimits.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getComputeQuotaLimits.json // this example is just showing the usage of "Quota_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -433,7 +433,7 @@ public async Task GetAll_QuotasListQuotaLimitsForCompute() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_QuotasListQuotaLimitsForNetwork() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getNetworkQuotaLimits.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getNetworkQuotaLimits.json // this example is just showing the usage of "Quota_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -467,7 +467,7 @@ public async Task GetAll_QuotasListQuotaLimitsForNetwork() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_QuotasListQuotaLimitsMachineLearningServices() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getMachineLearningServicesQuotaLimits.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getMachineLearningServicesQuotaLimits.json // this example is just showing the usage of "Quota_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentQuotaLimitBaseResource.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentQuotaLimitBaseResource.cs index 28ac0b4feb750..8c7ee11303c42 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentQuotaLimitBaseResource.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentQuotaLimitBaseResource.cs @@ -20,7 +20,7 @@ public partial class Sample_CurrentQuotaLimitBaseResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_QuotasGetRequestForCompute() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getComputeOneSkuQuotaLimit.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getComputeOneSkuQuotaLimit.json // this example is just showing the usage of "Quota_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_QuotasGetRequestForCompute() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_QuotasUsagesRequestForNetwork() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getNetworkOneSkuQuotaLimit.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getNetworkOneSkuQuotaLimit.json // this example is just showing the usage of "Quota_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -80,7 +80,7 @@ public async Task Get_QuotasUsagesRequestForNetwork() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_QuotasRequestPatchForCompute() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/patchComputeQuotaRequest.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/patchComputeQuotaRequest.json // this example is just showing the usage of "Quota_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -122,7 +122,7 @@ public async Task Update_QuotasRequestPatchForCompute() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_QuotasRequestPatchForNetwork() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/patchNetworkOneSkuQuotaRequest.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/patchNetworkOneSkuQuotaRequest.json // this example is just showing the usage of "Quota_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentUsagesBaseCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentUsagesBaseCollection.cs index 8ffb3c360c488..a2e6a2c678b8c 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentUsagesBaseCollection.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentUsagesBaseCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_CurrentUsagesBaseCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_QuotasUsagesRequestForCompute() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getComputeOneSkuUsages.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getComputeOneSkuUsages.json // this example is just showing the usage of "Usages_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_QuotasUsagesRequestForCompute() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_QuotasUsagesRequestForCompute() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getComputeOneSkuUsages.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getComputeOneSkuUsages.json // this example is just showing the usage of "Usages_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -79,7 +79,7 @@ public async Task Exists_QuotasUsagesRequestForCompute() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_QuotasUsagesRequestForCompute() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getComputeOneSkuUsages.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getComputeOneSkuUsages.json // this example is just showing the usage of "Usages_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -119,7 +119,7 @@ public async Task GetIfExists_QuotasUsagesRequestForCompute() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_QuotasUsagesRequestForNetwork() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getNetworkOneSkuUsages.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getNetworkOneSkuUsages.json // this example is just showing the usage of "Usages_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -151,7 +151,7 @@ public async Task Get_QuotasUsagesRequestForNetwork() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_QuotasUsagesRequestForNetwork() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getNetworkOneSkuUsages.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getNetworkOneSkuUsages.json // this example is just showing the usage of "Usages_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -179,7 +179,7 @@ public async Task Exists_QuotasUsagesRequestForNetwork() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_QuotasUsagesRequestForNetwork() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getNetworkOneSkuUsages.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getNetworkOneSkuUsages.json // this example is just showing the usage of "Usages_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -219,7 +219,7 @@ public async Task GetIfExists_QuotasUsagesRequestForNetwork() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_QuotasListUsagesForCompute() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getComputeUsages.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getComputeUsages.json // this example is just showing the usage of "Usages_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -253,7 +253,7 @@ public async Task GetAll_QuotasListUsagesForCompute() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_QuotasListUsagesForNetwork() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getNetworkUsages.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getNetworkUsages.json // this example is just showing the usage of "Usages_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -287,7 +287,7 @@ public async Task GetAll_QuotasListUsagesForNetwork() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_QuotasListUsagesMachineLearningServices() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getMachineLearningServicesUsages.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getMachineLearningServicesUsages.json // this example is just showing the usage of "Usages_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentUsagesBaseResource.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentUsagesBaseResource.cs index b93933511d489..0589035b906f0 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentUsagesBaseResource.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentUsagesBaseResource.cs @@ -19,7 +19,7 @@ public partial class Sample_CurrentUsagesBaseResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_QuotasUsagesRequestForCompute() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getComputeOneSkuUsages.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getComputeOneSkuUsages.json // this example is just showing the usage of "Usages_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -49,7 +49,7 @@ public async Task Get_QuotasUsagesRequestForCompute() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_QuotasUsagesRequestForNetwork() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getNetworkOneSkuUsages.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getNetworkOneSkuUsages.json // this example is just showing the usage of "Usages_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaEnforcementCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaEnforcementCollection.cs new file mode 100644 index 0000000000000..f13764f3ec0e4 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaEnforcementCollection.cs @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_GroupQuotaEnforcementCollection + { + // GroupQuotaLocationSettings_CreateOrUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_GroupQuotaLocationSettingsCreateOrUpdate() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasEnforcement/PutGroupQuotaEnforcement.json + // this example is just showing the usage of "GroupQuotaLocationSettings_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaEnforcementResource + string resourceProviderName = "Microsoft.Compute"; + GroupQuotaEnforcementCollection collection = groupQuotaEntity.GetGroupQuotaEnforcements(resourceProviderName); + + // invoke the operation + AzureLocation location = new AzureLocation("eastus"); + GroupQuotaEnforcementData data = new GroupQuotaEnforcementData() + { + Properties = new GroupQuotaEnforcementProperties() + { + EnforcementEnabled = GroupQuotaEnforcementState.Enabled, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, location, data); + GroupQuotaEnforcementResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaEnforcementData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotaLocationSettings_CreateOrUpdate_Failed + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_GroupQuotaLocationSettingsCreateOrUpdateFailed() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasEnforcement/PutGroupQuotaEnforcementFailed.json + // this example is just showing the usage of "GroupQuotaLocationSettings_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaEnforcementResource + string resourceProviderName = "Microsoft.Compute"; + GroupQuotaEnforcementCollection collection = groupQuotaEntity.GetGroupQuotaEnforcements(resourceProviderName); + + // invoke the operation + AzureLocation location = new AzureLocation("eastus"); + GroupQuotaEnforcementData data = new GroupQuotaEnforcementData() + { + Properties = new GroupQuotaEnforcementProperties() + { + EnforcementEnabled = GroupQuotaEnforcementState.Enabled, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, location, data); + GroupQuotaEnforcementResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaEnforcementData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotasEnforcement_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GroupQuotasEnforcementGet() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasEnforcement/GetGroupQuotaEnforcement.json + // this example is just showing the usage of "GroupQuotaLocationSettings_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaEnforcementResource + string resourceProviderName = "Microsoft.Compute"; + GroupQuotaEnforcementCollection collection = groupQuotaEntity.GetGroupQuotaEnforcements(resourceProviderName); + + // invoke the operation + AzureLocation location = new AzureLocation("eastus"); + GroupQuotaEnforcementResource result = await collection.GetAsync(location); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaEnforcementData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotasEnforcement_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GroupQuotasEnforcementGet() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasEnforcement/GetGroupQuotaEnforcement.json + // this example is just showing the usage of "GroupQuotaLocationSettings_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaEnforcementResource + string resourceProviderName = "Microsoft.Compute"; + GroupQuotaEnforcementCollection collection = groupQuotaEntity.GetGroupQuotaEnforcements(resourceProviderName); + + // invoke the operation + AzureLocation location = new AzureLocation("eastus"); + bool result = await collection.ExistsAsync(location); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GroupQuotasEnforcement_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GroupQuotasEnforcementGet() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasEnforcement/GetGroupQuotaEnforcement.json + // this example is just showing the usage of "GroupQuotaLocationSettings_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaEnforcementResource + string resourceProviderName = "Microsoft.Compute"; + GroupQuotaEnforcementCollection collection = groupQuotaEntity.GetGroupQuotaEnforcements(resourceProviderName); + + // invoke the operation + AzureLocation location = new AzureLocation("eastus"); + NullableResponse response = await collection.GetIfExistsAsync(location); + GroupQuotaEnforcementResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaEnforcementData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // GroupQuotaEnforcement_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GroupQuotaEnforcementList() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasEnforcement/ListGroupQuotaEnforcement.json + // this example is just showing the usage of "GroupQuotaLocationSettings_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaEnforcementResource + string resourceProviderName = "Microsoft.Compute"; + GroupQuotaEnforcementCollection collection = groupQuotaEntity.GetGroupQuotaEnforcements(resourceProviderName); + + // invoke the operation and iterate over the result + await foreach (GroupQuotaEnforcementResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaEnforcementData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaEnforcementResource.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaEnforcementResource.cs new file mode 100644 index 0000000000000..70e7190fc6461 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaEnforcementResource.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_GroupQuotaEnforcementResource + { + // GroupQuotaLocationSettings_Patch + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_GroupQuotaLocationSettingsPatch() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasEnforcement/PatchGroupQuotaEnforcement.json + // this example is just showing the usage of "GroupQuotaLocationSettings_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEnforcementResource created on azure + // for more information of creating GroupQuotaEnforcementResource, please refer to the document of GroupQuotaEnforcementResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + string resourceProviderName = "Microsoft.Compute"; + AzureLocation location = new AzureLocation("eastus"); + ResourceIdentifier groupQuotaEnforcementResourceId = GroupQuotaEnforcementResource.CreateResourceIdentifier(managementGroupId, groupQuotaName, resourceProviderName, location); + GroupQuotaEnforcementResource groupQuotaEnforcement = client.GetGroupQuotaEnforcementResource(groupQuotaEnforcementResourceId); + + // invoke the operation + GroupQuotaEnforcementData data = new GroupQuotaEnforcementData() + { + Properties = new GroupQuotaEnforcementProperties() + { + EnforcementEnabled = GroupQuotaEnforcementState.Enabled, + }, + }; + ArmOperation lro = await groupQuotaEnforcement.UpdateAsync(WaitUntil.Completed, data); + GroupQuotaEnforcementResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaEnforcementData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotasEnforcement_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GroupQuotasEnforcementGet() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasEnforcement/GetGroupQuotaEnforcement.json + // this example is just showing the usage of "GroupQuotaLocationSettings_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEnforcementResource created on azure + // for more information of creating GroupQuotaEnforcementResource, please refer to the document of GroupQuotaEnforcementResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + string resourceProviderName = "Microsoft.Compute"; + AzureLocation location = new AzureLocation("eastus"); + ResourceIdentifier groupQuotaEnforcementResourceId = GroupQuotaEnforcementResource.CreateResourceIdentifier(managementGroupId, groupQuotaName, resourceProviderName, location); + GroupQuotaEnforcementResource groupQuotaEnforcement = client.GetGroupQuotaEnforcementResource(groupQuotaEnforcementResourceId); + + // invoke the operation + GroupQuotaEnforcementResource result = await groupQuotaEnforcement.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaEnforcementData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaEntityCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaEntityCollection.cs new file mode 100644 index 0000000000000..8adfeb32c2c66 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaEntityCollection.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.ManagementGroups; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_GroupQuotaEntityCollection + { + // GroupQuotas_Put_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_GroupQuotasPutRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/PutGroupQuotas.json + // this example is just showing the usage of "GroupQuotas_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this GroupQuotaEntityResource + GroupQuotaEntityCollection collection = managementGroupResource.GetGroupQuotaEntities(); + + // invoke the operation + string groupQuotaName = "groupquota1"; + GroupQuotaEntityData data = new GroupQuotaEntityData() + { + Properties = new GroupQuotaEntityBase() + { + DisplayName = "GroupQuota1", + AdditionalAttributes = new GroupQuotaAdditionalAttributes(new GroupQuotaGroupingId() + { + GroupingIdType = GroupQuotaGroupingIdType.ServiceTreeId, + Value = "yourServiceTreeIdHere", + }) + { + Environment = GroupQuotaEnvironmentType.Production, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, groupQuotaName, data); + GroupQuotaEntityResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaEntityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotas_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GroupQuotasGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/GetGroupQuotas.json + // this example is just showing the usage of "GroupQuotas_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this GroupQuotaEntityResource + GroupQuotaEntityCollection collection = managementGroupResource.GetGroupQuotaEntities(); + + // invoke the operation + string groupQuotaName = "groupquota1"; + GroupQuotaEntityResource result = await collection.GetAsync(groupQuotaName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaEntityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotas_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GroupQuotasGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/GetGroupQuotas.json + // this example is just showing the usage of "GroupQuotas_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this GroupQuotaEntityResource + GroupQuotaEntityCollection collection = managementGroupResource.GetGroupQuotaEntities(); + + // invoke the operation + string groupQuotaName = "groupquota1"; + bool result = await collection.ExistsAsync(groupQuotaName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GroupQuotas_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GroupQuotasGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/GetGroupQuotas.json + // this example is just showing the usage of "GroupQuotas_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this GroupQuotaEntityResource + GroupQuotaEntityCollection collection = managementGroupResource.GetGroupQuotaEntities(); + + // invoke the operation + string groupQuotaName = "groupquota1"; + NullableResponse response = await collection.GetIfExistsAsync(groupQuotaName); + GroupQuotaEntityResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaEntityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // GroupQuotas_List_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GroupQuotasListRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/GetGroupQuotasList.json + // this example is just showing the usage of "GroupQuotas_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this GroupQuotaEntityResource + GroupQuotaEntityCollection collection = managementGroupResource.GetGroupQuotaEntities(); + + // invoke the operation and iterate over the result + await foreach (GroupQuotaEntityResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaEntityData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaEntityResource.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaEntityResource.cs new file mode 100644 index 0000000000000..73f37983f49f9 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaEntityResource.cs @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_GroupQuotaEntityResource + { + // GroupQuotas_Patch_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_GroupQuotasPatchRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/PatchGroupQuotas.json + // this example is just showing the usage of "GroupQuotas_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // invoke the operation + GroupQuotaEntityPatch patch = new GroupQuotaEntityPatch() + { + Properties = new GroupQuotasEntityBasePatch() + { + DisplayName = "UpdatedGroupQuota1", + AdditionalAttributes = new GroupQuotaAdditionalAttributesPatch() + { + GroupId = new GroupQuotaGroupingId() + { + GroupingIdType = GroupQuotaGroupingIdType.ServiceTreeId, + Value = "UpdatedServiceTreeIdHere", + }, + Environment = GroupQuotaEnvironmentType.Production, + }, + }, + }; + ArmOperation lro = await groupQuotaEntity.UpdateAsync(WaitUntil.Completed, patch); + GroupQuotaEntityResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaEntityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotas_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GroupQuotasGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/GetGroupQuotas.json + // this example is just showing the usage of "GroupQuotas_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // invoke the operation + GroupQuotaEntityResource result = await groupQuotaEntity.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaEntityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotas_Delete_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_GroupQuotasDeleteRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/DeleteGroupQuotas.json + // this example is just showing the usage of "GroupQuotas_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // invoke the operation + await groupQuotaEntity.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // GroupQuotaLimitsRequests_CreateOrUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdateGroupQuotaLimitsRequest_GroupQuotaLimitsRequestsCreateOrUpdate() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimitsRequests/PutGroupQuotaLimitsRequests-Compute.json + // this example is just showing the usage of "GroupQuotaLimitsRequest_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // invoke the operation + string resourceProviderName = "Microsoft.Compute"; + string resourceName = "standardav2family"; + ArmOperation lro = await groupQuotaEntity.CreateOrUpdateGroupQuotaLimitsRequestAsync(WaitUntil.Completed, resourceProviderName, resourceName); + GroupQuotaRequestStatusResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaRequestStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotaLimitsRequests_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateGroupQuotaLimitsRequest_GroupQuotaLimitsRequestsUpdate() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimitsRequests/PatchGroupQuotaLimitsRequests-Compute.json + // this example is just showing the usage of "GroupQuotaLimitsRequest_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // invoke the operation + string resourceProviderName = "Microsoft.Compute"; + string resourceName = "standardav2family"; + ArmOperation lro = await groupQuotaEntity.UpdateGroupQuotaLimitsRequestAsync(WaitUntil.Completed, resourceProviderName, resourceName); + GroupQuotaRequestStatusResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaRequestStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotaLimitsRequest_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetGroupQuotaLimitsRequests_GroupQuotaLimitsRequestList() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimitsRequests/GroupQuotaLimitsRequests_List.json + // this example is just showing the usage of "GroupQuotaLimitsRequest_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // invoke the operation and iterate over the result + string resourceProviderName = "Microsoft.Compute"; + string filter = "location eq westus"; + await foreach (GroupQuotaRequestStatusResource item in groupQuotaEntity.GetGroupQuotaLimitsRequestsAsync(resourceProviderName, filter)) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaRequestStatusData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GroupQuotasUsages_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetGroupQuotaUsages_GroupQuotasUsagesList() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaUsages/GetGroupQuotaUsages.json + // this example is just showing the usage of "GroupQuotaUsages_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // invoke the operation and iterate over the result + string resourceProviderName = "Microsoft.Compute"; + AzureLocation location = new AzureLocation("westus"); + await foreach (GroupQuotaResourceUsages item in groupQuotaEntity.GetGroupQuotaUsagesAsync(resourceProviderName, location)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaLimitCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaLimitCollection.cs new file mode 100644 index 0000000000000..09b2946219d60 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaLimitCollection.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_GroupQuotaLimitCollection + { + // GroupQuotaLimits_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GroupQuotaLimitsGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimits/GetGroupQuotaLimits-Compute.json + // this example is just showing the usage of "GroupQuotaLimits_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaLimitResource + string resourceProviderName = "Microsoft.Compute"; + GroupQuotaLimitCollection collection = groupQuotaEntity.GetGroupQuotaLimits(resourceProviderName); + + // invoke the operation + string resourceName = "cores"; + string filter = "location eq westus"; + GroupQuotaLimitResource result = await collection.GetAsync(resourceName, filter); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaLimitData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotaLimits_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GroupQuotaLimitsGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimits/GetGroupQuotaLimits-Compute.json + // this example is just showing the usage of "GroupQuotaLimits_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaLimitResource + string resourceProviderName = "Microsoft.Compute"; + GroupQuotaLimitCollection collection = groupQuotaEntity.GetGroupQuotaLimits(resourceProviderName); + + // invoke the operation + string resourceName = "cores"; + string filter = "location eq westus"; + bool result = await collection.ExistsAsync(resourceName, filter); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GroupQuotaLimits_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GroupQuotaLimitsGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimits/GetGroupQuotaLimits-Compute.json + // this example is just showing the usage of "GroupQuotaLimits_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaLimitResource + string resourceProviderName = "Microsoft.Compute"; + GroupQuotaLimitCollection collection = groupQuotaEntity.GetGroupQuotaLimits(resourceProviderName); + + // invoke the operation + string resourceName = "cores"; + string filter = "location eq westus"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName, filter); + GroupQuotaLimitResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaLimitData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // GroupQuotaLimits_List_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GroupQuotaLimitsListRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimits/ListGroupQuotaLimits-Compute.json + // this example is just showing the usage of "GroupQuotaLimits_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaLimitResource + string resourceProviderName = "Microsoft.Compute"; + GroupQuotaLimitCollection collection = groupQuotaEntity.GetGroupQuotaLimits(resourceProviderName); + + // invoke the operation and iterate over the result + string filter = "location eq westus"; + await foreach (GroupQuotaLimitResource item in collection.GetAllAsync(filter)) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaLimitData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaLimitResource.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaLimitResource.cs new file mode 100644 index 0000000000000..4a9a3fbe00177 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaLimitResource.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_GroupQuotaLimitResource + { + // GroupQuotaLimits_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GroupQuotaLimitsGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimits/GetGroupQuotaLimits-Compute.json + // this example is just showing the usage of "GroupQuotaLimits_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaLimitResource created on azure + // for more information of creating GroupQuotaLimitResource, please refer to the document of GroupQuotaLimitResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + string resourceProviderName = "Microsoft.Compute"; + string resourceName = "cores"; + ResourceIdentifier groupQuotaLimitResourceId = GroupQuotaLimitResource.CreateResourceIdentifier(managementGroupId, groupQuotaName, resourceProviderName, resourceName); + GroupQuotaLimitResource groupQuotaLimit = client.GetGroupQuotaLimitResource(groupQuotaLimitResourceId); + + // invoke the operation + string filter = "location eq westus"; + GroupQuotaLimitResource result = await groupQuotaLimit.GetAsync(filter); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaLimitData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaRequestStatusCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaRequestStatusCollection.cs new file mode 100644 index 0000000000000..63512eb8fd26e --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaRequestStatusCollection.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_GroupQuotaRequestStatusCollection + { + // GroupQuotaLimitsRequests_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GroupQuotaLimitsRequestsGet() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimitsRequests/GroupQuotaLimitsRequests_Get.json + // this example is just showing the usage of "GroupQuotaLimitsRequest_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaRequestStatusResource + GroupQuotaRequestStatusCollection collection = groupQuotaEntity.GetGroupQuotaRequestStatuses(); + + // invoke the operation + string requestId = "requestId"; + GroupQuotaRequestStatusResource result = await collection.GetAsync(requestId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaRequestStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotaLimitsRequests_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GroupQuotaLimitsRequestsGet() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimitsRequests/GroupQuotaLimitsRequests_Get.json + // this example is just showing the usage of "GroupQuotaLimitsRequest_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaRequestStatusResource + GroupQuotaRequestStatusCollection collection = groupQuotaEntity.GetGroupQuotaRequestStatuses(); + + // invoke the operation + string requestId = "requestId"; + bool result = await collection.ExistsAsync(requestId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GroupQuotaLimitsRequests_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GroupQuotaLimitsRequestsGet() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimitsRequests/GroupQuotaLimitsRequests_Get.json + // this example is just showing the usage of "GroupQuotaLimitsRequest_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaRequestStatusResource + GroupQuotaRequestStatusCollection collection = groupQuotaEntity.GetGroupQuotaRequestStatuses(); + + // invoke the operation + string requestId = "requestId"; + NullableResponse response = await collection.GetIfExistsAsync(requestId); + GroupQuotaRequestStatusResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaRequestStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaRequestStatusResource.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaRequestStatusResource.cs new file mode 100644 index 0000000000000..175e2d9cbc5b0 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaRequestStatusResource.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_GroupQuotaRequestStatusResource + { + // GroupQuotaLimitsRequests_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GroupQuotaLimitsRequestsGet() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimitsRequests/GroupQuotaLimitsRequests_Get.json + // this example is just showing the usage of "GroupQuotaLimitsRequest_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaRequestStatusResource created on azure + // for more information of creating GroupQuotaRequestStatusResource, please refer to the document of GroupQuotaRequestStatusResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + string requestId = "requestId"; + ResourceIdentifier groupQuotaRequestStatusResourceId = GroupQuotaRequestStatusResource.CreateResourceIdentifier(managementGroupId, groupQuotaName, requestId); + GroupQuotaRequestStatusResource groupQuotaRequestStatus = client.GetGroupQuotaRequestStatusResource(groupQuotaRequestStatusResourceId); + + // invoke the operation + GroupQuotaRequestStatusResource result = await groupQuotaRequestStatus.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaRequestStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaSubscriptionCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaSubscriptionCollection.cs new file mode 100644 index 0000000000000..07ceaf487177e --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaSubscriptionCollection.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_GroupQuotaSubscriptionCollection + { + // GroupQuotaSubscriptions_Put_Subscriptions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_GroupQuotaSubscriptionsPutSubscriptions() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/PutGroupQuotasSubscription.json + // this example is just showing the usage of "GroupQuotaSubscriptions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaSubscriptionResource + GroupQuotaSubscriptionCollection collection = groupQuotaEntity.GetGroupQuotaSubscriptions(); + + // invoke the operation + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, subscriptionId); + GroupQuotaSubscriptionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotaSubscriptions_Get_Subscriptions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GroupQuotaSubscriptionsGetSubscriptions() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/GetGroupQuotaSubscriptions.json + // this example is just showing the usage of "GroupQuotaSubscriptions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaSubscriptionResource + GroupQuotaSubscriptionCollection collection = groupQuotaEntity.GetGroupQuotaSubscriptions(); + + // invoke the operation + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + GroupQuotaSubscriptionResource result = await collection.GetAsync(subscriptionId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotaSubscriptions_Get_Subscriptions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GroupQuotaSubscriptionsGetSubscriptions() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/GetGroupQuotaSubscriptions.json + // this example is just showing the usage of "GroupQuotaSubscriptions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaSubscriptionResource + GroupQuotaSubscriptionCollection collection = groupQuotaEntity.GetGroupQuotaSubscriptions(); + + // invoke the operation + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + bool result = await collection.ExistsAsync(subscriptionId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GroupQuotaSubscriptions_Get_Subscriptions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GroupQuotaSubscriptionsGetSubscriptions() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/GetGroupQuotaSubscriptions.json + // this example is just showing the usage of "GroupQuotaSubscriptions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaSubscriptionResource + GroupQuotaSubscriptionCollection collection = groupQuotaEntity.GetGroupQuotaSubscriptions(); + + // invoke the operation + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + NullableResponse response = await collection.GetIfExistsAsync(subscriptionId); + GroupQuotaSubscriptionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // GroupQuotaSubscriptions_List_Subscriptions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GroupQuotaSubscriptionsListSubscriptions() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/ListGroupQuotaSubscriptions.json + // this example is just showing the usage of "GroupQuotaSubscriptions_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaSubscriptionResource + GroupQuotaSubscriptionCollection collection = groupQuotaEntity.GetGroupQuotaSubscriptions(); + + // invoke the operation and iterate over the result + await foreach (GroupQuotaSubscriptionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaSubscriptionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaSubscriptionRequestStatusCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaSubscriptionRequestStatusCollection.cs new file mode 100644 index 0000000000000..30183b48cd057 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaSubscriptionRequestStatusCollection.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_GroupQuotaSubscriptionRequestStatusCollection + { + // GroupQuotaSubscriptionRequests_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GroupQuotaSubscriptionRequestsList() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionRequests/SubscriptionRequests_List.json + // this example is just showing the usage of "GroupQuotaSubscriptionRequests_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaSubscriptionRequestStatusResource + GroupQuotaSubscriptionRequestStatusCollection collection = groupQuotaEntity.GetGroupQuotaSubscriptionRequestStatuses(); + + // invoke the operation and iterate over the result + await foreach (GroupQuotaSubscriptionRequestStatusResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaSubscriptionRequestStatusData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GroupQuotaSubscriptionRequests_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GroupQuotaSubscriptionRequestsGet() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionRequests/SubscriptionRequests_Get.json + // this example is just showing the usage of "GroupQuotaSubscriptionRequests_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaSubscriptionRequestStatusResource + GroupQuotaSubscriptionRequestStatusCollection collection = groupQuotaEntity.GetGroupQuotaSubscriptionRequestStatuses(); + + // invoke the operation + string requestId = "00000000-0000-0000-0000-000000000000"; + GroupQuotaSubscriptionRequestStatusResource result = await collection.GetAsync(requestId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaSubscriptionRequestStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotaSubscriptionRequests_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GroupQuotaSubscriptionRequestsGet() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionRequests/SubscriptionRequests_Get.json + // this example is just showing the usage of "GroupQuotaSubscriptionRequests_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaSubscriptionRequestStatusResource + GroupQuotaSubscriptionRequestStatusCollection collection = groupQuotaEntity.GetGroupQuotaSubscriptionRequestStatuses(); + + // invoke the operation + string requestId = "00000000-0000-0000-0000-000000000000"; + bool result = await collection.ExistsAsync(requestId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GroupQuotaSubscriptionRequests_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GroupQuotaSubscriptionRequestsGet() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionRequests/SubscriptionRequests_Get.json + // this example is just showing the usage of "GroupQuotaSubscriptionRequests_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaEntityResource created on azure + // for more information of creating GroupQuotaEntityResource, please refer to the document of GroupQuotaEntityResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + ResourceIdentifier groupQuotaEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + GroupQuotaEntityResource groupQuotaEntity = client.GetGroupQuotaEntityResource(groupQuotaEntityResourceId); + + // get the collection of this GroupQuotaSubscriptionRequestStatusResource + GroupQuotaSubscriptionRequestStatusCollection collection = groupQuotaEntity.GetGroupQuotaSubscriptionRequestStatuses(); + + // invoke the operation + string requestId = "00000000-0000-0000-0000-000000000000"; + NullableResponse response = await collection.GetIfExistsAsync(requestId); + GroupQuotaSubscriptionRequestStatusResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaSubscriptionRequestStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaSubscriptionRequestStatusResource.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaSubscriptionRequestStatusResource.cs new file mode 100644 index 0000000000000..9b644dd44ed86 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaSubscriptionRequestStatusResource.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_GroupQuotaSubscriptionRequestStatusResource + { + // GroupQuotaSubscriptionRequests_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GroupQuotaSubscriptionRequestsGet() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionRequests/SubscriptionRequests_Get.json + // this example is just showing the usage of "GroupQuotaSubscriptionRequests_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaSubscriptionRequestStatusResource created on azure + // for more information of creating GroupQuotaSubscriptionRequestStatusResource, please refer to the document of GroupQuotaSubscriptionRequestStatusResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + string requestId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier groupQuotaSubscriptionRequestStatusResourceId = GroupQuotaSubscriptionRequestStatusResource.CreateResourceIdentifier(managementGroupId, groupQuotaName, requestId); + GroupQuotaSubscriptionRequestStatusResource groupQuotaSubscriptionRequestStatus = client.GetGroupQuotaSubscriptionRequestStatusResource(groupQuotaSubscriptionRequestStatusResourceId); + + // invoke the operation + GroupQuotaSubscriptionRequestStatusResource result = await groupQuotaSubscriptionRequestStatus.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaSubscriptionRequestStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaSubscriptionResource.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaSubscriptionResource.cs new file mode 100644 index 0000000000000..21431c1b9b853 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_GroupQuotaSubscriptionResource.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_GroupQuotaSubscriptionResource + { + // GroupQuotaSubscriptions_Patch_Subscriptions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_GroupQuotaSubscriptionsPatchSubscriptions() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/PatchGroupQuotasSubscription.json + // this example is just showing the usage of "GroupQuotaSubscriptions_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaSubscriptionResource created on azure + // for more information of creating GroupQuotaSubscriptionResource, please refer to the document of GroupQuotaSubscriptionResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier groupQuotaSubscriptionResourceId = GroupQuotaSubscriptionResource.CreateResourceIdentifier(managementGroupId, groupQuotaName, subscriptionId); + GroupQuotaSubscriptionResource groupQuotaSubscription = client.GetGroupQuotaSubscriptionResource(groupQuotaSubscriptionResourceId); + + // invoke the operation + ArmOperation lro = await groupQuotaSubscription.UpdateAsync(WaitUntil.Completed); + GroupQuotaSubscriptionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GroupQuotaSubscriptions_Delete_Subscriptions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_GroupQuotaSubscriptionsDeleteSubscriptions() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/DeleteGroupQuotaSubscriptions.json + // this example is just showing the usage of "GroupQuotaSubscriptions_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaSubscriptionResource created on azure + // for more information of creating GroupQuotaSubscriptionResource, please refer to the document of GroupQuotaSubscriptionResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier groupQuotaSubscriptionResourceId = GroupQuotaSubscriptionResource.CreateResourceIdentifier(managementGroupId, groupQuotaName, subscriptionId); + GroupQuotaSubscriptionResource groupQuotaSubscription = client.GetGroupQuotaSubscriptionResource(groupQuotaSubscriptionResourceId); + + // invoke the operation + await groupQuotaSubscription.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // GroupQuotaSubscriptions_Get_Subscriptions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GroupQuotaSubscriptionsGetSubscriptions() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/GetGroupQuotaSubscriptions.json + // this example is just showing the usage of "GroupQuotaSubscriptions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GroupQuotaSubscriptionResource created on azure + // for more information of creating GroupQuotaSubscriptionResource, please refer to the document of GroupQuotaSubscriptionResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string groupQuotaName = "groupquota1"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier groupQuotaSubscriptionResourceId = GroupQuotaSubscriptionResource.CreateResourceIdentifier(managementGroupId, groupQuotaName, subscriptionId); + GroupQuotaSubscriptionResource groupQuotaSubscription = client.GetGroupQuotaSubscriptionResource(groupQuotaSubscriptionResourceId); + + // invoke the operation + GroupQuotaSubscriptionResource result = await groupQuotaSubscription.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GroupQuotaSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaAllocationRequestStatusCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaAllocationRequestStatusCollection.cs new file mode 100644 index 0000000000000..e9595abc3f981 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaAllocationRequestStatusCollection.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.ManagementGroups; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_QuotaAllocationRequestStatusCollection + { + // SubscriptionQuotaAllocationRequests_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SubscriptionQuotaAllocationRequestsGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocationRequests/SubscriptionQuotaAllocationRequests_Get-Compute.json + // this example is just showing the usage of "GroupQuotaSubscriptionAllocationRequest_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this QuotaAllocationRequestStatusResource + QuotaAllocationRequestStatusCollection collection = managementGroupResource.GetQuotaAllocationRequestStatuses(); + + // invoke the operation + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string groupQuotaName = "groupquota1"; + string allocationId = "AE000000-0000-0000-0000-00000000000A"; + QuotaAllocationRequestStatusResource result = await collection.GetAsync(subscriptionId, groupQuotaName, allocationId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + QuotaAllocationRequestStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SubscriptionQuotaAllocationRequests_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_SubscriptionQuotaAllocationRequestsGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocationRequests/SubscriptionQuotaAllocationRequests_Get-Compute.json + // this example is just showing the usage of "GroupQuotaSubscriptionAllocationRequest_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this QuotaAllocationRequestStatusResource + QuotaAllocationRequestStatusCollection collection = managementGroupResource.GetQuotaAllocationRequestStatuses(); + + // invoke the operation + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string groupQuotaName = "groupquota1"; + string allocationId = "AE000000-0000-0000-0000-00000000000A"; + bool result = await collection.ExistsAsync(subscriptionId, groupQuotaName, allocationId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // SubscriptionQuotaAllocationRequests_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SubscriptionQuotaAllocationRequestsGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocationRequests/SubscriptionQuotaAllocationRequests_Get-Compute.json + // this example is just showing the usage of "GroupQuotaSubscriptionAllocationRequest_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this QuotaAllocationRequestStatusResource + QuotaAllocationRequestStatusCollection collection = managementGroupResource.GetQuotaAllocationRequestStatuses(); + + // invoke the operation + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string groupQuotaName = "groupquota1"; + string allocationId = "AE000000-0000-0000-0000-00000000000A"; + NullableResponse response = await collection.GetIfExistsAsync(subscriptionId, groupQuotaName, allocationId); + QuotaAllocationRequestStatusResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + QuotaAllocationRequestStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaAllocationRequestStatusResource.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaAllocationRequestStatusResource.cs new file mode 100644 index 0000000000000..1098c190739a6 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaAllocationRequestStatusResource.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.ManagementGroups; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_QuotaAllocationRequestStatusResource + { + // SubscriptionQuotaAllocationRequests_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SubscriptionQuotaAllocationRequestsGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocationRequests/SubscriptionQuotaAllocationRequests_Get-Compute.json + // this example is just showing the usage of "GroupQuotaSubscriptionAllocationRequest_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this QuotaAllocationRequestStatusResource created on azure + // for more information of creating QuotaAllocationRequestStatusResource, please refer to the document of QuotaAllocationRequestStatusResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string groupQuotaName = "groupquota1"; + string allocationId = "AE000000-0000-0000-0000-00000000000A"; + ResourceIdentifier quotaAllocationRequestStatusResourceId = QuotaAllocationRequestStatusResource.CreateResourceIdentifier(managementGroupId, subscriptionId, groupQuotaName, allocationId); + QuotaAllocationRequestStatusResource quotaAllocationRequestStatus = client.GetQuotaAllocationRequestStatusResource(quotaAllocationRequestStatusResourceId); + + // invoke the operation + QuotaAllocationRequestStatusResource result = await quotaAllocationRequestStatus.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + QuotaAllocationRequestStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SubscriptionQuotaAllocation_List_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetQuotaAllocationRequestStatusesByResourceProvider_SubscriptionQuotaAllocationListRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocationRequests/SubscriptionQuotaAllocationRequests_List-Compute.json + // this example is just showing the usage of "GroupQuotaSubscriptionAllocationRequest_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // invoke the operation and iterate over the result + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string groupQuotaName = "groupquota1"; + string resourceProviderName = "Microsoft.Compute"; + string filter = "location eq westus"; + await foreach (QuotaAllocationRequestStatusResource item in managementGroupResource.GetQuotaAllocationRequestStatusesByResourceProviderAsync(subscriptionId, groupQuotaName, resourceProviderName, filter)) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + QuotaAllocationRequestStatusData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // SubscriptionQuotaAllocation_Put_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdateGroupQuotaSubscriptionAllocationRequest_SubscriptionQuotaAllocationPutRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocationRequests/PutSubscriptionQuotaAllocationRequest-Compute.json + // this example is just showing the usage of "GroupQuotaSubscriptionAllocationRequest_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // invoke the operation + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string groupQuotaName = "groupquota1"; + string resourceProviderName = "Microsoft.Compute"; + string resourceName = "standardav2family"; + QuotaAllocationRequestStatusData data = new QuotaAllocationRequestStatusData() + { + RequestedResource = new QuotaAllocationRequestBase() + { + Limit = 10, + Region = "westus", + }, + }; + ArmOperation lro = await managementGroupResource.CreateOrUpdateGroupQuotaSubscriptionAllocationRequestAsync(WaitUntil.Completed, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data); + QuotaAllocationRequestStatusResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + QuotaAllocationRequestStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SubscriptionQuotaAllocation_Patch_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateGroupQuotaSubscriptionAllocationRequest_SubscriptionQuotaAllocationPatchRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocationRequests/PatchSubscriptionQuotaAllocationRequest-Compute.json + // this example is just showing the usage of "GroupQuotaSubscriptionAllocationRequest_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // invoke the operation + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string groupQuotaName = "groupquota1"; + string resourceProviderName = "Microsoft.Compute"; + string resourceName = "standardav2family"; + QuotaAllocationRequestStatusData data = new QuotaAllocationRequestStatusData() + { + RequestedResource = new QuotaAllocationRequestBase() + { + Limit = 10, + Region = "westus", + }, + }; + ArmOperation lro = await managementGroupResource.UpdateGroupQuotaSubscriptionAllocationRequestAsync(WaitUntil.Completed, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data); + QuotaAllocationRequestStatusResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + QuotaAllocationRequestStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaRequestDetailCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaRequestDetailCollection.cs index b0362340e5b7b..7247f01db4091 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaRequestDetailCollection.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaRequestDetailCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_QuotaRequestDetailCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_QuotaRequestFailed() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestStatusFailed.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestStatusFailed.json // this example is just showing the usage of "QuotaRequestStatus_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_QuotaRequestFailed() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_QuotaRequestFailed() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestStatusFailed.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestStatusFailed.json // this example is just showing the usage of "QuotaRequestStatus_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -79,7 +79,7 @@ public async Task Exists_QuotaRequestFailed() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_QuotaRequestFailed() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestStatusFailed.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestStatusFailed.json // this example is just showing the usage of "QuotaRequestStatus_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -119,7 +119,7 @@ public async Task GetIfExists_QuotaRequestFailed() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_QuotaRequestInProgress() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestStatusInProgress.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestStatusInProgress.json // this example is just showing the usage of "QuotaRequestStatus_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -151,7 +151,7 @@ public async Task Get_QuotaRequestInProgress() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_QuotaRequestInProgress() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestStatusInProgress.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestStatusInProgress.json // this example is just showing the usage of "QuotaRequestStatus_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -179,7 +179,7 @@ public async Task Exists_QuotaRequestInProgress() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_QuotaRequestInProgress() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestStatusInProgress.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestStatusInProgress.json // this example is just showing the usage of "QuotaRequestStatus_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -219,7 +219,7 @@ public async Task GetIfExists_QuotaRequestInProgress() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_QuotaRequestStatus() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestStatusById.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestStatusById.json // this example is just showing the usage of "QuotaRequestStatus_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -251,7 +251,7 @@ public async Task Get_QuotaRequestStatus() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_QuotaRequestStatus() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestStatusById.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestStatusById.json // this example is just showing the usage of "QuotaRequestStatus_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -279,7 +279,7 @@ public async Task Exists_QuotaRequestStatus() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_QuotaRequestStatus() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestStatusById.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestStatusById.json // this example is just showing the usage of "QuotaRequestStatus_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -319,7 +319,7 @@ public async Task GetIfExists_QuotaRequestStatus() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_QuotaRequestHistory() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestsHistory.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestsHistory.json // this example is just showing the usage of "QuotaRequestStatus_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaRequestDetailResource.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaRequestDetailResource.cs index 5b206acb85514..75c7688494083 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaRequestDetailResource.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaRequestDetailResource.cs @@ -19,7 +19,7 @@ public partial class Sample_QuotaRequestDetailResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_QuotaRequestFailed() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestStatusFailed.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestStatusFailed.json // this example is just showing the usage of "QuotaRequestStatus_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -49,7 +49,7 @@ public async Task Get_QuotaRequestFailed() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_QuotaRequestInProgress() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestStatusInProgress.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestStatusInProgress.json // this example is just showing the usage of "QuotaRequestStatus_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -79,7 +79,7 @@ public async Task Get_QuotaRequestInProgress() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_QuotaRequestStatus() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestStatusById.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestStatusById.json // this example is just showing the usage of "QuotaRequestStatus_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_SubscriptionQuotaAllocationCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_SubscriptionQuotaAllocationCollection.cs new file mode 100644 index 0000000000000..3e0571decf519 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_SubscriptionQuotaAllocationCollection.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.ManagementGroups; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_SubscriptionQuotaAllocationCollection + { + // SubscriptionQuotaAllocation_List_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_SubscriptionQuotaAllocationListForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_List-Compute.json + // this example is just showing the usage of "GroupQuotaSubscriptionAllocation_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this SubscriptionQuotaAllocationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string groupQuotaName = "groupquota1"; + SubscriptionQuotaAllocationCollection collection = managementGroupResource.GetSubscriptionQuotaAllocations(subscriptionId, groupQuotaName); + + // invoke the operation and iterate over the result + string filter = "provider eq Microsoft.Compute & location eq westus"; + await foreach (SubscriptionQuotaAllocationResource item in collection.GetAllAsync(filter)) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SubscriptionQuotaAllocationData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // SubscriptionQuotaAllocation_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SubscriptionQuotaAllocationGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_Get-Compute.json + // this example is just showing the usage of "GroupQuotaSubscriptionAllocation_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this SubscriptionQuotaAllocationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string groupQuotaName = "groupquota1"; + SubscriptionQuotaAllocationCollection collection = managementGroupResource.GetSubscriptionQuotaAllocations(subscriptionId, groupQuotaName); + + // invoke the operation + string resourceName = "standardav2family"; + string filter = "provider eq Microsoft.Compute & location eq westus"; + SubscriptionQuotaAllocationResource result = await collection.GetAsync(resourceName, filter); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SubscriptionQuotaAllocationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SubscriptionQuotaAllocation_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_SubscriptionQuotaAllocationGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_Get-Compute.json + // this example is just showing the usage of "GroupQuotaSubscriptionAllocation_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this SubscriptionQuotaAllocationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string groupQuotaName = "groupquota1"; + SubscriptionQuotaAllocationCollection collection = managementGroupResource.GetSubscriptionQuotaAllocations(subscriptionId, groupQuotaName); + + // invoke the operation + string resourceName = "standardav2family"; + string filter = "provider eq Microsoft.Compute & location eq westus"; + bool result = await collection.ExistsAsync(resourceName, filter); + + Console.WriteLine($"Succeeded: {result}"); + } + + // SubscriptionQuotaAllocation_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SubscriptionQuotaAllocationGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_Get-Compute.json + // this example is just showing the usage of "GroupQuotaSubscriptionAllocation_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this SubscriptionQuotaAllocationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string groupQuotaName = "groupquota1"; + SubscriptionQuotaAllocationCollection collection = managementGroupResource.GetSubscriptionQuotaAllocations(subscriptionId, groupQuotaName); + + // invoke the operation + string resourceName = "standardav2family"; + string filter = "provider eq Microsoft.Compute & location eq westus"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName, filter); + SubscriptionQuotaAllocationResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SubscriptionQuotaAllocationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_SubscriptionQuotaAllocationResource.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_SubscriptionQuotaAllocationResource.cs new file mode 100644 index 0000000000000..fe117ad2cb350 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_SubscriptionQuotaAllocationResource.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.Quota.Samples +{ + public partial class Sample_SubscriptionQuotaAllocationResource + { + // SubscriptionQuotaAllocation_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SubscriptionQuotaAllocationGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_Get-Compute.json + // this example is just showing the usage of "GroupQuotaSubscriptionAllocation_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionQuotaAllocationResource created on azure + // for more information of creating SubscriptionQuotaAllocationResource, please refer to the document of SubscriptionQuotaAllocationResource + string managementGroupId = "E7EC67B3-7657-4966-BFFC-41EFD36BAA09"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string groupQuotaName = "groupquota1"; + string resourceName = "standardav2family"; + ResourceIdentifier subscriptionQuotaAllocationResourceId = SubscriptionQuotaAllocationResource.CreateResourceIdentifier(managementGroupId, subscriptionId, groupQuotaName, resourceName); + SubscriptionQuotaAllocationResource subscriptionQuotaAllocation = client.GetSubscriptionQuotaAllocationResource(subscriptionQuotaAllocationResourceId); + + // invoke the operation + string filter = "provider eq Microsoft.Compute & location eq westus"; + SubscriptionQuotaAllocationResource result = await subscriptionQuotaAllocation.GetAsync(filter); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SubscriptionQuotaAllocationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_TenantResourceExtensions.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_TenantResourceExtensions.cs index e9b12b4a18715..d7f81bcac57b6 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_TenantResourceExtensions.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_TenantResourceExtensions.cs @@ -20,7 +20,7 @@ public partial class Sample_TenantResourceExtensions [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetQuotaOperations_GetOperations() { - // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/GetOperations.json + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GetOperations.json // this example is just showing the usage of "QuotaOperation_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Azure.ResourceManager.Quota.csproj b/sdk/quota/Azure.ResourceManager.Quota/src/Azure.ResourceManager.Quota.csproj index 84e0e9b7b9404..353350c641894 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Azure.ResourceManager.Quota.csproj +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Azure.ResourceManager.Quota.csproj @@ -2,7 +2,7 @@ 1.1.0-beta.2 - 1.0.0 + Azure.ResourceManager.Quota Microsoft Azure Resource Manager client SDK for Azure resource provider Microsoft.Quota. azure;management;arm;resource manager;quota diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/ArmQuotaModelFactory.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/ArmQuotaModelFactory.cs index 66cac0ac92331..fdf34e670e8fd 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/ArmQuotaModelFactory.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/ArmQuotaModelFactory.cs @@ -16,6 +16,352 @@ namespace Azure.ResourceManager.Quota.Models /// Model factory for models. public static partial class ArmQuotaModelFactory { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. + /// A new instance for mocking. + public static GroupQuotaEntityData GroupQuotaEntityData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, GroupQuotaEntityBase properties = null) + { + return new GroupQuotaEntityData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Display name of the GroupQuota entity. + /// Additional attributes to filter/restrict the subscriptions, which can be added to the subscriptionIds. + /// Provisioning state of the operation. + /// A new instance for mocking. + public static GroupQuotaEntityBase GroupQuotaEntityBase(string displayName = null, GroupQuotaAdditionalAttributes additionalAttributes = null, QuotaRequestStatus? provisioningState = null) + { + return new GroupQuotaEntityBase(displayName, additionalAttributes, provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. + /// A new instance for mocking. + public static GroupQuotaEntityPatch GroupQuotaEntityPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, GroupQuotasEntityBasePatch properties = null) + { + return new GroupQuotaEntityPatch( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Display name of the GroupQuota entity. + /// Additional attributes to filter/restrict the subscriptions, which can be added to the subscriptionIds. + /// Provisioning state of the operation. + /// A new instance for mocking. + public static GroupQuotasEntityBasePatch GroupQuotasEntityBasePatch(string displayName = null, GroupQuotaAdditionalAttributesPatch additionalAttributes = null, QuotaRequestStatus? provisioningState = null) + { + return new GroupQuotasEntityBasePatch(displayName, additionalAttributes, provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// A new instance for mocking. + public static GroupQuotaSubscriptionData GroupQuotaSubscriptionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, GroupQuotaSubscriptionProperties properties = null) + { + return new GroupQuotaSubscriptionData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// An Azure subscriptionId. + /// Status of this subscriptionId being associated with the GroupQuotasEntity. + /// A new instance for mocking. + public static GroupQuotaSubscriptionProperties GroupQuotaSubscriptionProperties(string subscriptionId = null, QuotaRequestStatus? provisioningState = null) + { + return new GroupQuotaSubscriptionProperties(subscriptionId, provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// A new instance for mocking. + public static GroupQuotaSubscriptionRequestStatusData GroupQuotaSubscriptionRequestStatusData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, GroupQuotaSubscriptionRequestStatusProperties properties = null) + { + return new GroupQuotaSubscriptionRequestStatusData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The subscription Id. + /// The request submission time. The date conforms to the following format specified by the ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ. + /// Status of this subscriptionId being associated with the GroupQuotasEntity. + /// A new instance for mocking. + public static GroupQuotaSubscriptionRequestStatusProperties GroupQuotaSubscriptionRequestStatusProperties(string subscriptionId = null, DateTimeOffset? requestSubmitOn = null, QuotaRequestStatus? provisioningState = null) + { + return new GroupQuotaSubscriptionRequestStatusProperties(subscriptionId, requestSubmitOn, provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Group Quota properties for the specified resource. + /// A new instance for mocking. + public static GroupQuotaLimitData GroupQuotaLimitData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, GroupQuotaDetails properties = null) + { + return new GroupQuotaLimitData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Location/Azure region for the quota requested for resource. + /// The current Group Quota Limit at the parentId level. + /// Any comment related to quota request. + /// The usages units, such as Count and Bytes. When requesting quota, use the **unit** value returned in the GET response in the request body of your PUT operation. + /// The available Group Quota Limit at the MG level. This Group quota can be allocated to subscription(s). + /// Quota allocated to subscriptions. + /// Resource name. + /// Resource display name. + /// A new instance for mocking. + public static GroupQuotaDetails GroupQuotaDetails(string region = null, long? limit = null, string comment = null, string unit = null, long? availableLimit = null, IEnumerable allocatedToSubscriptionsValue = null, string value = null, string localizedValue = null) + { + allocatedToSubscriptionsValue ??= new List(); + + return new GroupQuotaDetails( + region, + limit, + comment, + unit, + availableLimit, + allocatedToSubscriptionsValue != null ? new AllocatedQuotaToSubscriptionList(allocatedToSubscriptionsValue?.ToList(), serializedAdditionalRawData: null) : null, + value, + localizedValue, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// An Azure subscriptionId. + /// The amount of quota allocated to this subscriptionId from the GroupQuotasEntity. + /// A new instance for mocking. + public static SubscriptionAllocatedQuota SubscriptionAllocatedQuota(string subscriptionId = null, long? quotaAllocated = null) + { + return new SubscriptionAllocatedQuota(subscriptionId, quotaAllocated, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// A new instance for mocking. + public static GroupQuotaRequestStatusData GroupQuotaRequestStatusData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, GroupQuotaRequestStatusProperties properties = null) + { + return new GroupQuotaRequestStatusData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Requested Resource. + /// The request submission time. The date conforms to the following format specified by the ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ. + /// Request status. + /// Details of the failure. + /// A new instance for mocking. + public static GroupQuotaRequestStatusProperties GroupQuotaRequestStatusProperties(GroupQuotaRequestBase requestedResource = null, DateTimeOffset? requestSubmittedOn = null, QuotaRequestStatus? provisioningState = null, string faultCode = null) + { + return new GroupQuotaRequestStatusProperties(requestedResource, requestSubmittedOn, provisioningState, faultCode, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The new quota limit for the subscription. The incremental quota will be allocated from pre-approved group quota. + /// Location/Azure region for the quota requested for resource. + /// GroupQuota Request comments and details for request. This is optional paramter to provide more details related to the requested resource. + /// Resource name. + /// Resource display name. + /// A new instance for mocking. + public static GroupQuotaRequestBase GroupQuotaRequestBase(long? limit = null, string region = null, string comments = null, string value = null, string localizedValue = null) + { + return new GroupQuotaRequestBase( + limit, + region, + comments, + value, + localizedValue, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Quota properties for the specified resource. + /// A new instance for mocking. + public static SubscriptionQuotaAllocationData SubscriptionQuotaAllocationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SubscriptionQuotaDetails properties = null) + { + return new SubscriptionQuotaAllocationData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Location/Azure region for the quota requested for resource. + /// The total quota limit for the subscription. + /// The shareable quota for the subscription. + /// Resource name. + /// Resource display name. + /// A new instance for mocking. + public static SubscriptionQuotaDetails SubscriptionQuotaDetails(string region = null, long? limit = null, long? shareableQuota = null, string value = null, string localizedValue = null) + { + return new SubscriptionQuotaDetails( + region, + limit, + shareableQuota, + value, + localizedValue, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The new quota request allocated to subscription. + /// The request submission time. The date conforms to the following format specified by the ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ. + /// Request status. + /// Details of the failure. + /// A new instance for mocking. + public static QuotaAllocationRequestStatusData QuotaAllocationRequestStatusData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, QuotaAllocationRequestBase requestedResource = null, DateTimeOffset? requestSubmittedOn = null, QuotaRequestStatus? provisioningState = null, string faultCode = null) + { + return new QuotaAllocationRequestStatusData( + id, + name, + resourceType, + systemData, + requestedResource, + requestSubmittedOn, + provisioningState, + faultCode, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The new quota limit for the subscription. The incremental quota will be allocated from pre-approved group quota. + /// The location for which the subscription is allocated. + /// Resource name. + /// Resource display name. + /// A new instance for mocking. + public static QuotaAllocationRequestBase QuotaAllocationRequestBase(long? limit = null, string region = null, string value = null, string localizedValue = null) + { + return new QuotaAllocationRequestBase(limit, region, value, localizedValue, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource details with usages and GroupQuota. + /// A new instance for mocking. + public static GroupQuotaResourceUsages GroupQuotaResourceUsages(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, GroupQuotaUsagesBase properties = null) + { + return new GroupQuotaResourceUsages( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Quota/limits for the resource. + /// Usages for the resource. + /// Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. Based on - https://armwiki.azurewebsites.net/api_contracts/UsagesAPIContract.html?q=usages . Different RPs may have different units, Count, type as int64 should work for most of the integer values. + /// Resource name. + /// Resource display name. + /// A new instance for mocking. + public static GroupQuotaUsagesBase GroupQuotaUsagesBase(long? limit = null, long? usages = null, string unit = null, string value = null, string localizedValue = null) + { + return new GroupQuotaUsagesBase( + limit, + usages, + unit, + value, + localizedValue, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// A new instance for mocking. + public static GroupQuotaEnforcementData GroupQuotaEnforcementData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, GroupQuotaEnforcementProperties properties = null) + { + return new GroupQuotaEnforcementData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Is the GroupQuota Enforcement enabled for the Azure region. + /// Request status. + /// Details of the failure. + /// A new instance for mocking. + public static GroupQuotaEnforcementProperties GroupQuotaEnforcementProperties(GroupQuotaEnforcementState? enforcementEnabled = null, QuotaRequestStatus? provisioningState = null, string faultCode = null) + { + return new GroupQuotaEnforcementProperties(enforcementEnabled, provisioningState, faultCode, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseCollection.cs index f3de212d468e8..1b0262a48a8c3 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseCollection.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseCollection.cs @@ -56,7 +56,7 @@ internal CurrentQuotaLimitBaseCollection(ArmClient client, ResourceIdentifier id /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -112,7 +112,7 @@ public virtual async Task> CreateOrU /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUn /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -216,7 +216,7 @@ public virtual async Task> GetAsync(stri /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -266,7 +266,7 @@ public virtual Response Get(string resourceName, /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -296,7 +296,7 @@ public virtual AsyncPageable GetAllAsync(Cancella /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -326,7 +326,7 @@ public virtual Pageable GetAll(CancellationToken /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -374,7 +374,7 @@ public virtual async Task> ExistsAsync(string resourceName, Cance /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -422,7 +422,7 @@ public virtual Response Exists(string resourceName, CancellationToken canc /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -472,7 +472,7 @@ public virtual async Task> GetIf /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseData.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseData.Serialization.cs index a284603105b6e..7b4512d304c3b 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseData.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseData.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; using Azure.ResourceManager.Models; @@ -148,6 +149,89 @@ internal static CurrentQuotaLimitBaseData DeserializeCurrentQuotaLimitBaseData(J serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -156,6 +240,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(CurrentQuotaLimitBaseData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseData.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseData.cs index 53934e6589f63..c60b765cdd12f 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseData.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseData.cs @@ -70,6 +70,7 @@ internal CurrentQuotaLimitBaseData(ResourceIdentifier id, string name, ResourceT } /// Quota properties for the specified resource, based on the API called, Quotas or Usages. + [WirePath("properties")] public QuotaProperties Properties { get; set; } } } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseResource.cs index 0f653f78db556..30a53131587b3 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseResource.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseResource.cs @@ -99,7 +99,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -139,7 +139,7 @@ public virtual async Task> GetAsync(Canc /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -181,7 +181,7 @@ public virtual Response Get(CancellationToken can /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -229,7 +229,7 @@ public virtual async Task> UpdateAsy /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseCollection.cs index ca2dd67da3f89..7a71387aca8d2 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseCollection.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseCollection.cs @@ -54,7 +54,7 @@ internal CurrentUsagesBaseCollection(ArmClient client, ResourceIdentifier id) : /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -104,7 +104,7 @@ public virtual async Task> GetAsync(string r /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -154,7 +154,7 @@ public virtual Response Get(string resourceName, Canc /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -184,7 +184,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -214,7 +214,7 @@ public virtual Pageable GetAll(CancellationToken canc /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -262,7 +262,7 @@ public virtual async Task> ExistsAsync(string resourceName, Cance /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -310,7 +310,7 @@ public virtual Response Exists(string resourceName, CancellationToken canc /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -360,7 +360,7 @@ public virtual async Task> GetIfExis /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseData.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseData.Serialization.cs index f5413a0499df5..a4e586724e043 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseData.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseData.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; using Azure.ResourceManager.Models; @@ -148,6 +149,89 @@ internal static CurrentUsagesBaseData DeserializeCurrentUsagesBaseData(JsonEleme serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -156,6 +240,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(CurrentUsagesBaseData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseData.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseData.cs index 4845a357fbc74..624b987eda16d 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseData.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseData.cs @@ -70,6 +70,7 @@ internal CurrentUsagesBaseData(ResourceIdentifier id, string name, ResourceType } /// Usage properties for the specified resource. + [WirePath("properties")] public QuotaUsagesProperties Properties { get; } } } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseResource.cs index d7979765a4217..2c669d578ae5f 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseResource.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseResource.cs @@ -99,7 +99,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -139,7 +139,7 @@ public virtual async Task> GetAsync(Cancella /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaArmClient.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaArmClient.cs index fde270b324ece..69be0966a18c8 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaArmClient.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaArmClient.cs @@ -58,7 +58,7 @@ public virtual CurrentUsagesBaseCollection GetCurrentUsagesBases(ResourceIdentif /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -95,7 +95,7 @@ public virtual async Task> GetCurrentUsagesB /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -140,7 +140,7 @@ public virtual CurrentQuotaLimitBaseCollection GetCurrentQuotaLimitBases(Resourc /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -177,7 +177,7 @@ public virtual async Task> GetCurrentQuo /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -222,7 +222,7 @@ public virtual QuotaRequestDetailCollection GetQuotaRequestDetails(ResourceIdent /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -254,7 +254,7 @@ public virtual async Task> GetQuotaRequestD /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -273,6 +273,102 @@ public virtual Response GetQuotaRequestDetail(Resour return GetQuotaRequestDetails(scope).Get(id, cancellationToken); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GroupQuotaEntityResource GetGroupQuotaEntityResource(ResourceIdentifier id) + { + GroupQuotaEntityResource.ValidateResourceId(id); + return new GroupQuotaEntityResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GroupQuotaSubscriptionResource GetGroupQuotaSubscriptionResource(ResourceIdentifier id) + { + GroupQuotaSubscriptionResource.ValidateResourceId(id); + return new GroupQuotaSubscriptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GroupQuotaSubscriptionRequestStatusResource GetGroupQuotaSubscriptionRequestStatusResource(ResourceIdentifier id) + { + GroupQuotaSubscriptionRequestStatusResource.ValidateResourceId(id); + return new GroupQuotaSubscriptionRequestStatusResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GroupQuotaLimitResource GetGroupQuotaLimitResource(ResourceIdentifier id) + { + GroupQuotaLimitResource.ValidateResourceId(id); + return new GroupQuotaLimitResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GroupQuotaRequestStatusResource GetGroupQuotaRequestStatusResource(ResourceIdentifier id) + { + GroupQuotaRequestStatusResource.ValidateResourceId(id); + return new GroupQuotaRequestStatusResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SubscriptionQuotaAllocationResource GetSubscriptionQuotaAllocationResource(ResourceIdentifier id) + { + SubscriptionQuotaAllocationResource.ValidateResourceId(id); + return new SubscriptionQuotaAllocationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual QuotaAllocationRequestStatusResource GetQuotaAllocationRequestStatusResource(ResourceIdentifier id) + { + QuotaAllocationRequestStatusResource.ValidateResourceId(id); + return new QuotaAllocationRequestStatusResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GroupQuotaEnforcementResource GetGroupQuotaEnforcementResource(ResourceIdentifier id) + { + GroupQuotaEnforcementResource.ValidateResourceId(id); + return new GroupQuotaEnforcementResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaManagementGroupResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaManagementGroupResource.cs new file mode 100644 index 0000000000000..1493b0da52135 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaManagementGroupResource.cs @@ -0,0 +1,591 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Quota.Mocking +{ + /// A class to add extension methods to ManagementGroupResource. + public partial class MockableQuotaManagementGroupResource : ArmResource + { + private ClientDiagnostics _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics; + private GroupQuotaSubscriptionAllocationRequestRestOperations _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableQuotaManagementGroupResource() + { + } + + /// 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 MockableQuotaManagementGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics => _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Quota", QuotaAllocationRequestStatusResource.ResourceType.Namespace, Diagnostics); + private GroupQuotaSubscriptionAllocationRequestRestOperations QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient => _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient ??= new GroupQuotaSubscriptionAllocationRequestRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(QuotaAllocationRequestStatusResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of GroupQuotaEntityResources in the ManagementGroupResource. + /// An object representing collection of GroupQuotaEntityResources and their operations over a GroupQuotaEntityResource. + public virtual GroupQuotaEntityCollection GetGroupQuotaEntities() + { + return GetCachedClient(client => new GroupQuotaEntityCollection(client, Id)); + } + + /// + /// Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on group quota can be access from the group quota APIs. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGroupQuotaEntityAsync(string groupQuotaName, CancellationToken cancellationToken = default) + { + return await GetGroupQuotaEntities().GetAsync(groupQuotaName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on group quota can be access from the group quota APIs. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGroupQuotaEntity(string groupQuotaName, CancellationToken cancellationToken = default) + { + return GetGroupQuotaEntities().Get(groupQuotaName, cancellationToken); + } + + /// Gets a collection of SubscriptionQuotaAllocationResources in the ManagementGroupResource. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// An object representing collection of SubscriptionQuotaAllocationResources and their operations over a SubscriptionQuotaAllocationResource. + public virtual SubscriptionQuotaAllocationCollection GetSubscriptionQuotaAllocations(string subscriptionId, string groupQuotaName) + { + return new SubscriptionQuotaAllocationCollection(Client, Id, subscriptionId, groupQuotaName); + } + + /// + /// Gets Quota allocated to a subscription for the specific Resource Provider, Location, ResourceName. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocation_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSubscriptionQuotaAllocationAsync(string subscriptionId, string groupQuotaName, string resourceName, string filter, CancellationToken cancellationToken = default) + { + return await GetSubscriptionQuotaAllocations(subscriptionId, groupQuotaName).GetAsync(resourceName, filter, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets Quota allocated to a subscription for the specific Resource Provider, Location, ResourceName. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocation_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSubscriptionQuotaAllocation(string subscriptionId, string groupQuotaName, string resourceName, string filter, CancellationToken cancellationToken = default) + { + return GetSubscriptionQuotaAllocations(subscriptionId, groupQuotaName).Get(resourceName, filter, cancellationToken); + } + + /// Gets a collection of QuotaAllocationRequestStatusResources in the ManagementGroupResource. + /// An object representing collection of QuotaAllocationRequestStatusResources and their operations over a QuotaAllocationRequestStatusResource. + public virtual QuotaAllocationRequestStatusCollection GetQuotaAllocationRequestStatuses() + { + return GetCachedClient(client => new QuotaAllocationRequestStatusCollection(client, Id)); + } + + /// + /// Get the quota allocation request status for the subscriptionId by allocationId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetQuotaAllocationRequestStatusAsync(string subscriptionId, string groupQuotaName, string allocationId, CancellationToken cancellationToken = default) + { + return await GetQuotaAllocationRequestStatuses().GetAsync(subscriptionId, groupQuotaName, allocationId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the quota allocation request status for the subscriptionId by allocationId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetQuotaAllocationRequestStatus(string subscriptionId, string groupQuotaName, string allocationId, CancellationToken cancellationToken = default) + { + return GetQuotaAllocationRequestStatuses().Get(subscriptionId, groupQuotaName, allocationId, cancellationToken); + } + + /// + /// Get all the quotaAllocationRequests for a resourceProvider/location. The filter paramter for location is required. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocationRequests + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQuotaAllocationRequestStatusesByResourceProviderAsync(string subscriptionId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.CreateListRequest(Id.Name, subscriptionId, groupQuotaName, resourceProviderName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.CreateListNextPageRequest(nextLink, Id.Name, subscriptionId, groupQuotaName, resourceProviderName, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new QuotaAllocationRequestStatusResource(Client, QuotaAllocationRequestStatusData.DeserializeQuotaAllocationRequestStatusData(e)), QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics, Pipeline, "MockableQuotaManagementGroupResource.GetQuotaAllocationRequestStatusesByResourceProvider", "value", "nextLink", cancellationToken); + } + + /// + /// Get all the quotaAllocationRequests for a resourceProvider/location. The filter paramter for location is required. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocationRequests + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , , or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQuotaAllocationRequestStatusesByResourceProvider(string subscriptionId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.CreateListRequest(Id.Name, subscriptionId, groupQuotaName, resourceProviderName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.CreateListNextPageRequest(nextLink, Id.Name, subscriptionId, groupQuotaName, resourceProviderName, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new QuotaAllocationRequestStatusResource(Client, QuotaAllocationRequestStatusData.DeserializeQuotaAllocationRequestStatusData(e)), QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics, Pipeline, "MockableQuotaManagementGroupResource.GetQuotaAllocationRequestStatusesByResourceProvider", "value", "nextLink", cancellationToken); + } + + /// + /// Request to assign quota from group quota to a specific Subscription. The assign GroupQuota to subscriptions or reduce the quota allocated to subscription to give back the unused quota ( quota >= usages) to the groupQuota. So, this API can be used to assign Quota to subscriptions and assign back unused quota to group quota, which can be assigned to another subscriptions in the GroupQuota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocationRequests/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// Quota requests payload. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + public virtual async Task> CreateOrUpdateGroupQuotaSubscriptionAllocationRequestAsync(WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics.CreateScope("MockableQuotaManagementGroupResource.CreateOrUpdateGroupQuotaSubscriptionAllocationRequest"); + scope.Start(); + try + { + var response = await QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.CreateOrUpdateAsync(Id.Name, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data, cancellationToken).ConfigureAwait(false); + var operation = new QuotaArmOperation(new QuotaAllocationRequestStatusOperationSource(Client), QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics, Pipeline, QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.CreateCreateOrUpdateRequest(Id.Name, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Request to assign quota from group quota to a specific Subscription. The assign GroupQuota to subscriptions or reduce the quota allocated to subscription to give back the unused quota ( quota >= usages) to the groupQuota. So, this API can be used to assign Quota to subscriptions and assign back unused quota to group quota, which can be assigned to another subscriptions in the GroupQuota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocationRequests/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// Quota requests payload. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + public virtual ArmOperation CreateOrUpdateGroupQuotaSubscriptionAllocationRequest(WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics.CreateScope("MockableQuotaManagementGroupResource.CreateOrUpdateGroupQuotaSubscriptionAllocationRequest"); + scope.Start(); + try + { + var response = QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.CreateOrUpdate(Id.Name, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data, cancellationToken); + var operation = new QuotaArmOperation(new QuotaAllocationRequestStatusOperationSource(Client), QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics, Pipeline, QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.CreateCreateOrUpdateRequest(Id.Name, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Request to assign quota from group quota to a specific Subscription. The assign GroupQuota to subscriptions or reduce the quota allocated to subscription to give back the unused quota ( quota >= usages) to the groupQuota. So, this API can be used to assign Quota to subscriptions and assign back unused quota to group quota, which can be assigned to another subscriptions in the GroupQuota. User can collect unused quotas from multiple subscriptions within the groupQuota and assign the groupQuota to the subscription, where it's needed. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocationRequests/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Update + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// Quota requests payload. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + public virtual async Task> UpdateGroupQuotaSubscriptionAllocationRequestAsync(WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics.CreateScope("MockableQuotaManagementGroupResource.UpdateGroupQuotaSubscriptionAllocationRequest"); + scope.Start(); + try + { + var response = await QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.UpdateAsync(Id.Name, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data, cancellationToken).ConfigureAwait(false); + var operation = new QuotaArmOperation(new QuotaAllocationRequestStatusOperationSource(Client), QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics, Pipeline, QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.CreateUpdateRequest(Id.Name, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Request to assign quota from group quota to a specific Subscription. The assign GroupQuota to subscriptions or reduce the quota allocated to subscription to give back the unused quota ( quota >= usages) to the groupQuota. So, this API can be used to assign Quota to subscriptions and assign back unused quota to group quota, which can be assigned to another subscriptions in the GroupQuota. User can collect unused quotas from multiple subscriptions within the groupQuota and assign the groupQuota to the subscription, where it's needed. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocationRequests/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Update + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// Quota requests payload. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + public virtual ArmOperation UpdateGroupQuotaSubscriptionAllocationRequest(WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics.CreateScope("MockableQuotaManagementGroupResource.UpdateGroupQuotaSubscriptionAllocationRequest"); + scope.Start(); + try + { + var response = QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.Update(Id.Name, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data, cancellationToken); + var operation = new QuotaArmOperation(new QuotaAllocationRequestStatusOperationSource(Client), QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics, Pipeline, QuotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.CreateUpdateRequest(Id.Name, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaTenantResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaTenantResource.cs index 91670b26780d8..a1ee8d6f1f55d 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaTenantResource.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaTenantResource.cs @@ -53,7 +53,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// @@ -79,7 +79,7 @@ public virtual AsyncPageable GetQuotaOperationsAsync(Cance /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/QuotaExtensions.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/QuotaExtensions.cs index c97e7ccab62e8..98f9f1b3531ce 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/QuotaExtensions.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/QuotaExtensions.cs @@ -9,6 +9,7 @@ using System.Threading; using System.Threading.Tasks; using Azure.Core; +using Azure.ResourceManager.ManagementGroups; using Azure.ResourceManager.Quota.Mocking; using Azure.ResourceManager.Quota.Models; using Azure.ResourceManager.Resources; @@ -23,6 +24,11 @@ private static MockableQuotaArmClient GetMockableQuotaArmClient(ArmClient client return client.GetCachedClient(client0 => new MockableQuotaArmClient(client0)); } + private static MockableQuotaManagementGroupResource GetMockableQuotaManagementGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableQuotaManagementGroupResource(client, resource.Id)); + } + private static MockableQuotaTenantResource GetMockableQuotaTenantResource(ArmResource resource) { return resource.GetCachedClient(client => new MockableQuotaTenantResource(client, resource.Id)); @@ -59,7 +65,7 @@ public static CurrentUsagesBaseCollection GetCurrentUsagesBases(this ArmClient c /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -103,7 +109,7 @@ public static async Task> GetCurrentUsagesBa /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -165,7 +171,7 @@ public static CurrentQuotaLimitBaseCollection GetCurrentQuotaLimitBases(this Arm /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -209,7 +215,7 @@ public static async Task> GetCurrentQuot /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -271,7 +277,7 @@ public static QuotaRequestDetailCollection GetQuotaRequestDetails(this ArmClient /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -310,7 +316,7 @@ public static async Task> GetQuotaRequestDe /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -336,6 +342,158 @@ public static Response GetQuotaRequestDetail(this Ar return GetMockableQuotaArmClient(client).GetQuotaRequestDetail(scope, id, cancellationToken); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static GroupQuotaEntityResource GetGroupQuotaEntityResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableQuotaArmClient(client).GetGroupQuotaEntityResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static GroupQuotaSubscriptionResource GetGroupQuotaSubscriptionResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableQuotaArmClient(client).GetGroupQuotaSubscriptionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static GroupQuotaSubscriptionRequestStatusResource GetGroupQuotaSubscriptionRequestStatusResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableQuotaArmClient(client).GetGroupQuotaSubscriptionRequestStatusResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static GroupQuotaLimitResource GetGroupQuotaLimitResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableQuotaArmClient(client).GetGroupQuotaLimitResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static GroupQuotaRequestStatusResource GetGroupQuotaRequestStatusResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableQuotaArmClient(client).GetGroupQuotaRequestStatusResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SubscriptionQuotaAllocationResource GetSubscriptionQuotaAllocationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableQuotaArmClient(client).GetSubscriptionQuotaAllocationResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static QuotaAllocationRequestStatusResource GetQuotaAllocationRequestStatusResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableQuotaArmClient(client).GetQuotaAllocationRequestStatusResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static GroupQuotaEnforcementResource GetGroupQuotaEnforcementResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableQuotaArmClient(client).GetGroupQuotaEnforcementResource(id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -393,6 +551,572 @@ public static QuotaRequestDetailResource GetQuotaRequestDetailResource(this ArmC return GetMockableQuotaArmClient(client).GetQuotaRequestDetailResource(id); } + /// + /// Gets a collection of GroupQuotaEntityResources in the ManagementGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of GroupQuotaEntityResources and their operations over a GroupQuotaEntityResource. + public static GroupQuotaEntityCollection GetGroupQuotaEntities(this ManagementGroupResource managementGroupResource) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return GetMockableQuotaManagementGroupResource(managementGroupResource).GetGroupQuotaEntities(); + } + + /// + /// Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on group quota can be access from the group quota APIs. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetGroupQuotaEntityAsync(this ManagementGroupResource managementGroupResource, string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return await GetMockableQuotaManagementGroupResource(managementGroupResource).GetGroupQuotaEntityAsync(groupQuotaName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on group quota can be access from the group quota APIs. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetGroupQuotaEntity(this ManagementGroupResource managementGroupResource, string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return GetMockableQuotaManagementGroupResource(managementGroupResource).GetGroupQuotaEntity(groupQuotaName, cancellationToken); + } + + /// + /// Gets a collection of SubscriptionQuotaAllocationResources in the ManagementGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// An object representing collection of SubscriptionQuotaAllocationResources and their operations over a SubscriptionQuotaAllocationResource. + public static SubscriptionQuotaAllocationCollection GetSubscriptionQuotaAllocations(this ManagementGroupResource managementGroupResource, string subscriptionId, string groupQuotaName) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return GetMockableQuotaManagementGroupResource(managementGroupResource).GetSubscriptionQuotaAllocations(subscriptionId, groupQuotaName); + } + + /// + /// Gets Quota allocated to a subscription for the specific Resource Provider, Location, ResourceName. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocation_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSubscriptionQuotaAllocationAsync(this ManagementGroupResource managementGroupResource, string subscriptionId, string groupQuotaName, string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return await GetMockableQuotaManagementGroupResource(managementGroupResource).GetSubscriptionQuotaAllocationAsync(subscriptionId, groupQuotaName, resourceName, filter, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets Quota allocated to a subscription for the specific Resource Provider, Location, ResourceName. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocation_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetSubscriptionQuotaAllocation(this ManagementGroupResource managementGroupResource, string subscriptionId, string groupQuotaName, string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return GetMockableQuotaManagementGroupResource(managementGroupResource).GetSubscriptionQuotaAllocation(subscriptionId, groupQuotaName, resourceName, filter, cancellationToken); + } + + /// + /// Gets a collection of QuotaAllocationRequestStatusResources in the ManagementGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of QuotaAllocationRequestStatusResources and their operations over a QuotaAllocationRequestStatusResource. + public static QuotaAllocationRequestStatusCollection GetQuotaAllocationRequestStatuses(this ManagementGroupResource managementGroupResource) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return GetMockableQuotaManagementGroupResource(managementGroupResource).GetQuotaAllocationRequestStatuses(); + } + + /// + /// Get the quota allocation request status for the subscriptionId by allocationId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetQuotaAllocationRequestStatusAsync(this ManagementGroupResource managementGroupResource, string subscriptionId, string groupQuotaName, string allocationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return await GetMockableQuotaManagementGroupResource(managementGroupResource).GetQuotaAllocationRequestStatusAsync(subscriptionId, groupQuotaName, allocationId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the quota allocation request status for the subscriptionId by allocationId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetQuotaAllocationRequestStatus(this ManagementGroupResource managementGroupResource, string subscriptionId, string groupQuotaName, string allocationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return GetMockableQuotaManagementGroupResource(managementGroupResource).GetQuotaAllocationRequestStatus(subscriptionId, groupQuotaName, allocationId, cancellationToken); + } + + /// + /// Get all the quotaAllocationRequests for a resourceProvider/location. The filter paramter for location is required. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocationRequests + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetQuotaAllocationRequestStatusesByResourceProviderAsync(this ManagementGroupResource managementGroupResource, string subscriptionId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return GetMockableQuotaManagementGroupResource(managementGroupResource).GetQuotaAllocationRequestStatusesByResourceProviderAsync(subscriptionId, groupQuotaName, resourceProviderName, filter, cancellationToken); + } + + /// + /// Get all the quotaAllocationRequests for a resourceProvider/location. The filter paramter for location is required. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocationRequests + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetQuotaAllocationRequestStatusesByResourceProvider(this ManagementGroupResource managementGroupResource, string subscriptionId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return GetMockableQuotaManagementGroupResource(managementGroupResource).GetQuotaAllocationRequestStatusesByResourceProvider(subscriptionId, groupQuotaName, resourceProviderName, filter, cancellationToken); + } + + /// + /// Request to assign quota from group quota to a specific Subscription. The assign GroupQuota to subscriptions or reduce the quota allocated to subscription to give back the unused quota ( quota >= usages) to the groupQuota. So, this API can be used to assign Quota to subscriptions and assign back unused quota to group quota, which can be assigned to another subscriptions in the GroupQuota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocationRequests/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// 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 ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// Quota requests payload. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , , , or is null. + public static async Task> CreateOrUpdateGroupQuotaSubscriptionAllocationRequestAsync(this ManagementGroupResource managementGroupResource, WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return await GetMockableQuotaManagementGroupResource(managementGroupResource).CreateOrUpdateGroupQuotaSubscriptionAllocationRequestAsync(waitUntil, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data, cancellationToken).ConfigureAwait(false); + } + + /// + /// Request to assign quota from group quota to a specific Subscription. The assign GroupQuota to subscriptions or reduce the quota allocated to subscription to give back the unused quota ( quota >= usages) to the groupQuota. So, this API can be used to assign Quota to subscriptions and assign back unused quota to group quota, which can be assigned to another subscriptions in the GroupQuota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocationRequests/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// 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 ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// Quota requests payload. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , , , or is null. + public static ArmOperation CreateOrUpdateGroupQuotaSubscriptionAllocationRequest(this ManagementGroupResource managementGroupResource, WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return GetMockableQuotaManagementGroupResource(managementGroupResource).CreateOrUpdateGroupQuotaSubscriptionAllocationRequest(waitUntil, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data, cancellationToken); + } + + /// + /// Request to assign quota from group quota to a specific Subscription. The assign GroupQuota to subscriptions or reduce the quota allocated to subscription to give back the unused quota ( quota >= usages) to the groupQuota. So, this API can be used to assign Quota to subscriptions and assign back unused quota to group quota, which can be assigned to another subscriptions in the GroupQuota. User can collect unused quotas from multiple subscriptions within the groupQuota and assign the groupQuota to the subscription, where it's needed. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocationRequests/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Update + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// 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 ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// Quota requests payload. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , , , or is null. + public static async Task> UpdateGroupQuotaSubscriptionAllocationRequestAsync(this ManagementGroupResource managementGroupResource, WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return await GetMockableQuotaManagementGroupResource(managementGroupResource).UpdateGroupQuotaSubscriptionAllocationRequestAsync(waitUntil, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data, cancellationToken).ConfigureAwait(false); + } + + /// + /// Request to assign quota from group quota to a specific Subscription. The assign GroupQuota to subscriptions or reduce the quota allocated to subscription to give back the unused quota ( quota >= usages) to the groupQuota. So, this API can be used to assign Quota to subscriptions and assign back unused quota to group quota, which can be assigned to another subscriptions in the GroupQuota. User can collect unused quotas from multiple subscriptions within the groupQuota and assign the groupQuota to the subscription, where it's needed. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocationRequests/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Update + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// 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 ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// Quota requests payload. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , , , or is null. + public static ArmOperation UpdateGroupQuotaSubscriptionAllocationRequest(this ManagementGroupResource managementGroupResource, WaitUntil waitUntil, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return GetMockableQuotaManagementGroupResource(managementGroupResource).UpdateGroupQuotaSubscriptionAllocationRequest(waitUntil, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data, cancellationToken); + } + /// /// List all the operations supported by the Microsoft.Quota resource provider. /// @@ -406,7 +1130,7 @@ public static QuotaRequestDetailResource GetQuotaRequestDetailResource(this ArmC /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// @@ -438,7 +1162,7 @@ public static AsyncPageable GetQuotaOperationsAsync(this T /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEnforcementCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEnforcementCollection.cs new file mode 100644 index 0000000000000..a6aa0fe10e091 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEnforcementCollection.cs @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Quota +{ + /// + /// 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 GetGroupQuotaEnforcements method from an instance of . + /// + public partial class GroupQuotaEnforcementCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics; + private readonly GroupQuotaLocationSettingsRestOperations _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient; + private readonly string _resourceProviderName; + + /// Initializes a new instance of the class for mocking. + protected GroupQuotaEnforcementCollection() + { + } + + /// 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. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal GroupQuotaEnforcementCollection(ArmClient client, ResourceIdentifier id, string resourceProviderName) : base(client, id) + { + _resourceProviderName = resourceProviderName; + _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", GroupQuotaEnforcementResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(GroupQuotaEnforcementResource.ResourceType, out string groupQuotaEnforcementGroupQuotaLocationSettingsApiVersion); + _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient = new GroupQuotaLocationSettingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, groupQuotaEnforcementGroupQuotaLocationSettingsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != GroupQuotaEntityResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, GroupQuotaEntityResource.ResourceType), nameof(id)); + } + + /// + /// Enables the GroupQuotas enforcement for the resource provider and the location specified. The resource provider will start using the group quotas as the overall quota for the subscriptions included in the GroupQuota. The subscriptions cannot request quota at subscription level. + /// The subscriptions share the GroupQuotaLimits assigned to the GroupQuota. If the GroupQuotaLimits is used, then submit a groupQuotaLimit request for the specific resource - provider/location/resource. + /// Once the GroupQuota Enforcement is enabled then, it cannot be deleted or reverted back. To disable GroupQuota Enforcement - + /// 1. Remove all the subscriptions from the groupQuota using the delete API for Subscriptions (Check the example - GroupQuotaSubscriptions_Delete). + /// 2. Ten delete the GroupQuota (Check the example - GroupQuotas_Delete). + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location} + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the Azure region. + /// The GroupQuota body details for creation or update of a GroupQuota entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, AzureLocation location, GroupQuotaEnforcementData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics.CreateScope("GroupQuotaEnforcementCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.CreateOrUpdateAsync(Id.Parent.Name, Id.Name, _resourceProviderName, location, data, cancellationToken).ConfigureAwait(false); + var operation = new QuotaArmOperation(new GroupQuotaEnforcementOperationSource(Client), _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics, Pipeline, _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.CreateCreateOrUpdateRequest(Id.Parent.Name, Id.Name, _resourceProviderName, location, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Enables the GroupQuotas enforcement for the resource provider and the location specified. The resource provider will start using the group quotas as the overall quota for the subscriptions included in the GroupQuota. The subscriptions cannot request quota at subscription level. + /// The subscriptions share the GroupQuotaLimits assigned to the GroupQuota. If the GroupQuotaLimits is used, then submit a groupQuotaLimit request for the specific resource - provider/location/resource. + /// Once the GroupQuota Enforcement is enabled then, it cannot be deleted or reverted back. To disable GroupQuota Enforcement - + /// 1. Remove all the subscriptions from the groupQuota using the delete API for Subscriptions (Check the example - GroupQuotaSubscriptions_Delete). + /// 2. Ten delete the GroupQuota (Check the example - GroupQuotas_Delete). + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location} + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the Azure region. + /// The GroupQuota body details for creation or update of a GroupQuota entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, AzureLocation location, GroupQuotaEnforcementData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics.CreateScope("GroupQuotaEnforcementCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.CreateOrUpdate(Id.Parent.Name, Id.Name, _resourceProviderName, location, data, cancellationToken); + var operation = new QuotaArmOperation(new GroupQuotaEnforcementOperationSource(Client), _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics, Pipeline, _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.CreateCreateOrUpdateRequest(Id.Parent.Name, Id.Name, _resourceProviderName, location, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the GroupQuotas enforcement settings for the ResourceProvider/location. The locations, where GroupQuota enforcement is not enabled will return Not Found. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location} + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + public virtual async Task> GetAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics.CreateScope("GroupQuotaEnforcementCollection.Get"); + scope.Start(); + try + { + var response = await _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.GetAsync(Id.Parent.Name, Id.Name, _resourceProviderName, location, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaEnforcementResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the GroupQuotas enforcement settings for the ResourceProvider/location. The locations, where GroupQuota enforcement is not enabled will return Not Found. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location} + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + public virtual Response Get(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics.CreateScope("GroupQuotaEnforcementCollection.Get"); + scope.Start(); + try + { + var response = _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.Get(Id.Parent.Name, Id.Name, _resourceProviderName, location, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaEnforcementResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns only the list of the Azure regions settings, where the GroupQuotas enforcement is enabled. The locations not included in GroupQuota Enforcement will not be listed, the regions in failed status with listed as status Failed. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.CreateListRequest(Id.Parent.Name, Id.Name, _resourceProviderName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.CreateListNextPageRequest(nextLink, Id.Parent.Name, Id.Name, _resourceProviderName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GroupQuotaEnforcementResource(Client, GroupQuotaEnforcementData.DeserializeGroupQuotaEnforcementData(e)), _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics, Pipeline, "GroupQuotaEnforcementCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Returns only the list of the Azure regions settings, where the GroupQuotas enforcement is enabled. The locations not included in GroupQuota Enforcement will not be listed, the regions in failed status with listed as status Failed. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.CreateListRequest(Id.Parent.Name, Id.Name, _resourceProviderName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.CreateListNextPageRequest(nextLink, Id.Parent.Name, Id.Name, _resourceProviderName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GroupQuotaEnforcementResource(Client, GroupQuotaEnforcementData.DeserializeGroupQuotaEnforcementData(e)), _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics, Pipeline, "GroupQuotaEnforcementCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location} + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics.CreateScope("GroupQuotaEnforcementCollection.Exists"); + scope.Start(); + try + { + var response = await _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.GetAsync(Id.Parent.Name, Id.Name, _resourceProviderName, location, 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 + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location} + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + public virtual Response Exists(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics.CreateScope("GroupQuotaEnforcementCollection.Exists"); + scope.Start(); + try + { + var response = _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.Get(Id.Parent.Name, Id.Name, _resourceProviderName, location, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location} + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics.CreateScope("GroupQuotaEnforcementCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.GetAsync(Id.Parent.Name, Id.Name, _resourceProviderName, location, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaEnforcementResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location} + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics.CreateScope("GroupQuotaEnforcementCollection.GetIfExists"); + scope.Start(); + try + { + var response = _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.Get(Id.Parent.Name, Id.Name, _resourceProviderName, location, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaEnforcementResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEnforcementData.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEnforcementData.Serialization.cs new file mode 100644 index 0000000000000..0e1d9911a7215 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEnforcementData.Serialization.cs @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + public partial class GroupQuotaEnforcementData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaEnforcementData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaEnforcementData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaEnforcementData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaEnforcementData(document.RootElement, options); + } + + internal static GroupQuotaEnforcementData DeserializeGroupQuotaEnforcementData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GroupQuotaEnforcementProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = GroupQuotaEnforcementProperties.DeserializeGroupQuotaEnforcementProperties(property.Value, options); + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaEnforcementData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaEnforcementData)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaEnforcementData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaEnforcementData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaEnforcementData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEnforcementData.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEnforcementData.cs new file mode 100644 index 0000000000000..dc4f348e51752 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEnforcementData.cs @@ -0,0 +1,76 @@ +// 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.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A class representing the GroupQuotaEnforcement data model. + /// The GroupQuota Enforcement status for a Azure Location/Region. + /// + public partial class GroupQuotaEnforcementData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaEnforcementData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// Keeps track of any properties unknown to the library. + internal GroupQuotaEnforcementData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GroupQuotaEnforcementProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Gets or sets the properties. + [WirePath("properties")] + public GroupQuotaEnforcementProperties Properties { get; set; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEnforcementResource.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEnforcementResource.Serialization.cs new file mode 100644 index 0000000000000..6282eba4224aa --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEnforcementResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Quota +{ + public partial class GroupQuotaEnforcementResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + GroupQuotaEnforcementData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + GroupQuotaEnforcementData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEnforcementResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEnforcementResource.cs new file mode 100644 index 0000000000000..18f0dd28303c8 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEnforcementResource.cs @@ -0,0 +1,271 @@ +// 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.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A Class representing a GroupQuotaEnforcement 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 GetGroupQuotaEnforcementResource method. + /// Otherwise you can get one from its parent resource using the GetGroupQuotaEnforcement method. + /// + public partial class GroupQuotaEnforcementResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The managementGroupId. + /// The groupQuotaName. + /// The resourceProviderName. + /// The location. + public static ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location) + { + var resourceId = $"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics; + private readonly GroupQuotaLocationSettingsRestOperations _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient; + private readonly GroupQuotaEnforcementData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Quota/groupQuotas/resourceProviders/locationSettings"; + + /// Initializes a new instance of the class for mocking. + protected GroupQuotaEnforcementResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal GroupQuotaEnforcementResource(ArmClient client, GroupQuotaEnforcementData 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 GroupQuotaEnforcementResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string groupQuotaEnforcementGroupQuotaLocationSettingsApiVersion); + _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient = new GroupQuotaLocationSettingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, groupQuotaEnforcementGroupQuotaLocationSettingsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual GroupQuotaEnforcementData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the GroupQuotas enforcement settings for the ResourceProvider/location. The locations, where GroupQuota enforcement is not enabled will return Not Found. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location} + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics.CreateScope("GroupQuotaEnforcementResource.Get"); + scope.Start(); + try + { + var response = await _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.GetAsync(Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, new AzureLocation(Id.Name), cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaEnforcementResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the GroupQuotas enforcement settings for the ResourceProvider/location. The locations, where GroupQuota enforcement is not enabled will return Not Found. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location} + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics.CreateScope("GroupQuotaEnforcementResource.Get"); + scope.Start(); + try + { + var response = _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.Get(Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, new AzureLocation(Id.Name), cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaEnforcementResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Enables the GroupQuotas enforcement for the resource provider and the location specified. The resource provider will start using the group quotas as the overall quota for the subscriptions included in the GroupQuota. The subscriptions cannot request quota at subscription level. + /// The subscriptions share the GroupQuotaLimits assigned to the GroupQuota. If the GroupQuotaLimits is used, then submit a groupQuotaLimit request for the specific resource - provider/location/resource. + /// Once the GroupQuota Enforcement is enabled then, it cannot be deleted or reverted back. To disable GroupQuota Enforcement - + /// 1. Remove all the subscriptions from the groupQuota using the delete API for Subscriptions (Check the example - GroupQuotaSubscriptions_Delete). + /// 2. Ten delete the GroupQuota (Check the example - GroupQuotas_Delete). + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location} + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_Update + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The GroupQuota body details for creation or update of a GroupQuota entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, GroupQuotaEnforcementData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics.CreateScope("GroupQuotaEnforcementResource.Update"); + scope.Start(); + try + { + var response = await _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.UpdateAsync(Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, new AzureLocation(Id.Name), data, cancellationToken).ConfigureAwait(false); + var operation = new QuotaArmOperation(new GroupQuotaEnforcementOperationSource(Client), _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics, Pipeline, _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.CreateUpdateRequest(Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, new AzureLocation(Id.Name), data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Enables the GroupQuotas enforcement for the resource provider and the location specified. The resource provider will start using the group quotas as the overall quota for the subscriptions included in the GroupQuota. The subscriptions cannot request quota at subscription level. + /// The subscriptions share the GroupQuotaLimits assigned to the GroupQuota. If the GroupQuotaLimits is used, then submit a groupQuotaLimit request for the specific resource - provider/location/resource. + /// Once the GroupQuota Enforcement is enabled then, it cannot be deleted or reverted back. To disable GroupQuota Enforcement - + /// 1. Remove all the subscriptions from the groupQuota using the delete API for Subscriptions (Check the example - GroupQuotaSubscriptions_Delete). + /// 2. Ten delete the GroupQuota (Check the example - GroupQuotas_Delete). + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location} + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_Update + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The GroupQuota body details for creation or update of a GroupQuota entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, GroupQuotaEnforcementData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics.CreateScope("GroupQuotaEnforcementResource.Update"); + scope.Start(); + try + { + var response = _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.Update(Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, new AzureLocation(Id.Name), data, cancellationToken); + var operation = new QuotaArmOperation(new GroupQuotaEnforcementOperationSource(Client), _groupQuotaEnforcementGroupQuotaLocationSettingsClientDiagnostics, Pipeline, _groupQuotaEnforcementGroupQuotaLocationSettingsRestClient.CreateUpdateRequest(Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, new AzureLocation(Id.Name), data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEntityCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEntityCollection.cs new file mode 100644 index 0000000000000..c1c4cdecad85b --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEntityCollection.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ManagementGroups; + +namespace Azure.ResourceManager.Quota +{ + /// + /// 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 GetGroupQuotaEntities method from an instance of . + /// + public partial class GroupQuotaEntityCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _groupQuotaEntityGroupQuotasClientDiagnostics; + private readonly GroupQuotasRestOperations _groupQuotaEntityGroupQuotasRestClient; + + /// Initializes a new instance of the class for mocking. + protected GroupQuotaEntityCollection() + { + } + + /// 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 GroupQuotaEntityCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _groupQuotaEntityGroupQuotasClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", GroupQuotaEntityResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(GroupQuotaEntityResource.ResourceType, out string groupQuotaEntityGroupQuotasApiVersion); + _groupQuotaEntityGroupQuotasRestClient = new GroupQuotasRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, groupQuotaEntityGroupQuotasApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ManagementGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagementGroupResource.ResourceType), nameof(id)); + } + + /// + /// Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be polled periodically. The status Async polling is using standards defined at - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to Get URI and full details can be checked. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The GroupQuota body details for creation or update of a GroupQuota entity. + /// 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 groupQuotaName, GroupQuotaEntityData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _groupQuotaEntityGroupQuotasClientDiagnostics.CreateScope("GroupQuotaEntityCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _groupQuotaEntityGroupQuotasRestClient.CreateOrUpdateAsync(Id.Name, groupQuotaName, data, cancellationToken).ConfigureAwait(false); + var operation = new QuotaArmOperation(new GroupQuotaEntityOperationSource(Client), _groupQuotaEntityGroupQuotasClientDiagnostics, Pipeline, _groupQuotaEntityGroupQuotasRestClient.CreateCreateOrUpdateRequest(Id.Name, groupQuotaName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be polled periodically. The status Async polling is using standards defined at - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to Get URI and full details can be checked. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The GroupQuota body details for creation or update of a GroupQuota entity. + /// 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 groupQuotaName, GroupQuotaEntityData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _groupQuotaEntityGroupQuotasClientDiagnostics.CreateScope("GroupQuotaEntityCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _groupQuotaEntityGroupQuotasRestClient.CreateOrUpdate(Id.Name, groupQuotaName, data, cancellationToken); + var operation = new QuotaArmOperation(new GroupQuotaEntityOperationSource(Client), _groupQuotaEntityGroupQuotasClientDiagnostics, Pipeline, _groupQuotaEntityGroupQuotasRestClient.CreateCreateOrUpdateRequest(Id.Name, groupQuotaName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on group quota can be access from the group quota APIs. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var scope = _groupQuotaEntityGroupQuotasClientDiagnostics.CreateScope("GroupQuotaEntityCollection.Get"); + scope.Start(); + try + { + var response = await _groupQuotaEntityGroupQuotasRestClient.GetAsync(Id.Name, groupQuotaName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaEntityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on group quota can be access from the group quota APIs. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var scope = _groupQuotaEntityGroupQuotasClientDiagnostics.CreateScope("GroupQuotaEntityCollection.Get"); + scope.Start(); + try + { + var response = _groupQuotaEntityGroupQuotasRestClient.Get(Id.Name, groupQuotaName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaEntityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details on group quota can be access from the group quota APIs. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas + /// + /// + /// Operation Id + /// GroupQuotas_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _groupQuotaEntityGroupQuotasRestClient.CreateListRequest(Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupQuotaEntityGroupQuotasRestClient.CreateListNextPageRequest(nextLink, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GroupQuotaEntityResource(Client, GroupQuotaEntityData.DeserializeGroupQuotaEntityData(e)), _groupQuotaEntityGroupQuotasClientDiagnostics, Pipeline, "GroupQuotaEntityCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details on group quota can be access from the group quota APIs. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas + /// + /// + /// Operation Id + /// GroupQuotas_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _groupQuotaEntityGroupQuotasRestClient.CreateListRequest(Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupQuotaEntityGroupQuotasRestClient.CreateListNextPageRequest(nextLink, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GroupQuotaEntityResource(Client, GroupQuotaEntityData.DeserializeGroupQuotaEntityData(e)), _groupQuotaEntityGroupQuotasClientDiagnostics, Pipeline, "GroupQuotaEntityCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var scope = _groupQuotaEntityGroupQuotasClientDiagnostics.CreateScope("GroupQuotaEntityCollection.Exists"); + scope.Start(); + try + { + var response = await _groupQuotaEntityGroupQuotasRestClient.GetAsync(Id.Name, groupQuotaName, 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 + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var scope = _groupQuotaEntityGroupQuotasClientDiagnostics.CreateScope("GroupQuotaEntityCollection.Exists"); + scope.Start(); + try + { + var response = _groupQuotaEntityGroupQuotasRestClient.Get(Id.Name, groupQuotaName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var scope = _groupQuotaEntityGroupQuotasClientDiagnostics.CreateScope("GroupQuotaEntityCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _groupQuotaEntityGroupQuotasRestClient.GetAsync(Id.Name, groupQuotaName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaEntityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var scope = _groupQuotaEntityGroupQuotasClientDiagnostics.CreateScope("GroupQuotaEntityCollection.GetIfExists"); + scope.Start(); + try + { + var response = _groupQuotaEntityGroupQuotasRestClient.Get(Id.Name, groupQuotaName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaEntityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEntityData.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEntityData.Serialization.cs new file mode 100644 index 0000000000000..464240ea8bb51 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEntityData.Serialization.cs @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + public partial class GroupQuotaEntityData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaEntityData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaEntityData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaEntityData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaEntityData(document.RootElement, options); + } + + internal static GroupQuotaEntityData DeserializeGroupQuotaEntityData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GroupQuotaEntityBase properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = GroupQuotaEntityBase.DeserializeGroupQuotaEntityBase(property.Value, options); + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaEntityData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaEntityData)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaEntityData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaEntityData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaEntityData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEntityData.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEntityData.cs new file mode 100644 index 0000000000000..33606c5ed7078 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEntityData.cs @@ -0,0 +1,76 @@ +// 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.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A class representing the GroupQuotaEntity data model. + /// Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. + /// + public partial class GroupQuotaEntityData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaEntityData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaEntityData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GroupQuotaEntityBase properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. + [WirePath("properties")] + public GroupQuotaEntityBase Properties { get; set; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEntityResource.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEntityResource.Serialization.cs new file mode 100644 index 0000000000000..6f9bb831f66b9 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEntityResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Quota +{ + public partial class GroupQuotaEntityResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + GroupQuotaEntityData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + GroupQuotaEntityData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEntityResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEntityResource.cs new file mode 100644 index 0000000000000..1f07f43a073a7 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaEntityResource.cs @@ -0,0 +1,1084 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ManagementGroups; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A Class representing a GroupQuotaEntity 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 GetGroupQuotaEntityResource method. + /// Otherwise you can get one from its parent resource using the GetGroupQuotaEntity method. + /// + public partial class GroupQuotaEntityResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The managementGroupId. + /// The groupQuotaName. + public static ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string groupQuotaName) + { + var resourceId = $"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _groupQuotaEntityGroupQuotasClientDiagnostics; + private readonly GroupQuotasRestOperations _groupQuotaEntityGroupQuotasRestClient; + private readonly ClientDiagnostics _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics; + private readonly GroupQuotaLimitsRequestRestOperations _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient; + private readonly ClientDiagnostics _groupQuotaUsagesClientDiagnostics; + private readonly GroupQuotaUsagesRestOperations _groupQuotaUsagesRestClient; + private readonly GroupQuotaEntityData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Quota/groupQuotas"; + + /// Initializes a new instance of the class for mocking. + protected GroupQuotaEntityResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal GroupQuotaEntityResource(ArmClient client, GroupQuotaEntityData 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 GroupQuotaEntityResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _groupQuotaEntityGroupQuotasClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string groupQuotaEntityGroupQuotasApiVersion); + _groupQuotaEntityGroupQuotasRestClient = new GroupQuotasRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, groupQuotaEntityGroupQuotasApiVersion); + _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", GroupQuotaRequestStatusResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(GroupQuotaRequestStatusResource.ResourceType, out string groupQuotaRequestStatusGroupQuotaLimitsRequestApiVersion); + _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient = new GroupQuotaLimitsRequestRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, groupQuotaRequestStatusGroupQuotaLimitsRequestApiVersion); + _groupQuotaUsagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _groupQuotaUsagesRestClient = new GroupQuotaUsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual GroupQuotaEntityData 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 GroupQuotaSubscriptionResources in the GroupQuotaEntity. + /// An object representing collection of GroupQuotaSubscriptionResources and their operations over a GroupQuotaSubscriptionResource. + public virtual GroupQuotaSubscriptionCollection GetGroupQuotaSubscriptions() + { + return GetCachedClient(client => new GroupQuotaSubscriptionCollection(client, Id)); + } + + /// + /// Returns the subscriptionIds along with its provisioning state for being associated with the GroupQuota. If the subscription is not a member of GroupQuota, it will return 404, else 200. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGroupQuotaSubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + return await GetGroupQuotaSubscriptions().GetAsync(subscriptionId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the subscriptionIds along with its provisioning state for being associated with the GroupQuota. If the subscription is not a member of GroupQuota, it will return 404, else 200. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGroupQuotaSubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + return GetGroupQuotaSubscriptions().Get(subscriptionId, cancellationToken); + } + + /// Gets a collection of GroupQuotaSubscriptionRequestStatusResources in the GroupQuotaEntity. + /// An object representing collection of GroupQuotaSubscriptionRequestStatusResources and their operations over a GroupQuotaSubscriptionRequestStatusResource. + public virtual GroupQuotaSubscriptionRequestStatusCollection GetGroupQuotaSubscriptionRequestStatuses() + { + return GetCachedClient(client => new GroupQuotaSubscriptionRequestStatusCollection(client, Id)); + } + + /// + /// Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionRequests_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGroupQuotaSubscriptionRequestStatusAsync(string requestId, CancellationToken cancellationToken = default) + { + return await GetGroupQuotaSubscriptionRequestStatuses().GetAsync(requestId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionRequests_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGroupQuotaSubscriptionRequestStatus(string requestId, CancellationToken cancellationToken = default) + { + return GetGroupQuotaSubscriptionRequestStatuses().Get(requestId, cancellationToken); + } + + /// Gets a collection of GroupQuotaLimitResources in the GroupQuotaEntity. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of GroupQuotaLimitResources and their operations over a GroupQuotaLimitResource. + public virtual GroupQuotaLimitCollection GetGroupQuotaLimits(string resourceProviderName) + { + return new GroupQuotaLimitCollection(Client, Id, resourceProviderName); + } + + /// + /// Gets the GroupQuotaLimits for the specific resource for a specific resource based on the resourceProviders, resourceName and $filter passed. + /// The $filter=location eq {location} is required to location specific resources groupQuota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaLimits_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGroupQuotaLimitAsync(string resourceProviderName, string resourceName, string filter, CancellationToken cancellationToken = default) + { + return await GetGroupQuotaLimits(resourceProviderName).GetAsync(resourceName, filter, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the GroupQuotaLimits for the specific resource for a specific resource based on the resourceProviders, resourceName and $filter passed. + /// The $filter=location eq {location} is required to location specific resources groupQuota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaLimits_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGroupQuotaLimit(string resourceProviderName, string resourceName, string filter, CancellationToken cancellationToken = default) + { + return GetGroupQuotaLimits(resourceProviderName).Get(resourceName, filter, cancellationToken); + } + + /// Gets a collection of GroupQuotaRequestStatusResources in the GroupQuotaEntity. + /// An object representing collection of GroupQuotaRequestStatusResources and their operations over a GroupQuotaRequestStatusResource. + public virtual GroupQuotaRequestStatusCollection GetGroupQuotaRequestStatuses() + { + return GetCachedClient(client => new GroupQuotaRequestStatusCollection(client, Id)); + } + + /// + /// Get API to check the status of a GroupQuota request by requestId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGroupQuotaRequestStatusAsync(string requestId, CancellationToken cancellationToken = default) + { + return await GetGroupQuotaRequestStatuses().GetAsync(requestId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get API to check the status of a GroupQuota request by requestId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGroupQuotaRequestStatus(string requestId, CancellationToken cancellationToken = default) + { + return GetGroupQuotaRequestStatuses().Get(requestId, cancellationToken); + } + + /// Gets a collection of GroupQuotaEnforcementResources in the GroupQuotaEntity. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of GroupQuotaEnforcementResources and their operations over a GroupQuotaEnforcementResource. + public virtual GroupQuotaEnforcementCollection GetGroupQuotaEnforcements(string resourceProviderName) + { + return new GroupQuotaEnforcementCollection(Client, Id, resourceProviderName); + } + + /// + /// Gets the GroupQuotas enforcement settings for the ResourceProvider/location. The locations, where GroupQuota enforcement is not enabled will return Not Found. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location} + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The name of the Azure region. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGroupQuotaEnforcementAsync(string resourceProviderName, AzureLocation location, CancellationToken cancellationToken = default) + { + return await GetGroupQuotaEnforcements(resourceProviderName).GetAsync(location, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the GroupQuotas enforcement settings for the ResourceProvider/location. The locations, where GroupQuota enforcement is not enabled will return Not Found. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location} + /// + /// + /// Operation Id + /// GroupQuotaLocationSettings_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The name of the Azure region. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGroupQuotaEnforcement(string resourceProviderName, AzureLocation location, CancellationToken cancellationToken = default) + { + return GetGroupQuotaEnforcements(resourceProviderName).Get(location, cancellationToken); + } + + /// + /// Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on group quota can be access from the group quota APIs. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaEntityGroupQuotasClientDiagnostics.CreateScope("GroupQuotaEntityResource.Get"); + scope.Start(); + try + { + var response = await _groupQuotaEntityGroupQuotasRestClient.GetAsync(Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaEntityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on group quota can be access from the group quota APIs. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaEntityGroupQuotasClientDiagnostics.CreateScope("GroupQuotaEntityResource.Get"); + scope.Start(); + try + { + var response = _groupQuotaEntityGroupQuotasRestClient.Get(Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaEntityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be lost. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Delete + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaEntityGroupQuotasClientDiagnostics.CreateScope("GroupQuotaEntityResource.Delete"); + scope.Start(); + try + { + var response = await _groupQuotaEntityGroupQuotasRestClient.DeleteAsync(Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new QuotaArmOperation(_groupQuotaEntityGroupQuotasClientDiagnostics, Pipeline, _groupQuotaEntityGroupQuotasRestClient.CreateDeleteRequest(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; + } + } + + /// + /// Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be lost. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Delete + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaEntityGroupQuotasClientDiagnostics.CreateScope("GroupQuotaEntityResource.Delete"); + scope.Start(); + try + { + var response = _groupQuotaEntityGroupQuotasRestClient.Delete(Id.Parent.Name, Id.Name, cancellationToken); + var operation = new QuotaArmOperation(_groupQuotaEntityGroupQuotasClientDiagnostics, Pipeline, _groupQuotaEntityGroupQuotasRestClient.CreateDeleteRequest(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; + } + } + + /// + /// Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The status can be polled periodically. The status Async polling is using standards defined at - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to Get URI and full details can be checked. + /// Any change in the filters will be applicable to the future quota assignments, existing quota allocated to subscriptions from the GroupQuotas remains unchanged. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Update + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The GroupQuotas Patch Request. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, GroupQuotaEntityPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _groupQuotaEntityGroupQuotasClientDiagnostics.CreateScope("GroupQuotaEntityResource.Update"); + scope.Start(); + try + { + var response = await _groupQuotaEntityGroupQuotasRestClient.UpdateAsync(Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new QuotaArmOperation(new GroupQuotaEntityOperationSource(Client), _groupQuotaEntityGroupQuotasClientDiagnostics, Pipeline, _groupQuotaEntityGroupQuotasRestClient.CreateUpdateRequest(Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The status can be polled periodically. The status Async polling is using standards defined at - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to Get URI and full details can be checked. + /// Any change in the filters will be applicable to the future quota assignments, existing quota allocated to subscriptions from the GroupQuotas remains unchanged. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName} + /// + /// + /// Operation Id + /// GroupQuotas_Update + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The GroupQuotas Patch Request. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, GroupQuotaEntityPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _groupQuotaEntityGroupQuotasClientDiagnostics.CreateScope("GroupQuotaEntityResource.Update"); + scope.Start(); + try + { + var response = _groupQuotaEntityGroupQuotasRestClient.Update(Id.Parent.Name, Id.Name, patch, cancellationToken); + var operation = new QuotaArmOperation(new GroupQuotaEntityOperationSource(Client), _groupQuotaEntityGroupQuotasClientDiagnostics, Pipeline, _groupQuotaEntityGroupQuotasRestClient.CreateUpdateRequest(Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Put the GroupQuota requests for a specific ResourceProvider/Location/Resource. the location and resourceName ("name": {"value" : "resourceName") properties are specified in the request body. Only 1 resource quota can be requested. + /// Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaRequests/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// The GroupQuotaRequest body details for specific resourceProvider/location/resources. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateGroupQuotaLimitsRequestAsync(WaitUntil waitUntil, string resourceProviderName, string resourceName, GroupQuotaRequestStatusData data = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics.CreateScope("GroupQuotaEntityResource.CreateOrUpdateGroupQuotaLimitsRequest"); + scope.Start(); + try + { + var response = await _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.CreateOrUpdateAsync(Id.Parent.Name, Id.Name, resourceProviderName, resourceName, data, cancellationToken).ConfigureAwait(false); + var operation = new QuotaArmOperation(new GroupQuotaRequestStatusOperationSource(Client), _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics, Pipeline, _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.CreateCreateOrUpdateRequest(Id.Parent.Name, Id.Name, resourceProviderName, resourceName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Put the GroupQuota requests for a specific ResourceProvider/Location/Resource. the location and resourceName ("name": {"value" : "resourceName") properties are specified in the request body. Only 1 resource quota can be requested. + /// Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaRequests/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// The GroupQuotaRequest body details for specific resourceProvider/location/resources. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdateGroupQuotaLimitsRequest(WaitUntil waitUntil, string resourceProviderName, string resourceName, GroupQuotaRequestStatusData data = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics.CreateScope("GroupQuotaEntityResource.CreateOrUpdateGroupQuotaLimitsRequest"); + scope.Start(); + try + { + var response = _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.CreateOrUpdate(Id.Parent.Name, Id.Name, resourceProviderName, resourceName, data, cancellationToken); + var operation = new QuotaArmOperation(new GroupQuotaRequestStatusOperationSource(Client), _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics, Pipeline, _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.CreateCreateOrUpdateRequest(Id.Parent.Name, Id.Name, resourceProviderName, resourceName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create the GroupQuota requests for a specific ResourceProvider/Location/Resource. the location and resourceName properties are specified in the request body. Only 1 resource quota can be requested. Please note that patch request creates a new groupQuota request. + /// Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaRequests/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_Update + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// The GroupQuotaRequest body details for specific resourceProvider/location/resources. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> UpdateGroupQuotaLimitsRequestAsync(WaitUntil waitUntil, string resourceProviderName, string resourceName, GroupQuotaRequestStatusData data = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics.CreateScope("GroupQuotaEntityResource.UpdateGroupQuotaLimitsRequest"); + scope.Start(); + try + { + var response = await _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.UpdateAsync(Id.Parent.Name, Id.Name, resourceProviderName, resourceName, data, cancellationToken).ConfigureAwait(false); + var operation = new QuotaArmOperation(new GroupQuotaRequestStatusOperationSource(Client), _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics, Pipeline, _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.CreateUpdateRequest(Id.Parent.Name, Id.Name, resourceProviderName, resourceName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create the GroupQuota requests for a specific ResourceProvider/Location/Resource. the location and resourceName properties are specified in the request body. Only 1 resource quota can be requested. Please note that patch request creates a new groupQuota request. + /// Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaRequests/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_Update + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// The GroupQuotaRequest body details for specific resourceProvider/location/resources. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation UpdateGroupQuotaLimitsRequest(WaitUntil waitUntil, string resourceProviderName, string resourceName, GroupQuotaRequestStatusData data = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics.CreateScope("GroupQuotaEntityResource.UpdateGroupQuotaLimitsRequest"); + scope.Start(); + try + { + var response = _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.Update(Id.Parent.Name, Id.Name, resourceProviderName, resourceName, data, cancellationToken); + var operation = new QuotaArmOperation(new GroupQuotaRequestStatusOperationSource(Client), _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics, Pipeline, _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.CreateUpdateRequest(Id.Parent.Name, Id.Name, resourceProviderName, resourceName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get API to check the status of a GroupQuota request by requestId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaRequests + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} and resource eq {resourceName} + /// Example: $filter=location eq eastus and resourceName eq cores + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetGroupQuotaLimitsRequestsAsync(string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.CreateListRequest(Id.Parent.Name, Id.Name, resourceProviderName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.CreateListNextPageRequest(nextLink, Id.Parent.Name, Id.Name, resourceProviderName, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GroupQuotaRequestStatusResource(Client, GroupQuotaRequestStatusData.DeserializeGroupQuotaRequestStatusData(e)), _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics, Pipeline, "GroupQuotaEntityResource.GetGroupQuotaLimitsRequests", "value", "nextLink", cancellationToken); + } + + /// + /// Get API to check the status of a GroupQuota request by requestId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaRequests + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} and resource eq {resourceName} + /// Example: $filter=location eq eastus and resourceName eq cores + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetGroupQuotaLimitsRequests(string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.CreateListRequest(Id.Parent.Name, Id.Name, resourceProviderName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.CreateListNextPageRequest(nextLink, Id.Parent.Name, Id.Name, resourceProviderName, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GroupQuotaRequestStatusResource(Client, GroupQuotaRequestStatusData.DeserializeGroupQuotaRequestStatusData(e)), _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics, Pipeline, "GroupQuotaEntityResource.GetGroupQuotaLimitsRequests", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the GroupQuotas usages and limits(quota). Location is required paramter. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationUsages/{location} + /// + /// + /// Operation Id + /// GroupQuotaUsages_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The name of the Azure region. + /// 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 virtual AsyncPageable GetGroupQuotaUsagesAsync(string resourceProviderName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _groupQuotaUsagesRestClient.CreateListRequest(Id.Parent.Name, Id.Name, resourceProviderName, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupQuotaUsagesRestClient.CreateListNextPageRequest(nextLink, Id.Parent.Name, Id.Name, resourceProviderName, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => GroupQuotaResourceUsages.DeserializeGroupQuotaResourceUsages(e), _groupQuotaUsagesClientDiagnostics, Pipeline, "GroupQuotaEntityResource.GetGroupQuotaUsages", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the GroupQuotas usages and limits(quota). Location is required paramter. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationUsages/{location} + /// + /// + /// Operation Id + /// GroupQuotaUsages_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The name of the Azure region. + /// 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 virtual Pageable GetGroupQuotaUsages(string resourceProviderName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _groupQuotaUsagesRestClient.CreateListRequest(Id.Parent.Name, Id.Name, resourceProviderName, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupQuotaUsagesRestClient.CreateListNextPageRequest(nextLink, Id.Parent.Name, Id.Name, resourceProviderName, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => GroupQuotaResourceUsages.DeserializeGroupQuotaResourceUsages(e), _groupQuotaUsagesClientDiagnostics, Pipeline, "GroupQuotaEntityResource.GetGroupQuotaUsages", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaLimitCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaLimitCollection.cs new file mode 100644 index 0000000000000..bd927d382d7cf --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaLimitCollection.cs @@ -0,0 +1,455 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Quota +{ + /// + /// 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 GetGroupQuotaLimits method from an instance of . + /// + public partial class GroupQuotaLimitCollection : ArmCollection + { + private readonly ClientDiagnostics _groupQuotaLimitClientDiagnostics; + private readonly GroupQuotaLimitsRestOperations _groupQuotaLimitRestClient; + private readonly string _resourceProviderName; + + /// Initializes a new instance of the class for mocking. + protected GroupQuotaLimitCollection() + { + } + + /// 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. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal GroupQuotaLimitCollection(ArmClient client, ResourceIdentifier id, string resourceProviderName) : base(client, id) + { + _resourceProviderName = resourceProviderName; + _groupQuotaLimitClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", GroupQuotaLimitResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(GroupQuotaLimitResource.ResourceType, out string groupQuotaLimitApiVersion); + _groupQuotaLimitRestClient = new GroupQuotaLimitsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, groupQuotaLimitApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != GroupQuotaEntityResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, GroupQuotaEntityResource.ResourceType), nameof(id)); + } + + /// + /// Gets the GroupQuotaLimits for the specific resource for a specific resource based on the resourceProviders, resourceName and $filter passed. + /// The $filter=location eq {location} is required to location specific resources groupQuota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaLimits_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetAsync(string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _groupQuotaLimitClientDiagnostics.CreateScope("GroupQuotaLimitCollection.Get"); + scope.Start(); + try + { + var response = await _groupQuotaLimitRestClient.GetAsync(Id.Parent.Name, Id.Name, _resourceProviderName, resourceName, filter, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaLimitResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the GroupQuotaLimits for the specific resource for a specific resource based on the resourceProviders, resourceName and $filter passed. + /// The $filter=location eq {location} is required to location specific resources groupQuota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaLimits_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response Get(string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _groupQuotaLimitClientDiagnostics.CreateScope("GroupQuotaLimitCollection.Get"); + scope.Start(); + try + { + var response = _groupQuotaLimitRestClient.Get(Id.Parent.Name, Id.Name, _resourceProviderName, resourceName, filter, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaLimitResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the GroupQuotaLimits for the all resource for a specific resourceProvider and $filter passed. + /// The $filter=location eq {location} is required to location specific resources groupQuota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits + /// + /// + /// Operation Id + /// GroupQuotaLimits_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(filter, nameof(filter)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _groupQuotaLimitRestClient.CreateListRequest(Id.Parent.Name, Id.Name, _resourceProviderName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupQuotaLimitRestClient.CreateListNextPageRequest(nextLink, Id.Parent.Name, Id.Name, _resourceProviderName, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GroupQuotaLimitResource(Client, GroupQuotaLimitData.DeserializeGroupQuotaLimitData(e)), _groupQuotaLimitClientDiagnostics, Pipeline, "GroupQuotaLimitCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the GroupQuotaLimits for the all resource for a specific resourceProvider and $filter passed. + /// The $filter=location eq {location} is required to location specific resources groupQuota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits + /// + /// + /// Operation Id + /// GroupQuotaLimits_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(filter, nameof(filter)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _groupQuotaLimitRestClient.CreateListRequest(Id.Parent.Name, Id.Name, _resourceProviderName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupQuotaLimitRestClient.CreateListNextPageRequest(nextLink, Id.Parent.Name, Id.Name, _resourceProviderName, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GroupQuotaLimitResource(Client, GroupQuotaLimitData.DeserializeGroupQuotaLimitData(e)), _groupQuotaLimitClientDiagnostics, Pipeline, "GroupQuotaLimitCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaLimits_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> ExistsAsync(string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _groupQuotaLimitClientDiagnostics.CreateScope("GroupQuotaLimitCollection.Exists"); + scope.Start(); + try + { + var response = await _groupQuotaLimitRestClient.GetAsync(Id.Parent.Name, Id.Name, _resourceProviderName, resourceName, filter, 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 + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaLimits_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response Exists(string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _groupQuotaLimitClientDiagnostics.CreateScope("GroupQuotaLimitCollection.Exists"); + scope.Start(); + try + { + var response = _groupQuotaLimitRestClient.Get(Id.Parent.Name, Id.Name, _resourceProviderName, resourceName, filter, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaLimits_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetIfExistsAsync(string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _groupQuotaLimitClientDiagnostics.CreateScope("GroupQuotaLimitCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _groupQuotaLimitRestClient.GetAsync(Id.Parent.Name, Id.Name, _resourceProviderName, resourceName, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaLimitResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaLimits_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual NullableResponse GetIfExists(string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _groupQuotaLimitClientDiagnostics.CreateScope("GroupQuotaLimitCollection.GetIfExists"); + scope.Start(); + try + { + var response = _groupQuotaLimitRestClient.Get(Id.Parent.Name, Id.Name, _resourceProviderName, resourceName, filter, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaLimitResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaLimitData.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaLimitData.Serialization.cs new file mode 100644 index 0000000000000..da26c05e06673 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaLimitData.Serialization.cs @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + public partial class GroupQuotaLimitData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaLimitData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaLimitData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaLimitData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaLimitData(document.RootElement, options); + } + + internal static GroupQuotaLimitData DeserializeGroupQuotaLimitData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GroupQuotaDetails properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = GroupQuotaDetails.DeserializeGroupQuotaDetails(property.Value, options); + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaLimitData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaLimitData)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaLimitData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaLimitData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaLimitData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaLimitData.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaLimitData.cs new file mode 100644 index 0000000000000..22858e54e8f84 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaLimitData.cs @@ -0,0 +1,76 @@ +// 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.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A class representing the GroupQuotaLimit data model. + /// Group Quota limit. + /// + public partial class GroupQuotaLimitData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaLimitData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Group Quota properties for the specified resource. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaLimitData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GroupQuotaDetails properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Group Quota properties for the specified resource. + [WirePath("properties")] + public GroupQuotaDetails Properties { get; set; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaLimitResource.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaLimitResource.Serialization.cs new file mode 100644 index 0000000000000..31b8507ac7942 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaLimitResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Quota +{ + public partial class GroupQuotaLimitResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + GroupQuotaLimitData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + GroupQuotaLimitData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaLimitResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaLimitResource.cs new file mode 100644 index 0000000000000..89e7edbe570bf --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaLimitResource.cs @@ -0,0 +1,193 @@ +// 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.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A Class representing a GroupQuotaLimit 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 GetGroupQuotaLimitResource method. + /// Otherwise you can get one from its parent resource using the GetGroupQuotaLimit method. + /// + public partial class GroupQuotaLimitResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The managementGroupId. + /// The groupQuotaName. + /// The resourceProviderName. + /// The resourceName. + public static ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string groupQuotaName, string resourceProviderName, string resourceName) + { + var resourceId = $"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits/{resourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _groupQuotaLimitClientDiagnostics; + private readonly GroupQuotaLimitsRestOperations _groupQuotaLimitRestClient; + private readonly GroupQuotaLimitData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Quota/groupQuotas/resourceProviders/groupQuotaLimits"; + + /// Initializes a new instance of the class for mocking. + protected GroupQuotaLimitResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal GroupQuotaLimitResource(ArmClient client, GroupQuotaLimitData 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 GroupQuotaLimitResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _groupQuotaLimitClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string groupQuotaLimitApiVersion); + _groupQuotaLimitRestClient = new GroupQuotaLimitsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, groupQuotaLimitApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual GroupQuotaLimitData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the GroupQuotaLimits for the specific resource for a specific resource based on the resourceProviders, resourceName and $filter passed. + /// The $filter=location eq {location} is required to location specific resources groupQuota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaLimits_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is null. + public virtual async Task> GetAsync(string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _groupQuotaLimitClientDiagnostics.CreateScope("GroupQuotaLimitResource.Get"); + scope.Start(); + try + { + var response = await _groupQuotaLimitRestClient.GetAsync(Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaLimitResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the GroupQuotaLimits for the specific resource for a specific resource based on the resourceProviders, resourceName and $filter passed. + /// The $filter=location eq {location} is required to location specific resources groupQuota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaLimits_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is null. + public virtual Response Get(string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _groupQuotaLimitClientDiagnostics.CreateScope("GroupQuotaLimitResource.Get"); + scope.Start(); + try + { + var response = _groupQuotaLimitRestClient.Get(Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaLimitResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaRequestStatusCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaRequestStatusCollection.cs new file mode 100644 index 0000000000000..15390b808f9ef --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaRequestStatusCollection.cs @@ -0,0 +1,317 @@ +// 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.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Quota +{ + /// + /// 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 GetGroupQuotaRequestStatuses method from an instance of . + /// + public partial class GroupQuotaRequestStatusCollection : ArmCollection + { + private readonly ClientDiagnostics _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics; + private readonly GroupQuotaLimitsRequestRestOperations _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient; + + /// Initializes a new instance of the class for mocking. + protected GroupQuotaRequestStatusCollection() + { + } + + /// 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 GroupQuotaRequestStatusCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", GroupQuotaRequestStatusResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(GroupQuotaRequestStatusResource.ResourceType, out string groupQuotaRequestStatusGroupQuotaLimitsRequestApiVersion); + _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient = new GroupQuotaLimitsRequestRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, groupQuotaRequestStatusGroupQuotaLimitsRequestApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != GroupQuotaEntityResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, GroupQuotaEntityResource.ResourceType), nameof(id)); + } + + /// + /// Get API to check the status of a GroupQuota request by requestId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var scope = _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics.CreateScope("GroupQuotaRequestStatusCollection.Get"); + scope.Start(); + try + { + var response = await _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.GetAsync(Id.Parent.Name, Id.Name, requestId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get API to check the status of a GroupQuota request by requestId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var scope = _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics.CreateScope("GroupQuotaRequestStatusCollection.Get"); + scope.Start(); + try + { + var response = _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.Get(Id.Parent.Name, Id.Name, requestId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var scope = _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics.CreateScope("GroupQuotaRequestStatusCollection.Exists"); + scope.Start(); + try + { + var response = await _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.GetAsync(Id.Parent.Name, Id.Name, requestId, 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 + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var scope = _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics.CreateScope("GroupQuotaRequestStatusCollection.Exists"); + scope.Start(); + try + { + var response = _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.Get(Id.Parent.Name, Id.Name, requestId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var scope = _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics.CreateScope("GroupQuotaRequestStatusCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.GetAsync(Id.Parent.Name, Id.Name, requestId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var scope = _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics.CreateScope("GroupQuotaRequestStatusCollection.GetIfExists"); + scope.Start(); + try + { + var response = _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.Get(Id.Parent.Name, Id.Name, requestId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaRequestStatusData.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaRequestStatusData.Serialization.cs new file mode 100644 index 0000000000000..a07e885200997 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaRequestStatusData.Serialization.cs @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + public partial class GroupQuotaRequestStatusData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaRequestStatusData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaRequestStatusData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaRequestStatusData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaRequestStatusData(document.RootElement, options); + } + + internal static GroupQuotaRequestStatusData DeserializeGroupQuotaRequestStatusData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GroupQuotaRequestStatusProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = GroupQuotaRequestStatusProperties.DeserializeGroupQuotaRequestStatusProperties(property.Value, options); + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaRequestStatusData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaRequestStatusData)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaRequestStatusData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaRequestStatusData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaRequestStatusData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaRequestStatusData.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaRequestStatusData.cs new file mode 100644 index 0000000000000..20fed4940c96e --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaRequestStatusData.cs @@ -0,0 +1,76 @@ +// 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.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A class representing the GroupQuotaRequestStatus data model. + /// Status of a single GroupQuota request. + /// + public partial class GroupQuotaRequestStatusData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaRequestStatusData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// Keeps track of any properties unknown to the library. + internal GroupQuotaRequestStatusData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GroupQuotaRequestStatusProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Gets or sets the properties. + [WirePath("properties")] + public GroupQuotaRequestStatusProperties Properties { get; set; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaRequestStatusResource.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaRequestStatusResource.Serialization.cs new file mode 100644 index 0000000000000..ca19e757be7c5 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaRequestStatusResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Quota +{ + public partial class GroupQuotaRequestStatusResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + GroupQuotaRequestStatusData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + GroupQuotaRequestStatusData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaRequestStatusResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaRequestStatusResource.cs new file mode 100644 index 0000000000000..e20bedcd2fbe9 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaRequestStatusResource.cs @@ -0,0 +1,170 @@ +// 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.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A Class representing a GroupQuotaRequestStatus 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 GetGroupQuotaRequestStatusResource method. + /// Otherwise you can get one from its parent resource using the GetGroupQuotaRequestStatus method. + /// + public partial class GroupQuotaRequestStatusResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The managementGroupId. + /// The groupQuotaName. + /// The requestId. + public static ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string groupQuotaName, string requestId) + { + var resourceId = $"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests/{requestId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics; + private readonly GroupQuotaLimitsRequestRestOperations _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient; + private readonly GroupQuotaRequestStatusData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Quota/groupQuotas/groupQuotaRequests"; + + /// Initializes a new instance of the class for mocking. + protected GroupQuotaRequestStatusResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal GroupQuotaRequestStatusResource(ArmClient client, GroupQuotaRequestStatusData 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 GroupQuotaRequestStatusResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string groupQuotaRequestStatusGroupQuotaLimitsRequestApiVersion); + _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient = new GroupQuotaLimitsRequestRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, groupQuotaRequestStatusGroupQuotaLimitsRequestApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual GroupQuotaRequestStatusData 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 API to check the status of a GroupQuota request by requestId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics.CreateScope("GroupQuotaRequestStatusResource.Get"); + scope.Start(); + try + { + var response = await _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.GetAsync(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 GroupQuotaRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get API to check the status of a GroupQuota request by requestId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaLimitsRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaRequestStatusGroupQuotaLimitsRequestClientDiagnostics.CreateScope("GroupQuotaRequestStatusResource.Get"); + scope.Start(); + try + { + var response = _groupQuotaRequestStatusGroupQuotaLimitsRequestRestClient.Get(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionCollection.cs new file mode 100644 index 0000000000000..043a9110db673 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionCollection.cs @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Quota +{ + /// + /// 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 GetGroupQuotaSubscriptions method from an instance of . + /// + public partial class GroupQuotaSubscriptionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _groupQuotaSubscriptionClientDiagnostics; + private readonly GroupQuotaSubscriptionsRestOperations _groupQuotaSubscriptionRestClient; + + /// Initializes a new instance of the class for mocking. + protected GroupQuotaSubscriptionCollection() + { + } + + /// 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 GroupQuotaSubscriptionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _groupQuotaSubscriptionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", GroupQuotaSubscriptionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(GroupQuotaSubscriptionResource.ResourceType, out string groupQuotaSubscriptionApiVersion); + _groupQuotaSubscriptionRestClient = new GroupQuotaSubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, groupQuotaSubscriptionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != GroupQuotaEntityResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, GroupQuotaEntityResource.ResourceType), nameof(id)); + } + + /// + /// Adds a subscription to GroupQuotas. The subscriptions will be validated based on the additionalAttributes defined in the GroupQuota. The additionalAttributes works as filter for the subscriptions, which can be included in the GroupQuotas. The request's TenantId is validated against the subscription's TenantId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var scope = _groupQuotaSubscriptionClientDiagnostics.CreateScope("GroupQuotaSubscriptionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _groupQuotaSubscriptionRestClient.CreateOrUpdateAsync(Id.Parent.Name, Id.Name, subscriptionId, cancellationToken).ConfigureAwait(false); + var operation = new QuotaArmOperation(new GroupQuotaSubscriptionOperationSource(Client), _groupQuotaSubscriptionClientDiagnostics, Pipeline, _groupQuotaSubscriptionRestClient.CreateCreateOrUpdateRequest(Id.Parent.Name, Id.Name, subscriptionId).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a subscription to GroupQuotas. The subscriptions will be validated based on the additionalAttributes defined in the GroupQuota. The additionalAttributes works as filter for the subscriptions, which can be included in the GroupQuotas. The request's TenantId is validated against the subscription's TenantId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var scope = _groupQuotaSubscriptionClientDiagnostics.CreateScope("GroupQuotaSubscriptionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _groupQuotaSubscriptionRestClient.CreateOrUpdate(Id.Parent.Name, Id.Name, subscriptionId, cancellationToken); + var operation = new QuotaArmOperation(new GroupQuotaSubscriptionOperationSource(Client), _groupQuotaSubscriptionClientDiagnostics, Pipeline, _groupQuotaSubscriptionRestClient.CreateCreateOrUpdateRequest(Id.Parent.Name, Id.Name, subscriptionId).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the subscriptionIds along with its provisioning state for being associated with the GroupQuota. If the subscription is not a member of GroupQuota, it will return 404, else 200. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var scope = _groupQuotaSubscriptionClientDiagnostics.CreateScope("GroupQuotaSubscriptionCollection.Get"); + scope.Start(); + try + { + var response = await _groupQuotaSubscriptionRestClient.GetAsync(Id.Parent.Name, Id.Name, subscriptionId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the subscriptionIds along with its provisioning state for being associated with the GroupQuota. If the subscription is not a member of GroupQuota, it will return 404, else 200. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var scope = _groupQuotaSubscriptionClientDiagnostics.CreateScope("GroupQuotaSubscriptionCollection.Get"); + scope.Start(); + try + { + var response = _groupQuotaSubscriptionRestClient.Get(Id.Parent.Name, Id.Name, subscriptionId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns a list of the subscriptionIds associated with the GroupQuotas. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _groupQuotaSubscriptionRestClient.CreateListRequest(Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupQuotaSubscriptionRestClient.CreateListNextPageRequest(nextLink, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GroupQuotaSubscriptionResource(Client, GroupQuotaSubscriptionData.DeserializeGroupQuotaSubscriptionData(e)), _groupQuotaSubscriptionClientDiagnostics, Pipeline, "GroupQuotaSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of the subscriptionIds associated with the GroupQuotas. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _groupQuotaSubscriptionRestClient.CreateListRequest(Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupQuotaSubscriptionRestClient.CreateListNextPageRequest(nextLink, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GroupQuotaSubscriptionResource(Client, GroupQuotaSubscriptionData.DeserializeGroupQuotaSubscriptionData(e)), _groupQuotaSubscriptionClientDiagnostics, Pipeline, "GroupQuotaSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var scope = _groupQuotaSubscriptionClientDiagnostics.CreateScope("GroupQuotaSubscriptionCollection.Exists"); + scope.Start(); + try + { + var response = await _groupQuotaSubscriptionRestClient.GetAsync(Id.Parent.Name, Id.Name, subscriptionId, 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 + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var scope = _groupQuotaSubscriptionClientDiagnostics.CreateScope("GroupQuotaSubscriptionCollection.Exists"); + scope.Start(); + try + { + var response = _groupQuotaSubscriptionRestClient.Get(Id.Parent.Name, Id.Name, subscriptionId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var scope = _groupQuotaSubscriptionClientDiagnostics.CreateScope("GroupQuotaSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _groupQuotaSubscriptionRestClient.GetAsync(Id.Parent.Name, Id.Name, subscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var scope = _groupQuotaSubscriptionClientDiagnostics.CreateScope("GroupQuotaSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _groupQuotaSubscriptionRestClient.Get(Id.Parent.Name, Id.Name, subscriptionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionData.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionData.Serialization.cs new file mode 100644 index 0000000000000..c53719db53411 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionData.Serialization.cs @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + public partial class GroupQuotaSubscriptionData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaSubscriptionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaSubscriptionData(document.RootElement, options); + } + + internal static GroupQuotaSubscriptionData DeserializeGroupQuotaSubscriptionData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GroupQuotaSubscriptionProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = GroupQuotaSubscriptionProperties.DeserializeGroupQuotaSubscriptionProperties(property.Value, options); + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaSubscriptionData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionData)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaSubscriptionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaSubscriptionData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionData.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionData.cs new file mode 100644 index 0000000000000..37672e582653c --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionData.cs @@ -0,0 +1,76 @@ +// 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.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A class representing the GroupQuotaSubscription data model. + /// This represents a Azure subscriptionId that is associated with a GroupQuotasEntity. + /// + public partial class GroupQuotaSubscriptionData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaSubscriptionData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// Keeps track of any properties unknown to the library. + internal GroupQuotaSubscriptionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GroupQuotaSubscriptionProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Gets or sets the properties. + [WirePath("properties")] + public GroupQuotaSubscriptionProperties Properties { get; set; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionRequestStatusCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionRequestStatusCollection.cs new file mode 100644 index 0000000000000..eb328e3374072 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionRequestStatusCollection.cs @@ -0,0 +1,395 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Quota +{ + /// + /// 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 GetGroupQuotaSubscriptionRequestStatuses method from an instance of . + /// + public partial class GroupQuotaSubscriptionRequestStatusCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsClientDiagnostics; + private readonly GroupQuotaSubscriptionRequestsRestOperations _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient; + + /// Initializes a new instance of the class for mocking. + protected GroupQuotaSubscriptionRequestStatusCollection() + { + } + + /// 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 GroupQuotaSubscriptionRequestStatusCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", GroupQuotaSubscriptionRequestStatusResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(GroupQuotaSubscriptionRequestStatusResource.ResourceType, out string groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsApiVersion); + _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient = new GroupQuotaSubscriptionRequestsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != GroupQuotaEntityResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, GroupQuotaEntityResource.ResourceType), nameof(id)); + } + + /// + /// Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionRequests_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var scope = _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsClientDiagnostics.CreateScope("GroupQuotaSubscriptionRequestStatusCollection.Get"); + scope.Start(); + try + { + var response = await _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient.GetAsync(Id.Parent.Name, Id.Name, requestId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaSubscriptionRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionRequests_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var scope = _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsClientDiagnostics.CreateScope("GroupQuotaSubscriptionRequestStatusCollection.Get"); + scope.Start(); + try + { + var response = _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient.Get(Id.Parent.Name, Id.Name, requestId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaSubscriptionRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 year. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionRequests_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient.CreateListRequest(Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient.CreateListNextPageRequest(nextLink, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GroupQuotaSubscriptionRequestStatusResource(Client, GroupQuotaSubscriptionRequestStatusData.DeserializeGroupQuotaSubscriptionRequestStatusData(e)), _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsClientDiagnostics, Pipeline, "GroupQuotaSubscriptionRequestStatusCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 year. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionRequests_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient.CreateListRequest(Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient.CreateListNextPageRequest(nextLink, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GroupQuotaSubscriptionRequestStatusResource(Client, GroupQuotaSubscriptionRequestStatusData.DeserializeGroupQuotaSubscriptionRequestStatusData(e)), _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsClientDiagnostics, Pipeline, "GroupQuotaSubscriptionRequestStatusCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionRequests_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var scope = _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsClientDiagnostics.CreateScope("GroupQuotaSubscriptionRequestStatusCollection.Exists"); + scope.Start(); + try + { + var response = await _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient.GetAsync(Id.Parent.Name, Id.Name, requestId, 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 + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionRequests_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var scope = _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsClientDiagnostics.CreateScope("GroupQuotaSubscriptionRequestStatusCollection.Exists"); + scope.Start(); + try + { + var response = _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient.Get(Id.Parent.Name, Id.Name, requestId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionRequests_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var scope = _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsClientDiagnostics.CreateScope("GroupQuotaSubscriptionRequestStatusCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient.GetAsync(Id.Parent.Name, Id.Name, requestId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaSubscriptionRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionRequests_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Request Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var scope = _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsClientDiagnostics.CreateScope("GroupQuotaSubscriptionRequestStatusCollection.GetIfExists"); + scope.Start(); + try + { + var response = _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient.Get(Id.Parent.Name, Id.Name, requestId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaSubscriptionRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionRequestStatusData.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionRequestStatusData.Serialization.cs new file mode 100644 index 0000000000000..84ff2527a0a26 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionRequestStatusData.Serialization.cs @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + public partial class GroupQuotaSubscriptionRequestStatusData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionRequestStatusData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaSubscriptionRequestStatusData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionRequestStatusData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaSubscriptionRequestStatusData(document.RootElement, options); + } + + internal static GroupQuotaSubscriptionRequestStatusData DeserializeGroupQuotaSubscriptionRequestStatusData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GroupQuotaSubscriptionRequestStatusProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = GroupQuotaSubscriptionRequestStatusProperties.DeserializeGroupQuotaSubscriptionRequestStatusProperties(property.Value, options); + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaSubscriptionRequestStatusData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionRequestStatusData)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaSubscriptionRequestStatusData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaSubscriptionRequestStatusData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionRequestStatusData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionRequestStatusData.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionRequestStatusData.cs new file mode 100644 index 0000000000000..ee474260da726 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionRequestStatusData.cs @@ -0,0 +1,76 @@ +// 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.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A class representing the GroupQuotaSubscriptionRequestStatus data model. + /// The new quota limit request status. + /// + public partial class GroupQuotaSubscriptionRequestStatusData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaSubscriptionRequestStatusData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// Keeps track of any properties unknown to the library. + internal GroupQuotaSubscriptionRequestStatusData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GroupQuotaSubscriptionRequestStatusProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Gets or sets the properties. + [WirePath("properties")] + public GroupQuotaSubscriptionRequestStatusProperties Properties { get; set; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionRequestStatusResource.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionRequestStatusResource.Serialization.cs new file mode 100644 index 0000000000000..78ee0d79a4fa0 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionRequestStatusResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Quota +{ + public partial class GroupQuotaSubscriptionRequestStatusResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + GroupQuotaSubscriptionRequestStatusData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + GroupQuotaSubscriptionRequestStatusData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionRequestStatusResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionRequestStatusResource.cs new file mode 100644 index 0000000000000..0922377d96cd3 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionRequestStatusResource.cs @@ -0,0 +1,170 @@ +// 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.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A Class representing a GroupQuotaSubscriptionRequestStatus 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 GetGroupQuotaSubscriptionRequestStatusResource method. + /// Otherwise you can get one from its parent resource using the GetGroupQuotaSubscriptionRequestStatus method. + /// + public partial class GroupQuotaSubscriptionRequestStatusResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The managementGroupId. + /// The groupQuotaName. + /// The requestId. + public static ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string groupQuotaName, string requestId) + { + var resourceId = $"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests/{requestId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsClientDiagnostics; + private readonly GroupQuotaSubscriptionRequestsRestOperations _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient; + private readonly GroupQuotaSubscriptionRequestStatusData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Quota/groupQuotas/subscriptionRequests"; + + /// Initializes a new instance of the class for mocking. + protected GroupQuotaSubscriptionRequestStatusResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal GroupQuotaSubscriptionRequestStatusResource(ArmClient client, GroupQuotaSubscriptionRequestStatusData 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 GroupQuotaSubscriptionRequestStatusResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsApiVersion); + _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient = new GroupQuotaSubscriptionRequestsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual GroupQuotaSubscriptionRequestStatusData 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 API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionRequests_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsClientDiagnostics.CreateScope("GroupQuotaSubscriptionRequestStatusResource.Get"); + scope.Start(); + try + { + var response = await _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient.GetAsync(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 GroupQuotaSubscriptionRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests/{requestId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionRequests_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsClientDiagnostics.CreateScope("GroupQuotaSubscriptionRequestStatusResource.Get"); + scope.Start(); + try + { + var response = _groupQuotaSubscriptionRequestStatusGroupQuotaSubscriptionRequestsRestClient.Get(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaSubscriptionRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionResource.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionResource.Serialization.cs new file mode 100644 index 0000000000000..95f01d54463de --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Quota +{ + public partial class GroupQuotaSubscriptionResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + GroupQuotaSubscriptionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + GroupQuotaSubscriptionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionResource.cs new file mode 100644 index 0000000000000..d68074ac54acd --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/GroupQuotaSubscriptionResource.cs @@ -0,0 +1,338 @@ +// 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.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A Class representing a GroupQuotaSubscription 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 GetGroupQuotaSubscriptionResource method. + /// Otherwise you can get one from its parent resource using the GetGroupQuotaSubscription method. + /// + public partial class GroupQuotaSubscriptionResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The managementGroupId. + /// The groupQuotaName. + /// The subscriptionId. + public static ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string groupQuotaName, string subscriptionId) + { + var resourceId = $"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _groupQuotaSubscriptionClientDiagnostics; + private readonly GroupQuotaSubscriptionsRestOperations _groupQuotaSubscriptionRestClient; + private readonly GroupQuotaSubscriptionData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Quota/groupQuotas/subscriptions"; + + /// Initializes a new instance of the class for mocking. + protected GroupQuotaSubscriptionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal GroupQuotaSubscriptionResource(ArmClient client, GroupQuotaSubscriptionData 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 GroupQuotaSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _groupQuotaSubscriptionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string groupQuotaSubscriptionApiVersion); + _groupQuotaSubscriptionRestClient = new GroupQuotaSubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, groupQuotaSubscriptionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual GroupQuotaSubscriptionData 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)); + } + + /// + /// Returns the subscriptionIds along with its provisioning state for being associated with the GroupQuota. If the subscription is not a member of GroupQuota, it will return 404, else 200. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaSubscriptionClientDiagnostics.CreateScope("GroupQuotaSubscriptionResource.Get"); + scope.Start(); + try + { + var response = await _groupQuotaSubscriptionRestClient.GetAsync(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 GroupQuotaSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the subscriptionIds along with its provisioning state for being associated with the GroupQuota. If the subscription is not a member of GroupQuota, it will return 404, else 200. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaSubscriptionClientDiagnostics.CreateScope("GroupQuotaSubscriptionResource.Get"); + scope.Start(); + try + { + var response = _groupQuotaSubscriptionRestClient.Get(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GroupQuotaSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the subscription from GroupQuotas. The request's TenantId is validated against the subscription's TenantId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_Delete + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaSubscriptionClientDiagnostics.CreateScope("GroupQuotaSubscriptionResource.Delete"); + scope.Start(); + try + { + var response = await _groupQuotaSubscriptionRestClient.DeleteAsync(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new QuotaArmOperation(_groupQuotaSubscriptionClientDiagnostics, Pipeline, _groupQuotaSubscriptionRestClient.CreateDeleteRequest(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; + } + } + + /// + /// Removes the subscription from GroupQuotas. The request's TenantId is validated against the subscription's TenantId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_Delete + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaSubscriptionClientDiagnostics.CreateScope("GroupQuotaSubscriptionResource.Delete"); + scope.Start(); + try + { + var response = _groupQuotaSubscriptionRestClient.Delete(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new QuotaArmOperation(_groupQuotaSubscriptionClientDiagnostics, Pipeline, _groupQuotaSubscriptionRestClient.CreateDeleteRequest(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; + } + } + + /// + /// Updates the GroupQuotas with the subscription to add to the subscriptions list. The subscriptions will be validated if additionalAttributes are defined in the GroupQuota. The request's TenantId is validated against the subscription's TenantId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_Update + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaSubscriptionClientDiagnostics.CreateScope("GroupQuotaSubscriptionResource.Update"); + scope.Start(); + try + { + var response = await _groupQuotaSubscriptionRestClient.UpdateAsync(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new QuotaArmOperation(new GroupQuotaSubscriptionOperationSource(Client), _groupQuotaSubscriptionClientDiagnostics, Pipeline, _groupQuotaSubscriptionRestClient.CreateUpdateRequest(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the GroupQuotas with the subscription to add to the subscriptions list. The subscriptions will be validated if additionalAttributes are defined in the GroupQuota. The request's TenantId is validated against the subscription's TenantId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptions_Update + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Update(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _groupQuotaSubscriptionClientDiagnostics.CreateScope("GroupQuotaSubscriptionResource.Update"); + scope.Start(); + try + { + var response = _groupQuotaSubscriptionRestClient.Update(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new QuotaArmOperation(new GroupQuotaSubscriptionOperationSource(Client), _groupQuotaSubscriptionClientDiagnostics, Pipeline, _groupQuotaSubscriptionRestClient.CreateUpdateRequest(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Internal/BicepSerializationHelpers.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Internal/BicepSerializationHelpers.cs new file mode 100644 index 0000000000000..db6c9745e2167 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Internal/BicepSerializationHelpers.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text; + +namespace Azure.ResourceManager.Quota +{ + internal static class BicepSerializationHelpers + { + public static void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName) + { + string indent = new string(' ', spaces); + int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length; + int length = stringBuilder.Length; + bool inMultilineString = false; + + BinaryData data = ModelReaderWriter.Write(childObject, options); + string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); + for (int i = 0; i < lines.Length; i++) + { + string line = lines[i]; + if (inMultilineString) + { + if (line.Contains("'''")) + { + inMultilineString = false; + } + stringBuilder.AppendLine(line); + continue; + } + if (line.Contains("'''")) + { + inMultilineString = true; + stringBuilder.AppendLine($"{indent}{line}"); + continue; + } + if (i == 0 && !indentFirstLine) + { + stringBuilder.AppendLine($"{line}"); + } + else + { + stringBuilder.AppendLine($"{indent}{line}"); + } + } + if (stringBuilder.Length == length + emptyObjectLength) + { + stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length; + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Internal/WirePathAttribute.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Internal/WirePathAttribute.cs new file mode 100644 index 0000000000000..f2480dc4c68f6 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Internal/WirePathAttribute.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Quota +{ + [AttributeUsage(AttributeTargets.Property)] + internal class WirePathAttribute : Attribute + { + private string _wirePath; + + public WirePathAttribute(string wirePath) + { + _wirePath = wirePath; + } + + public override string ToString() + { + return _wirePath; + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/GroupQuotaEnforcementOperationSource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/GroupQuotaEnforcementOperationSource.cs new file mode 100644 index 0000000000000..458eb073a44a8 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/GroupQuotaEnforcementOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Quota +{ + internal class GroupQuotaEnforcementOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal GroupQuotaEnforcementOperationSource(ArmClient client) + { + _client = client; + } + + GroupQuotaEnforcementResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = GroupQuotaEnforcementData.DeserializeGroupQuotaEnforcementData(document.RootElement); + return new GroupQuotaEnforcementResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = GroupQuotaEnforcementData.DeserializeGroupQuotaEnforcementData(document.RootElement); + return new GroupQuotaEnforcementResource(_client, data); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/GroupQuotaEntityOperationSource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/GroupQuotaEntityOperationSource.cs new file mode 100644 index 0000000000000..e503cd6018b18 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/GroupQuotaEntityOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Quota +{ + internal class GroupQuotaEntityOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal GroupQuotaEntityOperationSource(ArmClient client) + { + _client = client; + } + + GroupQuotaEntityResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = GroupQuotaEntityData.DeserializeGroupQuotaEntityData(document.RootElement); + return new GroupQuotaEntityResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = GroupQuotaEntityData.DeserializeGroupQuotaEntityData(document.RootElement); + return new GroupQuotaEntityResource(_client, data); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/GroupQuotaRequestStatusOperationSource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/GroupQuotaRequestStatusOperationSource.cs new file mode 100644 index 0000000000000..c9a38619cabef --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/GroupQuotaRequestStatusOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Quota +{ + internal class GroupQuotaRequestStatusOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal GroupQuotaRequestStatusOperationSource(ArmClient client) + { + _client = client; + } + + GroupQuotaRequestStatusResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = GroupQuotaRequestStatusData.DeserializeGroupQuotaRequestStatusData(document.RootElement); + return new GroupQuotaRequestStatusResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = GroupQuotaRequestStatusData.DeserializeGroupQuotaRequestStatusData(document.RootElement); + return new GroupQuotaRequestStatusResource(_client, data); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/GroupQuotaSubscriptionOperationSource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/GroupQuotaSubscriptionOperationSource.cs new file mode 100644 index 0000000000000..fe918fece08bd --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/GroupQuotaSubscriptionOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Quota +{ + internal class GroupQuotaSubscriptionOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal GroupQuotaSubscriptionOperationSource(ArmClient client) + { + _client = client; + } + + GroupQuotaSubscriptionResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = GroupQuotaSubscriptionData.DeserializeGroupQuotaSubscriptionData(document.RootElement); + return new GroupQuotaSubscriptionResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = GroupQuotaSubscriptionData.DeserializeGroupQuotaSubscriptionData(document.RootElement); + return new GroupQuotaSubscriptionResource(_client, data); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/QuotaAllocationRequestStatusOperationSource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/QuotaAllocationRequestStatusOperationSource.cs new file mode 100644 index 0000000000000..95612e3f494d6 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/QuotaAllocationRequestStatusOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Quota +{ + internal class QuotaAllocationRequestStatusOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal QuotaAllocationRequestStatusOperationSource(ArmClient client) + { + _client = client; + } + + QuotaAllocationRequestStatusResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = QuotaAllocationRequestStatusData.DeserializeQuotaAllocationRequestStatusData(document.RootElement); + return new QuotaAllocationRequestStatusResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = QuotaAllocationRequestStatusData.DeserializeQuotaAllocationRequestStatusData(document.RootElement); + return new QuotaAllocationRequestStatusResource(_client, data); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/QuotaArmOperation.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/QuotaArmOperation.cs new file mode 100644 index 0000000000000..8ad28798cb4fe --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/LongRunningOperation/QuotaArmOperation.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Quota +{ +#pragma warning disable SA1649 // File name should match first type name + internal class QuotaArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of QuotaArmOperation for mocking. + protected QuotaArmOperation() + { + } + + internal QuotaArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal QuotaArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "QuotaArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken); + + /// + public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/AllocatedQuotaToSubscriptionList.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/AllocatedQuotaToSubscriptionList.Serialization.cs new file mode 100644 index 0000000000000..cec61bf136e32 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/AllocatedQuotaToSubscriptionList.Serialization.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + internal partial class AllocatedQuotaToSubscriptionList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AllocatedQuotaToSubscriptionList)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AllocatedQuotaToSubscriptionList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AllocatedQuotaToSubscriptionList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAllocatedQuotaToSubscriptionList(document.RootElement, options); + } + + internal static AllocatedQuotaToSubscriptionList DeserializeAllocatedQuotaToSubscriptionList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SubscriptionAllocatedQuota.DeserializeSubscriptionAllocatedQuota(item, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AllocatedQuotaToSubscriptionList(value ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AllocatedQuotaToSubscriptionList)} does not support writing '{options.Format}' format."); + } + } + + AllocatedQuotaToSubscriptionList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAllocatedQuotaToSubscriptionList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AllocatedQuotaToSubscriptionList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/AllocatedQuotaToSubscriptionList.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/AllocatedQuotaToSubscriptionList.cs new file mode 100644 index 0000000000000..16f5c407f2fae --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/AllocatedQuotaToSubscriptionList.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// Quota allocated to subscriptions. + internal partial class AllocatedQuotaToSubscriptionList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal AllocatedQuotaToSubscriptionList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of Group Quota Limit allocated to subscriptions. + /// Keeps track of any properties unknown to the library. + internal AllocatedQuotaToSubscriptionList(IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of Group Quota Limit allocated to subscriptions. + [WirePath("value")] + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaAdditionalAttributes.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaAdditionalAttributes.Serialization.cs new file mode 100644 index 0000000000000..01199af1eca7b --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaAdditionalAttributes.Serialization.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class GroupQuotaAdditionalAttributes : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaAdditionalAttributes)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("groupId"u8); + writer.WriteObjectValue(GroupId, options); + if (Optional.IsDefined(Environment)) + { + writer.WritePropertyName("environment"u8); + writer.WriteStringValue(Environment.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaAdditionalAttributes IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaAdditionalAttributes)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaAdditionalAttributes(document.RootElement, options); + } + + internal static GroupQuotaAdditionalAttributes DeserializeGroupQuotaAdditionalAttributes(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GroupQuotaGroupingId groupId = default; + GroupQuotaEnvironmentType? environment = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("groupId"u8)) + { + groupId = GroupQuotaGroupingId.DeserializeGroupQuotaGroupingId(property.Value, options); + continue; + } + if (property.NameEquals("environment"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + environment = new GroupQuotaEnvironmentType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaAdditionalAttributes(groupId, environment, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GroupId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" groupId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(GroupId)) + { + builder.Append(" groupId: "); + BicepSerializationHelpers.AppendChildObject(builder, GroupId, options, 2, false, " groupId: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Environment), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" environment: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Environment)) + { + builder.Append(" environment: "); + builder.AppendLine($"'{Environment.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaAdditionalAttributes)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaAdditionalAttributes IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaAdditionalAttributes(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaAdditionalAttributes)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaAdditionalAttributes.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaAdditionalAttributes.cs new file mode 100644 index 0000000000000..092939c606352 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaAdditionalAttributes.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// Additional attribute or filter to allow subscriptions meeting the requirements to be part of the GroupQuota. + public partial class GroupQuotaAdditionalAttributes + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The grouping Id for the group quota. It can be Billing Id or ServiceTreeId if applicable. + /// is null. + public GroupQuotaAdditionalAttributes(GroupQuotaGroupingId groupId) + { + Argument.AssertNotNull(groupId, nameof(groupId)); + + GroupId = groupId; + } + + /// Initializes a new instance of . + /// The grouping Id for the group quota. It can be Billing Id or ServiceTreeId if applicable. + /// Environment name. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaAdditionalAttributes(GroupQuotaGroupingId groupId, GroupQuotaEnvironmentType? environment, IDictionary serializedAdditionalRawData) + { + GroupId = groupId; + Environment = environment; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GroupQuotaAdditionalAttributes() + { + } + + /// The grouping Id for the group quota. It can be Billing Id or ServiceTreeId if applicable. + [WirePath("groupId")] + public GroupQuotaGroupingId GroupId { get; set; } + /// Environment name. + [WirePath("environment")] + public GroupQuotaEnvironmentType? Environment { get; set; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaAdditionalAttributesPatch.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaAdditionalAttributesPatch.Serialization.cs new file mode 100644 index 0000000000000..e0c3f3acad5ed --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaAdditionalAttributesPatch.Serialization.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class GroupQuotaAdditionalAttributesPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaAdditionalAttributesPatch)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(GroupId)) + { + writer.WritePropertyName("groupId"u8); + writer.WriteObjectValue(GroupId, options); + } + if (Optional.IsDefined(Environment)) + { + writer.WritePropertyName("environment"u8); + writer.WriteStringValue(Environment.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaAdditionalAttributesPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaAdditionalAttributesPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaAdditionalAttributesPatch(document.RootElement, options); + } + + internal static GroupQuotaAdditionalAttributesPatch DeserializeGroupQuotaAdditionalAttributesPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GroupQuotaGroupingId groupId = default; + GroupQuotaEnvironmentType? environment = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("groupId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupId = GroupQuotaGroupingId.DeserializeGroupQuotaGroupingId(property.Value, options); + continue; + } + if (property.NameEquals("environment"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + environment = new GroupQuotaEnvironmentType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaAdditionalAttributesPatch(groupId, environment, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GroupId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" groupId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(GroupId)) + { + builder.Append(" groupId: "); + BicepSerializationHelpers.AppendChildObject(builder, GroupId, options, 2, false, " groupId: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Environment), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" environment: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Environment)) + { + builder.Append(" environment: "); + builder.AppendLine($"'{Environment.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaAdditionalAttributesPatch)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaAdditionalAttributesPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaAdditionalAttributesPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaAdditionalAttributesPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaAdditionalAttributesPatch.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaAdditionalAttributesPatch.cs new file mode 100644 index 0000000000000..9fc839829b8a7 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaAdditionalAttributesPatch.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// Additional attribute or filter to allow subscriptions meeting the requirements to be part of the GroupQuota. + public partial class GroupQuotaAdditionalAttributesPatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaAdditionalAttributesPatch() + { + } + + /// Initializes a new instance of . + /// The grouping Id for the group quota. It can be Billing Id or ServiceTreeId if applicable. + /// Environment name. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaAdditionalAttributesPatch(GroupQuotaGroupingId groupId, GroupQuotaEnvironmentType? environment, IDictionary serializedAdditionalRawData) + { + GroupId = groupId; + Environment = environment; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The grouping Id for the group quota. It can be Billing Id or ServiceTreeId if applicable. + [WirePath("groupId")] + public GroupQuotaGroupingId GroupId { get; set; } + /// Environment name. + [WirePath("environment")] + public GroupQuotaEnvironmentType? Environment { get; set; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaDetails.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaDetails.Serialization.cs new file mode 100644 index 0000000000000..ff91e5126f6de --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaDetails.Serialization.cs @@ -0,0 +1,419 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class GroupQuotaDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaDetails)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + if (Optional.IsDefined(Limit)) + { + writer.WritePropertyName("limit"u8); + writer.WriteNumberValue(Limit.Value); + } + if (Optional.IsDefined(Comment)) + { + writer.WritePropertyName("comment"u8); + writer.WriteStringValue(Comment); + } + if (options.Format != "W" && Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit); + } + if (options.Format != "W" && Optional.IsDefined(AvailableLimit)) + { + writer.WritePropertyName("availableLimit"u8); + writer.WriteNumberValue(AvailableLimit.Value); + } + if (options.Format != "W" && Optional.IsDefined(AllocatedToSubscriptions)) + { + writer.WritePropertyName("allocatedToSubscriptions"u8); + writer.WriteObjectValue(AllocatedToSubscriptions, options); + } + writer.WritePropertyName("name"u8); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (options.Format != "W" && Optional.IsDefined(LocalizedValue)) + { + writer.WritePropertyName("localizedValue"u8); + writer.WriteStringValue(LocalizedValue); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaDetails(document.RootElement, options); + } + + internal static GroupQuotaDetails DeserializeGroupQuotaDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string region = default; + long? limit = default; + string comment = default; + string unit = default; + long? availableLimit = default; + AllocatedQuotaToSubscriptionList allocatedToSubscriptions = default; + string value = default; + string localizedValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("region"u8)) + { + region = property.Value.GetString(); + continue; + } + if (property.NameEquals("limit"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + limit = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("comment"u8)) + { + comment = property.Value.GetString(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = property.Value.GetString(); + continue; + } + if (property.NameEquals("availableLimit"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + availableLimit = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("allocatedToSubscriptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allocatedToSubscriptions = AllocatedQuotaToSubscriptionList.DeserializeAllocatedQuotaToSubscriptionList(property.Value, options); + continue; + } + if (property.NameEquals("name"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("value"u8)) + { + value = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("localizedValue"u8)) + { + localizedValue = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaDetails( + region, + limit, + comment, + unit, + availableLimit, + allocatedToSubscriptions, + value, + localizedValue, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Region), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" region: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Region)) + { + builder.Append(" region: "); + if (Region.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Region}'''"); + } + else + { + builder.AppendLine($"'{Region}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Limit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" limit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Limit)) + { + builder.Append(" limit: "); + builder.AppendLine($"'{Limit.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Comment), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" comment: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Comment)) + { + builder.Append(" comment: "); + if (Comment.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Comment}'''"); + } + else + { + builder.AppendLine($"'{Comment}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Unit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" unit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Unit)) + { + builder.Append(" unit: "); + if (Unit.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Unit}'''"); + } + else + { + builder.AppendLine($"'{Unit}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AvailableLimit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" availableLimit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AvailableLimit)) + { + builder.Append(" availableLimit: "); + builder.AppendLine($"'{AvailableLimit.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("AllocatedToSubscriptionsValue", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" allocatedToSubscriptions: "); + builder.AppendLine("{"); + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(AllocatedToSubscriptions)) + { + builder.Append(" allocatedToSubscriptions: "); + BicepSerializationHelpers.AppendChildObject(builder, AllocatedToSubscriptions, options, 2, false, " allocatedToSubscriptions: "); + } + } + + builder.Append(" name:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + if (Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Value}'''"); + } + else + { + builder.AppendLine($"'{Value}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LocalizedValue), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" localizedValue: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LocalizedValue)) + { + builder.Append(" localizedValue: "); + if (LocalizedValue.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LocalizedValue}'''"); + } + else + { + builder.AppendLine($"'{LocalizedValue}'"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaDetails)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaDetails.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaDetails.cs new file mode 100644 index 0000000000000..fba6bf18d12f9 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaDetails.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// Group Quota details. + public partial class GroupQuotaDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaDetails() + { + } + + /// Initializes a new instance of . + /// Location/Azure region for the quota requested for resource. + /// The current Group Quota Limit at the parentId level. + /// Any comment related to quota request. + /// The usages units, such as Count and Bytes. When requesting quota, use the **unit** value returned in the GET response in the request body of your PUT operation. + /// The available Group Quota Limit at the MG level. This Group quota can be allocated to subscription(s). + /// Quota allocated to subscriptions. + /// Resource name. + /// Resource display name. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaDetails(string region, long? limit, string comment, string unit, long? availableLimit, AllocatedQuotaToSubscriptionList allocatedToSubscriptions, string value, string localizedValue, IDictionary serializedAdditionalRawData) + { + Region = region; + Limit = limit; + Comment = comment; + Unit = unit; + AvailableLimit = availableLimit; + AllocatedToSubscriptions = allocatedToSubscriptions; + Value = value; + LocalizedValue = localizedValue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Location/Azure region for the quota requested for resource. + [WirePath("region")] + public string Region { get; set; } + /// The current Group Quota Limit at the parentId level. + [WirePath("limit")] + public long? Limit { get; set; } + /// Any comment related to quota request. + [WirePath("comment")] + public string Comment { get; set; } + /// The usages units, such as Count and Bytes. When requesting quota, use the **unit** value returned in the GET response in the request body of your PUT operation. + [WirePath("unit")] + public string Unit { get; } + /// The available Group Quota Limit at the MG level. This Group quota can be allocated to subscription(s). + [WirePath("availableLimit")] + public long? AvailableLimit { get; } + /// Quota allocated to subscriptions. + internal AllocatedQuotaToSubscriptionList AllocatedToSubscriptions { get; } + /// List of Group Quota Limit allocated to subscriptions. + [WirePath("allocatedToSubscriptions.value")] + public IReadOnlyList AllocatedToSubscriptionsValue + { + get => AllocatedToSubscriptions?.Value; + } + + /// Resource name. + [WirePath("name.value")] + public string Value { get; } + /// Resource display name. + [WirePath("name.localizedValue")] + public string LocalizedValue { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEnforcementProperties.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEnforcementProperties.Serialization.cs new file mode 100644 index 0000000000000..6e9db1e0e2075 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEnforcementProperties.Serialization.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class GroupQuotaEnforcementProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaEnforcementProperties)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(EnforcementEnabled)) + { + writer.WritePropertyName("enforcementEnabled"u8); + writer.WriteStringValue(EnforcementEnabled.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(FaultCode)) + { + writer.WritePropertyName("faultCode"u8); + writer.WriteStringValue(FaultCode); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaEnforcementProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaEnforcementProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaEnforcementProperties(document.RootElement, options); + } + + internal static GroupQuotaEnforcementProperties DeserializeGroupQuotaEnforcementProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GroupQuotaEnforcementState? enforcementEnabled = default; + QuotaRequestStatus? provisioningState = default; + string faultCode = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enforcementEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enforcementEnabled = new GroupQuotaEnforcementState(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new QuotaRequestStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("faultCode"u8)) + { + faultCode = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaEnforcementProperties(enforcementEnabled, provisioningState, faultCode, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnforcementEnabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enforcementEnabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EnforcementEnabled)) + { + builder.Append(" enforcementEnabled: "); + builder.AppendLine($"'{EnforcementEnabled.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FaultCode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" faultCode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(FaultCode)) + { + builder.Append(" faultCode: "); + if (FaultCode.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{FaultCode}'''"); + } + else + { + builder.AppendLine($"'{FaultCode}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaEnforcementProperties)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaEnforcementProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaEnforcementProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaEnforcementProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEnforcementProperties.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEnforcementProperties.cs new file mode 100644 index 0000000000000..662f26fa8a427 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEnforcementProperties.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// The GroupQuotaEnforcementProperties. + public partial class GroupQuotaEnforcementProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaEnforcementProperties() + { + } + + /// Initializes a new instance of . + /// Is the GroupQuota Enforcement enabled for the Azure region. + /// Request status. + /// Details of the failure. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaEnforcementProperties(GroupQuotaEnforcementState? enforcementEnabled, QuotaRequestStatus? provisioningState, string faultCode, IDictionary serializedAdditionalRawData) + { + EnforcementEnabled = enforcementEnabled; + ProvisioningState = provisioningState; + FaultCode = faultCode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Is the GroupQuota Enforcement enabled for the Azure region. + [WirePath("enforcementEnabled")] + public GroupQuotaEnforcementState? EnforcementEnabled { get; set; } + /// Request status. + [WirePath("provisioningState")] + public QuotaRequestStatus? ProvisioningState { get; } + /// Details of the failure. + [WirePath("faultCode")] + public string FaultCode { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEnforcementState.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEnforcementState.cs new file mode 100644 index 0000000000000..a04817826a499 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEnforcementState.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.Quota.Models +{ + /// Enforcement status. + public readonly partial struct GroupQuotaEnforcementState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public GroupQuotaEnforcementState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + private const string NotAvailableValue = "NotAvailable"; + + /// Enabled. + public static GroupQuotaEnforcementState Enabled { get; } = new GroupQuotaEnforcementState(EnabledValue); + /// Disabled. + public static GroupQuotaEnforcementState Disabled { get; } = new GroupQuotaEnforcementState(DisabledValue); + /// NotAvailable. + public static GroupQuotaEnforcementState NotAvailable { get; } = new GroupQuotaEnforcementState(NotAvailableValue); + /// Determines if two values are the same. + public static bool operator ==(GroupQuotaEnforcementState left, GroupQuotaEnforcementState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(GroupQuotaEnforcementState left, GroupQuotaEnforcementState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator GroupQuotaEnforcementState(string value) => new GroupQuotaEnforcementState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is GroupQuotaEnforcementState other && Equals(other); + /// + public bool Equals(GroupQuotaEnforcementState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEntityBase.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEntityBase.Serialization.cs new file mode 100644 index 0000000000000..90e180840a5d7 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEntityBase.Serialization.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class GroupQuotaEntityBase : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaEntityBase)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(AdditionalAttributes)) + { + writer.WritePropertyName("additionalAttributes"u8); + writer.WriteObjectValue(AdditionalAttributes, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaEntityBase IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaEntityBase)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaEntityBase(document.RootElement, options); + } + + internal static GroupQuotaEntityBase DeserializeGroupQuotaEntityBase(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + GroupQuotaAdditionalAttributes additionalAttributes = default; + QuotaRequestStatus? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("additionalAttributes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + additionalAttributes = GroupQuotaAdditionalAttributes.DeserializeGroupQuotaAdditionalAttributes(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new QuotaRequestStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaEntityBase(displayName, additionalAttributes, provisioningState, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisplayName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" displayName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DisplayName)) + { + builder.Append(" displayName: "); + if (DisplayName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DisplayName}'''"); + } + else + { + builder.AppendLine($"'{DisplayName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AdditionalAttributes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" additionalAttributes: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AdditionalAttributes)) + { + builder.Append(" additionalAttributes: "); + BicepSerializationHelpers.AppendChildObject(builder, AdditionalAttributes, options, 2, false, " additionalAttributes: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaEntityBase)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaEntityBase IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaEntityBase(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaEntityBase)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEntityBase.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEntityBase.cs new file mode 100644 index 0000000000000..c4dff68aca180 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEntityBase.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. + public partial class GroupQuotaEntityBase + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaEntityBase() + { + } + + /// Initializes a new instance of . + /// Display name of the GroupQuota entity. + /// Additional attributes to filter/restrict the subscriptions, which can be added to the subscriptionIds. + /// Provisioning state of the operation. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaEntityBase(string displayName, GroupQuotaAdditionalAttributes additionalAttributes, QuotaRequestStatus? provisioningState, IDictionary serializedAdditionalRawData) + { + DisplayName = displayName; + AdditionalAttributes = additionalAttributes; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Display name of the GroupQuota entity. + [WirePath("displayName")] + public string DisplayName { get; set; } + /// Additional attributes to filter/restrict the subscriptions, which can be added to the subscriptionIds. + [WirePath("additionalAttributes")] + public GroupQuotaAdditionalAttributes AdditionalAttributes { get; set; } + /// Provisioning state of the operation. + [WirePath("provisioningState")] + public QuotaRequestStatus? ProvisioningState { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEntityPatch.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEntityPatch.Serialization.cs new file mode 100644 index 0000000000000..5ab7624b2dbbb --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEntityPatch.Serialization.cs @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class GroupQuotaEntityPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaEntityPatch)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaEntityPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaEntityPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaEntityPatch(document.RootElement, options); + } + + internal static GroupQuotaEntityPatch DeserializeGroupQuotaEntityPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GroupQuotasEntityBasePatch properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = GroupQuotasEntityBasePatch.DeserializeGroupQuotasEntityBasePatch(property.Value, options); + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaEntityPatch( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaEntityPatch)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaEntityPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaEntityPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaEntityPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEntityPatch.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEntityPatch.cs new file mode 100644 index 0000000000000..d221078a2297a --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEntityPatch.cs @@ -0,0 +1,72 @@ +// 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.Models; + +namespace Azure.ResourceManager.Quota.Models +{ + /// Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. + public partial class GroupQuotaEntityPatch : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaEntityPatch() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaEntityPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GroupQuotasEntityBasePatch properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. + [WirePath("properties")] + public GroupQuotasEntityBasePatch Properties { get; set; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEnvironmentType.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEnvironmentType.cs new file mode 100644 index 0000000000000..60dc351bb0134 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaEnvironmentType.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.Quota.Models +{ + /// Environment name. + public readonly partial struct GroupQuotaEnvironmentType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public GroupQuotaEnvironmentType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NonProductionValue = "NonProduction"; + private const string ProductionValue = "Production"; + + /// NonProduction. + public static GroupQuotaEnvironmentType NonProduction { get; } = new GroupQuotaEnvironmentType(NonProductionValue); + /// Production. + public static GroupQuotaEnvironmentType Production { get; } = new GroupQuotaEnvironmentType(ProductionValue); + /// Determines if two values are the same. + public static bool operator ==(GroupQuotaEnvironmentType left, GroupQuotaEnvironmentType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(GroupQuotaEnvironmentType left, GroupQuotaEnvironmentType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator GroupQuotaEnvironmentType(string value) => new GroupQuotaEnvironmentType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is GroupQuotaEnvironmentType other && Equals(other); + /// + public bool Equals(GroupQuotaEnvironmentType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaGroupingId.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaGroupingId.Serialization.cs new file mode 100644 index 0000000000000..c5c12a847d4cb --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaGroupingId.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class GroupQuotaGroupingId : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaGroupingId)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(GroupingIdType)) + { + writer.WritePropertyName("groupingIdType"u8); + writer.WriteStringValue(GroupingIdType.Value.ToString()); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaGroupingId IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaGroupingId)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaGroupingId(document.RootElement, options); + } + + internal static GroupQuotaGroupingId DeserializeGroupQuotaGroupingId(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GroupQuotaGroupingIdType? groupingIdType = default; + string value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("groupingIdType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupingIdType = new GroupQuotaGroupingIdType(property.Value.GetString()); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaGroupingId(groupingIdType, value, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GroupingIdType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" groupingIdType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(GroupingIdType)) + { + builder.Append(" groupingIdType: "); + builder.AppendLine($"'{GroupingIdType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + if (Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Value}'''"); + } + else + { + builder.AppendLine($"'{Value}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaGroupingId)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaGroupingId IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaGroupingId(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaGroupingId)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaGroupingId.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaGroupingId.cs new file mode 100644 index 0000000000000..350d617e5f653 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaGroupingId.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// The grouping Id for the group quota. It can be Billing Id or ServiceTreeId if applicable. + public partial class GroupQuotaGroupingId + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaGroupingId() + { + } + + /// Initializes a new instance of . + /// GroupingId type. It is a required property. More types of groupIds can be supported in future. + /// GroupId value based on the groupingType selected - Billing Id or ServiceTreeId. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaGroupingId(GroupQuotaGroupingIdType? groupingIdType, string value, IDictionary serializedAdditionalRawData) + { + GroupingIdType = groupingIdType; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// GroupingId type. It is a required property. More types of groupIds can be supported in future. + [WirePath("groupingIdType")] + public GroupQuotaGroupingIdType? GroupingIdType { get; set; } + /// GroupId value based on the groupingType selected - Billing Id or ServiceTreeId. + [WirePath("value")] + public string Value { get; set; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaGroupingIdType.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaGroupingIdType.cs new file mode 100644 index 0000000000000..f42ff54908d7d --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaGroupingIdType.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.Quota.Models +{ + /// GroupingId type. It is a required property. More types of groupIds can be supported in future. + public readonly partial struct GroupQuotaGroupingIdType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public GroupQuotaGroupingIdType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ServiceTreeIdValue = "ServiceTreeId"; + private const string BillingIdValue = "BillingId"; + + /// ServiceTreeId. + public static GroupQuotaGroupingIdType ServiceTreeId { get; } = new GroupQuotaGroupingIdType(ServiceTreeIdValue); + /// BillingId. + public static GroupQuotaGroupingIdType BillingId { get; } = new GroupQuotaGroupingIdType(BillingIdValue); + /// Determines if two values are the same. + public static bool operator ==(GroupQuotaGroupingIdType left, GroupQuotaGroupingIdType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(GroupQuotaGroupingIdType left, GroupQuotaGroupingIdType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator GroupQuotaGroupingIdType(string value) => new GroupQuotaGroupingIdType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is GroupQuotaGroupingIdType other && Equals(other); + /// + public bool Equals(GroupQuotaGroupingIdType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaLimitList.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaLimitList.Serialization.cs new file mode 100644 index 0000000000000..0f809c6231fd7 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaLimitList.Serialization.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + internal partial class GroupQuotaLimitList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaLimitList)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaLimitList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaLimitList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaLimitList(document.RootElement, options); + } + + internal static GroupQuotaLimitList DeserializeGroupQuotaLimitList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(GroupQuotaLimitData.DeserializeGroupQuotaLimitData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaLimitList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaLimitList)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaLimitList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaLimitList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaLimitList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaLimitList.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaLimitList.cs new file mode 100644 index 0000000000000..8b1527ef007e8 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaLimitList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// List of Group Quota Limit details. + internal partial class GroupQuotaLimitList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal GroupQuotaLimitList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of Group Quota Limit details. + /// The URL to use for getting the next set of results. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaLimitList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of Group Quota Limit details. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaList.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaList.Serialization.cs new file mode 100644 index 0000000000000..8107f2f7a74c5 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaList.Serialization.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + internal partial class GroupQuotaList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaList)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaList(document.RootElement, options); + } + + internal static GroupQuotaList DeserializeGroupQuotaList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(GroupQuotaEntityData.DeserializeGroupQuotaEntityData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaList)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaList.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaList.cs new file mode 100644 index 0000000000000..90b2cb338bcbb --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// List of Group Quotas at MG level. + internal partial class GroupQuotaList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal GroupQuotaList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of Group Quotas at MG level. + /// The URL to use for getting the next set of results. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of Group Quotas at MG level. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaRequestBase.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaRequestBase.Serialization.cs new file mode 100644 index 0000000000000..6ec5b875c45bd --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaRequestBase.Serialization.cs @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class GroupQuotaRequestBase : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaRequestBase)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Limit)) + { + writer.WritePropertyName("limit"u8); + writer.WriteNumberValue(Limit.Value); + } + if (Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + if (Optional.IsDefined(Comments)) + { + writer.WritePropertyName("comments"u8); + writer.WriteStringValue(Comments); + } + writer.WritePropertyName("name"u8); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (options.Format != "W" && Optional.IsDefined(LocalizedValue)) + { + writer.WritePropertyName("localizedValue"u8); + writer.WriteStringValue(LocalizedValue); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaRequestBase IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaRequestBase)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaRequestBase(document.RootElement, options); + } + + internal static GroupQuotaRequestBase DeserializeGroupQuotaRequestBase(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? limit = default; + string region = default; + string comments = default; + string value = default; + string localizedValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("limit"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + limit = property0.Value.GetInt64(); + continue; + } + if (property0.NameEquals("region"u8)) + { + region = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("comments"u8)) + { + comments = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("name"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property1 in property0.Value.EnumerateObject()) + { + if (property1.NameEquals("value"u8)) + { + value = property1.Value.GetString(); + continue; + } + if (property1.NameEquals("localizedValue"u8)) + { + localizedValue = property1.Value.GetString(); + continue; + } + } + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaRequestBase( + limit, + region, + comments, + value, + localizedValue, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Limit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" limit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Limit)) + { + builder.Append(" limit: "); + builder.AppendLine($"'{Limit.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Region), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" region: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Region)) + { + builder.Append(" region: "); + if (Region.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Region}'''"); + } + else + { + builder.AppendLine($"'{Region}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Comments), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" comments: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Comments)) + { + builder.Append(" comments: "); + if (Comments.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Comments}'''"); + } + else + { + builder.AppendLine($"'{Comments}'"); + } + } + } + + builder.Append(" name:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + if (Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Value}'''"); + } + else + { + builder.AppendLine($"'{Value}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LocalizedValue), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" localizedValue: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LocalizedValue)) + { + builder.Append(" localizedValue: "); + if (LocalizedValue.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LocalizedValue}'''"); + } + else + { + builder.AppendLine($"'{LocalizedValue}'"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaRequestBase)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaRequestBase IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaRequestBase(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaRequestBase)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaRequestBase.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaRequestBase.cs new file mode 100644 index 0000000000000..5da28507554b2 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaRequestBase.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// The new GroupQuota limit requested. + public partial class GroupQuotaRequestBase + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaRequestBase() + { + } + + /// Initializes a new instance of . + /// The new quota limit for the subscription. The incremental quota will be allocated from pre-approved group quota. + /// Location/Azure region for the quota requested for resource. + /// GroupQuota Request comments and details for request. This is optional paramter to provide more details related to the requested resource. + /// Resource name. + /// Resource display name. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaRequestBase(long? limit, string region, string comments, string value, string localizedValue, IDictionary serializedAdditionalRawData) + { + Limit = limit; + Region = region; + Comments = comments; + Value = value; + LocalizedValue = localizedValue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The new quota limit for the subscription. The incremental quota will be allocated from pre-approved group quota. + [WirePath("properties.limit")] + public long? Limit { get; set; } + /// Location/Azure region for the quota requested for resource. + [WirePath("properties.region")] + public string Region { get; set; } + /// GroupQuota Request comments and details for request. This is optional paramter to provide more details related to the requested resource. + [WirePath("properties.comments")] + public string Comments { get; set; } + /// Resource name. + [WirePath("properties.value")] + public string Value { get; } + /// Resource display name. + [WirePath("properties.localizedValue")] + public string LocalizedValue { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaRequestStatusProperties.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaRequestStatusProperties.Serialization.cs new file mode 100644 index 0000000000000..2d79597d5b224 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaRequestStatusProperties.Serialization.cs @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class GroupQuotaRequestStatusProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaRequestStatusProperties)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(RequestedResource)) + { + writer.WritePropertyName("requestedResource"u8); + writer.WriteObjectValue(RequestedResource, options); + } + if (options.Format != "W" && Optional.IsDefined(RequestSubmittedOn)) + { + writer.WritePropertyName("requestSubmitTime"u8); + writer.WriteStringValue(RequestSubmittedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(FaultCode)) + { + writer.WritePropertyName("faultCode"u8); + writer.WriteStringValue(FaultCode); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaRequestStatusProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaRequestStatusProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaRequestStatusProperties(document.RootElement, options); + } + + internal static GroupQuotaRequestStatusProperties DeserializeGroupQuotaRequestStatusProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GroupQuotaRequestBase requestedResource = default; + DateTimeOffset? requestSubmitTime = default; + QuotaRequestStatus? provisioningState = default; + string faultCode = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("requestedResource"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + requestedResource = GroupQuotaRequestBase.DeserializeGroupQuotaRequestBase(property.Value, options); + continue; + } + if (property.NameEquals("requestSubmitTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + requestSubmitTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new QuotaRequestStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("faultCode"u8)) + { + faultCode = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaRequestStatusProperties(requestedResource, requestSubmitTime, provisioningState, faultCode, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequestedResource), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" requestedResource: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RequestedResource)) + { + builder.Append(" requestedResource: "); + BicepSerializationHelpers.AppendChildObject(builder, RequestedResource, options, 2, false, " requestedResource: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequestSubmittedOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" requestSubmitTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RequestSubmittedOn)) + { + builder.Append(" requestSubmitTime: "); + var formattedDateTimeString = TypeFormatters.ToString(RequestSubmittedOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FaultCode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" faultCode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(FaultCode)) + { + builder.Append(" faultCode: "); + if (FaultCode.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{FaultCode}'''"); + } + else + { + builder.AppendLine($"'{FaultCode}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaRequestStatusProperties)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaRequestStatusProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaRequestStatusProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaRequestStatusProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaRequestStatusProperties.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaRequestStatusProperties.cs new file mode 100644 index 0000000000000..765601b6df614 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaRequestStatusProperties.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// The GroupQuotaRequestStatusProperties. + public partial class GroupQuotaRequestStatusProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaRequestStatusProperties() + { + } + + /// Initializes a new instance of . + /// Requested Resource. + /// The request submission time. The date conforms to the following format specified by the ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ. + /// Request status. + /// Details of the failure. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaRequestStatusProperties(GroupQuotaRequestBase requestedResource, DateTimeOffset? requestSubmittedOn, QuotaRequestStatus? provisioningState, string faultCode, IDictionary serializedAdditionalRawData) + { + RequestedResource = requestedResource; + RequestSubmittedOn = requestSubmittedOn; + ProvisioningState = provisioningState; + FaultCode = faultCode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Requested Resource. + [WirePath("requestedResource")] + public GroupQuotaRequestBase RequestedResource { get; set; } + /// The request submission time. The date conforms to the following format specified by the ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ. + [WirePath("requestSubmitTime")] + public DateTimeOffset? RequestSubmittedOn { get; } + /// Request status. + [WirePath("provisioningState")] + public QuotaRequestStatus? ProvisioningState { get; } + /// Details of the failure. + [WirePath("faultCode")] + public string FaultCode { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaResourceUsages.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaResourceUsages.Serialization.cs new file mode 100644 index 0000000000000..5bf15e0cdec6f --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaResourceUsages.Serialization.cs @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class GroupQuotaResourceUsages : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaResourceUsages)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaResourceUsages IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaResourceUsages)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaResourceUsages(document.RootElement, options); + } + + internal static GroupQuotaResourceUsages DeserializeGroupQuotaResourceUsages(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GroupQuotaUsagesBase properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = GroupQuotaUsagesBase.DeserializeGroupQuotaUsagesBase(property.Value, options); + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaResourceUsages( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaResourceUsages)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaResourceUsages IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaResourceUsages(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaResourceUsages)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaResourceUsages.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaResourceUsages.cs new file mode 100644 index 0000000000000..82ecaac0f9b05 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaResourceUsages.cs @@ -0,0 +1,72 @@ +// 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.Models; + +namespace Azure.ResourceManager.Quota.Models +{ + /// Resource details with usages and GroupQuota. + public partial class GroupQuotaResourceUsages : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaResourceUsages() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource details with usages and GroupQuota. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaResourceUsages(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GroupQuotaUsagesBase properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource details with usages and GroupQuota. + [WirePath("properties")] + public GroupQuotaUsagesBase Properties { get; set; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionIdList.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionIdList.Serialization.cs new file mode 100644 index 0000000000000..49f0b00d00716 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionIdList.Serialization.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + internal partial class GroupQuotaSubscriptionIdList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionIdList)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaSubscriptionIdList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionIdList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaSubscriptionIdList(document.RootElement, options); + } + + internal static GroupQuotaSubscriptionIdList DeserializeGroupQuotaSubscriptionIdList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(GroupQuotaSubscriptionData.DeserializeGroupQuotaSubscriptionData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaSubscriptionIdList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionIdList)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaSubscriptionIdList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaSubscriptionIdList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionIdList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionIdList.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionIdList.cs new file mode 100644 index 0000000000000..9cd6c0798d718 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionIdList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// List of GroupQuotaSubscriptionIds. + internal partial class GroupQuotaSubscriptionIdList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal GroupQuotaSubscriptionIdList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of GroupQuotaSubscriptionIds. + /// The URL to use for getting the next set of results. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaSubscriptionIdList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of GroupQuotaSubscriptionIds. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionProperties.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionProperties.Serialization.cs new file mode 100644 index 0000000000000..0858f07712bef --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionProperties.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class GroupQuotaSubscriptionProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionProperties)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(SubscriptionId)) + { + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaSubscriptionProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaSubscriptionProperties(document.RootElement, options); + } + + internal static GroupQuotaSubscriptionProperties DeserializeGroupQuotaSubscriptionProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string subscriptionId = default; + QuotaRequestStatus? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new QuotaRequestStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaSubscriptionProperties(subscriptionId, provisioningState, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SubscriptionId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" subscriptionId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SubscriptionId)) + { + builder.Append(" subscriptionId: "); + if (SubscriptionId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SubscriptionId}'''"); + } + else + { + builder.AppendLine($"'{SubscriptionId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionProperties)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaSubscriptionProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaSubscriptionProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionProperties.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionProperties.cs new file mode 100644 index 0000000000000..c8b2c624cce81 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionProperties.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// The GroupQuotaSubscriptionProperties. + public partial class GroupQuotaSubscriptionProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaSubscriptionProperties() + { + } + + /// Initializes a new instance of . + /// An Azure subscriptionId. + /// Status of this subscriptionId being associated with the GroupQuotasEntity. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaSubscriptionProperties(string subscriptionId, QuotaRequestStatus? provisioningState, IDictionary serializedAdditionalRawData) + { + SubscriptionId = subscriptionId; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// An Azure subscriptionId. + [WirePath("subscriptionId")] + public string SubscriptionId { get; } + /// Status of this subscriptionId being associated with the GroupQuotasEntity. + [WirePath("provisioningState")] + public QuotaRequestStatus? ProvisioningState { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionRequestStatusList.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionRequestStatusList.Serialization.cs new file mode 100644 index 0000000000000..ed947f52b7093 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionRequestStatusList.Serialization.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + internal partial class GroupQuotaSubscriptionRequestStatusList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionRequestStatusList)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaSubscriptionRequestStatusList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionRequestStatusList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaSubscriptionRequestStatusList(document.RootElement, options); + } + + internal static GroupQuotaSubscriptionRequestStatusList DeserializeGroupQuotaSubscriptionRequestStatusList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(GroupQuotaSubscriptionRequestStatusData.DeserializeGroupQuotaSubscriptionRequestStatusData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaSubscriptionRequestStatusList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionRequestStatusList)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaSubscriptionRequestStatusList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaSubscriptionRequestStatusList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionRequestStatusList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionRequestStatusList.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionRequestStatusList.cs new file mode 100644 index 0000000000000..56e3afa64337b --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionRequestStatusList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// List of GroupQuotaSubscriptionRequests Status. + internal partial class GroupQuotaSubscriptionRequestStatusList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal GroupQuotaSubscriptionRequestStatusList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of GroupQuotaSubscriptionRequests Status. + /// The URL to use for getting the next set of results. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaSubscriptionRequestStatusList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of GroupQuotaSubscriptionRequests Status. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionRequestStatusProperties.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionRequestStatusProperties.Serialization.cs new file mode 100644 index 0000000000000..50fb6fe699002 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionRequestStatusProperties.Serialization.cs @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class GroupQuotaSubscriptionRequestStatusProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionRequestStatusProperties)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(SubscriptionId)) + { + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + } + if (Optional.IsDefined(RequestSubmitOn)) + { + writer.WritePropertyName("requestSubmitTime"u8); + writer.WriteStringValue(RequestSubmitOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaSubscriptionRequestStatusProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionRequestStatusProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaSubscriptionRequestStatusProperties(document.RootElement, options); + } + + internal static GroupQuotaSubscriptionRequestStatusProperties DeserializeGroupQuotaSubscriptionRequestStatusProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string subscriptionId = default; + DateTimeOffset? requestSubmitTime = default; + QuotaRequestStatus? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("requestSubmitTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + requestSubmitTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new QuotaRequestStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaSubscriptionRequestStatusProperties(subscriptionId, requestSubmitTime, provisioningState, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SubscriptionId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" subscriptionId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SubscriptionId)) + { + builder.Append(" subscriptionId: "); + if (SubscriptionId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SubscriptionId}'''"); + } + else + { + builder.AppendLine($"'{SubscriptionId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequestSubmitOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" requestSubmitTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RequestSubmitOn)) + { + builder.Append(" requestSubmitTime: "); + var formattedDateTimeString = TypeFormatters.ToString(RequestSubmitOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionRequestStatusProperties)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaSubscriptionRequestStatusProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaSubscriptionRequestStatusProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaSubscriptionRequestStatusProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionRequestStatusProperties.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionRequestStatusProperties.cs new file mode 100644 index 0000000000000..ffc9a30b06112 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaSubscriptionRequestStatusProperties.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// The GroupQuotaSubscriptionRequestStatusProperties. + public partial class GroupQuotaSubscriptionRequestStatusProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaSubscriptionRequestStatusProperties() + { + } + + /// Initializes a new instance of . + /// The subscription Id. + /// The request submission time. The date conforms to the following format specified by the ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ. + /// Status of this subscriptionId being associated with the GroupQuotasEntity. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaSubscriptionRequestStatusProperties(string subscriptionId, DateTimeOffset? requestSubmitOn, QuotaRequestStatus? provisioningState, IDictionary serializedAdditionalRawData) + { + SubscriptionId = subscriptionId; + RequestSubmitOn = requestSubmitOn; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The subscription Id. + [WirePath("subscriptionId")] + public string SubscriptionId { get; set; } + /// The request submission time. The date conforms to the following format specified by the ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ. + [WirePath("requestSubmitTime")] + public DateTimeOffset? RequestSubmitOn { get; set; } + /// Status of this subscriptionId being associated with the GroupQuotasEntity. + [WirePath("provisioningState")] + public QuotaRequestStatus? ProvisioningState { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaUsagesBase.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaUsagesBase.Serialization.cs new file mode 100644 index 0000000000000..0dffd6596a1e9 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaUsagesBase.Serialization.cs @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class GroupQuotaUsagesBase : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaUsagesBase)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Limit)) + { + writer.WritePropertyName("limit"u8); + writer.WriteNumberValue(Limit.Value); + } + if (Optional.IsDefined(Usages)) + { + writer.WritePropertyName("usages"u8); + writer.WriteNumberValue(Usages.Value); + } + if (options.Format != "W" && Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit); + } + writer.WritePropertyName("name"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (options.Format != "W" && Optional.IsDefined(LocalizedValue)) + { + writer.WritePropertyName("localizedValue"u8); + writer.WriteStringValue(LocalizedValue); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotaUsagesBase IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotaUsagesBase)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotaUsagesBase(document.RootElement, options); + } + + internal static GroupQuotaUsagesBase DeserializeGroupQuotaUsagesBase(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? limit = default; + long? usages = default; + string unit = default; + string value = default; + string localizedValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("limit"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + limit = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("usages"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + usages = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("value"u8)) + { + value = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("localizedValue"u8)) + { + localizedValue = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotaUsagesBase( + limit, + usages, + unit, + value, + localizedValue, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Limit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" limit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Limit)) + { + builder.Append(" limit: "); + builder.AppendLine($"'{Limit.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Usages), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" usages: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Usages)) + { + builder.Append(" usages: "); + builder.AppendLine($"'{Usages.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Unit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" unit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Unit)) + { + builder.Append(" unit: "); + if (Unit.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Unit}'''"); + } + else + { + builder.AppendLine($"'{Unit}'"); + } + } + } + + builder.Append(" name:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + if (Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Value}'''"); + } + else + { + builder.AppendLine($"'{Value}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LocalizedValue), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" localizedValue: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LocalizedValue)) + { + builder.Append(" localizedValue: "); + if (LocalizedValue.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LocalizedValue}'''"); + } + else + { + builder.AppendLine($"'{LocalizedValue}'"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotaUsagesBase)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotaUsagesBase IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotaUsagesBase(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotaUsagesBase)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaUsagesBase.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaUsagesBase.cs new file mode 100644 index 0000000000000..d41e004ceb2dd --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotaUsagesBase.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// Resource details with usages and GroupQuota. + public partial class GroupQuotaUsagesBase + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotaUsagesBase() + { + } + + /// Initializes a new instance of . + /// Quota/limits for the resource. + /// Usages for the resource. + /// Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. Based on - https://armwiki.azurewebsites.net/api_contracts/UsagesAPIContract.html?q=usages . Different RPs may have different units, Count, type as int64 should work for most of the integer values. + /// Resource name. + /// Resource display name. + /// Keeps track of any properties unknown to the library. + internal GroupQuotaUsagesBase(long? limit, long? usages, string unit, string value, string localizedValue, IDictionary serializedAdditionalRawData) + { + Limit = limit; + Usages = usages; + Unit = unit; + Value = value; + LocalizedValue = localizedValue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Quota/limits for the resource. + [WirePath("limit")] + public long? Limit { get; set; } + /// Usages for the resource. + [WirePath("usages")] + public long? Usages { get; set; } + /// Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. Based on - https://armwiki.azurewebsites.net/api_contracts/UsagesAPIContract.html?q=usages . Different RPs may have different units, Count, type as int64 should work for most of the integer values. + [WirePath("unit")] + public string Unit { get; } + /// Resource name. + [WirePath("name.value")] + public string Value { get; set; } + /// Resource display name. + [WirePath("name.localizedValue")] + public string LocalizedValue { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotasEnforcementListResponse.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotasEnforcementListResponse.Serialization.cs new file mode 100644 index 0000000000000..911b57cb20c81 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotasEnforcementListResponse.Serialization.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + internal partial class GroupQuotasEnforcementListResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotasEnforcementListResponse)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotasEnforcementListResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotasEnforcementListResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotasEnforcementListResponse(document.RootElement, options); + } + + internal static GroupQuotasEnforcementListResponse DeserializeGroupQuotasEnforcementListResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(GroupQuotaEnforcementData.DeserializeGroupQuotaEnforcementData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotasEnforcementListResponse(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotasEnforcementListResponse)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotasEnforcementListResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotasEnforcementListResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotasEnforcementListResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotasEnforcementListResponse.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotasEnforcementListResponse.cs new file mode 100644 index 0000000000000..4ea6be1f9482b --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotasEnforcementListResponse.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// List of Azure regions, where the group quotas is enabled for enforcement. + internal partial class GroupQuotasEnforcementListResponse + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal GroupQuotasEnforcementListResponse() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of Azure Regions. + /// The URL to use for getting the next set of results. + /// Keeps track of any properties unknown to the library. + internal GroupQuotasEnforcementListResponse(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of Azure Regions. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotasEntityBasePatch.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotasEntityBasePatch.Serialization.cs new file mode 100644 index 0000000000000..dd75a7076865b --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotasEntityBasePatch.Serialization.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class GroupQuotasEntityBasePatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotasEntityBasePatch)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(AdditionalAttributes)) + { + writer.WritePropertyName("additionalAttributes"u8); + writer.WriteObjectValue(AdditionalAttributes, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GroupQuotasEntityBasePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupQuotasEntityBasePatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupQuotasEntityBasePatch(document.RootElement, options); + } + + internal static GroupQuotasEntityBasePatch DeserializeGroupQuotasEntityBasePatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + GroupQuotaAdditionalAttributesPatch additionalAttributes = default; + QuotaRequestStatus? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("additionalAttributes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + additionalAttributes = GroupQuotaAdditionalAttributesPatch.DeserializeGroupQuotaAdditionalAttributesPatch(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new QuotaRequestStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupQuotasEntityBasePatch(displayName, additionalAttributes, provisioningState, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisplayName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" displayName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DisplayName)) + { + builder.Append(" displayName: "); + if (DisplayName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DisplayName}'''"); + } + else + { + builder.AppendLine($"'{DisplayName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AdditionalAttributes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" additionalAttributes: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AdditionalAttributes)) + { + builder.Append(" additionalAttributes: "); + BicepSerializationHelpers.AppendChildObject(builder, AdditionalAttributes, options, 2, false, " additionalAttributes: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(GroupQuotasEntityBasePatch)} does not support writing '{options.Format}' format."); + } + } + + GroupQuotasEntityBasePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGroupQuotasEntityBasePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupQuotasEntityBasePatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotasEntityBasePatch.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotasEntityBasePatch.cs new file mode 100644 index 0000000000000..d1ef31d4bde19 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/GroupQuotasEntityBasePatch.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. + public partial class GroupQuotasEntityBasePatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GroupQuotasEntityBasePatch() + { + } + + /// Initializes a new instance of . + /// Display name of the GroupQuota entity. + /// Additional attributes to filter/restrict the subscriptions, which can be added to the subscriptionIds. + /// Provisioning state of the operation. + /// Keeps track of any properties unknown to the library. + internal GroupQuotasEntityBasePatch(string displayName, GroupQuotaAdditionalAttributesPatch additionalAttributes, QuotaRequestStatus? provisioningState, IDictionary serializedAdditionalRawData) + { + DisplayName = displayName; + AdditionalAttributes = additionalAttributes; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Display name of the GroupQuota entity. + [WirePath("displayName")] + public string DisplayName { get; set; } + /// Additional attributes to filter/restrict the subscriptions, which can be added to the subscriptionIds. + [WirePath("additionalAttributes")] + public GroupQuotaAdditionalAttributesPatch AdditionalAttributes { get; set; } + /// Provisioning state of the operation. + [WirePath("provisioningState")] + public QuotaRequestStatus? ProvisioningState { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaAllocationRequestBase.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaAllocationRequestBase.Serialization.cs new file mode 100644 index 0000000000000..0ec38b02ac9ba --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaAllocationRequestBase.Serialization.cs @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class QuotaAllocationRequestBase : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuotaAllocationRequestBase)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Limit)) + { + writer.WritePropertyName("limit"u8); + writer.WriteNumberValue(Limit.Value); + } + if (Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + writer.WritePropertyName("name"u8); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (options.Format != "W" && Optional.IsDefined(LocalizedValue)) + { + writer.WritePropertyName("localizedValue"u8); + writer.WriteStringValue(LocalizedValue); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + QuotaAllocationRequestBase IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuotaAllocationRequestBase)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQuotaAllocationRequestBase(document.RootElement, options); + } + + internal static QuotaAllocationRequestBase DeserializeQuotaAllocationRequestBase(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? limit = default; + string region = default; + string value = default; + string localizedValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("limit"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + limit = property0.Value.GetInt64(); + continue; + } + if (property0.NameEquals("region"u8)) + { + region = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("name"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property1 in property0.Value.EnumerateObject()) + { + if (property1.NameEquals("value"u8)) + { + value = property1.Value.GetString(); + continue; + } + if (property1.NameEquals("localizedValue"u8)) + { + localizedValue = property1.Value.GetString(); + continue; + } + } + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new QuotaAllocationRequestBase(limit, region, value, localizedValue, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Limit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" limit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Limit)) + { + builder.Append(" limit: "); + builder.AppendLine($"'{Limit.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Region), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" region: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Region)) + { + builder.Append(" region: "); + if (Region.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Region}'''"); + } + else + { + builder.AppendLine($"'{Region}'"); + } + } + } + + builder.Append(" name:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + if (Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Value}'''"); + } + else + { + builder.AppendLine($"'{Value}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LocalizedValue), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" localizedValue: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LocalizedValue)) + { + builder.Append(" localizedValue: "); + if (LocalizedValue.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LocalizedValue}'''"); + } + else + { + builder.AppendLine($"'{LocalizedValue}'"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(QuotaAllocationRequestBase)} does not support writing '{options.Format}' format."); + } + } + + QuotaAllocationRequestBase IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeQuotaAllocationRequestBase(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QuotaAllocationRequestBase)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaAllocationRequestBase.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaAllocationRequestBase.cs new file mode 100644 index 0000000000000..0a74e89a71cbc --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaAllocationRequestBase.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// The new quota request allocated to subscription. + public partial class QuotaAllocationRequestBase + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public QuotaAllocationRequestBase() + { + } + + /// Initializes a new instance of . + /// The new quota limit for the subscription. The incremental quota will be allocated from pre-approved group quota. + /// The location for which the subscription is allocated. + /// Resource name. + /// Resource display name. + /// Keeps track of any properties unknown to the library. + internal QuotaAllocationRequestBase(long? limit, string region, string value, string localizedValue, IDictionary serializedAdditionalRawData) + { + Limit = limit; + Region = region; + Value = value; + LocalizedValue = localizedValue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The new quota limit for the subscription. The incremental quota will be allocated from pre-approved group quota. + [WirePath("properties.limit")] + public long? Limit { get; set; } + /// The location for which the subscription is allocated. + [WirePath("properties.region")] + public string Region { get; set; } + /// Resource name. + [WirePath("properties.value")] + public string Value { get; } + /// Resource display name. + [WirePath("properties.localizedValue")] + public string LocalizedValue { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaAllocationRequestStatusList.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaAllocationRequestStatusList.Serialization.cs new file mode 100644 index 0000000000000..60bc56231bc98 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaAllocationRequestStatusList.Serialization.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + internal partial class QuotaAllocationRequestStatusList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuotaAllocationRequestStatusList)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + QuotaAllocationRequestStatusList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuotaAllocationRequestStatusList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQuotaAllocationRequestStatusList(document.RootElement, options); + } + + internal static QuotaAllocationRequestStatusList DeserializeQuotaAllocationRequestStatusList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(QuotaAllocationRequestStatusData.DeserializeQuotaAllocationRequestStatusData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new QuotaAllocationRequestStatusList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(QuotaAllocationRequestStatusList)} does not support writing '{options.Format}' format."); + } + } + + QuotaAllocationRequestStatusList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeQuotaAllocationRequestStatusList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QuotaAllocationRequestStatusList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaAllocationRequestStatusList.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaAllocationRequestStatusList.cs new file mode 100644 index 0000000000000..b653a281aefab --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaAllocationRequestStatusList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// List of QuotaAllocation Request Status. + internal partial class QuotaAllocationRequestStatusList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal QuotaAllocationRequestStatusList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of QuotaAllocation Request Status. + /// The URL to use for getting the next set of results. + /// Keeps track of any properties unknown to the library. + internal QuotaAllocationRequestStatusList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of QuotaAllocation Request Status. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimitJsonObject.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimitJsonObject.Serialization.cs index 2e3ecff470780..b95d45827fab0 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimitJsonObject.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimitJsonObject.Serialization.cs @@ -7,6 +7,8 @@ using System; using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -76,6 +78,33 @@ internal static QuotaLimitJsonObject DeserializeQuotaLimitJsonObject(JsonElement return UnknownLimitJsonObject.DeserializeUnknownLimitJsonObject(element, options); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LimitObjectType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" limitObjectType: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" limitObjectType: "); + builder.AppendLine($"'{LimitObjectType.ToString()}'"); + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -84,6 +113,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOption { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(QuotaLimitJsonObject)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimitObject.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimitObject.Serialization.cs index 8e62f34e06b6a..be7788f7e7424 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimitObject.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimitObject.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -108,6 +109,60 @@ internal static QuotaLimitObject DeserializeQuotaLimitObject(JsonElement element return new QuotaLimitObject(limitObjectType, serializedAdditionalRawData, value, limitType); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" value: "); + builder.AppendLine($"{Value}"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LimitType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" limitType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LimitType)) + { + builder.Append(" limitType: "); + builder.AppendLine($"'{LimitType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LimitObjectType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" limitObjectType: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" limitObjectType: "); + builder.AppendLine($"'{LimitObjectType.ToString()}'"); + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -116,6 +171,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions op { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(QuotaLimitObject)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimitObject.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimitObject.cs index 26db180b9de7a..f46b11485f5b1 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimitObject.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimitObject.cs @@ -39,8 +39,10 @@ internal QuotaLimitObject() } /// The quota/limit value. + [WirePath("value")] public int Value { get; set; } /// The quota or usages limit types. + [WirePath("limitType")] public QuotaLimitType? LimitType { get; set; } } } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimits.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimits.Serialization.cs index b6108154c7af9..283d23b0c6482 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimits.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaLimits.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -113,6 +115,67 @@ internal static QuotaLimits DeserializeQuotaLimits(JsonElement element, ModelRea return new QuotaLimits(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -121,6 +184,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(QuotaLimits)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationDisplay.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationDisplay.Serialization.cs index 894f644fc574c..21350f0254d3c 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationDisplay.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationDisplay.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -121,6 +122,113 @@ internal static QuotaOperationDisplay DeserializeQuotaOperationDisplay(JsonEleme return new QuotaOperationDisplay(provider, resource, operation, description, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Provider), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provider: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Provider)) + { + builder.Append(" provider: "); + if (Provider.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Provider}'''"); + } + else + { + builder.AppendLine($"'{Provider}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Resource), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resource: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Resource)) + { + builder.Append(" resource: "); + if (Resource.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Resource}'''"); + } + else + { + builder.AppendLine($"'{Resource}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Operation), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" operation: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Operation)) + { + builder.Append(" operation: "); + if (Operation.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Operation}'''"); + } + else + { + builder.AppendLine($"'{Operation}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Description), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" description: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Description)) + { + builder.Append(" description: "); + if (Description.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Description}'''"); + } + else + { + builder.AppendLine($"'{Description}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -129,6 +237,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(QuotaOperationDisplay)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationDisplay.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationDisplay.cs index 7b43a1acdd695..379eaf5268535 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationDisplay.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationDisplay.cs @@ -66,12 +66,16 @@ internal QuotaOperationDisplay(string provider, string resource, string operatio } /// Provider name. + [WirePath("provider")] public string Provider { get; } /// Resource name. + [WirePath("resource")] public string Resource { get; } /// Operation name. + [WirePath("operation")] public string Operation { get; } /// Operation description. + [WirePath("description")] public string Description { get; } } } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationListResult.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationListResult.Serialization.cs index 3d602da1e32d1..829848ea54168 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationListResult.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationListResult.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -113,6 +115,67 @@ internal static QuotaOperationListResult DeserializeQuotaOperationListResult(Jso return new QuotaOperationListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -121,6 +184,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(QuotaOperationListResult)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationResult.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationResult.Serialization.cs index d6a651f60b9c3..7091759085237 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationResult.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationResult.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -114,6 +115,82 @@ internal static QuotaOperationResult DeserializeQuotaOperationResult(JsonElement return new QuotaOperationResult(name, display, origin, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Display), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" display: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Display)) + { + builder.Append(" display: "); + BicepSerializationHelpers.AppendChildObject(builder, Display, options, 2, false, " display: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Origin), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" origin: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Origin)) + { + builder.Append(" origin: "); + if (Origin.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Origin}'''"); + } + else + { + builder.AppendLine($"'{Origin}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -122,6 +199,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOption { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(QuotaOperationResult)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationResult.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationResult.cs index 067016872c357..6729b244cc039 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationResult.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaOperationResult.cs @@ -64,10 +64,13 @@ internal QuotaOperationResult(string name, QuotaOperationDisplay display, string } /// Gets the name. + [WirePath("name")] public string Name { get; } /// Gets the display. + [WirePath("display")] public QuotaOperationDisplay Display { get; } /// Gets the origin. + [WirePath("origin")] public string Origin { get; } } } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaProperties.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaProperties.Serialization.cs index 163da80689dd8..28aef38398240 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaProperties.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaProperties.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -189,6 +190,144 @@ internal static QuotaProperties DeserializeQuotaProperties(JsonElement element, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Limit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" limit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Limit)) + { + builder.Append(" limit: "); + BicepSerializationHelpers.AppendChildObject(builder, Limit, options, 2, false, " limit: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Unit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" unit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Unit)) + { + builder.Append(" unit: "); + if (Unit.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Unit}'''"); + } + else + { + builder.AppendLine($"'{Unit}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + BicepSerializationHelpers.AppendChildObject(builder, Name, options, 2, false, " name: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceTypeName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceTypeName)) + { + builder.Append(" resourceType: "); + if (ResourceTypeName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ResourceTypeName}'''"); + } + else + { + builder.AppendLine($"'{ResourceTypeName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(QuotaPeriod), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" quotaPeriod: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(QuotaPeriod)) + { + builder.Append(" quotaPeriod: "); + var formattedTimeSpan = TypeFormatters.ToString(QuotaPeriod.Value, "P"); + builder.AppendLine($"'{formattedTimeSpan}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsQuotaApplicable), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isQuotaApplicable: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsQuotaApplicable)) + { + builder.Append(" isQuotaApplicable: "); + var boolValue = IsQuotaApplicable.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + builder.AppendLine($"'{Properties.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -197,6 +336,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opt { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(QuotaProperties)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaProperties.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaProperties.cs index 24d748f47aa9d..9bb9c7a810ea7 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaProperties.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaProperties.cs @@ -86,12 +86,16 @@ internal QuotaProperties(QuotaLimitJsonObject limit, string unit, QuotaRequestRe /// 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 . /// + [WirePath("limit")] public QuotaLimitJsonObject Limit { get; set; } /// The quota units, such as Count and Bytes. When requesting quota, use the **unit** value returned in the GET response in the request body of your PUT operation. + [WirePath("unit")] public string Unit { get; } /// Resource name provided by the resource provider. Use this property name when requesting quota. + [WirePath("name")] public QuotaRequestResourceName Name { get; set; } /// The name of the resource type. Optional field. + [WirePath("resourceType")] public string ResourceTypeName { get; set; } /// /// The time period over which the quota usage values are summarized. For example: @@ -100,8 +104,10 @@ internal QuotaProperties(QuotaLimitJsonObject limit, string unit, QuotaRequestRe /// *PT1S (per one second). /// This parameter is optional because, for some resources like compute, the period is irrelevant. /// + [WirePath("quotaPeriod")] public TimeSpan? QuotaPeriod { get; } /// States if quota can be requested for this resource. + [WirePath("isQuotaApplicable")] public bool? IsQuotaApplicable { get; } /// /// Additional properties for the specific resource provider. @@ -133,6 +139,7 @@ internal QuotaProperties(QuotaLimitJsonObject limit, string unit, QuotaRequestRe /// /// /// + [WirePath("properties")] public BinaryData Properties { get; set; } } } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaRequestDetailsList.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaRequestDetailsList.Serialization.cs index 09e907521937a..d12eb4f275d62 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaRequestDetailsList.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaRequestDetailsList.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -113,6 +115,67 @@ internal static QuotaRequestDetailsList DeserializeQuotaRequestDetailsList(JsonE return new QuotaRequestDetailsList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -121,6 +184,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(QuotaRequestDetailsList)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaRequestResourceName.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaRequestResourceName.Serialization.cs index 3f6a34e2fde1a..0aa1b9760a532 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaRequestResourceName.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaRequestResourceName.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -99,6 +100,67 @@ internal static QuotaRequestResourceName DeserializeQuotaRequestResourceName(Jso return new QuotaRequestResourceName(value, localizedValue, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + if (Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Value}'''"); + } + else + { + builder.AppendLine($"'{Value}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LocalizedValue), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" localizedValue: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LocalizedValue)) + { + builder.Append(" localizedValue: "); + if (LocalizedValue.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LocalizedValue}'''"); + } + else + { + builder.AppendLine($"'{LocalizedValue}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -107,6 +169,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(QuotaRequestResourceName)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaRequestResourceName.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaRequestResourceName.cs index 8f88d2d705641..f4af6a542ac1a 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaRequestResourceName.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaRequestResourceName.cs @@ -62,8 +62,10 @@ internal QuotaRequestResourceName(string value, string localizedValue, IDictiona } /// Resource name. + [WirePath("value")] public string Value { get; set; } /// Resource display name. + [WirePath("localizedValue")] public string LocalizedValue { get; } } } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaRequestStatus.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaRequestStatus.cs new file mode 100644 index 0000000000000..a8e9d2d2d8439 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaRequestStatus.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.Quota.Models +{ + /// Request status. + public readonly partial struct QuotaRequestStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public QuotaRequestStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AcceptedValue = "Accepted"; + private const string CreatedValue = "Created"; + private const string InvalidValue = "Invalid"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string InProgressValue = "InProgress"; + private const string CanceledValue = "Canceled"; + + /// Accepted. + public static QuotaRequestStatus Accepted { get; } = new QuotaRequestStatus(AcceptedValue); + /// Created. + public static QuotaRequestStatus Created { get; } = new QuotaRequestStatus(CreatedValue); + /// Invalid. + public static QuotaRequestStatus Invalid { get; } = new QuotaRequestStatus(InvalidValue); + /// Succeeded. + public static QuotaRequestStatus Succeeded { get; } = new QuotaRequestStatus(SucceededValue); + /// Failed. + public static QuotaRequestStatus Failed { get; } = new QuotaRequestStatus(FailedValue); + /// InProgress. + public static QuotaRequestStatus InProgress { get; } = new QuotaRequestStatus(InProgressValue); + /// Canceled. + public static QuotaRequestStatus Canceled { get; } = new QuotaRequestStatus(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(QuotaRequestStatus left, QuotaRequestStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(QuotaRequestStatus left, QuotaRequestStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator QuotaRequestStatus(string value) => new QuotaRequestStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is QuotaRequestStatus other && Equals(other); + /// + public bool Equals(QuotaRequestStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaSubRequestDetail.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaSubRequestDetail.Serialization.cs index bee10f408e837..1a1dcddb82b7f 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaSubRequestDetail.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaSubRequestDetail.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -178,6 +179,150 @@ internal static QuotaSubRequestDetail DeserializeQuotaSubRequestDetail(JsonEleme serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + BicepSerializationHelpers.AppendChildObject(builder, Name, options, 2, false, " name: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceTypeName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceTypeName)) + { + builder.Append(" resourceType: "); + if (ResourceTypeName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ResourceTypeName}'''"); + } + else + { + builder.AppendLine($"'{ResourceTypeName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Unit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" unit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Unit)) + { + builder.Append(" unit: "); + if (Unit.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Unit}'''"); + } + else + { + builder.AppendLine($"'{Unit}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Message), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" message: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Message)) + { + builder.Append(" message: "); + if (Message.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Message}'''"); + } + else + { + builder.AppendLine($"'{Message}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SubRequestId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" subRequestId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SubRequestId)) + { + builder.Append(" subRequestId: "); + builder.AppendLine($"'{SubRequestId.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Limit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" limit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Limit)) + { + builder.Append(" limit: "); + BicepSerializationHelpers.AppendChildObject(builder, Limit, options, 2, false, " limit: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -186,6 +331,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(QuotaSubRequestDetail)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaSubRequestDetail.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaSubRequestDetail.cs index fedba78c10a77..65a0611b49b5c 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaSubRequestDetail.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaSubRequestDetail.cs @@ -76,22 +76,29 @@ internal QuotaSubRequestDetail(QuotaRequestResourceName name, string resourceTyp } /// Resource name. + [WirePath("name")] public QuotaRequestResourceName Name { get; } /// Resource type for which the quota properties were requested. + [WirePath("resourceType")] public string ResourceTypeName { get; } /// Quota limit units, such as Count and Bytes. When requesting quota, use the **unit** value returned in the GET response in the request body of your PUT operation. + [WirePath("unit")] public string Unit { get; } /// The quota request status. + [WirePath("provisioningState")] public QuotaRequestState? ProvisioningState { get; } /// User-friendly status message. + [WirePath("message")] public string Message { get; } /// Quota request ID. + [WirePath("subRequestId")] public Guid? SubRequestId { get; } /// /// Resource quota limit properties. /// 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 . /// + [WirePath("limit")] public QuotaLimitJsonObject Limit { get; } } } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesObject.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesObject.Serialization.cs index 6f1ccf88529cc..0d2d595127cb8 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesObject.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesObject.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -100,6 +101,48 @@ internal static QuotaUsagesObject DeserializeQuotaUsagesObject(JsonElement eleme return new QuotaUsagesObject(value, usagesType, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" value: "); + builder.AppendLine($"{Value}"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UsagesType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" usagesType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(UsagesType)) + { + builder.Append(" usagesType: "); + builder.AppendLine($"'{UsagesType.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -108,6 +151,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions o { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(QuotaUsagesObject)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesObject.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesObject.cs index 87ab15538fb59..683ed12b79a73 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesObject.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesObject.cs @@ -69,8 +69,10 @@ internal QuotaUsagesObject() } /// The usages value. + [WirePath("value")] public int Value { get; } /// The quota or usages limit types. + [WirePath("usagesType")] public QuotaUsagesType? UsagesType { get; } } } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesProperties.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesProperties.Serialization.cs index 75164d5d74d0e..49c47597db68c 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesProperties.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesProperties.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -189,6 +190,144 @@ internal static QuotaUsagesProperties DeserializeQuotaUsagesProperties(JsonEleme serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Usages), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" usages: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Usages)) + { + builder.Append(" usages: "); + BicepSerializationHelpers.AppendChildObject(builder, Usages, options, 2, false, " usages: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Unit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" unit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Unit)) + { + builder.Append(" unit: "); + if (Unit.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Unit}'''"); + } + else + { + builder.AppendLine($"'{Unit}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + BicepSerializationHelpers.AppendChildObject(builder, Name, options, 2, false, " name: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceTypeName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceTypeName)) + { + builder.Append(" resourceType: "); + if (ResourceTypeName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ResourceTypeName}'''"); + } + else + { + builder.AppendLine($"'{ResourceTypeName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(QuotaPeriod), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" quotaPeriod: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(QuotaPeriod)) + { + builder.Append(" quotaPeriod: "); + var formattedTimeSpan = TypeFormatters.ToString(QuotaPeriod.Value, "P"); + builder.AppendLine($"'{formattedTimeSpan}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsQuotaApplicable), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isQuotaApplicable: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsQuotaApplicable)) + { + builder.Append(" isQuotaApplicable: "); + var boolValue = IsQuotaApplicable.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + builder.AppendLine($"'{Properties.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -197,6 +336,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(QuotaUsagesProperties)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesProperties.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesProperties.cs index 4ed72e5af2c13..813d2e4041d97 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesProperties.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/QuotaUsagesProperties.cs @@ -78,12 +78,16 @@ internal QuotaUsagesProperties(QuotaUsagesObject usages, string unit, QuotaReque } /// The quota limit properties for this resource. + [WirePath("usages")] public QuotaUsagesObject Usages { get; } /// The units for the quota usage, such as Count and Bytes. When requesting quota, use the **unit** value returned in the GET response in the request body of your PUT operation. + [WirePath("unit")] public string Unit { get; } /// Resource name provided by the resource provider. Use this property name when requesting quota. + [WirePath("name")] public QuotaRequestResourceName Name { get; } /// The name of the resource type. Optional field. + [WirePath("resourceType")] public string ResourceTypeName { get; } /// /// The time period for the summary of the quota usage values. For example: @@ -92,8 +96,10 @@ internal QuotaUsagesProperties(QuotaUsagesObject usages, string unit, QuotaReque /// *PT1S (per one second). /// This parameter is optional because it is not relevant for all resources such as compute. /// + [WirePath("quotaPeriod")] public TimeSpan? QuotaPeriod { get; } /// States if quota can be requested for this resource. + [WirePath("isQuotaApplicable")] public bool? IsQuotaApplicable { get; } /// /// Additional properties for the specific resource provider. @@ -125,6 +131,7 @@ internal QuotaUsagesProperties(QuotaUsagesObject usages, string unit, QuotaReque /// /// /// + [WirePath("properties")] public BinaryData Properties { get; } } } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/ResourceUsageList.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/ResourceUsageList.Serialization.cs new file mode 100644 index 0000000000000..fde9f770789b0 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/ResourceUsageList.Serialization.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + internal partial class ResourceUsageList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceUsageList)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ResourceUsageList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceUsageList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceUsageList(document.RootElement, options); + } + + internal static ResourceUsageList DeserializeResourceUsageList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(GroupQuotaResourceUsages.DeserializeGroupQuotaResourceUsages(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceUsageList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ResourceUsageList)} does not support writing '{options.Format}' format."); + } + } + + ResourceUsageList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeResourceUsageList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceUsageList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/ResourceUsageList.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/ResourceUsageList.cs new file mode 100644 index 0000000000000..25f6034d0d3f5 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/ResourceUsageList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// List of resource usages and quotas for GroupQuota. + internal partial class ResourceUsageList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ResourceUsageList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of resource usages at Group Quotas. + /// The URL to use for getting the next set of results. + /// Keeps track of any properties unknown to the library. + internal ResourceUsageList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of resource usages at Group Quotas. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/ServiceErrorDetail.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/ServiceErrorDetail.Serialization.cs index 40e54f33fae96..11f3d5a199490 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/ServiceErrorDetail.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/ServiceErrorDetail.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -99,6 +100,67 @@ internal static ServiceErrorDetail DeserializeServiceErrorDetail(JsonElement ele return new ServiceErrorDetail(code, message, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Code), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" code: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Code)) + { + builder.Append(" code: "); + if (Code.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Code}'''"); + } + else + { + builder.AppendLine($"'{Code}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Message), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" message: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Message)) + { + builder.Append(" message: "); + if (Message.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Message}'''"); + } + else + { + builder.AppendLine($"'{Message}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -107,6 +169,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(ServiceErrorDetail)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/ServiceErrorDetail.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/ServiceErrorDetail.cs index 1eaf54b5f92ac..f17f7fda308ee 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/ServiceErrorDetail.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/ServiceErrorDetail.cs @@ -62,8 +62,10 @@ internal ServiceErrorDetail(string code, string message, IDictionary Error code. + [WirePath("code")] public string Code { get; } /// Error message. + [WirePath("message")] public string Message { get; } } } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubmittedResourceRequestStatusList.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubmittedResourceRequestStatusList.Serialization.cs new file mode 100644 index 0000000000000..938231df977f0 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubmittedResourceRequestStatusList.Serialization.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + internal partial class SubmittedResourceRequestStatusList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubmittedResourceRequestStatusList)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SubmittedResourceRequestStatusList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubmittedResourceRequestStatusList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubmittedResourceRequestStatusList(document.RootElement, options); + } + + internal static SubmittedResourceRequestStatusList DeserializeSubmittedResourceRequestStatusList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(GroupQuotaRequestStatusData.DeserializeGroupQuotaRequestStatusData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SubmittedResourceRequestStatusList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SubmittedResourceRequestStatusList)} does not support writing '{options.Format}' format."); + } + } + + SubmittedResourceRequestStatusList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSubmittedResourceRequestStatusList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubmittedResourceRequestStatusList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubmittedResourceRequestStatusList.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubmittedResourceRequestStatusList.cs new file mode 100644 index 0000000000000..249331384b4ec --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubmittedResourceRequestStatusList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// Share Quota Entity list. + internal partial class SubmittedResourceRequestStatusList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal SubmittedResourceRequestStatusList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Subscription groupQuotaRequests list. + /// The URL to use for getting the next set of results. + /// Keeps track of any properties unknown to the library. + internal SubmittedResourceRequestStatusList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Subscription groupQuotaRequests list. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionAllocatedQuota.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionAllocatedQuota.Serialization.cs new file mode 100644 index 0000000000000..98f5b23faa943 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionAllocatedQuota.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class SubscriptionAllocatedQuota : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubscriptionAllocatedQuota)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(SubscriptionId)) + { + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + } + if (Optional.IsDefined(QuotaAllocated)) + { + writer.WritePropertyName("quotaAllocated"u8); + writer.WriteNumberValue(QuotaAllocated.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SubscriptionAllocatedQuota IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubscriptionAllocatedQuota)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriptionAllocatedQuota(document.RootElement, options); + } + + internal static SubscriptionAllocatedQuota DeserializeSubscriptionAllocatedQuota(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string subscriptionId = default; + long? quotaAllocated = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("quotaAllocated"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quotaAllocated = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SubscriptionAllocatedQuota(subscriptionId, quotaAllocated, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SubscriptionId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" subscriptionId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SubscriptionId)) + { + builder.Append(" subscriptionId: "); + if (SubscriptionId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SubscriptionId}'''"); + } + else + { + builder.AppendLine($"'{SubscriptionId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(QuotaAllocated), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" quotaAllocated: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(QuotaAllocated)) + { + builder.Append(" quotaAllocated: "); + builder.AppendLine($"'{QuotaAllocated.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SubscriptionAllocatedQuota)} does not support writing '{options.Format}' format."); + } + } + + SubscriptionAllocatedQuota IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSubscriptionAllocatedQuota(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubscriptionAllocatedQuota)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionAllocatedQuota.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionAllocatedQuota.cs new file mode 100644 index 0000000000000..639b3e347f9ab --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionAllocatedQuota.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// SubscriptionIds and quota allocated to subscriptions from the GroupQuota. + public partial class SubscriptionAllocatedQuota + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal SubscriptionAllocatedQuota() + { + } + + /// Initializes a new instance of . + /// An Azure subscriptionId. + /// The amount of quota allocated to this subscriptionId from the GroupQuotasEntity. + /// Keeps track of any properties unknown to the library. + internal SubscriptionAllocatedQuota(string subscriptionId, long? quotaAllocated, IDictionary serializedAdditionalRawData) + { + SubscriptionId = subscriptionId; + QuotaAllocated = quotaAllocated; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// An Azure subscriptionId. + [WirePath("subscriptionId")] + public string SubscriptionId { get; } + /// The amount of quota allocated to this subscriptionId from the GroupQuotasEntity. + [WirePath("quotaAllocated")] + public long? QuotaAllocated { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionQuotaAllocationsList.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionQuotaAllocationsList.Serialization.cs new file mode 100644 index 0000000000000..4f38a1e7bdfcf --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionQuotaAllocationsList.Serialization.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + internal partial class SubscriptionQuotaAllocationsList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubscriptionQuotaAllocationsList)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SubscriptionQuotaAllocationsList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubscriptionQuotaAllocationsList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriptionQuotaAllocationsList(document.RootElement, options); + } + + internal static SubscriptionQuotaAllocationsList DeserializeSubscriptionQuotaAllocationsList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SubscriptionQuotaAllocationData.DeserializeSubscriptionQuotaAllocationData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SubscriptionQuotaAllocationsList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SubscriptionQuotaAllocationsList)} does not support writing '{options.Format}' format."); + } + } + + SubscriptionQuotaAllocationsList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSubscriptionQuotaAllocationsList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubscriptionQuotaAllocationsList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionQuotaAllocationsList.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionQuotaAllocationsList.cs new file mode 100644 index 0000000000000..574386ef0dc54 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionQuotaAllocationsList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// Subscription quota list. + internal partial class SubscriptionQuotaAllocationsList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal SubscriptionQuotaAllocationsList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Subscription quota list. + /// The URL to use for getting the next set of results. + /// Keeps track of any properties unknown to the library. + internal SubscriptionQuotaAllocationsList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Subscription quota list. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionQuotaDetails.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionQuotaDetails.Serialization.cs new file mode 100644 index 0000000000000..ac926ed97e191 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionQuotaDetails.Serialization.cs @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Quota.Models +{ + public partial class SubscriptionQuotaDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubscriptionQuotaDetails)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + if (Optional.IsDefined(Limit)) + { + writer.WritePropertyName("limit"u8); + writer.WriteNumberValue(Limit.Value); + } + if (options.Format != "W" && Optional.IsDefined(ShareableQuota)) + { + writer.WritePropertyName("shareableQuota"u8); + writer.WriteNumberValue(ShareableQuota.Value); + } + writer.WritePropertyName("name"u8); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (options.Format != "W" && Optional.IsDefined(LocalizedValue)) + { + writer.WritePropertyName("localizedValue"u8); + writer.WriteStringValue(LocalizedValue); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SubscriptionQuotaDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubscriptionQuotaDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriptionQuotaDetails(document.RootElement, options); + } + + internal static SubscriptionQuotaDetails DeserializeSubscriptionQuotaDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string region = default; + long? limit = default; + long? shareableQuota = default; + string value = default; + string localizedValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("region"u8)) + { + region = property.Value.GetString(); + continue; + } + if (property.NameEquals("limit"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + limit = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("shareableQuota"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + shareableQuota = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("name"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("value"u8)) + { + value = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("localizedValue"u8)) + { + localizedValue = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SubscriptionQuotaDetails( + region, + limit, + shareableQuota, + value, + localizedValue, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Region), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" region: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Region)) + { + builder.Append(" region: "); + if (Region.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Region}'''"); + } + else + { + builder.AppendLine($"'{Region}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Limit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" limit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Limit)) + { + builder.Append(" limit: "); + builder.AppendLine($"'{Limit.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ShareableQuota), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" shareableQuota: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ShareableQuota)) + { + builder.Append(" shareableQuota: "); + builder.AppendLine($"'{ShareableQuota.Value.ToString()}'"); + } + } + + builder.Append(" name:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + if (Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Value}'''"); + } + else + { + builder.AppendLine($"'{Value}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LocalizedValue), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" localizedValue: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LocalizedValue)) + { + builder.Append(" localizedValue: "); + if (LocalizedValue.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LocalizedValue}'''"); + } + else + { + builder.AppendLine($"'{LocalizedValue}'"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SubscriptionQuotaDetails)} does not support writing '{options.Format}' format."); + } + } + + SubscriptionQuotaDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSubscriptionQuotaDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubscriptionQuotaDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionQuotaDetails.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionQuotaDetails.cs new file mode 100644 index 0000000000000..b5155074e11ff --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/SubscriptionQuotaDetails.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Quota.Models +{ + /// Subscription Quota details. + public partial class SubscriptionQuotaDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SubscriptionQuotaDetails() + { + } + + /// Initializes a new instance of . + /// Location/Azure region for the quota requested for resource. + /// The total quota limit for the subscription. + /// The shareable quota for the subscription. + /// Resource name. + /// Resource display name. + /// Keeps track of any properties unknown to the library. + internal SubscriptionQuotaDetails(string region, long? limit, long? shareableQuota, string value, string localizedValue, IDictionary serializedAdditionalRawData) + { + Region = region; + Limit = limit; + ShareableQuota = shareableQuota; + Value = value; + LocalizedValue = localizedValue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Location/Azure region for the quota requested for resource. + [WirePath("region")] + public string Region { get; set; } + /// The total quota limit for the subscription. + [WirePath("limit")] + public long? Limit { get; set; } + /// The shareable quota for the subscription. + [WirePath("shareableQuota")] + public long? ShareableQuota { get; } + /// Resource name. + [WirePath("name.value")] + public string Value { get; } + /// Resource display name. + [WirePath("name.localizedValue")] + public string LocalizedValue { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/UnknownLimitJsonObject.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/UnknownLimitJsonObject.Serialization.cs index 373fb543871b7..b76d5433e1d86 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/UnknownLimitJsonObject.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/UnknownLimitJsonObject.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -85,6 +86,33 @@ internal static UnknownLimitJsonObject DeserializeUnknownLimitJsonObject(JsonEle return new UnknownLimitJsonObject(limitObjectType, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LimitObjectType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" limitObjectType: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" limitObjectType: "); + builder.AppendLine($"'{LimitObjectType.ToString()}'"); + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -93,6 +121,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOption { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(QuotaLimitJsonObject)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/UsagesLimits.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/UsagesLimits.Serialization.cs index 38c7e46386443..634af22ea212e 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/UsagesLimits.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Models/UsagesLimits.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -113,6 +115,67 @@ internal static UsagesLimits DeserializeUsagesLimits(JsonElement element, ModelR return new UsagesLimits(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -121,6 +184,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions option { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(UsagesLimits)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaAllocationRequestStatusCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaAllocationRequestStatusCollection.cs new file mode 100644 index 0000000000000..de3013f87bd46 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaAllocationRequestStatusCollection.cs @@ -0,0 +1,342 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ManagementGroups; + +namespace Azure.ResourceManager.Quota +{ + /// + /// 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 GetQuotaAllocationRequestStatuses method from an instance of . + /// + public partial class QuotaAllocationRequestStatusCollection : ArmCollection + { + private readonly ClientDiagnostics _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics; + private readonly GroupQuotaSubscriptionAllocationRequestRestOperations _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient; + + /// Initializes a new instance of the class for mocking. + protected QuotaAllocationRequestStatusCollection() + { + } + + /// 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 QuotaAllocationRequestStatusCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", QuotaAllocationRequestStatusResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(QuotaAllocationRequestStatusResource.ResourceType, out string quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestApiVersion); + _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient = new GroupQuotaSubscriptionAllocationRequestRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ManagementGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagementGroupResource.ResourceType), nameof(id)); + } + + /// + /// Get the quota allocation request status for the subscriptionId by allocationId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> GetAsync(string subscriptionId, string groupQuotaName, string allocationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(allocationId, nameof(allocationId)); + + using var scope = _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics.CreateScope("QuotaAllocationRequestStatusCollection.Get"); + scope.Start(); + try + { + var response = await _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.GetAsync(Id.Name, subscriptionId, groupQuotaName, allocationId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new QuotaAllocationRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the quota allocation request status for the subscriptionId by allocationId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual Response Get(string subscriptionId, string groupQuotaName, string allocationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(allocationId, nameof(allocationId)); + + using var scope = _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics.CreateScope("QuotaAllocationRequestStatusCollection.Get"); + scope.Start(); + try + { + var response = _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.Get(Id.Name, subscriptionId, groupQuotaName, allocationId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new QuotaAllocationRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> ExistsAsync(string subscriptionId, string groupQuotaName, string allocationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(allocationId, nameof(allocationId)); + + using var scope = _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics.CreateScope("QuotaAllocationRequestStatusCollection.Exists"); + scope.Start(); + try + { + var response = await _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.GetAsync(Id.Name, subscriptionId, groupQuotaName, allocationId, 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 + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual Response Exists(string subscriptionId, string groupQuotaName, string allocationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(allocationId, nameof(allocationId)); + + using var scope = _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics.CreateScope("QuotaAllocationRequestStatusCollection.Exists"); + scope.Start(); + try + { + var response = _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.Get(Id.Name, subscriptionId, groupQuotaName, allocationId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> GetIfExistsAsync(string subscriptionId, string groupQuotaName, string allocationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(allocationId, nameof(allocationId)); + + using var scope = _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics.CreateScope("QuotaAllocationRequestStatusCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.GetAsync(Id.Name, subscriptionId, groupQuotaName, allocationId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new QuotaAllocationRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual NullableResponse GetIfExists(string subscriptionId, string groupQuotaName, string allocationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(allocationId, nameof(allocationId)); + + using var scope = _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics.CreateScope("QuotaAllocationRequestStatusCollection.GetIfExists"); + scope.Start(); + try + { + var response = _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.Get(Id.Name, subscriptionId, groupQuotaName, allocationId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new QuotaAllocationRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaAllocationRequestStatusData.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaAllocationRequestStatusData.Serialization.cs new file mode 100644 index 0000000000000..20389533ec029 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaAllocationRequestStatusData.Serialization.cs @@ -0,0 +1,384 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + public partial class QuotaAllocationRequestStatusData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuotaAllocationRequestStatusData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(RequestedResource)) + { + writer.WritePropertyName("requestedResource"u8); + writer.WriteObjectValue(RequestedResource, options); + } + if (options.Format != "W" && Optional.IsDefined(RequestSubmittedOn)) + { + writer.WritePropertyName("requestSubmitTime"u8); + writer.WriteStringValue(RequestSubmittedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(FaultCode)) + { + writer.WritePropertyName("faultCode"u8); + writer.WriteStringValue(FaultCode); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + QuotaAllocationRequestStatusData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuotaAllocationRequestStatusData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQuotaAllocationRequestStatusData(document.RootElement, options); + } + + internal static QuotaAllocationRequestStatusData DeserializeQuotaAllocationRequestStatusData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + QuotaAllocationRequestBase requestedResource = default; + DateTimeOffset? requestSubmitTime = default; + QuotaRequestStatus? provisioningState = default; + string faultCode = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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("requestedResource"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + requestedResource = QuotaAllocationRequestBase.DeserializeQuotaAllocationRequestBase(property0.Value, options); + continue; + } + if (property0.NameEquals("requestSubmitTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + requestSubmitTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new QuotaRequestStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("faultCode"u8)) + { + faultCode = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new QuotaAllocationRequestStatusData( + id, + name, + type, + systemData, + requestedResource, + requestSubmitTime, + provisioningState, + faultCode, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequestedResource), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" requestedResource: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RequestedResource)) + { + builder.Append(" requestedResource: "); + BicepSerializationHelpers.AppendChildObject(builder, RequestedResource, options, 4, false, " requestedResource: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequestSubmittedOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" requestSubmitTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RequestSubmittedOn)) + { + builder.Append(" requestSubmitTime: "); + var formattedDateTimeString = TypeFormatters.ToString(RequestSubmittedOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FaultCode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" faultCode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(FaultCode)) + { + builder.Append(" faultCode: "); + if (FaultCode.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{FaultCode}'''"); + } + else + { + builder.AppendLine($"'{FaultCode}'"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(QuotaAllocationRequestStatusData)} does not support writing '{options.Format}' format."); + } + } + + QuotaAllocationRequestStatusData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeQuotaAllocationRequestStatusData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QuotaAllocationRequestStatusData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaAllocationRequestStatusData.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaAllocationRequestStatusData.cs new file mode 100644 index 0000000000000..6e66bb90c55e0 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaAllocationRequestStatusData.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A class representing the QuotaAllocationRequestStatus data model. + /// The subscription quota allocation status. + /// + public partial class QuotaAllocationRequestStatusData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public QuotaAllocationRequestStatusData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The new quota request allocated to subscription. + /// The request submission time. The date conforms to the following format specified by the ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ. + /// Request status. + /// Details of the failure. + /// Keeps track of any properties unknown to the library. + internal QuotaAllocationRequestStatusData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, QuotaAllocationRequestBase requestedResource, DateTimeOffset? requestSubmittedOn, QuotaRequestStatus? provisioningState, string faultCode, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + RequestedResource = requestedResource; + RequestSubmittedOn = requestSubmittedOn; + ProvisioningState = provisioningState; + FaultCode = faultCode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The new quota request allocated to subscription. + [WirePath("properties.requestedResource")] + public QuotaAllocationRequestBase RequestedResource { get; set; } + /// The request submission time. The date conforms to the following format specified by the ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ. + [WirePath("properties.requestSubmitTime")] + public DateTimeOffset? RequestSubmittedOn { get; } + /// Request status. + [WirePath("properties.provisioningState")] + public QuotaRequestStatus? ProvisioningState { get; } + /// Details of the failure. + [WirePath("properties.faultCode")] + public string FaultCode { get; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaAllocationRequestStatusResource.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaAllocationRequestStatusResource.Serialization.cs new file mode 100644 index 0000000000000..d6c20058efcd2 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaAllocationRequestStatusResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Quota +{ + public partial class QuotaAllocationRequestStatusResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + QuotaAllocationRequestStatusData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + QuotaAllocationRequestStatusData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaAllocationRequestStatusResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaAllocationRequestStatusResource.cs new file mode 100644 index 0000000000000..a0e1ed92dc61b --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaAllocationRequestStatusResource.cs @@ -0,0 +1,172 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ManagementGroups; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A Class representing a QuotaAllocationRequestStatus 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 GetQuotaAllocationRequestStatusResource method. + /// Otherwise you can get one from its parent resource using the GetQuotaAllocationRequestStatus method. + /// + public partial class QuotaAllocationRequestStatusResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The managementGroupId. + /// The subscriptionId. + /// The groupQuotaName. + /// The allocationId. + public static ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string subscriptionId, string groupQuotaName, string allocationId) + { + var resourceId = $"/providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics; + private readonly GroupQuotaSubscriptionAllocationRequestRestOperations _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient; + private readonly QuotaAllocationRequestStatusData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Quota/groupQuotas/quotaAllocationRequests"; + + /// Initializes a new instance of the class for mocking. + protected QuotaAllocationRequestStatusResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal QuotaAllocationRequestStatusResource(ArmClient client, QuotaAllocationRequestStatusData 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 QuotaAllocationRequestStatusResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestApiVersion); + _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient = new GroupQuotaSubscriptionAllocationRequestRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual QuotaAllocationRequestStatusData 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 the quota allocation request status for the subscriptionId by allocationId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics.CreateScope("QuotaAllocationRequestStatusResource.Get"); + scope.Start(); + try + { + var response = await _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.GetAsync(Id.Parent.Parent.Parent.Name, 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 QuotaAllocationRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the quota allocation request status for the subscriptionId by allocationId. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocationRequest_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestClientDiagnostics.CreateScope("QuotaAllocationRequestStatusResource.Get"); + scope.Start(); + try + { + var response = _quotaAllocationRequestStatusGroupQuotaSubscriptionAllocationRequestRestClient.Get(Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new QuotaAllocationRequestStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailCollection.cs index 0fbbbb7688dff..8c47589fdcc26 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailCollection.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailCollection.cs @@ -54,7 +54,7 @@ internal QuotaRequestDetailCollection(ArmClient client, ResourceIdentifier id) : /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -99,7 +99,7 @@ public virtual async Task> GetAsync(string /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -144,7 +144,7 @@ public virtual Response Get(string id, CancellationT /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -185,7 +185,7 @@ public virtual AsyncPageable GetAllAsync(string filt /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -226,7 +226,7 @@ public virtual Pageable GetAll(string filter = null, /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -269,7 +269,7 @@ public virtual async Task> ExistsAsync(string id, CancellationTok /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Response Exists(string id, CancellationToken cancellationTo /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -357,7 +357,7 @@ public virtual async Task> GetIfExi /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailData.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailData.Serialization.cs index 30c2c6f57c2f4..78a0db04277aa 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailData.Serialization.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailData.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; using Azure.ResourceManager.Models; @@ -233,6 +235,169 @@ internal static QuotaRequestDetailData DeserializeQuotaRequestDetailData(JsonEle serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Message), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" message: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Message)) + { + builder.Append(" message: "); + if (Message.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Message}'''"); + } + else + { + builder.AppendLine($"'{Message}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Error), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" error: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Error)) + { + builder.Append(" error: "); + BicepSerializationHelpers.AppendChildObject(builder, Error, options, 4, false, " error: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequestSubmitOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" requestSubmitTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RequestSubmitOn)) + { + builder.Append(" requestSubmitTime: "); + var formattedDateTimeString = TypeFormatters.ToString(RequestSubmitOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -241,6 +406,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(QuotaRequestDetailData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailData.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailData.cs index 9177308b329a4..3c38156d5f218 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailData.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailData.cs @@ -79,14 +79,19 @@ internal QuotaRequestDetailData(ResourceIdentifier id, string name, ResourceType } /// The quota request status. + [WirePath("properties.provisioningState")] public QuotaRequestState? ProvisioningState { get; } /// User-friendly status message. + [WirePath("properties.message")] public string Message { get; } /// Error details of the quota request. + [WirePath("properties.error")] public ServiceErrorDetail Error { get; } /// The quota request submission time. The date conforms to the following format specified by the ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ. + [WirePath("properties.requestSubmitTime")] public DateTimeOffset? RequestSubmitOn { get; } /// Quota request details. + [WirePath("properties.value")] public IReadOnlyList Value { get; } } } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailResource.cs index fc1201cb5b2e3..c94bde1be1681 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailResource.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailResource.cs @@ -99,7 +99,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource @@ -139,7 +139,7 @@ public virtual async Task> GetAsync(Cancell /// /// /// Default Api Version - /// 2023-02-01 + /// 2023-06-01-preview /// /// /// Resource diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaLimitsRequestRestOperations.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaLimitsRequestRestOperations.cs new file mode 100644 index 0000000000000..b57c7f499eb38 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaLimitsRequestRestOperations.cs @@ -0,0 +1,561 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + internal partial class GroupQuotaLimitsRequestRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GroupQuotaLimitsRequestRestOperations. + /// 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 GroupQuotaLimitsRequestRestOperations(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 RequestUriBuilder CreateCreateOrUpdateRequestUri(string managementGroupId, string groupQuotaName, string resourceProviderName, string resourceName, GroupQuotaRequestStatusData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/groupQuotaRequests/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string managementGroupId, string groupQuotaName, string resourceProviderName, string resourceName, GroupQuotaRequestStatusData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/groupQuotaRequests/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (data != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// + /// Put the GroupQuota requests for a specific ResourceProvider/Location/Resource. the location and resourceName ("name": {"value" : "resourceName") properties are specified in the request body. Only 1 resource quota can be requested. + /// Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// The GroupQuotaRequest body details for specific resourceProvider/location/resources. + /// 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 managementGroupId, string groupQuotaName, string resourceProviderName, string resourceName, GroupQuotaRequestStatusData data = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateCreateOrUpdateRequest(managementGroupId, groupQuotaName, resourceProviderName, resourceName, 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); + } + } + + /// + /// Put the GroupQuota requests for a specific ResourceProvider/Location/Resource. the location and resourceName ("name": {"value" : "resourceName") properties are specified in the request body. Only 1 resource quota can be requested. + /// Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// The GroupQuotaRequest body details for specific resourceProvider/location/resources. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string managementGroupId, string groupQuotaName, string resourceProviderName, string resourceName, GroupQuotaRequestStatusData data = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateCreateOrUpdateRequest(managementGroupId, groupQuotaName, resourceProviderName, resourceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string managementGroupId, string groupQuotaName, string resourceProviderName, string resourceName, GroupQuotaRequestStatusData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/groupQuotaRequests/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string managementGroupId, string groupQuotaName, string resourceProviderName, string resourceName, GroupQuotaRequestStatusData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/groupQuotaRequests/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (data != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// + /// Create the GroupQuota requests for a specific ResourceProvider/Location/Resource. the location and resourceName properties are specified in the request body. Only 1 resource quota can be requested. Please note that patch request creates a new groupQuota request. + /// Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// The GroupQuotaRequest body details for specific resourceProvider/location/resources. + /// 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 managementGroupId, string groupQuotaName, string resourceProviderName, string resourceName, GroupQuotaRequestStatusData data = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateUpdateRequest(managementGroupId, groupQuotaName, resourceProviderName, resourceName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// + /// Create the GroupQuota requests for a specific ResourceProvider/Location/Resource. the location and resourceName properties are specified in the request body. Only 1 resource quota can be requested. Please note that patch request creates a new groupQuota request. + /// Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// The GroupQuotaRequest body details for specific resourceProvider/location/resources. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string managementGroupId, string groupQuotaName, string resourceProviderName, string resourceName, GroupQuotaRequestStatusData data = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateUpdateRequest(managementGroupId, groupQuotaName, resourceProviderName, resourceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string managementGroupId, string groupQuotaName, string requestId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/groupQuotaRequests/", false); + uri.AppendPath(requestId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string managementGroupId, string groupQuotaName, string requestId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/groupQuotaRequests/", false); + uri.AppendPath(requestId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get API to check the status of a GroupQuota request by requestId. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// 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 managementGroupId, string groupQuotaName, string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var message = CreateGetRequest(managementGroupId, groupQuotaName, requestId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaRequestStatusData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotaRequestStatusData.DeserializeGroupQuotaRequestStatusData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GroupQuotaRequestStatusData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get API to check the status of a GroupQuota request by requestId. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string managementGroupId, string groupQuotaName, string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var message = CreateGetRequest(managementGroupId, groupQuotaName, requestId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaRequestStatusData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotaRequestStatusData.DeserializeGroupQuotaRequestStatusData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GroupQuotaRequestStatusData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListRequestUri(string managementGroupId, string groupQuotaName, string resourceProviderName, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/groupQuotaRequests", false); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("$filter", filter, true); + return uri; + } + + internal HttpMessage CreateListRequest(string managementGroupId, string groupQuotaName, string resourceProviderName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/groupQuotaRequests", false); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get API to check the status of a GroupQuota request by requestId. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} and resource eq {resourceName} + /// Example: $filter=location eq eastus and resourceName eq cores + /// + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string managementGroupId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListRequest(managementGroupId, groupQuotaName, resourceProviderName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubmittedResourceRequestStatusList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubmittedResourceRequestStatusList.DeserializeSubmittedResourceRequestStatusList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get API to check the status of a GroupQuota request by requestId. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} and resource eq {resourceName} + /// Example: $filter=location eq eastus and resourceName eq cores + /// + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string managementGroupId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListRequest(managementGroupId, groupQuotaName, resourceProviderName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubmittedResourceRequestStatusList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubmittedResourceRequestStatusList.DeserializeSubmittedResourceRequestStatusList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName, string filter) + { + 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 API to check the status of a GroupQuota request by requestId. + /// The URL to the next page of results. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} and resource eq {resourceName} + /// Example: $filter=location eq eastus and resourceName eq cores + /// + /// The cancellation token to use. + /// , , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, groupQuotaName, resourceProviderName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubmittedResourceRequestStatusList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubmittedResourceRequestStatusList.DeserializeSubmittedResourceRequestStatusList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get API to check the status of a GroupQuota request by requestId. + /// The URL to the next page of results. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} and resource eq {resourceName} + /// Example: $filter=location eq eastus and resourceName eq cores + /// + /// The cancellation token to use. + /// , , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, groupQuotaName, resourceProviderName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubmittedResourceRequestStatusList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubmittedResourceRequestStatusList.DeserializeSubmittedResourceRequestStatusList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaLimitsRestOperations.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaLimitsRestOperations.cs new file mode 100644 index 0000000000000..0490549ae97da --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaLimitsRestOperations.cs @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + internal partial class GroupQuotaLimitsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GroupQuotaLimitsRestOperations. + /// 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 GroupQuotaLimitsRestOperations(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 RequestUriBuilder CreateGetRequestUri(string managementGroupId, string groupQuotaName, string resourceProviderName, string resourceName, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/groupQuotaLimits/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("$filter", filter, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string managementGroupId, string groupQuotaName, string resourceProviderName, string resourceName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/groupQuotaLimits/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// + /// Gets the GroupQuotaLimits for the specific resource for a specific resource based on the resourceProviders, resourceName and $filter passed. + /// The $filter=location eq {location} is required to location specific resources groupQuota. + /// + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// 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 managementGroupId, string groupQuotaName, string resourceProviderName, string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateGetRequest(managementGroupId, groupQuotaName, resourceProviderName, resourceName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaLimitData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotaLimitData.DeserializeGroupQuotaLimitData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GroupQuotaLimitData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// + /// Gets the GroupQuotaLimits for the specific resource for a specific resource based on the resourceProviders, resourceName and $filter passed. + /// The $filter=location eq {location} is required to location specific resources groupQuota. + /// + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string managementGroupId, string groupQuotaName, string resourceProviderName, string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateGetRequest(managementGroupId, groupQuotaName, resourceProviderName, resourceName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaLimitData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotaLimitData.DeserializeGroupQuotaLimitData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GroupQuotaLimitData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListRequestUri(string managementGroupId, string groupQuotaName, string resourceProviderName, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/groupQuotaLimits", false); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("$filter", filter, true); + return uri; + } + + internal HttpMessage CreateListRequest(string managementGroupId, string groupQuotaName, string resourceProviderName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/groupQuotaLimits", false); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// + /// Gets the GroupQuotaLimits for the all resource for a specific resourceProvider and $filter passed. + /// The $filter=location eq {location} is required to location specific resources groupQuota. + /// + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string managementGroupId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListRequest(managementGroupId, groupQuotaName, resourceProviderName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaLimitList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotaLimitList.DeserializeGroupQuotaLimitList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// + /// Gets the GroupQuotaLimits for the all resource for a specific resourceProvider and $filter passed. + /// The $filter=location eq {location} is required to location specific resources groupQuota. + /// + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string managementGroupId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListRequest(managementGroupId, groupQuotaName, resourceProviderName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaLimitList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotaLimitList.DeserializeGroupQuotaLimitList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName, string filter) + { + 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; + } + + /// + /// Gets the GroupQuotaLimits for the all resource for a specific resourceProvider and $filter passed. + /// The $filter=location eq {location} is required to location specific resources groupQuota. + /// + /// The URL to the next page of results. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, groupQuotaName, resourceProviderName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaLimitList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotaLimitList.DeserializeGroupQuotaLimitList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// + /// Gets the GroupQuotaLimits for the all resource for a specific resourceProvider and $filter passed. + /// The $filter=location eq {location} is required to location specific resources groupQuota. + /// + /// The URL to the next page of results. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, groupQuotaName, resourceProviderName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaLimitList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotaLimitList.DeserializeGroupQuotaLimitList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaLocationSettingsRestOperations.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaLocationSettingsRestOperations.cs new file mode 100644 index 0000000000000..598a32a10d11d --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaLocationSettingsRestOperations.cs @@ -0,0 +1,539 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + internal partial class GroupQuotaLocationSettingsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GroupQuotaLocationSettingsRestOperations. + /// 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 GroupQuotaLocationSettingsRestOperations(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 RequestUriBuilder CreateCreateOrUpdateRequestUri(string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location, GroupQuotaEnforcementData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/locationSettings/", false); + uri.AppendPath(location, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location, GroupQuotaEnforcementData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/locationSettings/", false); + uri.AppendPath(location, 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, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// + /// Enables the GroupQuotas enforcement for the resource provider and the location specified. The resource provider will start using the group quotas as the overall quota for the subscriptions included in the GroupQuota. The subscriptions cannot request quota at subscription level. + /// The subscriptions share the GroupQuotaLimits assigned to the GroupQuota. If the GroupQuotaLimits is used, then submit a groupQuotaLimit request for the specific resource - provider/location/resource. + /// Once the GroupQuota Enforcement is enabled then, it cannot be deleted or reverted back. To disable GroupQuota Enforcement - + /// 1. Remove all the subscriptions from the groupQuota using the delete API for Subscriptions (Check the example - GroupQuotaSubscriptions_Delete). + /// 2. Ten delete the GroupQuota (Check the example - GroupQuotas_Delete). + /// + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The name of the Azure region. + /// The GroupQuota body details for creation or update of a GroupQuota entity. + /// 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 managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location, GroupQuotaEnforcementData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(managementGroupId, groupQuotaName, resourceProviderName, location, 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); + } + } + + /// + /// Enables the GroupQuotas enforcement for the resource provider and the location specified. The resource provider will start using the group quotas as the overall quota for the subscriptions included in the GroupQuota. The subscriptions cannot request quota at subscription level. + /// The subscriptions share the GroupQuotaLimits assigned to the GroupQuota. If the GroupQuotaLimits is used, then submit a groupQuotaLimit request for the specific resource - provider/location/resource. + /// Once the GroupQuota Enforcement is enabled then, it cannot be deleted or reverted back. To disable GroupQuota Enforcement - + /// 1. Remove all the subscriptions from the groupQuota using the delete API for Subscriptions (Check the example - GroupQuotaSubscriptions_Delete). + /// 2. Ten delete the GroupQuota (Check the example - GroupQuotas_Delete). + /// + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The name of the Azure region. + /// The GroupQuota body details for creation or update of a GroupQuota entity. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location, GroupQuotaEnforcementData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(managementGroupId, groupQuotaName, resourceProviderName, location, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location, GroupQuotaEnforcementData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/locationSettings/", false); + uri.AppendPath(location, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location, GroupQuotaEnforcementData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/locationSettings/", false); + uri.AppendPath(location, 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, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// + /// Enables the GroupQuotas enforcement for the resource provider and the location specified. The resource provider will start using the group quotas as the overall quota for the subscriptions included in the GroupQuota. The subscriptions cannot request quota at subscription level. + /// The subscriptions share the GroupQuotaLimits assigned to the GroupQuota. If the GroupQuotaLimits is used, then submit a groupQuotaLimit request for the specific resource - provider/location/resource. + /// Once the GroupQuota Enforcement is enabled then, it cannot be deleted or reverted back. To disable GroupQuota Enforcement - + /// 1. Remove all the subscriptions from the groupQuota using the delete API for Subscriptions (Check the example - GroupQuotaSubscriptions_Delete). + /// 2. Ten delete the GroupQuota (Check the example - GroupQuotas_Delete). + /// + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The name of the Azure region. + /// The GroupQuota body details for creation or update of a GroupQuota entity. + /// 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 managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location, GroupQuotaEnforcementData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(managementGroupId, groupQuotaName, resourceProviderName, location, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// + /// Enables the GroupQuotas enforcement for the resource provider and the location specified. The resource provider will start using the group quotas as the overall quota for the subscriptions included in the GroupQuota. The subscriptions cannot request quota at subscription level. + /// The subscriptions share the GroupQuotaLimits assigned to the GroupQuota. If the GroupQuotaLimits is used, then submit a groupQuotaLimit request for the specific resource - provider/location/resource. + /// Once the GroupQuota Enforcement is enabled then, it cannot be deleted or reverted back. To disable GroupQuota Enforcement - + /// 1. Remove all the subscriptions from the groupQuota using the delete API for Subscriptions (Check the example - GroupQuotaSubscriptions_Delete). + /// 2. Ten delete the GroupQuota (Check the example - GroupQuotas_Delete). + /// + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The name of the Azure region. + /// The GroupQuota body details for creation or update of a GroupQuota entity. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location, GroupQuotaEnforcementData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(managementGroupId, groupQuotaName, resourceProviderName, location, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/locationSettings/", false); + uri.AppendPath(location, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/locationSettings/", false); + uri.AppendPath(location, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the GroupQuotas enforcement settings for the ResourceProvider/location. The locations, where GroupQuota enforcement is not enabled will return Not Found. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The name of the Azure region. + /// 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 managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + + using var message = CreateGetRequest(managementGroupId, groupQuotaName, resourceProviderName, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaEnforcementData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotaEnforcementData.DeserializeGroupQuotaEnforcementData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GroupQuotaEnforcementData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the GroupQuotas enforcement settings for the ResourceProvider/location. The locations, where GroupQuota enforcement is not enabled will return Not Found. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The name of the Azure region. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + + using var message = CreateGetRequest(managementGroupId, groupQuotaName, resourceProviderName, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaEnforcementData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotaEnforcementData.DeserializeGroupQuotaEnforcementData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GroupQuotaEnforcementData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListRequestUri(string managementGroupId, string groupQuotaName, string resourceProviderName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/locationSettings", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string managementGroupId, string groupQuotaName, string resourceProviderName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/locationSettings", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns only the list of the Azure regions settings, where the GroupQuotas enforcement is enabled. The locations not included in GroupQuota Enforcement will not be listed, the regions in failed status with listed as status Failed. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string managementGroupId, string groupQuotaName, string resourceProviderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + + using var message = CreateListRequest(managementGroupId, groupQuotaName, resourceProviderName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotasEnforcementListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotasEnforcementListResponse.DeserializeGroupQuotasEnforcementListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns only the list of the Azure regions settings, where the GroupQuotas enforcement is enabled. The locations not included in GroupQuota Enforcement will not be listed, the regions in failed status with listed as status Failed. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string managementGroupId, string groupQuotaName, string resourceProviderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + + using var message = CreateListRequest(managementGroupId, groupQuotaName, resourceProviderName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotasEnforcementListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotasEnforcementListResponse.DeserializeGroupQuotasEnforcementListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName) + { + 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; + } + + /// Returns only the list of the Azure regions settings, where the GroupQuotas enforcement is enabled. The locations not included in GroupQuota Enforcement will not be listed, the regions in failed status with listed as status Failed. + /// The URL to the next page of results. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, groupQuotaName, resourceProviderName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotasEnforcementListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotasEnforcementListResponse.DeserializeGroupQuotasEnforcementListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns only the list of the Azure regions settings, where the GroupQuotas enforcement is enabled. The locations not included in GroupQuota Enforcement will not be listed, the regions in failed status with listed as status Failed. + /// The URL to the next page of results. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, groupQuotaName, resourceProviderName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotasEnforcementListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotasEnforcementListResponse.DeserializeGroupQuotasEnforcementListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaSubscriptionAllocationRequestRestOperations.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaSubscriptionAllocationRequestRestOperations.cs new file mode 100644 index 0000000000000..58bbc0c7ec22a --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaSubscriptionAllocationRequestRestOperations.cs @@ -0,0 +1,583 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + internal partial class GroupQuotaSubscriptionAllocationRequestRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GroupQuotaSubscriptionAllocationRequestRestOperations. + /// 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 GroupQuotaSubscriptionAllocationRequestRestOperations(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 RequestUriBuilder CreateGetRequestUri(string managementGroupId, string subscriptionId, string groupQuotaName, string allocationId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/quotaAllocationRequests/", false); + uri.AppendPath(allocationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string managementGroupId, string subscriptionId, string groupQuotaName, string allocationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/quotaAllocationRequests/", false); + uri.AppendPath(allocationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the quota allocation request status for the subscriptionId by allocationId. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// 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 managementGroupId, string subscriptionId, string groupQuotaName, string allocationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(allocationId, nameof(allocationId)); + + using var message = CreateGetRequest(managementGroupId, subscriptionId, groupQuotaName, allocationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + QuotaAllocationRequestStatusData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = QuotaAllocationRequestStatusData.DeserializeQuotaAllocationRequestStatusData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((QuotaAllocationRequestStatusData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the quota allocation request status for the subscriptionId by allocationId. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string managementGroupId, string subscriptionId, string groupQuotaName, string allocationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(allocationId, nameof(allocationId)); + + using var message = CreateGetRequest(managementGroupId, subscriptionId, groupQuotaName, allocationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + QuotaAllocationRequestStatusData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = QuotaAllocationRequestStatusData.DeserializeQuotaAllocationRequestStatusData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((QuotaAllocationRequestStatusData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListRequestUri(string managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/quotaAllocationRequests", false); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("$filter", filter, true); + return uri; + } + + internal HttpMessage CreateListRequest(string managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/quotaAllocationRequests", false); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all the quotaAllocationRequests for a resourceProvider/location. The filter paramter for location is required. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListRequest(managementGroupId, subscriptionId, groupQuotaName, resourceProviderName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + QuotaAllocationRequestStatusList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = QuotaAllocationRequestStatusList.DeserializeQuotaAllocationRequestStatusList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the quotaAllocationRequests for a resourceProvider/location. The filter paramter for location is required. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response List(string managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListRequest(managementGroupId, subscriptionId, groupQuotaName, resourceProviderName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + QuotaAllocationRequestStatusList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = QuotaAllocationRequestStatusList.DeserializeQuotaAllocationRequestStatusList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/quotaAllocationRequests/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/quotaAllocationRequests/", false); + uri.AppendPath(resourceName, 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, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Request to assign quota from group quota to a specific Subscription. The assign GroupQuota to subscriptions or reduce the quota allocated to subscription to give back the unused quota ( quota >= usages) to the groupQuota. So, this API can be used to assign Quota to subscriptions and assign back unused quota to group quota, which can be assigned to another subscriptions in the GroupQuota. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// Quota requests payload. + /// 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 managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(managementGroupId, subscriptionId, groupQuotaName, resourceProviderName, resourceName, 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); + } + } + + /// Request to assign quota from group quota to a specific Subscription. The assign GroupQuota to subscriptions or reduce the quota allocated to subscription to give back the unused quota ( quota >= usages) to the groupQuota. So, this API can be used to assign Quota to subscriptions and assign back unused quota to group quota, which can be assigned to another subscriptions in the GroupQuota. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// Quota requests payload. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(managementGroupId, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/quotaAllocationRequests/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/quotaAllocationRequests/", false); + uri.AppendPath(resourceName, 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, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Request to assign quota from group quota to a specific Subscription. The assign GroupQuota to subscriptions or reduce the quota allocated to subscription to give back the unused quota ( quota >= usages) to the groupQuota. So, this API can be used to assign Quota to subscriptions and assign back unused quota to group quota, which can be assigned to another subscriptions in the GroupQuota. User can collect unused quotas from multiple subscriptions within the groupQuota and assign the groupQuota to the subscription, where it's needed. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// Quota requests payload. + /// 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 managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(managementGroupId, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Request to assign quota from group quota to a specific Subscription. The assign GroupQuota to subscriptions or reduce the quota allocated to subscription to give back the unused quota ( quota >= usages) to the groupQuota. So, this API can be used to assign Quota to subscriptions and assign back unused quota to group quota, which can be assigned to another subscriptions in the GroupQuota. User can collect unused quotas from multiple subscriptions within the groupQuota and assign the groupQuota to the subscription, where it's needed. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// Resource name. + /// Quota requests payload. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string resourceName, QuotaAllocationRequestStatusData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(managementGroupId, subscriptionId, groupQuotaName, resourceProviderName, resourceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string filter) + { + 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 quotaAllocationRequests for a resourceProvider/location. The filter paramter for location is required. + /// The URL to the next page of results. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, subscriptionId, groupQuotaName, resourceProviderName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + QuotaAllocationRequestStatusList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = QuotaAllocationRequestStatusList.DeserializeQuotaAllocationRequestStatusList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the quotaAllocationRequests for a resourceProvider/location. The filter paramter for location is required. + /// The URL to the next page of results. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string managementGroupId, string subscriptionId, string groupQuotaName, string resourceProviderName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, subscriptionId, groupQuotaName, resourceProviderName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + QuotaAllocationRequestStatusList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = QuotaAllocationRequestStatusList.DeserializeQuotaAllocationRequestStatusList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaSubscriptionAllocationRestOperations.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaSubscriptionAllocationRestOperations.cs new file mode 100644 index 0000000000000..2e074d82fb6d1 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaSubscriptionAllocationRestOperations.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + internal partial class GroupQuotaSubscriptionAllocationRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GroupQuotaSubscriptionAllocationRestOperations. + /// 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 GroupQuotaSubscriptionAllocationRestOperations(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 RequestUriBuilder CreateListRequestUri(string managementGroupId, string subscriptionId, string groupQuotaName, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/quotaAllocations", false); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("$filter", filter, true); + return uri; + } + + internal HttpMessage CreateListRequest(string managementGroupId, string subscriptionId, string groupQuotaName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/quotaAllocations", false); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets all the quota allocated to a subscription for the specific Resource Provider, Location. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. Use the $filter parameter to filter out the specific resource based on the ResourceProvider/Location. $filter is a required parameter. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string managementGroupId, string subscriptionId, string groupQuotaName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListRequest(managementGroupId, subscriptionId, groupQuotaName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionQuotaAllocationsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionQuotaAllocationsList.DeserializeSubscriptionQuotaAllocationsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all the quota allocated to a subscription for the specific Resource Provider, Location. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. Use the $filter parameter to filter out the specific resource based on the ResourceProvider/Location. $filter is a required parameter. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string managementGroupId, string subscriptionId, string groupQuotaName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListRequest(managementGroupId, subscriptionId, groupQuotaName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionQuotaAllocationsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionQuotaAllocationsList.DeserializeSubscriptionQuotaAllocationsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string managementGroupId, string subscriptionId, string groupQuotaName, string resourceName, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/quotaAllocations/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("$filter", filter, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string managementGroupId, string subscriptionId, string groupQuotaName, string resourceName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/quotaAllocations/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("$filter", filter, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets Quota allocated to a subscription for the specific Resource Provider, Location, ResourceName. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// 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 managementGroupId, string subscriptionId, string groupQuotaName, string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateGetRequest(managementGroupId, subscriptionId, groupQuotaName, resourceName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionQuotaAllocationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionQuotaAllocationData.DeserializeSubscriptionQuotaAllocationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SubscriptionQuotaAllocationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets Quota allocated to a subscription for the specific Resource Provider, Location, ResourceName. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string managementGroupId, string subscriptionId, string groupQuotaName, string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateGetRequest(managementGroupId, subscriptionId, groupQuotaName, resourceName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionQuotaAllocationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionQuotaAllocationData.DeserializeSubscriptionQuotaAllocationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SubscriptionQuotaAllocationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string managementGroupId, string subscriptionId, string groupQuotaName, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string managementGroupId, string subscriptionId, string groupQuotaName, string filter) + { + 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; + } + + /// Gets all the quota allocated to a subscription for the specific Resource Provider, Location. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. Use the $filter parameter to filter out the specific resource based on the ResourceProvider/Location. $filter is a required parameter. + /// The URL to the next page of results. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string managementGroupId, string subscriptionId, string groupQuotaName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, subscriptionId, groupQuotaName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionQuotaAllocationsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionQuotaAllocationsList.DeserializeSubscriptionQuotaAllocationsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all the quota allocated to a subscription for the specific Resource Provider, Location. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. Use the $filter parameter to filter out the specific resource based on the ResourceProvider/Location. $filter is a required parameter. + /// The URL to the next page of results. + /// Management Group Id. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// , , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string managementGroupId, string subscriptionId, string groupQuotaName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, subscriptionId, groupQuotaName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionQuotaAllocationsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionQuotaAllocationsList.DeserializeSubscriptionQuotaAllocationsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaSubscriptionRequestsRestOperations.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaSubscriptionRequestsRestOperations.cs new file mode 100644 index 0000000000000..a10af485b4d17 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaSubscriptionRequestsRestOperations.cs @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + internal partial class GroupQuotaSubscriptionRequestsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GroupQuotaSubscriptionRequestsRestOperations. + /// 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 GroupQuotaSubscriptionRequestsRestOperations(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 RequestUriBuilder CreateListRequestUri(string managementGroupId, string groupQuotaName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/subscriptionRequests", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string managementGroupId, string groupQuotaName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/subscriptionRequests", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 year. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string managementGroupId, string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var message = CreateListRequest(managementGroupId, groupQuotaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaSubscriptionRequestStatusList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotaSubscriptionRequestStatusList.DeserializeGroupQuotaSubscriptionRequestStatusList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 year. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response List(string managementGroupId, string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var message = CreateListRequest(managementGroupId, groupQuotaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaSubscriptionRequestStatusList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotaSubscriptionRequestStatusList.DeserializeGroupQuotaSubscriptionRequestStatusList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string managementGroupId, string groupQuotaName, string requestId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/subscriptionRequests/", false); + uri.AppendPath(requestId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string managementGroupId, string groupQuotaName, string requestId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/subscriptionRequests/", false); + uri.AppendPath(requestId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// 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 managementGroupId, string groupQuotaName, string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var message = CreateGetRequest(managementGroupId, groupQuotaName, requestId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaSubscriptionRequestStatusData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotaSubscriptionRequestStatusData.DeserializeGroupQuotaSubscriptionRequestStatusData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GroupQuotaSubscriptionRequestStatusData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate status. This API provides the finals status with the request details and status. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// Request Id. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string managementGroupId, string groupQuotaName, string requestId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(requestId, nameof(requestId)); + + using var message = CreateGetRequest(managementGroupId, groupQuotaName, requestId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaSubscriptionRequestStatusData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotaSubscriptionRequestStatusData.DeserializeGroupQuotaSubscriptionRequestStatusData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GroupQuotaSubscriptionRequestStatusData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string managementGroupId, string groupQuotaName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string managementGroupId, string groupQuotaName) + { + 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 API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 year. + /// The URL to the next page of results. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string managementGroupId, string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, groupQuotaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaSubscriptionRequestStatusList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotaSubscriptionRequestStatusList.DeserializeGroupQuotaSubscriptionRequestStatusList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 year. + /// The URL to the next page of results. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string managementGroupId, string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, groupQuotaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaSubscriptionRequestStatusList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotaSubscriptionRequestStatusList.DeserializeGroupQuotaSubscriptionRequestStatusList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaSubscriptionsRestOperations.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaSubscriptionsRestOperations.cs new file mode 100644 index 0000000000000..a83e42b124c60 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaSubscriptionsRestOperations.cs @@ -0,0 +1,553 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + internal partial class GroupQuotaSubscriptionsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GroupQuotaSubscriptionsRestOperations. + /// 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 GroupQuotaSubscriptionsRestOperations(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 RequestUriBuilder CreateCreateOrUpdateRequestUri(string managementGroupId, string groupQuotaName, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string managementGroupId, string groupQuotaName, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Adds a subscription to GroupQuotas. The subscriptions will be validated based on the additionalAttributes defined in the GroupQuota. The additionalAttributes works as filter for the subscriptions, which can be included in the GroupQuotas. The request's TenantId is validated against the subscription's TenantId. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The ID of the target subscription. The value must be an UUID. + /// 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 managementGroupId, string groupQuotaName, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateCreateOrUpdateRequest(managementGroupId, groupQuotaName, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds a subscription to GroupQuotas. The subscriptions will be validated based on the additionalAttributes defined in the GroupQuota. The additionalAttributes works as filter for the subscriptions, which can be included in the GroupQuotas. The request's TenantId is validated against the subscription's TenantId. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string managementGroupId, string groupQuotaName, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateCreateOrUpdateRequest(managementGroupId, groupQuotaName, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string managementGroupId, string groupQuotaName, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string managementGroupId, string groupQuotaName, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Updates the GroupQuotas with the subscription to add to the subscriptions list. The subscriptions will be validated if additionalAttributes are defined in the GroupQuota. The request's TenantId is validated against the subscription's TenantId. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The ID of the target subscription. The value must be an UUID. + /// 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 managementGroupId, string groupQuotaName, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateUpdateRequest(managementGroupId, groupQuotaName, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the GroupQuotas with the subscription to add to the subscriptions list. The subscriptions will be validated if additionalAttributes are defined in the GroupQuota. The request's TenantId is validated against the subscription's TenantId. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string managementGroupId, string groupQuotaName, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateUpdateRequest(managementGroupId, groupQuotaName, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string managementGroupId, string groupQuotaName, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string managementGroupId, string groupQuotaName, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Removes the subscription from GroupQuotas. The request's TenantId is validated against the subscription's TenantId. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The ID of the target subscription. The value must be an UUID. + /// 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 managementGroupId, string groupQuotaName, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateDeleteRequest(managementGroupId, groupQuotaName, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Removes the subscription from GroupQuotas. The request's TenantId is validated against the subscription's TenantId. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string managementGroupId, string groupQuotaName, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateDeleteRequest(managementGroupId, groupQuotaName, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string managementGroupId, string groupQuotaName, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string managementGroupId, string groupQuotaName, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns the subscriptionIds along with its provisioning state for being associated with the GroupQuota. If the subscription is not a member of GroupQuota, it will return 404, else 200. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The ID of the target subscription. The value must be an UUID. + /// 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 managementGroupId, string groupQuotaName, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateGetRequest(managementGroupId, groupQuotaName, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaSubscriptionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotaSubscriptionData.DeserializeGroupQuotaSubscriptionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GroupQuotaSubscriptionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns the subscriptionIds along with its provisioning state for being associated with the GroupQuota. If the subscription is not a member of GroupQuota, it will return 404, else 200. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string managementGroupId, string groupQuotaName, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateGetRequest(managementGroupId, groupQuotaName, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaSubscriptionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotaSubscriptionData.DeserializeGroupQuotaSubscriptionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GroupQuotaSubscriptionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListRequestUri(string managementGroupId, string groupQuotaName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/subscriptions", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string managementGroupId, string groupQuotaName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/subscriptions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns a list of the subscriptionIds associated with the GroupQuotas. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string managementGroupId, string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var message = CreateListRequest(managementGroupId, groupQuotaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaSubscriptionIdList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotaSubscriptionIdList.DeserializeGroupQuotaSubscriptionIdList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns a list of the subscriptionIds associated with the GroupQuotas. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response List(string managementGroupId, string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var message = CreateListRequest(managementGroupId, groupQuotaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaSubscriptionIdList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotaSubscriptionIdList.DeserializeGroupQuotaSubscriptionIdList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string managementGroupId, string groupQuotaName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string managementGroupId, string groupQuotaName) + { + 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; + } + + /// Returns a list of the subscriptionIds associated with the GroupQuotas. + /// The URL to the next page of results. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string managementGroupId, string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, groupQuotaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaSubscriptionIdList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotaSubscriptionIdList.DeserializeGroupQuotaSubscriptionIdList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns a list of the subscriptionIds associated with the GroupQuotas. + /// The URL to the next page of results. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string managementGroupId, string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, groupQuotaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaSubscriptionIdList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotaSubscriptionIdList.DeserializeGroupQuotaSubscriptionIdList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaUsagesRestOperations.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaUsagesRestOperations.cs new file mode 100644 index 0000000000000..e1480ff342427 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotaUsagesRestOperations.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + internal partial class GroupQuotaUsagesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GroupQuotaUsagesRestOperations. + /// 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 GroupQuotaUsagesRestOperations(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 RequestUriBuilder CreateListRequestUri(string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/locationUsages/", false); + uri.AppendPath(location, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendPath("/resourceProviders/", false); + uri.AppendPath(resourceProviderName, true); + uri.AppendPath("/locationUsages/", false); + uri.AppendPath(location, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the GroupQuotas usages and limits(quota). Location is required paramter. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The name of the Azure region. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + + using var message = CreateListRequest(managementGroupId, groupQuotaName, resourceProviderName, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceUsageList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResourceUsageList.DeserializeResourceUsageList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the GroupQuotas usages and limits(quota). Location is required paramter. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The name of the Azure region. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + + using var message = CreateListRequest(managementGroupId, groupQuotaName, resourceProviderName, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceUsageList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResourceUsageList.DeserializeResourceUsageList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location) + { + 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; + } + + /// Gets the GroupQuotas usages and limits(quota). Location is required paramter. + /// The URL to the next page of results. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The name of the Azure region. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, groupQuotaName, resourceProviderName, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceUsageList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResourceUsageList.DeserializeResourceUsageList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the GroupQuotas usages and limits(quota). Location is required paramter. + /// The URL to the next page of results. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource provider supports this API. + /// The name of the Azure region. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string managementGroupId, string groupQuotaName, string resourceProviderName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNullOrEmpty(resourceProviderName, nameof(resourceProviderName)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId, groupQuotaName, resourceProviderName, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceUsageList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResourceUsageList.DeserializeResourceUsageList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotasRestOperations.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotasRestOperations.cs new file mode 100644 index 0000000000000..f2ae827198c6f --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/GroupQuotasRestOperations.cs @@ -0,0 +1,531 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + internal partial class GroupQuotasRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GroupQuotasRestOperations. + /// 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 GroupQuotasRestOperations(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 RequestUriBuilder CreateCreateOrUpdateRequestUri(string managementGroupId, string groupQuotaName, GroupQuotaEntityData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string managementGroupId, string groupQuotaName, GroupQuotaEntityData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, 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, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be polled periodically. The status Async polling is using standards defined at - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to Get URI and full details can be checked. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The GroupQuota body details for creation or update of a GroupQuota entity. + /// 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 managementGroupId, string groupQuotaName, GroupQuotaEntityData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(managementGroupId, groupQuotaName, 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); + } + } + + /// Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be polled periodically. The status Async polling is using standards defined at - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to Get URI and full details can be checked. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The GroupQuota body details for creation or update of a GroupQuota entity. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string managementGroupId, string groupQuotaName, GroupQuotaEntityData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(managementGroupId, groupQuotaName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string managementGroupId, string groupQuotaName, GroupQuotaEntityPatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string managementGroupId, string groupQuotaName, GroupQuotaEntityPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, 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, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// + /// Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The status can be polled periodically. The status Async polling is using standards defined at - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to Get URI and full details can be checked. + /// Any change in the filters will be applicable to the future quota assignments, existing quota allocated to subscriptions from the GroupQuotas remains unchanged. + /// + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The GroupQuotas Patch Request. + /// 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 managementGroupId, string groupQuotaName, GroupQuotaEntityPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(managementGroupId, groupQuotaName, 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); + } + } + + /// + /// Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The status can be polled periodically. The status Async polling is using standards defined at - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to Get URI and full details can be checked. + /// Any change in the filters will be applicable to the future quota assignments, existing quota allocated to subscriptions from the GroupQuotas remains unchanged. + /// + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The GroupQuotas Patch Request. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Update(string managementGroupId, string groupQuotaName, GroupQuotaEntityPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(managementGroupId, groupQuotaName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string managementGroupId, string groupQuotaName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string managementGroupId, string groupQuotaName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on group quota can be access from the group quota APIs. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// 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 managementGroupId, string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var message = CreateGetRequest(managementGroupId, groupQuotaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaEntityData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotaEntityData.DeserializeGroupQuotaEntityData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GroupQuotaEntityData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on group quota can be access from the group quota APIs. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Get(string managementGroupId, string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var message = CreateGetRequest(managementGroupId, groupQuotaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaEntityData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotaEntityData.DeserializeGroupQuotaEntityData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GroupQuotaEntityData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string managementGroupId, string groupQuotaName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string managementGroupId, string groupQuotaName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas/", false); + uri.AppendPath(groupQuotaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be lost. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// 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 managementGroupId, string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var message = CreateDeleteRequest(managementGroupId, groupQuotaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be lost. + /// Management Group Id. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Delete(string managementGroupId, string groupQuotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + Argument.AssertNotNullOrEmpty(groupQuotaName, nameof(groupQuotaName)); + + using var message = CreateDeleteRequest(managementGroupId, groupQuotaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListRequestUri(string managementGroupId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string managementGroupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(managementGroupId, true); + uri.AppendPath("/providers/Microsoft.Quota/groupQuotas", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details on group quota can be access from the group quota APIs. + /// Management Group Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string managementGroupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + + using var message = CreateListRequest(managementGroupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotaList.DeserializeGroupQuotaList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details on group quota can be access from the group quota APIs. + /// Management Group Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string managementGroupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + + using var message = CreateListRequest(managementGroupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotaList.DeserializeGroupQuotaList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string managementGroupId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string managementGroupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details on group quota can be access from the group quota APIs. + /// The URL to the next page of results. + /// Management Group Id. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string managementGroupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupQuotaList.DeserializeGroupQuotaList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details on group quota can be access from the group quota APIs. + /// The URL to the next page of results. + /// Management Group Id. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string managementGroupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(managementGroupId, nameof(managementGroupId)); + + using var message = CreateListNextPageRequest(nextLink, managementGroupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupQuotaList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupQuotaList.DeserializeGroupQuotaList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/QuotaOperationRestOperations.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/QuotaOperationRestOperations.cs index ca16f9cdd37c6..6691c773a8b48 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/QuotaOperationRestOperations.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/QuotaOperationRestOperations.cs @@ -32,7 +32,7 @@ public QuotaOperationRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-02-01"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/QuotaRequestStatusRestOperations.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/QuotaRequestStatusRestOperations.cs index 8f22cdb7df547..c7f03c8ff9482 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/QuotaRequestStatusRestOperations.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/QuotaRequestStatusRestOperations.cs @@ -32,7 +32,7 @@ public QuotaRequestStatusRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-02-01"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/QuotaRestOperations.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/QuotaRestOperations.cs index 501ec8b068a43..6da24f924fe17 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/QuotaRestOperations.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/QuotaRestOperations.cs @@ -32,7 +32,7 @@ public QuotaRestOperations(HttpPipeline pipeline, string applicationId, Uri endp { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-02-01"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/UsagesRestOperations.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/UsagesRestOperations.cs index 55db404300287..7a0cffd2de745 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/UsagesRestOperations.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/RestOperations/UsagesRestOperations.cs @@ -32,7 +32,7 @@ public UsagesRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-02-01"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/SubscriptionQuotaAllocationCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/SubscriptionQuotaAllocationCollection.cs new file mode 100644 index 0000000000000..542f7f94f7624 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/SubscriptionQuotaAllocationCollection.cs @@ -0,0 +1,455 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ManagementGroups; + +namespace Azure.ResourceManager.Quota +{ + /// + /// 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 GetSubscriptionQuotaAllocations method from an instance of . + /// + public partial class SubscriptionQuotaAllocationCollection : ArmCollection + { + private readonly ClientDiagnostics _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationClientDiagnostics; + private readonly GroupQuotaSubscriptionAllocationRestOperations _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient; + private readonly string _subscriptionId; + private readonly string _groupQuotaName; + + /// Initializes a new instance of the class for mocking. + protected SubscriptionQuotaAllocationCollection() + { + } + + /// 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. + /// The ID of the target subscription. The value must be an UUID. + /// The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + internal SubscriptionQuotaAllocationCollection(ArmClient client, ResourceIdentifier id, string subscriptionId, string groupQuotaName) : base(client, id) + { + _subscriptionId = subscriptionId; + _groupQuotaName = groupQuotaName; + _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", SubscriptionQuotaAllocationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SubscriptionQuotaAllocationResource.ResourceType, out string subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationApiVersion); + _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient = new GroupQuotaSubscriptionAllocationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ManagementGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagementGroupResource.ResourceType), nameof(id)); + } + + /// + /// Gets Quota allocated to a subscription for the specific Resource Provider, Location, ResourceName. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocation_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetAsync(string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationClientDiagnostics.CreateScope("SubscriptionQuotaAllocationCollection.Get"); + scope.Start(); + try + { + var response = await _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient.GetAsync(Id.Name, _subscriptionId, _groupQuotaName, resourceName, filter, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionQuotaAllocationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets Quota allocated to a subscription for the specific Resource Provider, Location, ResourceName. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocation_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response Get(string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationClientDiagnostics.CreateScope("SubscriptionQuotaAllocationCollection.Get"); + scope.Start(); + try + { + var response = _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient.Get(Id.Name, _subscriptionId, _groupQuotaName, resourceName, filter, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionQuotaAllocationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all the quota allocated to a subscription for the specific Resource Provider, Location. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. Use the $filter parameter to filter out the specific resource based on the ResourceProvider/Location. $filter is a required parameter. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocation_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(filter, nameof(filter)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient.CreateListRequest(Id.Name, _subscriptionId, _groupQuotaName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient.CreateListNextPageRequest(nextLink, Id.Name, _subscriptionId, _groupQuotaName, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SubscriptionQuotaAllocationResource(Client, SubscriptionQuotaAllocationData.DeserializeSubscriptionQuotaAllocationData(e)), _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationClientDiagnostics, Pipeline, "SubscriptionQuotaAllocationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the quota allocated to a subscription for the specific Resource Provider, Location. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. Use the $filter parameter to filter out the specific resource based on the ResourceProvider/Location. $filter is a required parameter. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocation_List + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(filter, nameof(filter)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient.CreateListRequest(Id.Name, _subscriptionId, _groupQuotaName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient.CreateListNextPageRequest(nextLink, Id.Name, _subscriptionId, _groupQuotaName, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SubscriptionQuotaAllocationResource(Client, SubscriptionQuotaAllocationData.DeserializeSubscriptionQuotaAllocationData(e)), _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationClientDiagnostics, Pipeline, "SubscriptionQuotaAllocationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocation_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> ExistsAsync(string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationClientDiagnostics.CreateScope("SubscriptionQuotaAllocationCollection.Exists"); + scope.Start(); + try + { + var response = await _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient.GetAsync(Id.Name, _subscriptionId, _groupQuotaName, resourceName, filter, 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 + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocation_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response Exists(string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationClientDiagnostics.CreateScope("SubscriptionQuotaAllocationCollection.Exists"); + scope.Start(); + try + { + var response = _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient.Get(Id.Name, _subscriptionId, _groupQuotaName, resourceName, filter, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocation_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetIfExistsAsync(string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationClientDiagnostics.CreateScope("SubscriptionQuotaAllocationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient.GetAsync(Id.Name, _subscriptionId, _groupQuotaName, resourceName, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionQuotaAllocationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocation_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Resource name. + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual NullableResponse GetIfExists(string resourceName, string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationClientDiagnostics.CreateScope("SubscriptionQuotaAllocationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient.Get(Id.Name, _subscriptionId, _groupQuotaName, resourceName, filter, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionQuotaAllocationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/SubscriptionQuotaAllocationData.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/SubscriptionQuotaAllocationData.Serialization.cs new file mode 100644 index 0000000000000..adfc18a1db6ff --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/SubscriptionQuotaAllocationData.Serialization.cs @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + public partial class SubscriptionQuotaAllocationData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubscriptionQuotaAllocationData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SubscriptionQuotaAllocationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubscriptionQuotaAllocationData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriptionQuotaAllocationData(document.RootElement, options); + } + + internal static SubscriptionQuotaAllocationData DeserializeSubscriptionQuotaAllocationData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SubscriptionQuotaDetails properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SubscriptionQuotaDetails.DeserializeSubscriptionQuotaDetails(property.Value, options); + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SubscriptionQuotaAllocationData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SubscriptionQuotaAllocationData)} does not support writing '{options.Format}' format."); + } + } + + SubscriptionQuotaAllocationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSubscriptionQuotaAllocationData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubscriptionQuotaAllocationData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/SubscriptionQuotaAllocationData.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/SubscriptionQuotaAllocationData.cs new file mode 100644 index 0000000000000..c2667486cd17a --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/SubscriptionQuotaAllocationData.cs @@ -0,0 +1,76 @@ +// 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.Models; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A class representing the SubscriptionQuotaAllocation data model. + /// Quota allocated to a subscription for the specific Resource Provider, Location, ResourceName. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. + /// + public partial class SubscriptionQuotaAllocationData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SubscriptionQuotaAllocationData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Quota properties for the specified resource. + /// Keeps track of any properties unknown to the library. + internal SubscriptionQuotaAllocationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubscriptionQuotaDetails properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Quota properties for the specified resource. + [WirePath("properties")] + public SubscriptionQuotaDetails Properties { get; set; } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/SubscriptionQuotaAllocationResource.Serialization.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/SubscriptionQuotaAllocationResource.Serialization.cs new file mode 100644 index 0000000000000..60fe0871e4fe1 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/SubscriptionQuotaAllocationResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Quota +{ + public partial class SubscriptionQuotaAllocationResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + SubscriptionQuotaAllocationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + SubscriptionQuotaAllocationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/SubscriptionQuotaAllocationResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/SubscriptionQuotaAllocationResource.cs new file mode 100644 index 0000000000000..927d7b6d5e413 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/SubscriptionQuotaAllocationResource.cs @@ -0,0 +1,192 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ManagementGroups; + +namespace Azure.ResourceManager.Quota +{ + /// + /// A Class representing a SubscriptionQuotaAllocation 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 GetSubscriptionQuotaAllocationResource method. + /// Otherwise you can get one from its parent resource using the GetSubscriptionQuotaAllocation method. + /// + public partial class SubscriptionQuotaAllocationResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The managementGroupId. + /// The subscriptionId. + /// The groupQuotaName. + /// The resourceName. + public static ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string subscriptionId, string groupQuotaName, string resourceName) + { + var resourceId = $"/providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationClientDiagnostics; + private readonly GroupQuotaSubscriptionAllocationRestOperations _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient; + private readonly SubscriptionQuotaAllocationData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Quota/groupQuotas/quotaAllocations"; + + /// Initializes a new instance of the class for mocking. + protected SubscriptionQuotaAllocationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SubscriptionQuotaAllocationResource(ArmClient client, SubscriptionQuotaAllocationData 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 SubscriptionQuotaAllocationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Quota", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationApiVersion); + _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient = new GroupQuotaSubscriptionAllocationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual SubscriptionQuotaAllocationData 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 Quota allocated to a subscription for the specific Resource Provider, Location, ResourceName. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocation_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is null. + public virtual async Task> GetAsync(string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationClientDiagnostics.CreateScope("SubscriptionQuotaAllocationResource.Get"); + scope.Start(); + try + { + var response = await _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient.GetAsync(Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionQuotaAllocationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets Quota allocated to a subscription for the specific Resource Provider, Location, ResourceName. This will include the GroupQuota and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG Group Quota. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName} + /// + /// + /// Operation Id + /// GroupQuotaSubscriptionAllocation_Get + /// + /// + /// Default Api Version + /// 2023-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// location eq {location} + /// Example: $filter=location eq eastus + /// + /// The cancellation token to use. + /// is null. + public virtual Response Get(string filter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(filter, nameof(filter)); + + using var scope = _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationClientDiagnostics.CreateScope("SubscriptionQuotaAllocationResource.Get"); + scope.Start(); + try + { + var response = _subscriptionQuotaAllocationGroupQuotaSubscriptionAllocationRestClient.Get(Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionQuotaAllocationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/autorest.md b/sdk/quota/Azure.ResourceManager.Quota/src/autorest.md index 39726782b1829..f04b9a41b701e 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/autorest.md +++ b/sdk/quota/Azure.ResourceManager.Quota/src/autorest.md @@ -8,8 +8,8 @@ azure-arm: true csharp: true library-name: Quota namespace: Azure.ResourceManager.Quota -# default tag is a preview version -require: https://github.com/Azure/azure-rest-api-specs/blob/57e0f495d521002e883f5357db0dfdfdaaff0208/specification/quota/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/d1f4d6fcf1bbb2e71a32bb2079de12f17fedf56a/specification/quota/resource-manager/readme.md +#tag: package-2023-06-01-preview output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: @@ -19,6 +19,10 @@ skip-csproj: true modelerfour: flatten-payloads: false use-model-reader-writer: true +enable-bicep-serialization: true + +#mgmt-debug: +# show-serialized-names: true format-by-name-rules: 'tenantId': 'uuid' @@ -65,8 +69,25 @@ rename-mapping: UsagesProperties.resourceType: ResourceTypeName QuotaProperties.resourceType: ResourceTypeName SubRequest.resourceType: ResourceTypeName - # QuotaRequestStatusDetails.resourceType: ResourceTypeName - # quotaRequestOneResourceProperties.resourceType: ResourceTypeName + GroupQuotasEnforcementResponse: GroupQuotaEnforcement + GroupQuotasEnforcementResponseProperties: GroupQuotaEnforcementProperties + GroupQuotasEntity: GroupQuotaEntity + GroupQuotasEntityBase: GroupQuotaEntityBase + GroupQuotaSubscriptionId: GroupQuotaSubscription + GroupQuotaSubscriptionIdProperties: GroupQuotaSubscriptionProperties + QuotaAllocationRequestStatus.properties.requestSubmitTime: RequestSubmittedOn + SubmittedResourceRequestStatus: GroupQuotaRequestStatus + SubmittedResourceRequestStatusProperties: GroupQuotaRequestStatusProperties + SubmittedResourceRequestStatusProperties.requestSubmitTime: RequestSubmittedOn + AdditionalAttributes: GroupQuotaAdditionalAttributes + AdditionalAttributesPatch: GroupQuotaAdditionalAttributesPatch + AllocatedToSubscription: SubscriptionAllocatedQuota + EnforcementState: GroupQuotaEnforcementState + EnvironmentType: GroupQuotaEnvironmentType + GroupingId: GroupQuotaGroupingId + GroupingIdType: GroupQuotaGroupingIdType + RequestState: QuotaRequestStatus + ResourceUsages: GroupQuotaResourceUsages directive: # Correct the type of properties @@ -76,4 +97,8 @@ directive: $.QuotaProperties.properties.quotaPeriod['format'] = 'duration'; $.UsagesProperties.properties.quotaPeriod['format'] = 'duration'; +list-exception: +- /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests/{requestId} +- /providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId} + ``` diff --git a/sdk/quota/Azure.ResourceManager.Quota/tests/Tests/GroupQuotaTests.cs b/sdk/quota/Azure.ResourceManager.Quota/tests/Tests/GroupQuotaTests.cs new file mode 100644 index 0000000000000..fdb6a0fe85439 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/tests/Tests/GroupQuotaTests.cs @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Quota.Models; +using NUnit.Framework; +using Azure.ResourceManager.ManagementGroups; +using Azure.Identity; + +namespace Azure.ResourceManager.Quota.Tests.Tests +{ + [TestFixture] + public class GroupQuotaTests : QuotaManagementTestBase + { + private const string defaultSubscriptionId = "65a85478-2333-4bbd-981b-1a818c944faf"; + + private const string managementGroupId = "testMgIdRoot"; + + public GroupQuotaTests() : base(true) + { + } + + [SetUp] + public void Init() + { + CreateCommonClient(); + } + + [TestCase] + public async Task SetGroupQuota() + { + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + + ManagementGroupResource managementGroupResource = Client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this GroupQuotasEntityResource + GroupQuotaEntityCollection collection = managementGroupResource.GetGroupQuotaEntities(); + + // invoke the operation + string groupQuotaName = "sdk-test-group-quota-create"; + + // Builds the Group Quota Request Body + GroupQuotaEntityData data = new GroupQuotaEntityData() + { + Properties = new GroupQuotaEntityBase() + { + DisplayName = "sdk-test-group-quota-create", + AdditionalAttributes = new GroupQuotaAdditionalAttributes(new GroupQuotaGroupingId() + { + GroupingIdType = GroupQuotaGroupingIdType.BillingId, + Value = "ad41a99f-9c42-4b3d-9770-e711a24d8542", + }) + }, + }; + + //Performs the GroupQuota PUT operation + var createResponse = await collection.CreateOrUpdateAsync(WaitUntil.Started, groupQuotaName, data); + Assert.IsNotNull(createResponse); + + // Delete the created Group Quota for cleanup + ResourceIdentifier groupQuotasEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + + GroupQuotaEntityResource groupQuotasEntity = Client.GetGroupQuotaEntityResource(groupQuotasEntityResourceId); + await groupQuotasEntity.DeleteAsync(WaitUntil.Completed); + } + + [TestCase] + public async Task GetGroupQuota() + { + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + + ManagementGroupResource managementGroupResource = Client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this GroupQuotasEntityResource + var collection = managementGroupResource.GetGroupQuotaEntities(); + + // Performs the GET operation on a Group Quota resource + string groupQuotaName = "sdk-test-group-quota"; + var result = await collection.GetAsync(groupQuotaName); + Assert.IsNotNull(result); + } + + [TestCase] + public async Task GetGroupQuotaList() + { + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = Client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this GroupQuotasEntityResource + var collection = managementGroupResource.GetGroupQuotaEntities(); + + // Get all the Group Quota Entities + await foreach (GroupQuotaEntityResource item in collection.GetAllAsync()) + { + // Ensure that the Group Quota Objects are non empty + GroupQuotaEntityData resourceData = item.Data; + Assert.NotNull(resourceData); + } + } + + [TestCase] + public async Task SetGroupQuotaLimit() + { + // Create the Group Quota Limit Request Body + GroupQuotaRequestStatusData requestBody = new GroupQuotaRequestStatusData() + { + Properties = new GroupQuotaRequestStatusProperties() + { + RequestedResource = new GroupQuotaRequestBase() + { + Limit = 225, + Region = "westus", + Comments = "ticketComments" + } + }, + }; + + string groupQuotaName = "sdk-test-group-quota"; + + ResourceIdentifier groupQuotasEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + + // Get the Group Quota Resource + GroupQuotaEntityResource groupQuotasEntity = Client.GetGroupQuotaEntityResource(groupQuotasEntityResourceId); + + // Perform the QuotaLimit Request call + var response = await groupQuotasEntity.CreateOrUpdateGroupQuotaLimitsRequestAsync(WaitUntil.Started, "Microsoft.Compute", "standarddv4family", requestBody); + Assert.IsNotNull(response); + } + + [TestCase] + public async Task GetGroupQuotaLimit() + { + string groupQuotaName = "sdk-test-group-quota"; + + ResourceIdentifier groupQuotasEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + + GroupQuotaEntityResource groupQuotasEntity = Client.GetGroupQuotaEntityResource(groupQuotasEntityResourceId); + + // get the collection of this GroupQuotaLimitResource + string resourceProviderName = "Microsoft.Compute"; + GroupQuotaLimitCollection collection = groupQuotasEntity.GetGroupQuotaLimits(resourceProviderName); + + // Perform the GET operation with the proper location filter + string resourceName = "standarddv4family"; + string filter = "location eq westus"; + var result = await collection.GetAsync(resourceName, filter); + Assert.IsNotNull(result); + } + + [TestCase] + public async Task SetSubscription() + { + string groupQuotaName = "sdk-test-group-quota"; + + ResourceIdentifier groupQuotasEntityResourceId = GroupQuotaEntityResource.CreateResourceIdentifier(managementGroupId, groupQuotaName); + + GroupQuotaEntityResource groupQuotasEntity = Client.GetGroupQuotaEntityResource(groupQuotasEntityResourceId); + + // get the collection of this GroupQuotaSubscriptionIdResource + GroupQuotaSubscriptionCollection collection = groupQuotasEntity.GetGroupQuotaSubscriptions(); + + // Add a Subscription to the Group Quota Object + var response = await collection.CreateOrUpdateAsync(WaitUntil.Started, defaultSubscriptionId); + + //Clean up Sub + ResourceIdentifier groupQuotaSubscriptionIdResourceId = GroupQuotaSubscriptionResource.CreateResourceIdentifier(managementGroupId, groupQuotaName, defaultSubscriptionId); + + GroupQuotaSubscriptionResource groupQuotaSubscriptionId = Client.GetGroupQuotaSubscriptionResource(groupQuotaSubscriptionIdResourceId); + + await groupQuotaSubscriptionId.DeleteAsync(WaitUntil.Started); + } + + [TestCase] + public async Task SetSubscriptionAllocationRequest() + { + // invoke the operation + string groupQuotaName = "sdk-test-group-quota"; + string resourceProviderName = "Microsoft.Compute"; + string resourceName = "standarddv2family"; + + ResourceIdentifier groupQuotaSubscriptionIdResourceId = GroupQuotaSubscriptionResource.CreateResourceIdentifier(managementGroupId, groupQuotaName, defaultSubscriptionId); + + GroupQuotaSubscriptionResource groupQuotaSubscriptionId = Client.GetGroupQuotaSubscriptionResource(groupQuotaSubscriptionIdResourceId); + + // invoke the operation + var subscriptionAddResponse = await groupQuotaSubscriptionId.UpdateAsync(WaitUntil.Started); + Assert.IsNotNull(subscriptionAddResponse); + + // Builds the Quota Allocation Request Body + QuotaAllocationRequestStatusData data = new QuotaAllocationRequestStatusData() + { + RequestedResource = new QuotaAllocationRequestBase() + { + Limit = 20, + Region = "westus2", + }, + }; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + + ManagementGroupResource managementGroupResource = Client.GetManagementGroupResource(managementGroupResourceId); + + var allocationResponse = await managementGroupResource.CreateOrUpdateGroupQuotaSubscriptionAllocationRequestAsync(WaitUntil.Started, defaultSubscriptionId, groupQuotaName, resourceProviderName, resourceName, data); + + Assert.IsNotNull(allocationResponse); + + // Delete the Subscription as part of test cleanup + await groupQuotaSubscriptionId.DeleteAsync(WaitUntil.Started); + } + + [TestCase] + public async Task GetSubscriptionAllocation() + { + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + + ManagementGroupResource managementGroupResource = Client.GetManagementGroupResource(managementGroupResourceId); + + // invoke the operation + string groupQuotaName = "sdk-test-group-quota"; + string resourceName = "standarddv2family"; + ResourceIdentifier subscriptionQuotaAllocationResourceId = SubscriptionQuotaAllocationResource.CreateResourceIdentifier(managementGroupId, defaultSubscriptionId, groupQuotaName, resourceName); + + SubscriptionQuotaAllocationResource subscriptionQuotaAllocation = Client.GetSubscriptionQuotaAllocationResource(subscriptionQuotaAllocationResourceId); + + // Get the Subscription Allocation Object with the given location filter + string filter = "location eq westus2"; + var result = await subscriptionQuotaAllocation.GetAsync(filter); + Assert.IsNotNull(result); + } + + [TestCase] + public async Task GetSubscriptionAllocationList() + { + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + + ManagementGroupResource managementGroupResource = Client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this SubscriptionQuotaAllocationResource + string groupQuotaName = "sdk-test-group-quota"; + SubscriptionQuotaAllocationCollection collection = managementGroupResource.GetSubscriptionQuotaAllocations(defaultSubscriptionId, groupQuotaName); + + string filter = "location eq westus2"; + + //Get all the SubAllocation Resources + await foreach (SubscriptionQuotaAllocationResource item in collection.GetAllAsync(filter)) + { + //Ensure that all sub resources aren't null + var resourceData = item.Data; + + Assert.IsNotNull(resourceData); + } + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/tests/Tests/QuotaTests.cs b/sdk/quota/Azure.ResourceManager.Quota/tests/Tests/QuotaTests.cs index e30802c2e3690..5b27418f35f3f 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/tests/Tests/QuotaTests.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/tests/Tests/QuotaTests.cs @@ -3,11 +3,15 @@ using System; using System.Linq; +using System.Net; using System.Threading.Tasks; using Azure.Core; using Azure.Core.TestFramework; +using Azure.Core.Pipeline; using Azure.ResourceManager.Quota.Models; using NUnit.Framework; +//using Azure.Identity; +using Azure.ResourceManager.ManagementGroups; namespace Azure.ResourceManager.Quota.Tests.Tests {