diff --git a/sdk/resourcemanager/Proto.Client/Proto.Client.sln b/sdk/resourcemanager/Proto.Client/Proto.Client.sln deleted file mode 100644 index ce888353fafa..000000000000 --- a/sdk/resourcemanager/Proto.Client/Proto.Client.sln +++ /dev/null @@ -1,67 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31019.35 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Core", "..\Azure.ResourceManager.Core\src\Azure.ResourceManager.Core.csproj", "{AEBBB0DB-BA2F-42A2-85DD-0019EE64492B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Proto.Compute", "compute\Proto.Compute.csproj", "{8948E020-7C45-4817-9142-D80368F3FB11}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Proto.Network", "network\Proto.Network.csproj", "{AD152BEB-7AE0-42A1-873E-E2AB4519ADA7}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Proto.Client", "src\Proto.Client.csproj", "{280DD3C4-7EC6-471A-BB77-1E7F2F7D6666}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Proto.Authorization", "authorization\Proto.Authorization.csproj", "{540E8EF4-40B6-4F23-8744-2E6705186E7B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Authorization", "authorization\Azure.ResourceManager.Authorization\Azure.ResourceManager.Authorization.csproj", "{ADB32B3D-D6DE-49A3-80E1-59ADAA21F78F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Proto.Billing", "billing\Proto.Billing.csproj", "{05033168-19BE-4D6B-AD24-135CB028A1EA}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Billing", "billing\Azure.ResourceManager.Billing\Azure.ResourceManager.Billing.csproj", "{340B4A62-1817-4C28-A7BE-0648E0BCA933}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {AEBBB0DB-BA2F-42A2-85DD-0019EE64492B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AEBBB0DB-BA2F-42A2-85DD-0019EE64492B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AEBBB0DB-BA2F-42A2-85DD-0019EE64492B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AEBBB0DB-BA2F-42A2-85DD-0019EE64492B}.Release|Any CPU.Build.0 = Release|Any CPU - {8948E020-7C45-4817-9142-D80368F3FB11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8948E020-7C45-4817-9142-D80368F3FB11}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8948E020-7C45-4817-9142-D80368F3FB11}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8948E020-7C45-4817-9142-D80368F3FB11}.Release|Any CPU.Build.0 = Release|Any CPU - {AD152BEB-7AE0-42A1-873E-E2AB4519ADA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AD152BEB-7AE0-42A1-873E-E2AB4519ADA7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AD152BEB-7AE0-42A1-873E-E2AB4519ADA7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AD152BEB-7AE0-42A1-873E-E2AB4519ADA7}.Release|Any CPU.Build.0 = Release|Any CPU - {280DD3C4-7EC6-471A-BB77-1E7F2F7D6666}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {280DD3C4-7EC6-471A-BB77-1E7F2F7D6666}.Debug|Any CPU.Build.0 = Debug|Any CPU - {280DD3C4-7EC6-471A-BB77-1E7F2F7D6666}.Release|Any CPU.ActiveCfg = Release|Any CPU - {280DD3C4-7EC6-471A-BB77-1E7F2F7D6666}.Release|Any CPU.Build.0 = Release|Any CPU - {540E8EF4-40B6-4F23-8744-2E6705186E7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {540E8EF4-40B6-4F23-8744-2E6705186E7B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {540E8EF4-40B6-4F23-8744-2E6705186E7B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {540E8EF4-40B6-4F23-8744-2E6705186E7B}.Release|Any CPU.Build.0 = Release|Any CPU - {ADB32B3D-D6DE-49A3-80E1-59ADAA21F78F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ADB32B3D-D6DE-49A3-80E1-59ADAA21F78F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ADB32B3D-D6DE-49A3-80E1-59ADAA21F78F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ADB32B3D-D6DE-49A3-80E1-59ADAA21F78F}.Release|Any CPU.Build.0 = Release|Any CPU - {05033168-19BE-4D6B-AD24-135CB028A1EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {05033168-19BE-4D6B-AD24-135CB028A1EA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {05033168-19BE-4D6B-AD24-135CB028A1EA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {05033168-19BE-4D6B-AD24-135CB028A1EA}.Release|Any CPU.Build.0 = Release|Any CPU - {340B4A62-1817-4C28-A7BE-0648E0BCA933}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {340B4A62-1817-4C28-A7BE-0648E0BCA933}.Debug|Any CPU.Build.0 = Debug|Any CPU - {340B4A62-1817-4C28-A7BE-0648E0BCA933}.Release|Any CPU.ActiveCfg = Release|Any CPU - {340B4A62-1817-4C28-A7BE-0648E0BCA933}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {6C3A85E2-78AD-4C82-8943-A495B3B42533} - EndGlobalSection -EndGlobal diff --git a/sdk/resourcemanager/Proto.Client/README.MD b/sdk/resourcemanager/Proto.Client/README.MD deleted file mode 100644 index efeef3da2460..000000000000 --- a/sdk/resourcemanager/Proto.Client/README.MD +++ /dev/null @@ -1,3 +0,0 @@ -# Proto Client - -Client used to showcase and test the new prototype track 2 management plane SDK \ No newline at end of file diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Azure.ResourceManager.Authorization.csproj b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Azure.ResourceManager.Authorization.csproj deleted file mode 100644 index 8e8a312454b1..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Azure.ResourceManager.Authorization.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - 1.0.0-beta.1 - Azure.ResourceManager.Authorization - Azure Resource Manager client SDK for Azure resource provider Microsoft.Authorization - azure;management;arm;resource manager;authorization - true - true - false - - - - - $(NoWarn);AZC0001 - - - - - - diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Directory.Build.props b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Directory.Build.props deleted file mode 100644 index 1a9611bd4924..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Directory.Build.props +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/AuthorizationManagementClient.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/AuthorizationManagementClient.cs deleted file mode 100644 index 0332b8b67e2b..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/AuthorizationManagementClient.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Authorization; - -namespace Azure.ResourceManager.Authorization -{ - /// Authorization service management client. - public partial class AuthorizationManagementClient - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - private readonly string _subscriptionId; - private readonly Uri _endpoint; - - /// Initializes a new instance of AuthorizationManagementClient for mocking. - protected AuthorizationManagementClient() - { - } - - /// Initializes a new instance of AuthorizationManagementClient. - /// The ID of the target subscription. - /// The OAuth token for making client requests. - /// The options for configuring the client. - public AuthorizationManagementClient(string subscriptionId, TokenCredential tokenCredential, AuthorizationManagementClientOptions options = null) : this(subscriptionId, null, tokenCredential, options) - { - } - /// Initializes a new instance of AuthorizationManagementClient. - /// The ID of the target subscription. - /// server parameter. - /// The OAuth token for making client requests. - /// The options for configuring the client. - /// is null. - public AuthorizationManagementClient(string subscriptionId, Uri endpoint, TokenCredential tokenCredential, AuthorizationManagementClientOptions options = null) - { - if (subscriptionId == null) - { - throw new ArgumentNullException(nameof(subscriptionId)); - } - endpoint ??= new Uri("https://management.azure.com"); - - options ??= new AuthorizationManagementClientOptions(); - _clientDiagnostics = new ClientDiagnostics(options); - _pipeline = ManagementPipelineBuilder.Build(tokenCredential, endpoint, options); - _subscriptionId = subscriptionId; - _endpoint = endpoint; - } - - /// Returns an instance of RoleAssignmentsOperations. - public virtual RoleAssignmentsOperations RoleAssignments => new RoleAssignmentsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/AuthorizationManagementClientOptions.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/AuthorizationManagementClientOptions.cs deleted file mode 100644 index 890946048a0b..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/AuthorizationManagementClientOptions.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; - -namespace Azure.ResourceManager.Authorization -{ - /// Client options for Authorization. - public partial class AuthorizationManagementClientOptions : ClientOptions - { - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorAdditionalInfo.Serialization.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorAdditionalInfo.Serialization.cs deleted file mode 100644 index 2186871cacec..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorAdditionalInfo.Serialization.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Authorization.Models -{ - internal partial class ErrorAdditionalInfo - { - internal static ErrorAdditionalInfo DeserializeErrorAdditionalInfo(JsonElement element) - { - Optional type = default; - Optional info = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("info")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - info = property.Value.GetObject(); - continue; - } - } - return new ErrorAdditionalInfo(type.Value, info.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorAdditionalInfo.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorAdditionalInfo.cs deleted file mode 100644 index 0dd0396180f6..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorAdditionalInfo.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Authorization.Models -{ - /// The resource management error additional info. - internal partial class ErrorAdditionalInfo - { - /// Initializes a new instance of ErrorAdditionalInfo. - internal ErrorAdditionalInfo() - { - } - - /// Initializes a new instance of ErrorAdditionalInfo. - /// The additional info type. - /// The additional info. - internal ErrorAdditionalInfo(string type, object info) - { - Type = type; - Info = info; - } - - /// The additional info type. - public string Type { get; } - /// The additional info. - public object Info { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorDetail.Serialization.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorDetail.Serialization.cs deleted file mode 100644 index 536d7bed4ad8..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorDetail.Serialization.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Authorization.Models -{ - internal partial class ErrorDetail - { - internal static ErrorDetail DeserializeErrorDetail(JsonElement element) - { - Optional code = default; - Optional message = default; - Optional target = default; - Optional> details = default; - Optional> additionalInfo = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code")) - { - code = property.Value.GetString(); - continue; - } - if (property.NameEquals("message")) - { - message = property.Value.GetString(); - continue; - } - if (property.NameEquals("target")) - { - target = property.Value.GetString(); - continue; - } - if (property.NameEquals("details")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(DeserializeErrorDetail(item)); - } - details = array; - continue; - } - if (property.NameEquals("additionalInfo")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ErrorAdditionalInfo.DeserializeErrorAdditionalInfo(item)); - } - additionalInfo = array; - continue; - } - } - return new ErrorDetail(code.Value, message.Value, target.Value, Optional.ToList(details), Optional.ToList(additionalInfo)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorDetail.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorDetail.cs deleted file mode 100644 index eba350afafc4..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorDetail.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Authorization.Models -{ - /// The error detail. - internal partial class ErrorDetail - { - /// Initializes a new instance of ErrorDetail. - internal ErrorDetail() - { - Details = new ChangeTrackingList(); - AdditionalInfo = new ChangeTrackingList(); - } - - /// Initializes a new instance of ErrorDetail. - /// The error code. - /// The error message. - /// The error target. - /// The error details. - /// The error additional info. - internal ErrorDetail(string code, string message, string target, IReadOnlyList details, IReadOnlyList additionalInfo) - { - Code = code; - Message = message; - Target = target; - Details = details; - AdditionalInfo = additionalInfo; - } - - /// The error code. - public string Code { get; } - /// The error message. - public string Message { get; } - /// The error target. - public string Target { get; } - /// The error details. - public IReadOnlyList Details { get; } - /// The error additional info. - public IReadOnlyList AdditionalInfo { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorResponse.Serialization.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorResponse.Serialization.cs deleted file mode 100644 index 9db192f0f694..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorResponse.Serialization.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Authorization.Models -{ - internal partial class ErrorResponse - { - internal static ErrorResponse DeserializeErrorResponse(JsonElement element) - { - Optional error = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("error")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - error = ErrorDetail.DeserializeErrorDetail(property.Value); - continue; - } - } - return new ErrorResponse(error.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorResponse.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorResponse.cs deleted file mode 100644 index fbe1ef13920e..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/ErrorResponse.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Authorization.Models -{ - /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - internal partial class ErrorResponse - { - /// Initializes a new instance of ErrorResponse. - internal ErrorResponse() - { - } - - /// Initializes a new instance of ErrorResponse. - /// The error object. - internal ErrorResponse(ErrorDetail error) - { - Error = error; - } - - /// The error object. - public ErrorDetail Error { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/PrincipalType.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/PrincipalType.cs deleted file mode 100644 index dd2733e32d45..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/PrincipalType.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Authorization.Models -{ - /// The principal type of the assigned principal ID. - public readonly partial struct PrincipalType : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public PrincipalType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string UserValue = "User"; - private const string GroupValue = "Group"; - private const string ServicePrincipalValue = "ServicePrincipal"; - private const string UnknownValue = "Unknown"; - private const string DirectoryRoleTemplateValue = "DirectoryRoleTemplate"; - private const string ForeignGroupValue = "ForeignGroup"; - private const string ApplicationValue = "Application"; - private const string MSIValue = "MSI"; - private const string DirectoryObjectOrGroupValue = "DirectoryObjectOrGroup"; - private const string EveryoneValue = "Everyone"; - - /// User. - public static PrincipalType User { get; } = new PrincipalType(UserValue); - /// Group. - public static PrincipalType Group { get; } = new PrincipalType(GroupValue); - /// ServicePrincipal. - public static PrincipalType ServicePrincipal { get; } = new PrincipalType(ServicePrincipalValue); - /// Unknown. - public static PrincipalType Unknown { get; } = new PrincipalType(UnknownValue); - /// DirectoryRoleTemplate. - public static PrincipalType DirectoryRoleTemplate { get; } = new PrincipalType(DirectoryRoleTemplateValue); - /// ForeignGroup. - public static PrincipalType ForeignGroup { get; } = new PrincipalType(ForeignGroupValue); - /// Application. - public static PrincipalType Application { get; } = new PrincipalType(ApplicationValue); - /// MSI. - public static PrincipalType MSI { get; } = new PrincipalType(MSIValue); - /// DirectoryObjectOrGroup. - public static PrincipalType DirectoryObjectOrGroup { get; } = new PrincipalType(DirectoryObjectOrGroupValue); - /// Everyone. - public static PrincipalType Everyone { get; } = new PrincipalType(EveryoneValue); - /// Determines if two values are the same. - public static bool operator ==(PrincipalType left, PrincipalType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(PrincipalType left, PrincipalType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator PrincipalType(string value) => new PrincipalType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is PrincipalType other && Equals(other); - /// - public bool Equals(PrincipalType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignment.Serialization.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignment.Serialization.cs deleted file mode 100644 index ddb7e4809f65..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignment.Serialization.cs +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Authorization.Models -{ - public partial class RoleAssignment - { - internal static RoleAssignment DeserializeRoleAssignment(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional scope = default; - Optional roleDefinitionId = default; - Optional principalId = default; - Optional principalType = default; - Optional canDelegate = default; - Optional description = default; - Optional condition = default; - Optional conditionVersion = default; - Optional createdOn = default; - Optional updatedOn = default; - Optional createdBy = default; - Optional updatedBy = default; - Optional delegatedManagedIdentityResourceId = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("scope")) - { - scope = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("roleDefinitionId")) - { - roleDefinitionId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("principalId")) - { - principalId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("principalType")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - principalType = new PrincipalType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("canDelegate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - canDelegate = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("description")) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("condition")) - { - condition = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("conditionVersion")) - { - conditionVersion = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("createdOn")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - createdOn = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("updatedOn")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - updatedOn = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("createdBy")) - { - createdBy = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("updatedBy")) - { - updatedBy = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("delegatedManagedIdentityResourceId")) - { - delegatedManagedIdentityResourceId = property0.Value.GetString(); - continue; - } - } - continue; - } - } - return new RoleAssignment(id.Value, name.Value, type.Value, scope.Value, roleDefinitionId.Value, principalId.Value, Optional.ToNullable(principalType), Optional.ToNullable(canDelegate), description.Value, condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), Optional.ToNullable(updatedOn), createdBy.Value, updatedBy.Value, delegatedManagedIdentityResourceId.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignment.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignment.cs deleted file mode 100644 index dac8c754b295..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignment.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Authorization.Models -{ - /// Role Assignments. - public partial class RoleAssignment - { - /// Initializes a new instance of RoleAssignment. - internal RoleAssignment() - { - } - - /// Initializes a new instance of RoleAssignment. - /// The role assignment ID. - /// The role assignment name. - /// The role assignment type. - /// The role assignment scope. - /// The role definition ID. - /// The principal ID. - /// The principal type of the assigned principal ID. - /// The Delegation flag for the role assignment. - /// Description of role assignment. - /// The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'. - /// Version of the condition. Currently accepted value is '2.0'. - /// Time it was created. - /// Time it was updated. - /// Id of the user who created the assignment. - /// Id of the user who updated the assignment. - /// Id of the delegated managed identity resource. - internal RoleAssignment(string id, string name, string type, string scope, string roleDefinitionId, string principalId, PrincipalType? principalType, bool? canDelegate, string description, string condition, string conditionVersion, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, string createdBy, string updatedBy, string delegatedManagedIdentityResourceId) - { - Id = id; - Name = name; - Type = type; - Scope = scope; - RoleDefinitionId = roleDefinitionId; - PrincipalId = principalId; - PrincipalType = principalType; - CanDelegate = canDelegate; - Description = description; - Condition = condition; - ConditionVersion = conditionVersion; - CreatedOn = createdOn; - UpdatedOn = updatedOn; - CreatedBy = createdBy; - UpdatedBy = updatedBy; - DelegatedManagedIdentityResourceId = delegatedManagedIdentityResourceId; - } - - /// The role assignment ID. - public string Id { get; } - /// The role assignment name. - public string Name { get; } - /// The role assignment type. - public string Type { get; } - /// The role assignment scope. - public string Scope { get; } - /// The role definition ID. - public string RoleDefinitionId { get; } - /// The principal ID. - public string PrincipalId { get; } - /// The principal type of the assigned principal ID. - public PrincipalType? PrincipalType { get; } - /// The Delegation flag for the role assignment. - public bool? CanDelegate { get; } - /// Description of role assignment. - public string Description { get; } - /// The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'. - public string Condition { get; } - /// Version of the condition. Currently accepted value is '2.0'. - public string ConditionVersion { get; } - /// Time it was created. - public DateTimeOffset? CreatedOn { get; } - /// Time it was updated. - public DateTimeOffset? UpdatedOn { get; } - /// Id of the user who created the assignment. - public string CreatedBy { get; } - /// Id of the user who updated the assignment. - public string UpdatedBy { get; } - /// Id of the delegated managed identity resource. - public string DelegatedManagedIdentityResourceId { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignmentCreateParameters.Serialization.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignmentCreateParameters.Serialization.cs deleted file mode 100644 index f7fc590e0ab0..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignmentCreateParameters.Serialization.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Authorization.Models -{ - public partial class RoleAssignmentCreateParameters : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - writer.WritePropertyName("roleDefinitionId"); - writer.WriteStringValue(RoleDefinitionId); - writer.WritePropertyName("principalId"); - writer.WriteStringValue(PrincipalId); - if (Optional.IsDefined(PrincipalType)) - { - writer.WritePropertyName("principalType"); - writer.WriteStringValue(PrincipalType.Value.ToString()); - } - if (Optional.IsDefined(CanDelegate)) - { - writer.WritePropertyName("canDelegate"); - writer.WriteBooleanValue(CanDelegate.Value); - } - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(Description); - } - if (Optional.IsDefined(Condition)) - { - writer.WritePropertyName("condition"); - writer.WriteStringValue(Condition); - } - if (Optional.IsDefined(ConditionVersion)) - { - writer.WritePropertyName("conditionVersion"); - writer.WriteStringValue(ConditionVersion); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignmentCreateParameters.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignmentCreateParameters.cs deleted file mode 100644 index 265ddba80ff5..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignmentCreateParameters.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Authorization.Models -{ - /// Role assignment create parameters. - public partial class RoleAssignmentCreateParameters - { - /// Initializes a new instance of RoleAssignmentCreateParameters. - /// The role definition ID used in the role assignment. - /// The principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group. - /// or is null. - public RoleAssignmentCreateParameters(string roleDefinitionId, string principalId) - { - if (roleDefinitionId == null) - { - throw new ArgumentNullException(nameof(roleDefinitionId)); - } - if (principalId == null) - { - throw new ArgumentNullException(nameof(principalId)); - } - - RoleDefinitionId = roleDefinitionId; - PrincipalId = principalId; - } - - /// The role definition ID used in the role assignment. - public string RoleDefinitionId { get; } - /// The principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group. - public string PrincipalId { get; } - /// The principal type of the assigned principal ID. - public PrincipalType? PrincipalType { get; set; } - /// The delegation flag used for creating a role assignment. - public bool? CanDelegate { get; set; } - /// Description of role assignment. - public string Description { get; set; } - /// The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'. - public string Condition { get; set; } - /// Version of the condition. Currently accepted value is '2.0'. - public string ConditionVersion { get; set; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignmentFilter.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignmentFilter.cs deleted file mode 100644 index 3cb268cd2c64..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignmentFilter.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Authorization.Models -{ - /// Role Assignments filter. - internal partial class RoleAssignmentFilter - { - /// Initializes a new instance of RoleAssignmentFilter. - internal RoleAssignmentFilter() - { - } - - /// Returns role assignment of the specific principal. - public string PrincipalId { get; } - /// The Delegation flag for the role assignment. - public bool? CanDelegate { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignmentListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignmentListResult.Serialization.cs deleted file mode 100644 index 5c3d699538dd..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignmentListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Authorization.Models -{ - public partial class RoleAssignmentListResult - { - internal static RoleAssignmentListResult DeserializeRoleAssignmentListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(RoleAssignment.DeserializeRoleAssignment(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new RoleAssignmentListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignmentListResult.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignmentListResult.cs deleted file mode 100644 index ec7afa7e5a8c..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/Models/RoleAssignmentListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Authorization.Models -{ - /// Role assignment list operation result. - public partial class RoleAssignmentListResult - { - /// Initializes a new instance of RoleAssignmentListResult. - internal RoleAssignmentListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of RoleAssignmentListResult. - /// Role assignment list. - /// The URL to use for getting the next set of results. - internal RoleAssignmentListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// Role assignment list. - public IReadOnlyList Value { get; } - /// The URL to use for getting the next set of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/RoleAssignmentsOperations.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/RoleAssignmentsOperations.cs deleted file mode 100644 index f2cff03cada4..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/RoleAssignmentsOperations.cs +++ /dev/null @@ -1,653 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Authorization.Models; - -namespace Azure.ResourceManager.Authorization -{ - /// The RoleAssignments service client. - public partial class RoleAssignmentsOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal RoleAssignmentsRestOperations RestClient { get; } - /// Initializes a new instance of RoleAssignmentsOperations for mocking. - protected RoleAssignmentsOperations() - { - } - /// Initializes a new instance of RoleAssignmentsOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The ID of the target subscription. - /// server parameter. - /// Api Version. - internal RoleAssignmentsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2020-04-01-preview") - { - RestClient = new RoleAssignmentsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Delete a role assignment. - /// The scope of the role assignment to delete. - /// The name of the role assignment to delete. - /// The cancellation token to use. - public virtual async Task> DeleteAsync(string scope, string roleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.Delete"); - scope0.Start(); - try - { - return await RestClient.DeleteAsync(scope, roleAssignmentName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Delete a role assignment. - /// The scope of the role assignment to delete. - /// The name of the role assignment to delete. - /// The cancellation token to use. - public virtual Response Delete(string scope, string roleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.Delete"); - scope0.Start(); - try - { - return RestClient.Delete(scope, roleAssignmentName, cancellationToken); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Create a role assignment. - /// The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource. - /// The name of the role assignment to create. It can be any valid GUID. - /// Parameters for the role assignment. - /// The cancellation token to use. - public virtual async Task> CreateAsync(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.Create"); - scope0.Start(); - try - { - return await RestClient.CreateAsync(scope, roleAssignmentName, parameters, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Create a role assignment. - /// The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource. - /// The name of the role assignment to create. It can be any valid GUID. - /// Parameters for the role assignment. - /// The cancellation token to use. - public virtual Response Create(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.Create"); - scope0.Start(); - try - { - return RestClient.Create(scope, roleAssignmentName, parameters, cancellationToken); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Get the specified role assignment. - /// The scope of the role assignment. - /// The name of the role assignment to get. - /// The cancellation token to use. - public virtual async Task> GetAsync(string scope, string roleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.Get"); - scope0.Start(); - try - { - return await RestClient.GetAsync(scope, roleAssignmentName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Get the specified role assignment. - /// The scope of the role assignment. - /// The name of the role assignment to get. - /// The cancellation token to use. - public virtual Response Get(string scope, string roleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.Get"); - scope0.Start(); - try - { - return RestClient.Get(scope, roleAssignmentName, cancellationToken); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Delete a role assignment. - /// The ID of the role assignment to delete. - /// The cancellation token to use. - public virtual async Task> DeleteByIdAsync(string roleId, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.DeleteById"); - scope0.Start(); - try - { - return await RestClient.DeleteByIdAsync(roleId, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Delete a role assignment. - /// The ID of the role assignment to delete. - /// The cancellation token to use. - public virtual Response DeleteById(string roleId, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.DeleteById"); - scope0.Start(); - try - { - return RestClient.DeleteById(roleId, cancellationToken); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Creates a role assignment by ID. - /// The ID of the role assignment to create. - /// Parameters for the role assignment. - /// The cancellation token to use. - public virtual async Task> CreateByIdAsync(string roleId, RoleAssignmentCreateParameters parameters, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.CreateById"); - scope0.Start(); - try - { - return await RestClient.CreateByIdAsync(roleId, parameters, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Creates a role assignment by ID. - /// The ID of the role assignment to create. - /// Parameters for the role assignment. - /// The cancellation token to use. - public virtual Response CreateById(string roleId, RoleAssignmentCreateParameters parameters, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.CreateById"); - scope0.Start(); - try - { - return RestClient.CreateById(roleId, parameters, cancellationToken); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Gets a role assignment by ID. - /// The ID of the role assignment to get. - /// The cancellation token to use. - public virtual async Task> GetByIdAsync(string roleId, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.GetById"); - scope0.Start(); - try - { - return await RestClient.GetByIdAsync(roleId, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Gets a role assignment by ID. - /// The ID of the role assignment to get. - /// The cancellation token to use. - public virtual Response GetById(string roleId, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.GetById"); - scope0.Start(); - try - { - return RestClient.GetById(roleId, cancellationToken); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// List role assignments for a resource. - /// The name of the resource group. The name is case insensitive. - /// The namespace of the resource provider. - /// The parent resource identity. - /// The resource type of the resource. - /// The name of the resource to get role assignments for. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// , , , , or is null. - public virtual AsyncPageable ListForResourceAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) - { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - if (resourceProviderNamespace == null) - { - throw new ArgumentNullException(nameof(resourceProviderNamespace)); - } - if (parentResourcePath == null) - { - throw new ArgumentNullException(nameof(parentResourcePath)); - } - if (resourceType == null) - { - throw new ArgumentNullException(nameof(resourceType)); - } - if (resourceName == null) - { - throw new ArgumentNullException(nameof(resourceName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.ListForResource"); - scope0.Start(); - try - { - var response = await RestClient.ListForResourceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.ListForResource"); - scope0.Start(); - try - { - var response = await RestClient.ListForResourceNextPageAsync(nextLink, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List role assignments for a resource. - /// The name of the resource group. The name is case insensitive. - /// The namespace of the resource provider. - /// The parent resource identity. - /// The resource type of the resource. - /// The name of the resource to get role assignments for. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// , , , , or is null. - public virtual Pageable ListForResource(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) - { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - if (resourceProviderNamespace == null) - { - throw new ArgumentNullException(nameof(resourceProviderNamespace)); - } - if (parentResourcePath == null) - { - throw new ArgumentNullException(nameof(parentResourcePath)); - } - if (resourceType == null) - { - throw new ArgumentNullException(nameof(resourceType)); - } - if (resourceName == null) - { - throw new ArgumentNullException(nameof(resourceName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.ListForResource"); - scope0.Start(); - try - { - var response = RestClient.ListForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.ListForResource"); - scope0.Start(); - try - { - var response = RestClient.ListForResourceNextPage(nextLink, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List role assignments for a resource group. - /// The name of the resource group. The name is case insensitive. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// is null. - public virtual AsyncPageable ListForResourceGroupAsync(string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) - { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.ListForResourceGroup"); - scope0.Start(); - try - { - var response = await RestClient.ListForResourceGroupAsync(resourceGroupName, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.ListForResourceGroup"); - scope0.Start(); - try - { - var response = await RestClient.ListForResourceGroupNextPageAsync(nextLink, resourceGroupName, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List role assignments for a resource group. - /// The name of the resource group. The name is case insensitive. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// is null. - public virtual Pageable ListForResourceGroup(string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) - { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.ListForResourceGroup"); - scope0.Start(); - try - { - var response = RestClient.ListForResourceGroup(resourceGroupName, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.ListForResourceGroup"); - scope0.Start(); - try - { - var response = RestClient.ListForResourceGroupNextPage(nextLink, resourceGroupName, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Gets all role assignments for the subscription. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - public virtual AsyncPageable ListAsync(string nameFilter = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.List"); - scope0.Start(); - try - { - var response = await RestClient.ListAsync(nameFilter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.List"); - scope0.Start(); - try - { - var response = await RestClient.ListNextPageAsync(nextLink, nameFilter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Gets all role assignments for the subscription. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - public virtual Pageable List(string nameFilter = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.List"); - scope0.Start(); - try - { - var response = RestClient.List(nameFilter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.List"); - scope0.Start(); - try - { - var response = RestClient.ListNextPage(nextLink, nameFilter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Gets role assignments for a scope. - /// The scope of the role assignments. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// is null. - public virtual AsyncPageable ListForScopeAsync(string scope, string filter = null, CancellationToken cancellationToken = default) - { - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.ListForScope"); - scope0.Start(); - try - { - var response = await RestClient.ListForScopeAsync(scope, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.ListForScope"); - scope0.Start(); - try - { - var response = await RestClient.ListForScopeNextPageAsync(nextLink, scope, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Gets role assignments for a scope. - /// The scope of the role assignments. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// is null. - public virtual Pageable ListForScope(string scope, string filter = null, CancellationToken cancellationToken = default) - { - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.ListForScope"); - scope0.Start(); - try - { - var response = RestClient.ListForScope(scope, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsOperations.ListForScope"); - scope0.Start(); - try - { - var response = RestClient.ListForScopeNextPage(nextLink, scope, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/RoleAssignmentsRestOperations.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/RoleAssignmentsRestOperations.cs deleted file mode 100644 index a96335cb4f09..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Generated/RoleAssignmentsRestOperations.cs +++ /dev/null @@ -1,1227 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Authorization.Models; - -namespace Azure.ResourceManager.Authorization -{ - internal partial class RoleAssignmentsRestOperations - { - private string subscriptionId; - private Uri endpoint; - private string apiVersion; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of RoleAssignmentsRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The ID of the target subscription. - /// server parameter. - /// Api Version. - /// or is null. - public RoleAssignmentsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2020-04-01-preview") - { - if (subscriptionId == null) - { - throw new ArgumentNullException(nameof(subscriptionId)); - } - endpoint ??= new Uri("https://management.azure.com"); - if (apiVersion == null) - { - throw new ArgumentNullException(nameof(apiVersion)); - } - - this.subscriptionId = subscriptionId; - this.endpoint = endpoint; - this.apiVersion = apiVersion; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListForResourceRequest(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, 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("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/", false); - uri.AppendPath(resourceProviderNamespace, true); - uri.AppendPath("/", false); - uri.AppendPath(parentResourcePath, false); - uri.AppendPath("/", false); - uri.AppendPath(resourceType, false); - uri.AppendPath("/", false); - uri.AppendPath(resourceName, true); - uri.AppendPath("/providers/Microsoft.Authorization/roleAssignments", false); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// List role assignments for a resource. - /// The name of the resource group. The name is case insensitive. - /// The namespace of the resource provider. - /// The parent resource identity. - /// The resource type of the resource. - /// The name of the resource to get role assignments for. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// , , , , or is null. - public async Task> ListForResourceAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) - { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - if (resourceProviderNamespace == null) - { - throw new ArgumentNullException(nameof(resourceProviderNamespace)); - } - if (parentResourcePath == null) - { - throw new ArgumentNullException(nameof(parentResourcePath)); - } - if (resourceType == null) - { - throw new ArgumentNullException(nameof(resourceType)); - } - if (resourceName == null) - { - throw new ArgumentNullException(nameof(resourceName)); - } - - using var message = CreateListForResourceRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// List role assignments for a resource. - /// The name of the resource group. The name is case insensitive. - /// The namespace of the resource provider. - /// The parent resource identity. - /// The resource type of the resource. - /// The name of the resource to get role assignments for. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// , , , , or is null. - public Response ListForResource(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) - { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - if (resourceProviderNamespace == null) - { - throw new ArgumentNullException(nameof(resourceProviderNamespace)); - } - if (parentResourcePath == null) - { - throw new ArgumentNullException(nameof(parentResourcePath)); - } - if (resourceType == null) - { - throw new ArgumentNullException(nameof(resourceType)); - } - if (resourceName == null) - { - throw new ArgumentNullException(nameof(resourceName)); - } - - using var message = CreateListForResourceRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListForResourceGroupRequest(string resourceGroupName, string filter) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Authorization/roleAssignments", false); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// List role assignments for a resource group. - /// The name of the resource group. The name is case insensitive. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// is null. - public async Task> ListForResourceGroupAsync(string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) - { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - - using var message = CreateListForResourceGroupRequest(resourceGroupName, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// List role assignments for a resource group. - /// The name of the resource group. The name is case insensitive. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// is null. - public Response ListForResourceGroup(string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) - { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - - using var message = CreateListForResourceGroupRequest(resourceGroupName, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDeleteRequest(string scope, string roleAssignmentName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); - uri.AppendPath("/providers/Microsoft.Authorization/roleAssignments/", false); - uri.AppendPath(roleAssignmentName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Delete a role assignment. - /// The scope of the role assignment to delete. - /// The name of the role assignment to delete. - /// The cancellation token to use. - /// or is null. - public async Task> DeleteAsync(string scope, string roleAssignmentName, CancellationToken cancellationToken = default) - { - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - if (roleAssignmentName == null) - { - throw new ArgumentNullException(nameof(roleAssignmentName)); - } - - using var message = CreateDeleteRequest(scope, roleAssignmentName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RoleAssignment value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 204: - return Response.FromValue(null, message.Response); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Delete a role assignment. - /// The scope of the role assignment to delete. - /// The name of the role assignment to delete. - /// The cancellation token to use. - /// or is null. - public Response Delete(string scope, string roleAssignmentName, CancellationToken cancellationToken = default) - { - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - if (roleAssignmentName == null) - { - throw new ArgumentNullException(nameof(roleAssignmentName)); - } - - using var message = CreateDeleteRequest(scope, roleAssignmentName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RoleAssignment value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 204: - return Response.FromValue(null, message.Response); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateCreateRequest(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); - uri.AppendPath("/providers/Microsoft.Authorization/roleAssignments/", false); - uri.AppendPath(roleAssignmentName, 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(parameters); - request.Content = content; - return message; - } - - /// Create a role assignment. - /// The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource. - /// The name of the role assignment to create. It can be any valid GUID. - /// Parameters for the role assignment. - /// The cancellation token to use. - /// , , or is null. - public async Task> CreateAsync(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, CancellationToken cancellationToken = default) - { - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - if (roleAssignmentName == null) - { - throw new ArgumentNullException(nameof(roleAssignmentName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateCreateRequest(scope, roleAssignmentName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 201: - { - RoleAssignment value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Create a role assignment. - /// The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource. - /// The name of the role assignment to create. It can be any valid GUID. - /// Parameters for the role assignment. - /// The cancellation token to use. - /// , , or is null. - public Response Create(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, CancellationToken cancellationToken = default) - { - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - if (roleAssignmentName == null) - { - throw new ArgumentNullException(nameof(roleAssignmentName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateCreateRequest(scope, roleAssignmentName, parameters); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 201: - { - RoleAssignment value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRequest(string scope, string roleAssignmentName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); - uri.AppendPath("/providers/Microsoft.Authorization/roleAssignments/", false); - uri.AppendPath(roleAssignmentName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Get the specified role assignment. - /// The scope of the role assignment. - /// The name of the role assignment to get. - /// The cancellation token to use. - /// or is null. - public async Task> GetAsync(string scope, string roleAssignmentName, CancellationToken cancellationToken = default) - { - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - if (roleAssignmentName == null) - { - throw new ArgumentNullException(nameof(roleAssignmentName)); - } - - using var message = CreateGetRequest(scope, roleAssignmentName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RoleAssignment value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Get the specified role assignment. - /// The scope of the role assignment. - /// The name of the role assignment to get. - /// The cancellation token to use. - /// or is null. - public Response Get(string scope, string roleAssignmentName, CancellationToken cancellationToken = default) - { - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - if (roleAssignmentName == null) - { - throw new ArgumentNullException(nameof(roleAssignmentName)); - } - - using var message = CreateGetRequest(scope, roleAssignmentName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RoleAssignment value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDeleteByIdRequest(string roleId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/", false); - uri.AppendPath(roleId, false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Delete a role assignment. - /// The ID of the role assignment to delete. - /// The cancellation token to use. - /// is null. - public async Task> DeleteByIdAsync(string roleId, CancellationToken cancellationToken = default) - { - if (roleId == null) - { - throw new ArgumentNullException(nameof(roleId)); - } - - using var message = CreateDeleteByIdRequest(roleId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RoleAssignment value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 204: - return Response.FromValue(null, message.Response); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Delete a role assignment. - /// The ID of the role assignment to delete. - /// The cancellation token to use. - /// is null. - public Response DeleteById(string roleId, CancellationToken cancellationToken = default) - { - if (roleId == null) - { - throw new ArgumentNullException(nameof(roleId)); - } - - using var message = CreateDeleteByIdRequest(roleId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RoleAssignment value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 204: - return Response.FromValue(null, message.Response); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateCreateByIdRequest(string roleId, RoleAssignmentCreateParameters parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/", false); - uri.AppendPath(roleId, false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - return message; - } - - /// Creates a role assignment by ID. - /// The ID of the role assignment to create. - /// Parameters for the role assignment. - /// The cancellation token to use. - /// or is null. - public async Task> CreateByIdAsync(string roleId, RoleAssignmentCreateParameters parameters, CancellationToken cancellationToken = default) - { - if (roleId == null) - { - throw new ArgumentNullException(nameof(roleId)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateCreateByIdRequest(roleId, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 201: - { - RoleAssignment value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Creates a role assignment by ID. - /// The ID of the role assignment to create. - /// Parameters for the role assignment. - /// The cancellation token to use. - /// or is null. - public Response CreateById(string roleId, RoleAssignmentCreateParameters parameters, CancellationToken cancellationToken = default) - { - if (roleId == null) - { - throw new ArgumentNullException(nameof(roleId)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateCreateByIdRequest(roleId, parameters); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 201: - { - RoleAssignment value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetByIdRequest(string roleId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/", false); - uri.AppendPath(roleId, false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a role assignment by ID. - /// The ID of the role assignment to get. - /// The cancellation token to use. - /// is null. - public async Task> GetByIdAsync(string roleId, CancellationToken cancellationToken = default) - { - if (roleId == null) - { - throw new ArgumentNullException(nameof(roleId)); - } - - using var message = CreateGetByIdRequest(roleId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RoleAssignment value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets a role assignment by ID. - /// The ID of the role assignment to get. - /// The cancellation token to use. - /// is null. - public Response GetById(string roleId, CancellationToken cancellationToken = default) - { - if (roleId == null) - { - throw new ArgumentNullException(nameof(roleId)); - } - - using var message = CreateGetByIdRequest(roleId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RoleAssignment value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListRequest(string filter) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Authorization/roleAssignments", false); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets all role assignments for the subscription. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - public async Task> ListAsync(string nameFilter = null, CancellationToken cancellationToken = default) - { - using var message = CreateListRequest(nameFilter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets all role assignments for the subscription. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - public Response List(string nameFilter = null, CancellationToken cancellationToken = default) - { - using var message = CreateListRequest(nameFilter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListForScopeRequest(string scope, string filter) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); - uri.AppendPath("/providers/Microsoft.Authorization/roleAssignments", false); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets role assignments for a scope. - /// The scope of the role assignments. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// is null. - public async Task> ListForScopeAsync(string scope, string filter = null, CancellationToken cancellationToken = default) - { - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - - using var message = CreateListForScopeRequest(scope, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets role assignments for a scope. - /// The scope of the role assignments. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// is null. - public Response ListForScope(string scope, string filter = null, CancellationToken cancellationToken = default) - { - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - - using var message = CreateListForScopeRequest(scope, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListForResourceNextPageRequest(string nextLink, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, 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"); - return message; - } - - /// List role assignments for a resource. - /// The URL to the next page of results. - /// The name of the resource group. The name is case insensitive. - /// The namespace of the resource provider. - /// The parent resource identity. - /// The resource type of the resource. - /// The name of the resource to get role assignments for. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// , , , , , or is null. - public async Task> ListForResourceNextPageAsync(string nextLink, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - if (resourceProviderNamespace == null) - { - throw new ArgumentNullException(nameof(resourceProviderNamespace)); - } - if (parentResourcePath == null) - { - throw new ArgumentNullException(nameof(parentResourcePath)); - } - if (resourceType == null) - { - throw new ArgumentNullException(nameof(resourceType)); - } - if (resourceName == null) - { - throw new ArgumentNullException(nameof(resourceName)); - } - - using var message = CreateListForResourceNextPageRequest(nextLink, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// List role assignments for a resource. - /// The URL to the next page of results. - /// The name of the resource group. The name is case insensitive. - /// The namespace of the resource provider. - /// The parent resource identity. - /// The resource type of the resource. - /// The name of the resource to get role assignments for. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// , , , , , or is null. - public Response ListForResourceNextPage(string nextLink, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - if (resourceProviderNamespace == null) - { - throw new ArgumentNullException(nameof(resourceProviderNamespace)); - } - if (parentResourcePath == null) - { - throw new ArgumentNullException(nameof(parentResourcePath)); - } - if (resourceType == null) - { - throw new ArgumentNullException(nameof(resourceType)); - } - if (resourceName == null) - { - throw new ArgumentNullException(nameof(resourceName)); - } - - using var message = CreateListForResourceNextPageRequest(nextLink, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListForResourceGroupNextPageRequest(string nextLink, string resourceGroupName, 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"); - return message; - } - - /// List role assignments for a resource group. - /// The URL to the next page of results. - /// The name of the resource group. The name is case insensitive. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// or is null. - public async Task> ListForResourceGroupNextPageAsync(string nextLink, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - - using var message = CreateListForResourceGroupNextPageRequest(nextLink, resourceGroupName, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// List role assignments for a resource group. - /// The URL to the next page of results. - /// The name of the resource group. The name is case insensitive. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// or is null. - public Response ListForResourceGroupNextPage(string nextLink, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - - using var message = CreateListForResourceGroupNextPageRequest(nextLink, resourceGroupName, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, 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"); - return message; - } - - /// Gets all role assignments for the subscription. - /// The URL to the next page of results. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// is null. - public async Task> ListNextPageAsync(string nextLink, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListNextPageRequest(nextLink, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets all role assignments for the subscription. - /// The URL to the next page of results. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// is null. - public Response ListNextPage(string nextLink, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListNextPageRequest(nextLink, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListForScopeNextPageRequest(string nextLink, string scope, 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"); - return message; - } - - /// Gets role assignments for a scope. - /// The URL to the next page of results. - /// The scope of the role assignments. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// or is null. - public async Task> ListForScopeNextPageAsync(string nextLink, string scope, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - - using var message = CreateListForScopeNextPageRequest(nextLink, scope, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets role assignments for a scope. - /// The URL to the next page of results. - /// The scope of the role assignments. - /// The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. - /// The cancellation token to use. - /// or is null. - public Response ListForScopeNextPage(string nextLink, string scope, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - - using var message = CreateListForScopeNextPageRequest(nextLink, scope, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Properties/AssemblyInfo.cs b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Properties/AssemblyInfo.cs deleted file mode 100644 index 4cab9c49d0eb..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Runtime.CompilerServices; - -[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Authorization")] - -[assembly: InternalsVisibleTo("Azure.ResourceManager.Authorization.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/README.MD b/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/README.MD deleted file mode 100644 index b41873a90b17..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Azure.ResourceManager.Authorization/README.MD +++ /dev/null @@ -1,3 +0,0 @@ -# Proto Azure ResourceManager Authorization - -Prototype version of Azure.ResourceManager.Authorization used to showcase and test the new prototype track 2 management plane SDK \ No newline at end of file diff --git a/sdk/resourcemanager/Proto.Client/authorization/CHANGELOG.md b/sdk/resourcemanager/Proto.Client/authorization/CHANGELOG.md deleted file mode 100644 index 5c312e4ea9be..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -# Release History - -## 1.0.0-beta.1 (Unreleased) - --Initial checkin diff --git a/sdk/resourcemanager/Proto.Client/authorization/Extensions/RoleAssignmentExtensions.cs b/sdk/resourcemanager/Proto.Client/authorization/Extensions/RoleAssignmentExtensions.cs deleted file mode 100644 index 8a1522991338..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Extensions/RoleAssignmentExtensions.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License - -using Azure.ResourceManager.Core; - -namespace Proto.Authorization -{ - /// - /// Extensions for RoleAssignment Containers and Operations - /// - public static class RoleAssignmentExtensions - { - /// - /// Get RoleAssignment Container for the given resource. Note that this is only valid for unconstrained role assignments, so - /// it is a generation-time decision if we include this. - /// - /// The resource that is the target of the roel assignemnt - /// A that allows creating and listing RoleAssignments - public static RoleAssignmentContainer GetRoleAssignments(this ResourceOperationsBase resource) - { - return new RoleAssignmentContainer(resource); - } - - /// - /// Get RoleAssignment Container for the given resource. Note that this is only valid for unconstrained role assignments, so - /// it is a generation-time decision if we include this. - /// - /// The subscription that is the target of the role assignemnt - /// A that allows creating and listing RoleAssignments - public static RoleAssignmentContainer GetRoleAssignments(this SubscriptionOperations resource) - { - return new RoleAssignmentContainer(resource); - } - - /// - /// Get RoleAssignment Container for the given resource and scope. Note that this is only valid for unconstrained role assignments, so - /// it is a generation-time decision if we include this. - /// - /// The subscription containign the role assignment - /// The target of the role assignment - /// A that allows creating and listing RoleAssignments - public static RoleAssignmentContainer GetRoleAssigmentsAtScope(this SubscriptionOperations subscription, ResourceIdentifier scope) - { - return new RoleAssignmentContainer(subscription, scope); - } - - /// - /// Get RoleAssignment Container for the given resource and scope. Note that this is only valid for unconstrained role assignments, so - /// it is a generation-time decision if we include this. - /// - /// The subscription containign the role assignment - /// The target of the role assignment - /// A that allows creating and listing RoleAssignments - public static RoleAssignmentContainer GetRoleAssigmentsAtScope(this SubscriptionOperations subscription, Resource scope) - { - return new RoleAssignmentContainer(subscription, scope.Id); - } - - /// - /// Get RoleAssignment Operations for the given resource and scope. Note that this is only valid for unconstrained role assignments, so - /// it is a generation-time decision if we include this. - /// - /// The resource containing the role assignment - /// The name of the role assignment - /// A that allows getting and deleting RoleAssignments - public static RoleAssignmentOperations GetRoleAssignmentOperations(this ResourceOperationsBase resource, string name) - { - return new RoleAssignmentOperations(resource, $"{resource.Id}/providers/Microsoft.Authorization/roleAssignments/{name}"); - } - - /// - /// Get RoleAssignment Operations for the given resource and scope. Note that this is only valid for unconstrained role assignments, so - /// it is a generation-time decision if we include this. - /// - /// The subscription containing the role assignment - /// The name of the role assignment - /// A that allows getting and deleting RoleAssignments - public static RoleAssignmentOperations GetRoleAssignmentOperations(this SubscriptionOperations resource, string name) - { - return new RoleAssignmentOperations(resource, $"{resource.Id}/providers/Microsoft.Authorization/roleAssignments/{name}"); - } - - /// - /// Get RoleAssignment Operations for the given resource and scope. Note that this is only valid for unconstrained role assignments, so - /// it is a generation-time decision if we include this. - /// - /// The subscription containing the role assignment - /// The id of the role assignment - /// A that allows getting and deleting RoleAssignments - public static RoleAssignmentOperations GetRoleAssignmentOperationsAtScope(this SubscriptionOperations resource, ResourceIdentifier resourceId) - { - return new RoleAssignmentOperations(resource, resourceId); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Placeholder/PhArmOperation.cs b/sdk/resourcemanager/Proto.Client/authorization/Placeholder/PhArmOperation.cs deleted file mode 100644 index aecd09d4a1e6..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Placeholder/PhArmOperation.cs +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; - -namespace Proto.Authorization -{ - /// - /// A class representing an arm operation wrapper object. - /// - /// The to convert TModel into. - /// The model returned by existing Operation methods. - public class PhArmOperation : Operation - where TOperations : class - where TModel : class - { - private readonly Func _converter; - private readonly Operation _wrappedOperation; - private readonly Operation _wrappedResponseOperation; - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - public PhArmOperation(Operation wrapped, Func converter) - { - if (wrapped is null) - { - throw new ArgumentNullException(nameof(wrapped)); - } - - if (converter is null) - { - throw new ArgumentNullException(nameof(converter)); - } - - _wrappedOperation = wrapped; - _converter = converter; - } - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - public PhArmOperation(Response wrapped, Func converter) - { - if (wrapped is null) - { - throw new ArgumentNullException(nameof(wrapped)); - } - - if (converter is null) - { - throw new ArgumentNullException(nameof(converter)); - } - - _wrappedResponseOperation = new PhValueArmOperation(wrapped); - _converter = converter; - } - - /// - /// Initializes a new instance of the class for mocking. - /// - protected PhArmOperation() - { - } - - /// - public override string Id => _wrappedOperation?.Id; - - /// - public override TOperations Value => _converter(_doesWrapOperation ? _wrappedOperation.Value : _wrappedResponseOperation.Value); - - /// - public override bool HasCompleted => _doesWrapOperation ? _wrappedOperation.HasCompleted : _wrappedResponseOperation.HasCompleted; - - /// - public override bool HasValue => _doesWrapOperation ? _wrappedOperation.HasValue : _wrappedResponseOperation.HasValue; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "")] - private bool _doesWrapOperation => _wrappedResponseOperation is null; - - /// - public override Response GetRawResponse() - { - return _doesWrapOperation ? _wrappedOperation.GetRawResponse() : _wrappedResponseOperation.GetRawResponse(); - } - - /// - public override Response UpdateStatus(CancellationToken cancellationToken = default) - { - return _doesWrapOperation ? _wrappedOperation.UpdateStatus(cancellationToken) : _wrappedResponseOperation.UpdateStatus(cancellationToken); - } - - /// - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) - { - return _doesWrapOperation - ? _wrappedOperation.UpdateStatusAsync(cancellationToken) - : _wrappedResponseOperation.UpdateStatusAsync(cancellationToken); - } - - /// - public override async ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) - { - var task = WaitForCompletionAsync(OperationInternals.DefaultPollingInterval, cancellationToken); - return await task.ConfigureAwait(false); - } - - /// - public override async ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) - { - var value = _doesWrapOperation - ? await _wrappedOperation.WaitForCompletionAsync(pollingInterval, cancellationToken).ConfigureAwait(false) - : await _wrappedResponseOperation.WaitForCompletionAsync(pollingInterval, cancellationToken).ConfigureAwait(false); - return Response.FromValue(_converter(value.Value), GetRawResponse()); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Placeholder/PhValueArmOperation.cs b/sdk/resourcemanager/Proto.Client/authorization/Placeholder/PhValueArmOperation.cs deleted file mode 100644 index 3aaf5f1749ad..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Placeholder/PhValueArmOperation.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; - -namespace Proto.Authorization -{ - /// - /// A class representing an arm operation wrapper object. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1618:Generic type parameters should be documented", Justification = "")] - internal class PhValueArmOperation : Operation - where TOperations : class - { - private readonly Operation _wrappedOperation; - private readonly OperationOrResponseInternals _wrappedResponseOperation; - - /// - /// Initializes a new instance of the class for mocking. - /// - protected PhValueArmOperation() - { - } - - /// - /// Initializes a new instance of the . - /// - /// The operation object to wrap. - public PhValueArmOperation(Operation wrapped) - { - if (wrapped is null) - throw new ArgumentNullException(nameof(wrapped)); - - _wrappedOperation = wrapped; - } - - /// - /// Initializes a new instance of the . - /// - /// The response object to wrap. - public PhValueArmOperation(Response wrapped) - { - if (wrapped is null) - throw new ArgumentNullException(nameof(wrapped)); - - _wrappedResponseOperation = new OperationOrResponseInternals(wrapped); - } - - private bool _doesWrapOperation => _wrappedResponseOperation is null; - - public override TOperations Value => _doesWrapOperation ? _wrappedOperation.Value : _wrappedResponseOperation.Value; - - public override bool HasValue => _doesWrapOperation ? _wrappedOperation.HasValue : _wrappedResponseOperation.HasValue; - - public override string Id => _wrappedOperation?.Id; - - public override bool HasCompleted => _doesWrapOperation ? _wrappedOperation.HasCompleted : _wrappedResponseOperation.HasCompleted; - - public override Response GetRawResponse() => _doesWrapOperation? _wrappedOperation.GetRawResponse() : _wrappedResponseOperation.GetRawResponse(); - - public override Response UpdateStatus(CancellationToken cancellationToken = default) => _doesWrapOperation ? _wrappedOperation.UpdateStatus(cancellationToken) : _wrappedResponseOperation.UpdateStatus(cancellationToken); - - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _doesWrapOperation ? _wrappedOperation.UpdateStatusAsync(cancellationToken) : _wrappedResponseOperation.UpdateStatusAsync(cancellationToken); - - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _doesWrapOperation ? _wrappedOperation.WaitForCompletionAsync(cancellationToken) : _wrappedResponseOperation.WaitForCompletionAsync(cancellationToken); - - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) => _doesWrapOperation ? _wrappedOperation.WaitForCompletionAsync(pollingInterval, cancellationToken) : _wrappedResponseOperation.WaitForCompletionAsync(pollingInterval, cancellationToken); - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Placeholder/PhVoidArmOperation.cs b/sdk/resourcemanager/Proto.Client/authorization/Placeholder/PhVoidArmOperation.cs deleted file mode 100644 index 75d76ec9edd5..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Placeholder/PhVoidArmOperation.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; - -namespace Proto.Authorization -{ - /// - /// A class representing an arm operation wrapper object. - /// - public class PhVoidArmOperation : Operation - { - private readonly Operation _wrappedOperation; - private readonly OperationOrResponseInternals _wrappedResponseOperation; - - /// - /// Initializes a new instance of the class for mocking. - /// - protected PhVoidArmOperation() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - public PhVoidArmOperation(Operation wrapped) - { - if (wrapped is null) - throw new ArgumentNullException(nameof(wrapped)); - - _wrappedOperation = wrapped; - } - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - public PhVoidArmOperation(Response wrapped) - { - if (wrapped is null) - throw new ArgumentNullException(nameof(wrapped)); - - _wrappedResponseOperation = new OperationOrResponseInternals(wrapped); - } - - private bool _doesWrapOperation => _wrappedResponseOperation is null; - - /// - public override string Id => _wrappedOperation?.Id; - - /// - public override bool HasCompleted => _doesWrapOperation ? _wrappedOperation.HasCompleted : _wrappedResponseOperation.HasCompleted; - - /// - public override Response GetRawResponse() => _doesWrapOperation ? _wrappedOperation.GetRawResponse() : _wrappedResponseOperation.GetRawResponse(); - - /// - public override Response UpdateStatus(CancellationToken cancellationToken = default) => - _doesWrapOperation - ? _wrappedOperation.UpdateStatus(cancellationToken) - : _wrappedResponseOperation.UpdateStatus(cancellationToken); - - /// - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => - _doesWrapOperation - ? _wrappedOperation.UpdateStatusAsync(cancellationToken) - : _wrappedResponseOperation.UpdateStatusAsync(cancellationToken); - - /// - public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => - WaitForCompletionResponseAsync(OperationInternals.DefaultPollingInterval, cancellationToken); - - /// - public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) => - _doesWrapOperation - ? _wrappedOperation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken) - : _wrappedResponseOperation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Placeholder/RoleAssignmentCreateParameters.cs b/sdk/resourcemanager/Proto.Client/authorization/Placeholder/RoleAssignmentCreateParameters.cs deleted file mode 100644 index 21011c779e77..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Placeholder/RoleAssignmentCreateParameters.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License - -using Azure.ResourceManager.Authorization.Models; -using Azure.ResourceManager.Core; - -namespace Proto.Authorization -{ - /// - /// Creation properties for RoleAssignments - /// - public class RoleAssignmentCreateParameters - { - /// - /// Initializes a new instance of the class. - /// - /// The granted permissiosn for this assignment - /// The principal id for this assignment - public RoleAssignmentCreateParameters(ResourceIdentifier roleDefinitionId, string principalId) - { - RoleDefinitionId = roleDefinitionId; - PrincipalId = principalId; - PrincipalType = Azure.ResourceManager.Authorization.Models.PrincipalType.ServicePrincipal; - } - - /// - /// Gets the identifier of the role definition used in the assignment - /// - public ResourceIdentifier RoleDefinitionId { get; } - - /// - /// Gets the Object ID of the principal used in the assignment - /// - public string PrincipalId { get; } - - /// - /// Gets or sets the type of the principal used in the assignment - /// - public PrincipalType? PrincipalType { get; set; } - - /// - /// Gets or sets the data indicating whether the principal can delegate privileges - /// - public bool? CanDelegate { get; set; } - - /// - /// Return the underlying serialization model - /// - /// The serialization model for the role assignemnt - public Azure.ResourceManager.Authorization.Models.RoleAssignmentCreateParameters ToModel() - { - var model = new Azure.ResourceManager.Authorization.Models.RoleAssignmentCreateParameters(RoleDefinitionId, PrincipalId); - model.PrincipalType = PrincipalType; - model.CanDelegate = CanDelegate; - return model; - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Placeholder/RoleAssignmentData.cs b/sdk/resourcemanager/Proto.Client/authorization/Placeholder/RoleAssignmentData.cs deleted file mode 100644 index f6718cd75e41..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Placeholder/RoleAssignmentData.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License - -using Azure.ResourceManager.Authorization.Models; -using Azure.ResourceManager.Core; - -namespace Proto.Authorization -{ - /// - /// Placholder class containing Role assignment POCO properties. - /// - public class RoleAssignmentData : Resource - { - private Azure.ResourceManager.Authorization.Models.RoleAssignment _model; - - /// - /// Initializes a new instance of the class. - /// - /// The Track2 management plane assignment. - public RoleAssignmentData(Azure.ResourceManager.Authorization.Models.RoleAssignment assign) - : base(assign.Id, assign.Name, assign.Type) - { - _model = assign; - Scope = assign.Scope; - RoleDefinitionId = assign.RoleDefinitionId; - PrincipalId = assign.PrincipalId; - PrincipalType = assign.PrincipalType; - CanDelegate = assign.CanDelegate; - } - - /// - /// Gets the resource type of thsi resource. - /// - public static Azure.ResourceManager.Core.ResourceType ResourceType => "Microsoft.Authorization/roleAssignments"; - - /// - /// Gets the target of this role assignment. - /// - public string Scope { get; } - - /// - /// Gets the role definition id for this role assignment - determines the permissions allowed by this assignment. - /// - public ResourceIdentifier RoleDefinitionId { get; } - - /// - /// Gets the ActiveDirectory principal that is assigned privileges to the target by this assignemnt. - /// - public string PrincipalId { get; } - - /// - /// Gets the type of the principal associated with this assignment. - /// - public PrincipalType? PrincipalType { get; } - - /// - /// Gets the value determining whether the principal can delegate its permissions. - /// - public bool? CanDelegate { get; } - - /// - /// Gets the Track2 Management model associated with the data object. - /// - /// The Track2 Role Assignment, for serialization. - public Azure.ResourceManager.Authorization.Models.RoleAssignment ToModel() - { - return _model; - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/Proto.Authorization.csproj b/sdk/resourcemanager/Proto.Client/authorization/Proto.Authorization.csproj deleted file mode 100644 index d48caa0115ba..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/Proto.Authorization.csproj +++ /dev/null @@ -1,37 +0,0 @@ - - - - 1.0.0-beta.1 - netstandard2.0 - Proto.Authorization - latest - true - false - 0 - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - $(NoWarn);AZC0001;CA1303;SA0001;SA1629; SA1101;SA1200;SA1208;SA1309;SA1633; - false - - diff --git a/sdk/resourcemanager/Proto.Client/authorization/README.MD b/sdk/resourcemanager/Proto.Client/authorization/README.MD deleted file mode 100644 index dd11dbdd018a..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/README.MD +++ /dev/null @@ -1,3 +0,0 @@ -# Proto Authorization - -Prototype version of Azure.ResourceManager.Authorization used to showcase and test the new prototype track 2 management plane SDK \ No newline at end of file diff --git a/sdk/resourcemanager/Proto.Client/authorization/RoleAssignment.cs b/sdk/resourcemanager/Proto.Client/authorization/RoleAssignment.cs deleted file mode 100644 index 0590c98bf837..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/RoleAssignment.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Threading; -using System.Threading.Tasks; -using Azure.ResourceManager.Core; - -namespace Proto.Authorization -{ - /// - /// A Role Assignment for Role-based access control in ARM - /// - public class RoleAssignment : RoleAssignmentOperations - { - /// - /// Initializes a new instance of the class. - /// - /// The operations class to copy the http settings from. - /// The properties of the resource. - internal RoleAssignment(OperationsBase operations, RoleAssignmentData data) - : base(operations, data?.Id) - { - Data = data; - } - - /// - /// Gets the properties of the RoleAssignment. - /// - public RoleAssignmentData Data { get; } - - /// - protected override RoleAssignment GetResource(CancellationToken cancellationToken = default) - { - return this; - } - - /// - protected override Task GetResourceAsync(CancellationToken cancellationToken = default) - { - return Task.FromResult(this); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/RoleAssignmentContainer.cs b/sdk/resourcemanager/Proto.Client/authorization/RoleAssignmentContainer.cs deleted file mode 100644 index f2454a12be0a..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/RoleAssignmentContainer.cs +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using Azure.ResourceManager.Authorization; -using Azure.ResourceManager.Core; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Authorization -{ - /// - /// Container for role assignments - note that in this case, the container is either a TrackedResource or a resource Id - /// - public class RoleAssignmentContainer : ResourceContainerBase - { - /// - /// Initializes a new instance of the class. - /// - /// A generic operations class representing the parent of the role Assignment. - internal RoleAssignmentContainer(ResourceOperationsBase operations) - : base(operations) - { - // TODO: Remove this once we nio longer need to create management clients - string subscriptionId; - if (!operations.Id.TryGetSubscriptionId(out subscriptionId)) - { - subscriptionId = Guid.Empty.ToString(); - } - - Operations = new AuthorizationManagementClient(subscriptionId, BaseUri, Credential).RoleAssignments; - } - - /// - /// Initializes a new instance of the class. - /// - /// The client options with http client details for these operations. - /// The resource id of the target resource, resource group, or subscription for this role assignment. - internal RoleAssignmentContainer(ResourceOperationsBase operations, ResourceIdentifier scope) - : base(operations) - { - // TODO: Remove this once we nio longer need to create management clients - string subscriptionId; - if (!operations.Id.TryGetSubscriptionId(out subscriptionId)) - { - subscriptionId = Guid.Empty.ToString(); - } - - Operations = new AuthorizationManagementClient(subscriptionId, BaseUri, Credential).RoleAssignments; - } - - /// - protected override ResourceType ValidResourceType => RoleAssignmentOperations.ResourceType; - - /// - /// Gets the resource type of the resource being created. - /// - private RoleAssignmentsOperations Operations { get; } - - /// - /// Gets a RoleAssignment - /// - /// The role assignment name. - /// A token that allows cancellation of any blockign API calls made during this method. - /// The role assignment. - public Response Get(string resourceName, CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id, resourceName, cancellationToken); - return Response.FromValue(new RoleAssignment(this, new RoleAssignmentData(response.Value)), response.GetRawResponse()); - } - - /// - /// Gets a RoleAssignment - /// - /// The role assignment name. - /// A token that allows cancellation of any blockign API calls made during this method. - /// The role assignment. - public async Task> GetAsync(string resourceName, CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id, resourceName, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new RoleAssignment(this, new RoleAssignmentData(response.Value)), response.GetRawResponse()); - } - - /// - /// Create a role assignment. This method blocks until the RoleAssignment is created on the service. - /// - /// The name of the role assignment. - /// The properties of the role assignment. - /// A token that allows cancellation of any blockign API calls made during this method. - /// The created role assignment. - public Response Create(string name, RoleAssignmentCreateParameters resourceDetails, CancellationToken cancellationToken = default) - { - var response = Operations.Create(Id, name, resourceDetails.ToModel(), cancellationToken); - return Response.FromValue(new RoleAssignment(this, new RoleAssignmentData(response.Value)), response.GetRawResponse()); - } - - /// - /// Create a role assignment. This method returns a task performs the creation. The task may make multiple blocking calls. - /// When complete the task yields the created RoleAssignment. - /// - /// The name of the role assignment. - /// The properties of the role assignment. - /// A token that allows cancellation of any blockign API calls made during this method. - /// A Task that yields the created role assignment when complete. - public async Task> CreateAsync(string name, RoleAssignmentCreateParameters resourceDetails, CancellationToken cancellationToken = default) - { - var response = await Operations.CreateAsync(Id, name, resourceDetails.ToModel(), cancellationToken).ConfigureAwait(false); - return Response.FromValue(new RoleAssignment(this, new RoleAssignmentData(response.Value)), response.GetRawResponse()); - } - - /// - /// Create a role assignment. This method blocks until the RoleAssignment creation is accepted on the service. It returns an - /// allowing the caller to control polling and waiting for the creation to complete. - /// - /// The name of the role assignment. - /// The properties of the role assignment. - /// A token that allows cancellation of any blocking API calls made during this method. - /// An ArmOperation that yields the created role assignment and gives the user control over polling. - public Operation StartCreate(string name, RoleAssignmentCreateParameters resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - Operations.Create(Id, name, resourceDetails.ToModel(), cancellationToken), - a => new RoleAssignment(this, new RoleAssignmentData(a))); - } - - /// - /// Create a role assignment. This method blocks until the RoleAssignment creation is accepted on the service. It returns an - /// allowing the caller to control polling and waiting for the creation to complete. - /// - /// The name of the role assignment. - /// The properties of the role assignment. - /// A token that allows cancellation of any blocking API calls made during this method. - /// A that yields the created role assignment and gives the user control over polling. - public async Task> StartCreateAsync(string name, RoleAssignmentCreateParameters resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - await Operations.CreateAsync(Id, name, resourceDetails.ToModel(), cancellationToken).ConfigureAwait(false), - a => new RoleAssignment(this, new RoleAssignmentData(a))); - } - - /// - /// List all role assignments at this scope. This call blocks until the first page or results is returned from the service. - /// - /// A token that allows cancellation of any blocking API calls made during this method. - /// A that allows paged enumeration of the role assignments at this scope. - public Azure.Pageable ListAtScope(CancellationToken cancellationToken = default) - { - throw new System.NotImplementedException(); - } - - /// - /// List all role assignments at this scope. - /// - /// A token that allows cancellation of any blocking API calls made during this method. - /// A that allows asynchronous paged enumeration of the role assignments at this scope. - public Azure.AsyncPageable ListAtScopeAsync(CancellationToken cancellationToken = default) - { - throw new System.NotImplementedException(); - } - - /// - protected override void Validate(ResourceIdentifier identifier) - { - return; - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/authorization/RoleAssignmentOperations.cs b/sdk/resourcemanager/Proto.Client/authorization/RoleAssignmentOperations.cs deleted file mode 100644 index 1134a5185d03..000000000000 --- a/sdk/resourcemanager/Proto.Client/authorization/RoleAssignmentOperations.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using Azure.ResourceManager.Authorization; -using Azure.ResourceManager.Core; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Authorization -{ - /// - /// Operations over Role Assignments for Role-based access control to ARM resources - /// - public class RoleAssignmentOperations : ResourceOperationsBase - { - /// - /// Gets the resource type for Role Assignments. - /// - public static readonly ResourceType ResourceType = "Microsoft.Authorization/roleAssignments"; - - /// - /// Initializes a new instance of the class. - /// Allows creating operations specific to a role assignment from generic ARM operations for the same resource - /// - /// A generic operations class corresponding to a Role Assignment. - internal RoleAssignmentOperations(ResourceOperationsBase parent) - : base(parent, parent.Id) - { - string subscriptionId; - if (!Id.TryGetSubscriptionId(out subscriptionId)) - { - // TODO: Remove this once we have swapped in the REST client - subscriptionId = Guid.Empty.ToString(); - } - - Operations = new AuthorizationManagementClient(subscriptionId, BaseUri, Credential).RoleAssignments; - } - - /// - /// Initializes a new instance of the class. - /// - /// The http settings to use with these operations. - /// The resource identifier for the RoleAssignment to operate on. - internal RoleAssignmentOperations(OperationsBase operation, ResourceIdentifier id) - : base(operation, id) - { - string subscriptionId; - if (!Id.TryGetSubscriptionId(out subscriptionId)) - { - // TODO: Remove this once we have swapped in the REST client - subscriptionId = Guid.Empty.ToString(); - } - - Operations = new AuthorizationManagementClient(subscriptionId, BaseUri, Credential).RoleAssignments; - } - - /// - protected override ResourceType ValidResourceType => ResourceType; - - private RoleAssignmentsOperations Operations { get; } - - /// - public Response Delete(CancellationToken cancellationToken = default) - { - return Operations.DeleteById(Id, cancellationToken).GetRawResponse(); - } - - /// - public async Task DeleteAsync(CancellationToken cancellationToken = default) - { - return (await Operations.DeleteByIdAsync(Id, cancellationToken)).GetRawResponse(); - } - - /// - public Operation StartDelete(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(Operations.DeleteById(Id, cancellationToken).GetRawResponse()); - } - - /// - public async Task StartDeleteAsync(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation((await Operations.DeleteByIdAsync(Id, cancellationToken)).GetRawResponse()); - } - - /// - public override Response Get(CancellationToken cancellationToken = default) - { - var response = Operations.GetById(Id, cancellationToken); - return Response.FromValue(new RoleAssignment(this, new RoleAssignmentData(response.Value)), response.GetRawResponse()); - } - - /// - public async override Task> GetAsync(CancellationToken cancellationToken = default) - { - var response = await Operations.GetByIdAsync(Id, cancellationToken); - return Response.FromValue(new RoleAssignment(this, new RoleAssignmentData(response.Value)), response.GetRawResponse()); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Azure.ResourceManager.Billing.csproj b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Azure.ResourceManager.Billing.csproj deleted file mode 100644 index 42be3f077040..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Azure.ResourceManager.Billing.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - 1.0.0-beta.1 - Azure.ResourceManager.Billing - Azure Resource Manager client SDK for Azure resource provider Microsoft.Billing - azure;management;arm;resource manager;billing - true - true - false - - - - - $(NoWarn);AZC0001;AZC0005 - - - - - - diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/CHANGELOG.md b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/CHANGELOG.md deleted file mode 100644 index 3d4ff921b5b6..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ -# Release History - -## 1.0.0-preview.1 (Unreleased) - -This package follows the [Azure SDK Design Guidelines for .NET](https://azure.github.io/azure-sdk/dotnet_introduction.html) which provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more. - -This is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, please submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). \ No newline at end of file diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Directory.Build.props b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Directory.Build.props deleted file mode 100644 index 1a9611bd4924..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Directory.Build.props +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AddressOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AddressOperations.cs deleted file mode 100644 index 69c950c554a4..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AddressOperations.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The Address service client. - public partial class AddressOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal AddressRestOperations RestClient { get; } - - /// Initializes a new instance of AddressOperations for mocking. - protected AddressOperations() - { - } - - /// Initializes a new instance of AddressOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal AddressOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new AddressRestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. - /// The AddressDetails to use. - /// The cancellation token to use. - public virtual async Task> ValidateAsync(AddressDetails address, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("AddressOperations.Validate"); - scope.Start(); - try - { - return await RestClient.ValidateAsync(address, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. - /// The AddressDetails to use. - /// The cancellation token to use. - public virtual Response Validate(AddressDetails address, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("AddressOperations.Validate"); - scope.Start(); - try - { - return RestClient.Validate(address, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AddressRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AddressRestOperations.cs deleted file mode 100644 index 1f01f5bccbc8..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AddressRestOperations.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class AddressRestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of AddressRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public AddressRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateValidateRequest(AddressDetails address) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/validateAddress", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(address); - request.Content = content; - return message; - } - - /// Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. - /// The AddressDetails to use. - /// The cancellation token to use. - /// is null. - public async Task> ValidateAsync(AddressDetails address, CancellationToken cancellationToken = default) - { - if (address == null) - { - throw new ArgumentNullException(nameof(address)); - } - - using var message = CreateValidateRequest(address); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ValidateAddressResponse value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ValidateAddressResponse.DeserializeValidateAddressResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. - /// The AddressDetails to use. - /// The cancellation token to use. - /// is null. - public Response Validate(AddressDetails address, CancellationToken cancellationToken = default) - { - if (address == null) - { - throw new ArgumentNullException(nameof(address)); - } - - using var message = CreateValidateRequest(address); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ValidateAddressResponse value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ValidateAddressResponse.DeserializeValidateAddressResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AgreementsOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AgreementsOperations.cs deleted file mode 100644 index ba7d9ffe3200..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AgreementsOperations.cs +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The Agreements service client. - public partial class AgreementsOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal AgreementsRestOperations RestClient { get; } - - /// Initializes a new instance of AgreementsOperations for mocking. - protected AgreementsOperations() - { - } - - /// Initializes a new instance of AgreementsOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal AgreementsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new AgreementsRestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Gets an agreement by ID. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an agreement. - /// May be used to expand the participants. - /// The cancellation token to use. - public virtual async Task> GetAsync(string billingAccountName, string agreementName, string expand = null, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("AgreementsOperations.Get"); - scope.Start(); - try - { - return await RestClient.GetAsync(billingAccountName, agreementName, expand, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets an agreement by ID. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an agreement. - /// May be used to expand the participants. - /// The cancellation token to use. - public virtual Response Get(string billingAccountName, string agreementName, string expand = null, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("AgreementsOperations.Get"); - scope.Start(); - try - { - return RestClient.Get(billingAccountName, agreementName, expand, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the agreements for a billing account. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the participants. - /// The cancellation token to use. - /// is null. - public virtual AsyncPageable ListByBillingAccountAsync(string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("AgreementsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountAsync(billingAccountName, expand, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("AgreementsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountNextPageAsync(nextLink, billingAccountName, expand, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the agreements for a billing account. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the participants. - /// The cancellation token to use. - /// is null. - public virtual Pageable ListByBillingAccount(string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("AgreementsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccount(billingAccountName, expand, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("AgreementsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccountNextPage(nextLink, billingAccountName, expand, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AgreementsRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AgreementsRestOperations.cs deleted file mode 100644 index dc521728bd13..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AgreementsRestOperations.cs +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class AgreementsRestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of AgreementsRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public AgreementsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListByBillingAccountRequest(string billingAccountName, string expand) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/agreements", false); - uri.AppendQuery("api-version", "2020-05-01", true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the agreements for a billing account. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the participants. - /// The cancellation token to use. - /// is null. - public async Task> ListByBillingAccountAsync(string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AgreementListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AgreementListResult.DeserializeAgreementListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the agreements for a billing account. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the participants. - /// The cancellation token to use. - /// is null. - public Response ListByBillingAccount(string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AgreementListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AgreementListResult.DeserializeAgreementListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRequest(string billingAccountName, string agreementName, string expand) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/agreements/", false); - uri.AppendPath(agreementName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets an agreement by ID. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an agreement. - /// May be used to expand the participants. - /// The cancellation token to use. - /// or is null. - public async Task> GetAsync(string billingAccountName, string agreementName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (agreementName == null) - { - throw new ArgumentNullException(nameof(agreementName)); - } - - using var message = CreateGetRequest(billingAccountName, agreementName, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - Agreement value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = Agreement.DeserializeAgreement(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets an agreement by ID. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an agreement. - /// May be used to expand the participants. - /// The cancellation token to use. - /// or is null. - public Response Get(string billingAccountName, string agreementName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (agreementName == null) - { - throw new ArgumentNullException(nameof(agreementName)); - } - - using var message = CreateGetRequest(billingAccountName, agreementName, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - Agreement value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = Agreement.DeserializeAgreement(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingAccountNextPageRequest(string nextLink, string billingAccountName, string expand) - { - 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"); - return message; - } - - /// Lists the agreements for a billing account. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the participants. - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingAccountNextPageAsync(string nextLink, string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AgreementListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AgreementListResult.DeserializeAgreementListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the agreements for a billing account. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the participants. - /// The cancellation token to use. - /// or is null. - public Response ListByBillingAccountNextPage(string nextLink, string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AgreementListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AgreementListResult.DeserializeAgreementListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AvailableBalancesOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AvailableBalancesOperations.cs deleted file mode 100644 index 318e66d32192..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AvailableBalancesOperations.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The AvailableBalances service client. - public partial class AvailableBalancesOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal AvailableBalancesRestOperations RestClient { get; } - - /// Initializes a new instance of AvailableBalancesOperations for mocking. - protected AvailableBalancesOperations() - { - } - - /// Initializes a new instance of AvailableBalancesOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal AvailableBalancesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new AvailableBalancesRestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// The available credit balance for a billing profile. This is the balance that can be used for pay now to settle due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - public virtual async Task> GetAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("AvailableBalancesOperations.Get"); - scope.Start(); - try - { - return await RestClient.GetAsync(billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// The available credit balance for a billing profile. This is the balance that can be used for pay now to settle due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - public virtual Response Get(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("AvailableBalancesOperations.Get"); - scope.Start(); - try - { - return RestClient.Get(billingAccountName, billingProfileName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AvailableBalancesRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AvailableBalancesRestOperations.cs deleted file mode 100644 index 10b93bdcedac..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/AvailableBalancesRestOperations.cs +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class AvailableBalancesRestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of AvailableBalancesRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public AvailableBalancesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateGetRequest(string billingAccountName, string billingProfileName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/availableBalance/default", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// The available credit balance for a billing profile. This is the balance that can be used for pay now to settle due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public async Task> GetAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateGetRequest(billingAccountName, billingProfileName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AvailableBalance value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AvailableBalance.DeserializeAvailableBalance(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// The available credit balance for a billing profile. This is the balance that can be used for pay now to settle due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public Response Get(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateGetRequest(billingAccountName, billingProfileName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AvailableBalance value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AvailableBalance.DeserializeAvailableBalance(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingAccountsOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingAccountsOperations.cs deleted file mode 100644 index 7b940a647add..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingAccountsOperations.cs +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The BillingAccounts service client. - public partial class BillingAccountsOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal BillingAccountsRestOperations RestClient { get; } - - /// Initializes a new instance of BillingAccountsOperations for mocking. - protected BillingAccountsOperations() - { - } - - /// Initializes a new instance of BillingAccountsOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal BillingAccountsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new BillingAccountsRestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Gets a billing account by its ID. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the soldTo, invoice sections and billing profiles. - /// The cancellation token to use. - public virtual async Task> GetAsync(string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingAccountsOperations.Get"); - scope.Start(); - try - { - return await RestClient.GetAsync(billingAccountName, expand, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a billing account by its ID. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the soldTo, invoice sections and billing profiles. - /// The cancellation token to use. - public virtual Response Get(string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingAccountsOperations.Get"); - scope.Start(); - try - { - return RestClient.Get(billingAccountName, expand, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the billing accounts that a user has access to. - /// May be used to expand the soldTo, invoice sections and billing profiles. - /// The cancellation token to use. - public virtual AsyncPageable ListAsync(string expand = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingAccountsOperations.List"); - scope.Start(); - try - { - var response = await RestClient.ListAsync(expand, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingAccountsOperations.List"); - scope.Start(); - try - { - var response = await RestClient.ListNextPageAsync(nextLink, expand, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the billing accounts that a user has access to. - /// May be used to expand the soldTo, invoice sections and billing profiles. - /// The cancellation token to use. - public virtual Pageable List(string expand = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingAccountsOperations.List"); - scope.Start(); - try - { - var response = RestClient.List(expand, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingAccountsOperations.List"); - scope.Start(); - try - { - var response = RestClient.ListNextPage(nextLink, expand, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public virtual AsyncPageable ListInvoiceSectionsByCreateSubscriptionPermissionAsync(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingAccountsOperations.ListInvoiceSectionsByCreateSubscriptionPermission"); - scope.Start(); - try - { - var response = await RestClient.ListInvoiceSectionsByCreateSubscriptionPermissionAsync(billingAccountName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingAccountsOperations.ListInvoiceSectionsByCreateSubscriptionPermission"); - scope.Start(); - try - { - var response = await RestClient.ListInvoiceSectionsByCreateSubscriptionPermissionNextPageAsync(nextLink, billingAccountName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public virtual Pageable ListInvoiceSectionsByCreateSubscriptionPermission(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingAccountsOperations.ListInvoiceSectionsByCreateSubscriptionPermission"); - scope.Start(); - try - { - var response = RestClient.ListInvoiceSectionsByCreateSubscriptionPermission(billingAccountName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingAccountsOperations.ListInvoiceSectionsByCreateSubscriptionPermission"); - scope.Start(); - try - { - var response = RestClient.ListInvoiceSectionsByCreateSubscriptionPermissionNextPage(nextLink, billingAccountName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the update billing account operation. - /// The cancellation token to use. - /// or is null. - public virtual async Task StartUpdateAsync(string billingAccountName, BillingAccountUpdateRequest parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var scope = _clientDiagnostics.CreateScope("BillingAccountsOperations.StartUpdate"); - scope.Start(); - try - { - var originalResponse = await RestClient.UpdateAsync(billingAccountName, parameters, cancellationToken).ConfigureAwait(false); - return new BillingAccountsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(billingAccountName, parameters).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the update billing account operation. - /// The cancellation token to use. - /// or is null. - public virtual BillingAccountsUpdateOperation StartUpdate(string billingAccountName, BillingAccountUpdateRequest parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var scope = _clientDiagnostics.CreateScope("BillingAccountsOperations.StartUpdate"); - scope.Start(); - try - { - var originalResponse = RestClient.Update(billingAccountName, parameters, cancellationToken); - return new BillingAccountsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(billingAccountName, parameters).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingAccountsRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingAccountsRestOperations.cs deleted file mode 100644 index d4efbcb130a5..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingAccountsRestOperations.cs +++ /dev/null @@ -1,464 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class BillingAccountsRestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of BillingAccountsRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public BillingAccountsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListRequest(string expand) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts", false); - uri.AppendQuery("api-version", "2020-05-01", true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the billing accounts that a user has access to. - /// May be used to expand the soldTo, invoice sections and billing profiles. - /// The cancellation token to use. - public async Task> ListAsync(string expand = null, CancellationToken cancellationToken = default) - { - using var message = CreateListRequest(expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingAccountListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingAccountListResult.DeserializeBillingAccountListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the billing accounts that a user has access to. - /// May be used to expand the soldTo, invoice sections and billing profiles. - /// The cancellation token to use. - public Response List(string expand = null, CancellationToken cancellationToken = default) - { - using var message = CreateListRequest(expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingAccountListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingAccountListResult.DeserializeBillingAccountListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRequest(string billingAccountName, string expand) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a billing account by its ID. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the soldTo, invoice sections and billing profiles. - /// The cancellation token to use. - /// is null. - public async Task> GetAsync(string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateGetRequest(billingAccountName, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingAccount value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingAccount.DeserializeBillingAccount(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets a billing account by its ID. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the soldTo, invoice sections and billing profiles. - /// The cancellation token to use. - /// is null. - public Response Get(string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateGetRequest(billingAccountName, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingAccount value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingAccount.DeserializeBillingAccount(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateUpdateRequest(string billingAccountName, BillingAccountUpdateRequest parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - return message; - } - - /// Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the update billing account operation. - /// The cancellation token to use. - /// or is null. - public async Task UpdateAsync(string billingAccountName, BillingAccountUpdateRequest parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateUpdateRequest(billingAccountName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the update billing account operation. - /// The cancellation token to use. - /// or is null. - public Response Update(string billingAccountName, BillingAccountUpdateRequest parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateUpdateRequest(billingAccountName, parameters); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListInvoiceSectionsByCreateSubscriptionPermissionRequest(string billingAccountName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/listInvoiceSectionsWithCreateSubscriptionPermission", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public async Task> ListInvoiceSectionsByCreateSubscriptionPermissionAsync(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListInvoiceSectionsByCreateSubscriptionPermissionRequest(billingAccountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InvoiceSectionListWithCreateSubPermissionResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InvoiceSectionListWithCreateSubPermissionResult.DeserializeInvoiceSectionListWithCreateSubPermissionResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public Response ListInvoiceSectionsByCreateSubscriptionPermission(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListInvoiceSectionsByCreateSubscriptionPermissionRequest(billingAccountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InvoiceSectionListWithCreateSubPermissionResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InvoiceSectionListWithCreateSubPermissionResult.DeserializeInvoiceSectionListWithCreateSubPermissionResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string expand) - { - 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"); - return message; - } - - /// Lists the billing accounts that a user has access to. - /// The URL to the next page of results. - /// May be used to expand the soldTo, invoice sections and billing profiles. - /// The cancellation token to use. - /// is null. - public async Task> ListNextPageAsync(string nextLink, string expand = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListNextPageRequest(nextLink, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingAccountListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingAccountListResult.DeserializeBillingAccountListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the billing accounts that a user has access to. - /// The URL to the next page of results. - /// May be used to expand the soldTo, invoice sections and billing profiles. - /// The cancellation token to use. - /// is null. - public Response ListNextPage(string nextLink, string expand = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListNextPageRequest(nextLink, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingAccountListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingAccountListResult.DeserializeBillingAccountListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListInvoiceSectionsByCreateSubscriptionPermissionNextPageRequest(string nextLink, string billingAccountName) - { - 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"); - return message; - } - - /// Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// or is null. - public async Task> ListInvoiceSectionsByCreateSubscriptionPermissionNextPageAsync(string nextLink, string billingAccountName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListInvoiceSectionsByCreateSubscriptionPermissionNextPageRequest(nextLink, billingAccountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InvoiceSectionListWithCreateSubPermissionResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InvoiceSectionListWithCreateSubPermissionResult.DeserializeInvoiceSectionListWithCreateSubPermissionResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// or is null. - public Response ListInvoiceSectionsByCreateSubscriptionPermissionNextPage(string nextLink, string billingAccountName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListInvoiceSectionsByCreateSubscriptionPermissionNextPageRequest(nextLink, billingAccountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InvoiceSectionListWithCreateSubPermissionResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InvoiceSectionListWithCreateSubPermissionResult.DeserializeInvoiceSectionListWithCreateSubPermissionResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingAccountsUpdateOperation.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingAccountsUpdateOperation.cs deleted file mode 100644 index d8ff06d1a38b..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingAccountsUpdateOperation.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - public partial class BillingAccountsUpdateOperation : Operation, IOperationSource - { - private readonly ArmOperationHelpers _operation; - internal BillingAccountsUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) - { - _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.AzureAsyncOperation, "BillingAccountsUpdateOperation"); - } - /// - public override string Id => _operation.Id; - - /// - public override BillingAccount Value => _operation.Value; - - /// - public override bool HasCompleted => _operation.HasCompleted; - - /// - public override bool HasValue => _operation.HasValue; - - /// - public override Response GetRawResponse() => _operation.GetRawResponse(); - - /// - public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - - /// - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); - - BillingAccount IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream); - return BillingAccount.DeserializeBillingAccount(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return BillingAccount.DeserializeBillingAccount(document.RootElement); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingManagementClient.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingManagementClient.cs deleted file mode 100644 index e84e37cdf345..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingManagementClient.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing; - -namespace Azure.ResourceManager.Billing -{ - /// Billing service management client. - public partial class BillingManagementClient - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _subscriptionId; - - /// Initializes a new instance of BillingManagementClient for mocking. - protected BillingManagementClient() - { - } - - /// Initializes a new instance of BillingManagementClient. - /// The ID that uniquely identifies an Azure subscription. - /// The OAuth token for making client requests. - /// The options for configuring the client. - public BillingManagementClient(string subscriptionId, TokenCredential tokenCredential, BillingManagementClientOptions options = null) : this(null, subscriptionId, tokenCredential, options) - { - } - /// Initializes a new instance of BillingManagementClient. - /// server parameter. - /// The ID that uniquely identifies an Azure subscription. - /// The OAuth token for making client requests. - /// The options for configuring the client. - /// is null. - public BillingManagementClient(Uri endpoint, string subscriptionId, TokenCredential tokenCredential, BillingManagementClientOptions options = null) - { - endpoint ??= new Uri("https://management.azure.com"); - if (subscriptionId == null) - { - throw new ArgumentNullException(nameof(subscriptionId)); - } - - options ??= new BillingManagementClientOptions(); - _clientDiagnostics = new ClientDiagnostics(options); - _pipeline = ManagementPipelineBuilder.Build(tokenCredential, endpoint, options); - _endpoint = endpoint; - _subscriptionId = subscriptionId; - } - - /// Returns an instance of BillingAccountsOperations. - public virtual BillingAccountsOperations BillingAccounts => new BillingAccountsOperations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of AddressOperations. - public virtual AddressOperations Address => new AddressOperations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of AvailableBalancesOperations. - public virtual AvailableBalancesOperations AvailableBalances => new AvailableBalancesOperations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of InstructionsOperations. - public virtual InstructionsOperations Instructions => new InstructionsOperations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of BillingProfilesOperations. - public virtual BillingProfilesOperations BillingProfiles => new BillingProfilesOperations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of CustomersOperations. - public virtual CustomersOperations Customers => new CustomersOperations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of InvoiceSectionsOperations. - public virtual InvoiceSectionsOperations InvoiceSections => new InvoiceSectionsOperations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of BillingPermissionsOperations. - public virtual BillingPermissionsOperations BillingPermissions => new BillingPermissionsOperations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of BillingSubscriptionsOperations. - public virtual BillingSubscriptionsOperations BillingSubscriptions => new BillingSubscriptionsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - - /// Returns an instance of ProductsOperations. - public virtual ProductsOperations Products => new ProductsOperations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of InvoicesOperations. - public virtual InvoicesOperations Invoices => new InvoicesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - - /// Returns an instance of TransactionsOperations. - public virtual TransactionsOperations Transactions => new TransactionsOperations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of PoliciesOperations. - public virtual PoliciesOperations Policies => new PoliciesOperations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of BillingPropertyOperations. - public virtual BillingPropertyOperations BillingProperty => new BillingPropertyOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - - /// Returns an instance of Operations. - public virtual Operations Operations => new Operations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of BillingRoleDefinitionsOperations. - public virtual BillingRoleDefinitionsOperations BillingRoleDefinitions => new BillingRoleDefinitionsOperations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of BillingRoleAssignmentsOperations. - public virtual BillingRoleAssignmentsOperations BillingRoleAssignments => new BillingRoleAssignmentsOperations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of AgreementsOperations. - public virtual AgreementsOperations Agreements => new AgreementsOperations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of EnrollmentAccountsOperations. - public virtual EnrollmentAccountsOperations EnrollmentAccounts => new EnrollmentAccountsOperations(_clientDiagnostics, _pipeline, _endpoint); - - /// Returns an instance of BillingPeriodsOperations. - public virtual BillingPeriodsOperations BillingPeriods => new BillingPeriodsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingManagementClientOptions.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingManagementClientOptions.cs deleted file mode 100644 index 35e5d833054d..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingManagementClientOptions.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; - -namespace Azure.ResourceManager.Billing -{ - /// Client options for Billing. - public partial class BillingManagementClientOptions : ClientOptions - { - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPeriodsOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPeriodsOperations.cs deleted file mode 100644 index 74385a0b4b1a..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPeriodsOperations.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The BillingPeriods service client. - public partial class BillingPeriodsOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal BillingPeriodsRestOperations RestClient { get; } - - /// Initializes a new instance of BillingPeriodsOperations for mocking. - protected BillingPeriodsOperations() - { - } - - /// Initializes a new instance of BillingPeriodsOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The ID that uniquely identifies an Azure subscription. - /// server parameter. - internal BillingPeriodsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) - { - RestClient = new BillingPeriodsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. - /// The name of a BillingPeriod resource. - /// The cancellation token to use. - public virtual async Task> GetAsync(string billingPeriodName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingPeriodsOperations.Get"); - scope.Start(); - try - { - return await RestClient.GetAsync(billingPeriodName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. - /// The name of a BillingPeriod resource. - /// The cancellation token to use. - public virtual Response Get(string billingPeriodName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingPeriodsOperations.Get"); - scope.Start(); - try - { - return RestClient.Get(billingPeriodName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. - /// May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// May be used to limit the number of results to the most recent N billing periods. - /// The cancellation token to use. - public virtual AsyncPageable ListAsync(string filter = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPeriodsOperations.List"); - scope.Start(); - try - { - var response = await RestClient.ListAsync(filter, skiptoken, top, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPeriodsOperations.List"); - scope.Start(); - try - { - var response = await RestClient.ListNextPageAsync(nextLink, filter, skiptoken, top, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. - /// May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// May be used to limit the number of results to the most recent N billing periods. - /// The cancellation token to use. - public virtual Pageable List(string filter = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPeriodsOperations.List"); - scope.Start(); - try - { - var response = RestClient.List(filter, skiptoken, top, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPeriodsOperations.List"); - scope.Start(); - try - { - var response = RestClient.ListNextPage(nextLink, filter, skiptoken, top, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPeriodsRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPeriodsRestOperations.cs deleted file mode 100644 index 4035a4f49308..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPeriodsRestOperations.cs +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class BillingPeriodsRestOperations - { - private string subscriptionId; - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of BillingPeriodsRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The ID that uniquely identifies an Azure subscription. - /// server parameter. - /// is null. - public BillingPeriodsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) - { - if (subscriptionId == null) - { - throw new ArgumentNullException(nameof(subscriptionId)); - } - endpoint ??= new Uri("https://management.azure.com"); - - this.subscriptionId = subscriptionId; - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListRequest(string filter, string skiptoken, int? top) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Billing/billingPeriods", false); - uri.AppendQuery("api-version", "2018-03-01-preview", true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (skiptoken != null) - { - uri.AppendQuery("$skiptoken", skiptoken, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. - /// May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// May be used to limit the number of results to the most recent N billing periods. - /// The cancellation token to use. - public async Task> ListAsync(string filter = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) - { - using var message = CreateListRequest(filter, skiptoken, top); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingPeriodsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingPeriodsListResult.DeserializeBillingPeriodsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. - /// May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// May be used to limit the number of results to the most recent N billing periods. - /// The cancellation token to use. - public Response List(string filter = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) - { - using var message = CreateListRequest(filter, skiptoken, top); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingPeriodsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingPeriodsListResult.DeserializeBillingPeriodsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRequest(string billingPeriodName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Billing/billingPeriods/", false); - uri.AppendPath(billingPeriodName, true); - uri.AppendQuery("api-version", "2018-03-01-preview", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. - /// The name of a BillingPeriod resource. - /// The cancellation token to use. - /// is null. - public async Task> GetAsync(string billingPeriodName, CancellationToken cancellationToken = default) - { - if (billingPeriodName == null) - { - throw new ArgumentNullException(nameof(billingPeriodName)); - } - - using var message = CreateGetRequest(billingPeriodName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingPeriod value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingPeriod.DeserializeBillingPeriod(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. - /// The name of a BillingPeriod resource. - /// The cancellation token to use. - /// is null. - public Response Get(string billingPeriodName, CancellationToken cancellationToken = default) - { - if (billingPeriodName == null) - { - throw new ArgumentNullException(nameof(billingPeriodName)); - } - - using var message = CreateGetRequest(billingPeriodName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingPeriod value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingPeriod.DeserializeBillingPeriod(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string filter, string skiptoken, int? top) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. - /// The URL to the next page of results. - /// May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// May be used to limit the number of results to the most recent N billing periods. - /// The cancellation token to use. - /// is null. - public async Task> ListNextPageAsync(string nextLink, string filter = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListNextPageRequest(nextLink, filter, skiptoken, top); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingPeriodsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingPeriodsListResult.DeserializeBillingPeriodsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. - /// The URL to the next page of results. - /// May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// May be used to limit the number of results to the most recent N billing periods. - /// The cancellation token to use. - /// is null. - public Response ListNextPage(string nextLink, string filter = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListNextPageRequest(nextLink, filter, skiptoken, top); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingPeriodsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingPeriodsListResult.DeserializeBillingPeriodsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPermissionsOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPermissionsOperations.cs deleted file mode 100644 index 5415587c78cd..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPermissionsOperations.cs +++ /dev/null @@ -1,433 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The BillingPermissions service client. - public partial class BillingPermissionsOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal BillingPermissionsRestOperations RestClient { get; } - - /// Initializes a new instance of BillingPermissionsOperations for mocking. - protected BillingPermissionsOperations() - { - } - - /// Initializes a new instance of BillingPermissionsOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal BillingPermissionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new BillingPermissionsRestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Lists the billing permissions the caller has for a customer. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByCustomerAsync(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByCustomer"); - scope.Start(); - try - { - var response = await RestClient.ListByCustomerAsync(billingAccountName, customerName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByCustomer"); - scope.Start(); - try - { - var response = await RestClient.ListByCustomerNextPageAsync(nextLink, billingAccountName, customerName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the billing permissions the caller has for a customer. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByCustomer(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByCustomer"); - scope.Start(); - try - { - var response = RestClient.ListByCustomer(billingAccountName, customerName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByCustomer"); - scope.Start(); - try - { - var response = RestClient.ListByCustomerNextPage(nextLink, billingAccountName, customerName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the billing permissions the caller has on a billing account. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public virtual AsyncPageable ListByBillingAccountAsync(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountAsync(billingAccountName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountNextPageAsync(nextLink, billingAccountName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the billing permissions the caller has on a billing account. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public virtual Pageable ListByBillingAccount(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccount(billingAccountName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccountNextPage(nextLink, billingAccountName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the billing permissions the caller has on an invoice section. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public virtual AsyncPageable ListByInvoiceSectionsAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByInvoiceSections"); - scope.Start(); - try - { - var response = await RestClient.ListByInvoiceSectionsAsync(billingAccountName, billingProfileName, invoiceSectionName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByInvoiceSections"); - scope.Start(); - try - { - var response = await RestClient.ListByInvoiceSectionsNextPageAsync(nextLink, billingAccountName, billingProfileName, invoiceSectionName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the billing permissions the caller has on an invoice section. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public virtual Pageable ListByInvoiceSections(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByInvoiceSections"); - scope.Start(); - try - { - var response = RestClient.ListByInvoiceSections(billingAccountName, billingProfileName, invoiceSectionName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByInvoiceSections"); - scope.Start(); - try - { - var response = RestClient.ListByInvoiceSectionsNextPage(nextLink, billingAccountName, billingProfileName, invoiceSectionName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the billing permissions the caller has on a billing profile. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByBillingProfileAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileAsync(billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileNextPageAsync(nextLink, billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the billing permissions the caller has on a billing profile. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByBillingProfile(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfile(billingAccountName, billingProfileName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingPermissionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfileNextPage(nextLink, billingAccountName, billingProfileName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPermissionsRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPermissionsRestOperations.cs deleted file mode 100644 index 4b6d6497ea3b..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPermissionsRestOperations.cs +++ /dev/null @@ -1,714 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class BillingPermissionsRestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of BillingPermissionsRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public BillingPermissionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListByCustomerRequest(string billingAccountName, string customerName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/customers/", false); - uri.AppendPath(customerName, true); - uri.AppendPath("/billingPermissions", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the billing permissions the caller has for a customer. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// or is null. - public async Task> ListByCustomerAsync(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateListByCustomerRequest(billingAccountName, customerName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the billing permissions the caller has for a customer. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// or is null. - public Response ListByCustomer(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateListByCustomerRequest(billingAccountName, customerName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingAccountRequest(string billingAccountName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingPermissions", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the billing permissions the caller has on a billing account. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public async Task> ListByBillingAccountAsync(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the billing permissions the caller has on a billing account. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public Response ListByBillingAccount(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByInvoiceSectionsRequest(string billingAccountName, string billingProfileName, string invoiceSectionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/invoiceSections/", false); - uri.AppendPath(invoiceSectionName, true); - uri.AppendPath("/billingPermissions", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the billing permissions the caller has on an invoice section. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByInvoiceSectionsAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionsRequest(billingAccountName, billingProfileName, invoiceSectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the billing permissions the caller has on an invoice section. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public Response ListByInvoiceSections(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionsRequest(billingAccountName, billingProfileName, invoiceSectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingProfileRequest(string billingAccountName, string billingProfileName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/billingPermissions", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the billing permissions the caller has on a billing profile. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingProfileAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the billing permissions the caller has on a billing profile. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public Response ListByBillingProfile(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByCustomerNextPageRequest(string nextLink, string billingAccountName, string customerName) - { - 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"); - return message; - } - - /// Lists the billing permissions the caller has for a customer. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByCustomerNextPageAsync(string nextLink, string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateListByCustomerNextPageRequest(nextLink, billingAccountName, customerName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the billing permissions the caller has for a customer. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// , , or is null. - public Response ListByCustomerNextPage(string nextLink, string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateListByCustomerNextPageRequest(nextLink, billingAccountName, customerName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingAccountNextPageRequest(string nextLink, string billingAccountName) - { - 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"); - return message; - } - - /// Lists the billing permissions the caller has on a billing account. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingAccountNextPageAsync(string nextLink, string billingAccountName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the billing permissions the caller has on a billing account. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// or is null. - public Response ListByBillingAccountNextPage(string nextLink, string billingAccountName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByInvoiceSectionsNextPageRequest(string nextLink, string billingAccountName, string billingProfileName, string invoiceSectionName) - { - 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"); - return message; - } - - /// Lists the billing permissions the caller has on an invoice section. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , , or is null. - public async Task> ListByInvoiceSectionsNextPageAsync(string nextLink, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionsNextPageRequest(nextLink, billingAccountName, billingProfileName, invoiceSectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the billing permissions the caller has on an invoice section. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , , or is null. - public Response ListByInvoiceSectionsNextPage(string nextLink, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionsNextPageRequest(nextLink, billingAccountName, billingProfileName, invoiceSectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingProfileNextPageRequest(string nextLink, string billingAccountName, string billingProfileName) - { - 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"); - return message; - } - - /// Lists the billing permissions the caller has on a billing profile. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByBillingProfileNextPageAsync(string nextLink, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the billing permissions the caller has on a billing profile. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// , , or is null. - public Response ListByBillingProfileNextPage(string nextLink, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingPermissionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingPermissionsListResult.DeserializeBillingPermissionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingProfilesCreateOrUpdateHeaders.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingProfilesCreateOrUpdateHeaders.cs deleted file mode 100644 index 3f0b8f9b82fb..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingProfilesCreateOrUpdateHeaders.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure; -using Azure.Core; - -namespace Azure.ResourceManager.Billing -{ - internal partial class BillingProfilesCreateOrUpdateHeaders - { - private readonly Response _response; - public BillingProfilesCreateOrUpdateHeaders(Response response) - { - _response = response; - } - /// Location URI to poll for result. - public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; - /// Recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. - public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingProfilesCreateOrUpdateOperation.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingProfilesCreateOrUpdateOperation.cs deleted file mode 100644 index 70e00c32062b..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingProfilesCreateOrUpdateOperation.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// Creates or updates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - public partial class BillingProfilesCreateOrUpdateOperation : Operation, IOperationSource - { - private readonly ArmOperationHelpers _operation; - internal BillingProfilesCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) - { - _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "BillingProfilesCreateOrUpdateOperation"); - } - /// - public override string Id => _operation.Id; - - /// - public override BillingProfile Value => _operation.Value; - - /// - public override bool HasCompleted => _operation.HasCompleted; - - /// - public override bool HasValue => _operation.HasValue; - - /// - public override Response GetRawResponse() => _operation.GetRawResponse(); - - /// - public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - - /// - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); - - BillingProfile IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream); - return BillingProfile.DeserializeBillingProfile(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return BillingProfile.DeserializeBillingProfile(document.RootElement); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingProfilesOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingProfilesOperations.cs deleted file mode 100644 index 511e7df4bd40..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingProfilesOperations.cs +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The BillingProfiles service client. - public partial class BillingProfilesOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal BillingProfilesRestOperations RestClient { get; } - - /// Initializes a new instance of BillingProfilesOperations for mocking. - protected BillingProfilesOperations() - { - } - - /// Initializes a new instance of BillingProfilesOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal BillingProfilesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new BillingProfilesRestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// May be used to expand the invoice sections. - /// The cancellation token to use. - public virtual async Task> GetAsync(string billingAccountName, string billingProfileName, string expand = null, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingProfilesOperations.Get"); - scope.Start(); - try - { - return await RestClient.GetAsync(billingAccountName, billingProfileName, expand, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// May be used to expand the invoice sections. - /// The cancellation token to use. - public virtual Response Get(string billingAccountName, string billingProfileName, string expand = null, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingProfilesOperations.Get"); - scope.Start(); - try - { - return RestClient.Get(billingAccountName, billingProfileName, expand, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the invoice sections. - /// The cancellation token to use. - /// is null. - public virtual AsyncPageable ListByBillingAccountAsync(string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingProfilesOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountAsync(billingAccountName, expand, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingProfilesOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountNextPageAsync(nextLink, billingAccountName, expand, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the invoice sections. - /// The cancellation token to use. - /// is null. - public virtual Pageable ListByBillingAccount(string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingProfilesOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccount(billingAccountName, expand, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingProfilesOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccountNextPage(nextLink, billingAccountName, expand, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Creates or updates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The new or updated billing profile. - /// The cancellation token to use. - /// , , or is null. - public virtual async Task StartCreateOrUpdateAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var scope = _clientDiagnostics.CreateScope("BillingProfilesOperations.StartCreateOrUpdate"); - scope.Start(); - try - { - var originalResponse = await RestClient.CreateOrUpdateAsync(billingAccountName, billingProfileName, parameters, cancellationToken).ConfigureAwait(false); - return new BillingProfilesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(billingAccountName, billingProfileName, parameters).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Creates or updates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The new or updated billing profile. - /// The cancellation token to use. - /// , , or is null. - public virtual BillingProfilesCreateOrUpdateOperation StartCreateOrUpdate(string billingAccountName, string billingProfileName, BillingProfile parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var scope = _clientDiagnostics.CreateScope("BillingProfilesOperations.StartCreateOrUpdate"); - scope.Start(); - try - { - var originalResponse = RestClient.CreateOrUpdate(billingAccountName, billingProfileName, parameters, cancellationToken); - return new BillingProfilesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(billingAccountName, billingProfileName, parameters).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingProfilesRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingProfilesRestOperations.cs deleted file mode 100644 index 013af9016335..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingProfilesRestOperations.cs +++ /dev/null @@ -1,369 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class BillingProfilesRestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of BillingProfilesRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public BillingProfilesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListByBillingAccountRequest(string billingAccountName, string expand) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles", false); - uri.AppendQuery("api-version", "2020-05-01", true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the invoice sections. - /// The cancellation token to use. - /// is null. - public async Task> ListByBillingAccountAsync(string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingProfileListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingProfileListResult.DeserializeBillingProfileListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the invoice sections. - /// The cancellation token to use. - /// is null. - public Response ListByBillingAccount(string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingProfileListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingProfileListResult.DeserializeBillingProfileListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRequest(string billingAccountName, string billingProfileName, string expand) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// May be used to expand the invoice sections. - /// The cancellation token to use. - /// or is null. - public async Task> GetAsync(string billingAccountName, string billingProfileName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateGetRequest(billingAccountName, billingProfileName, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingProfile value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingProfile.DeserializeBillingProfile(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// May be used to expand the invoice sections. - /// The cancellation token to use. - /// or is null. - public Response Get(string billingAccountName, string billingProfileName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateGetRequest(billingAccountName, billingProfileName, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingProfile value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingProfile.DeserializeBillingProfile(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateCreateOrUpdateRequest(string billingAccountName, string billingProfileName, BillingProfile parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - return message; - } - - /// Creates or updates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The new or updated billing profile. - /// The cancellation token to use. - /// , , or is null. - public async Task> CreateOrUpdateAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateCreateOrUpdateRequest(billingAccountName, billingProfileName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - var headers = new BillingProfilesCreateOrUpdateHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - case 202: - return ResponseWithHeaders.FromValue(headers, message.Response); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Creates or updates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The new or updated billing profile. - /// The cancellation token to use. - /// , , or is null. - public ResponseWithHeaders CreateOrUpdate(string billingAccountName, string billingProfileName, BillingProfile parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateCreateOrUpdateRequest(billingAccountName, billingProfileName, parameters); - _pipeline.Send(message, cancellationToken); - var headers = new BillingProfilesCreateOrUpdateHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - case 202: - return ResponseWithHeaders.FromValue(headers, message.Response); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingAccountNextPageRequest(string nextLink, string billingAccountName, string expand) - { - 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"); - return message; - } - - /// Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the invoice sections. - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingAccountNextPageAsync(string nextLink, string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingProfileListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingProfileListResult.DeserializeBillingProfileListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// May be used to expand the invoice sections. - /// The cancellation token to use. - /// or is null. - public Response ListByBillingAccountNextPage(string nextLink, string billingAccountName, string expand = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingProfileListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingProfileListResult.DeserializeBillingProfileListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPropertyOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPropertyOperations.cs deleted file mode 100644 index b6b26627cd05..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPropertyOperations.cs +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The BillingProperty service client. - public partial class BillingPropertyOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal BillingPropertyRestOperations RestClient { get; } - - /// Initializes a new instance of BillingPropertyOperations for mocking. - protected BillingPropertyOperations() - { - } - - /// Initializes a new instance of BillingPropertyOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The ID that uniquely identifies an Azure subscription. - /// server parameter. - internal BillingPropertyOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) - { - RestClient = new BillingPropertyRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingPropertyOperations.Get"); - scope.Start(); - try - { - return await RestClient.GetAsync(cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingPropertyOperations.Get"); - scope.Start(); - try - { - return RestClient.Get(cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// Request parameters that are provided to the update billing property operation. - /// The cancellation token to use. - public virtual async Task> UpdateAsync(BillingProperty parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingPropertyOperations.Update"); - scope.Start(); - try - { - return await RestClient.UpdateAsync(parameters, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// Request parameters that are provided to the update billing property operation. - /// The cancellation token to use. - public virtual Response Update(BillingProperty parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingPropertyOperations.Update"); - scope.Start(); - try - { - return RestClient.Update(parameters, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPropertyRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPropertyRestOperations.cs deleted file mode 100644 index 8e579e78f68e..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingPropertyRestOperations.cs +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class BillingPropertyRestOperations - { - private string subscriptionId; - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of BillingPropertyRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The ID that uniquely identifies an Azure subscription. - /// server parameter. - /// is null. - public BillingPropertyRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) - { - if (subscriptionId == null) - { - throw new ArgumentNullException(nameof(subscriptionId)); - } - endpoint ??= new Uri("https://management.azure.com"); - - this.subscriptionId = subscriptionId; - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateGetRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Billing/billingProperty/default", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. - /// The cancellation token to use. - public async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var message = CreateGetRequest(); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingProperty value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingProperty.DeserializeBillingProperty(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. - /// The cancellation token to use. - public Response Get(CancellationToken cancellationToken = default) - { - using var message = CreateGetRequest(); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingProperty value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingProperty.DeserializeBillingProperty(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateUpdateRequest(BillingProperty parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Billing/billingProperty/default", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - return message; - } - - /// Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// Request parameters that are provided to the update billing property operation. - /// The cancellation token to use. - /// is null. - public async Task> UpdateAsync(BillingProperty parameters, CancellationToken cancellationToken = default) - { - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateUpdateRequest(parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingProperty value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingProperty.DeserializeBillingProperty(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// Request parameters that are provided to the update billing property operation. - /// The cancellation token to use. - /// is null. - public Response Update(BillingProperty parameters, CancellationToken cancellationToken = default) - { - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateUpdateRequest(parameters); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingProperty value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingProperty.DeserializeBillingProperty(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingRoleAssignmentsOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingRoleAssignmentsOperations.cs deleted file mode 100644 index 1ecd12767786..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingRoleAssignmentsOperations.cs +++ /dev/null @@ -1,575 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The BillingRoleAssignments service client. - public partial class BillingRoleAssignmentsOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal BillingRoleAssignmentsRestOperations RestClient { get; } - - /// Initializes a new instance of BillingRoleAssignmentsOperations for mocking. - protected BillingRoleAssignmentsOperations() - { - } - - /// Initializes a new instance of BillingRoleAssignmentsOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal BillingRoleAssignmentsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new BillingRoleAssignmentsRestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - public virtual async Task> GetByBillingAccountAsync(string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.GetByBillingAccount"); - scope.Start(); - try - { - return await RestClient.GetByBillingAccountAsync(billingAccountName, billingRoleAssignmentName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - public virtual Response GetByBillingAccount(string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.GetByBillingAccount"); - scope.Start(); - try - { - return RestClient.GetByBillingAccount(billingAccountName, billingRoleAssignmentName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - public virtual async Task> DeleteByBillingAccountAsync(string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.DeleteByBillingAccount"); - scope.Start(); - try - { - return await RestClient.DeleteByBillingAccountAsync(billingAccountName, billingRoleAssignmentName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - public virtual Response DeleteByBillingAccount(string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.DeleteByBillingAccount"); - scope.Start(); - try - { - return RestClient.DeleteByBillingAccount(billingAccountName, billingRoleAssignmentName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - public virtual async Task> GetByInvoiceSectionAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.GetByInvoiceSection"); - scope.Start(); - try - { - return await RestClient.GetByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - public virtual Response GetByInvoiceSection(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.GetByInvoiceSection"); - scope.Start(); - try - { - return RestClient.GetByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - public virtual async Task> DeleteByInvoiceSectionAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.DeleteByInvoiceSection"); - scope.Start(); - try - { - return await RestClient.DeleteByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - public virtual Response DeleteByInvoiceSection(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.DeleteByInvoiceSection"); - scope.Start(); - try - { - return RestClient.DeleteByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - public virtual async Task> GetByBillingProfileAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.GetByBillingProfile"); - scope.Start(); - try - { - return await RestClient.GetByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - public virtual Response GetByBillingProfile(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.GetByBillingProfile"); - scope.Start(); - try - { - return RestClient.GetByBillingProfile(billingAccountName, billingProfileName, billingRoleAssignmentName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - public virtual async Task> DeleteByBillingProfileAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.DeleteByBillingProfile"); - scope.Start(); - try - { - return await RestClient.DeleteByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - public virtual Response DeleteByBillingProfile(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.DeleteByBillingProfile"); - scope.Start(); - try - { - return RestClient.DeleteByBillingProfile(billingAccountName, billingProfileName, billingRoleAssignmentName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public virtual AsyncPageable ListByBillingAccountAsync(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountAsync(billingAccountName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountNextPageAsync(nextLink, billingAccountName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public virtual Pageable ListByBillingAccount(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccount(billingAccountName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccountNextPage(nextLink, billingAccountName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public virtual AsyncPageable ListByInvoiceSectionAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = await RestClient.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = await RestClient.ListByInvoiceSectionNextPageAsync(nextLink, billingAccountName, billingProfileName, invoiceSectionName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public virtual Pageable ListByInvoiceSection(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = RestClient.ListByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = RestClient.ListByInvoiceSectionNextPage(nextLink, billingAccountName, billingProfileName, invoiceSectionName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByBillingProfileAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileAsync(billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileNextPageAsync(nextLink, billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByBillingProfile(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfile(billingAccountName, billingProfileName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleAssignmentsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfileNextPage(nextLink, billingAccountName, billingProfileName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingRoleAssignmentsRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingRoleAssignmentsRestOperations.cs deleted file mode 100644 index eaed6104f057..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingRoleAssignmentsRestOperations.cs +++ /dev/null @@ -1,1103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class BillingRoleAssignmentsRestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of BillingRoleAssignmentsRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public BillingRoleAssignmentsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateGetByBillingAccountRequest(string billingAccountName, string billingRoleAssignmentName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingRoleAssignments/", false); - uri.AppendPath(billingRoleAssignmentName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// or is null. - public async Task> GetByBillingAccountAsync(string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingRoleAssignmentName == null) - { - throw new ArgumentNullException(nameof(billingRoleAssignmentName)); - } - - using var message = CreateGetByBillingAccountRequest(billingAccountName, billingRoleAssignmentName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignment value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleAssignment.DeserializeBillingRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// or is null. - public Response GetByBillingAccount(string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingRoleAssignmentName == null) - { - throw new ArgumentNullException(nameof(billingRoleAssignmentName)); - } - - using var message = CreateGetByBillingAccountRequest(billingAccountName, billingRoleAssignmentName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignment value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleAssignment.DeserializeBillingRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDeleteByBillingAccountRequest(string billingAccountName, string billingRoleAssignmentName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingRoleAssignments/", false); - uri.AppendPath(billingRoleAssignmentName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// or is null. - public async Task> DeleteByBillingAccountAsync(string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingRoleAssignmentName == null) - { - throw new ArgumentNullException(nameof(billingRoleAssignmentName)); - } - - using var message = CreateDeleteByBillingAccountRequest(billingAccountName, billingRoleAssignmentName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignment value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleAssignment.DeserializeBillingRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// or is null. - public Response DeleteByBillingAccount(string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingRoleAssignmentName == null) - { - throw new ArgumentNullException(nameof(billingRoleAssignmentName)); - } - - using var message = CreateDeleteByBillingAccountRequest(billingAccountName, billingRoleAssignmentName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignment value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleAssignment.DeserializeBillingRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetByInvoiceSectionRequest(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/invoiceSections/", false); - uri.AppendPath(invoiceSectionName, true); - uri.AppendPath("/billingRoleAssignments/", false); - uri.AppendPath(billingRoleAssignmentName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// , , , or is null. - public async Task> GetByInvoiceSectionAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - if (billingRoleAssignmentName == null) - { - throw new ArgumentNullException(nameof(billingRoleAssignmentName)); - } - - using var message = CreateGetByInvoiceSectionRequest(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignment value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleAssignment.DeserializeBillingRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// , , , or is null. - public Response GetByInvoiceSection(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - if (billingRoleAssignmentName == null) - { - throw new ArgumentNullException(nameof(billingRoleAssignmentName)); - } - - using var message = CreateGetByInvoiceSectionRequest(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignment value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleAssignment.DeserializeBillingRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDeleteByInvoiceSectionRequest(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/invoiceSections/", false); - uri.AppendPath(invoiceSectionName, true); - uri.AppendPath("/billingRoleAssignments/", false); - uri.AppendPath(billingRoleAssignmentName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// , , , or is null. - public async Task> DeleteByInvoiceSectionAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - if (billingRoleAssignmentName == null) - { - throw new ArgumentNullException(nameof(billingRoleAssignmentName)); - } - - using var message = CreateDeleteByInvoiceSectionRequest(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignment value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleAssignment.DeserializeBillingRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// , , , or is null. - public Response DeleteByInvoiceSection(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - if (billingRoleAssignmentName == null) - { - throw new ArgumentNullException(nameof(billingRoleAssignmentName)); - } - - using var message = CreateDeleteByInvoiceSectionRequest(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignment value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleAssignment.DeserializeBillingRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetByBillingProfileRequest(string billingAccountName, string billingProfileName, string billingRoleAssignmentName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/billingRoleAssignments/", false); - uri.AppendPath(billingRoleAssignmentName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// , , or is null. - public async Task> GetByBillingProfileAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (billingRoleAssignmentName == null) - { - throw new ArgumentNullException(nameof(billingRoleAssignmentName)); - } - - using var message = CreateGetByBillingProfileRequest(billingAccountName, billingProfileName, billingRoleAssignmentName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignment value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleAssignment.DeserializeBillingRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// , , or is null. - public Response GetByBillingProfile(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (billingRoleAssignmentName == null) - { - throw new ArgumentNullException(nameof(billingRoleAssignmentName)); - } - - using var message = CreateGetByBillingProfileRequest(billingAccountName, billingProfileName, billingRoleAssignmentName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignment value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleAssignment.DeserializeBillingRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDeleteByBillingProfileRequest(string billingAccountName, string billingProfileName, string billingRoleAssignmentName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/billingRoleAssignments/", false); - uri.AppendPath(billingRoleAssignmentName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// , , or is null. - public async Task> DeleteByBillingProfileAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (billingRoleAssignmentName == null) - { - throw new ArgumentNullException(nameof(billingRoleAssignmentName)); - } - - using var message = CreateDeleteByBillingProfileRequest(billingAccountName, billingProfileName, billingRoleAssignmentName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignment value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleAssignment.DeserializeBillingRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// , , or is null. - public Response DeleteByBillingProfile(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (billingRoleAssignmentName == null) - { - throw new ArgumentNullException(nameof(billingRoleAssignmentName)); - } - - using var message = CreateDeleteByBillingProfileRequest(billingAccountName, billingProfileName, billingRoleAssignmentName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignment value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleAssignment.DeserializeBillingRoleAssignment(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingAccountRequest(string billingAccountName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingRoleAssignments", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public async Task> ListByBillingAccountAsync(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignmentListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleAssignmentListResult.DeserializeBillingRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public Response ListByBillingAccount(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignmentListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleAssignmentListResult.DeserializeBillingRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByInvoiceSectionRequest(string billingAccountName, string billingProfileName, string invoiceSectionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/invoiceSections/", false); - uri.AppendPath(invoiceSectionName, true); - uri.AppendPath("/billingRoleAssignments", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByInvoiceSectionAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionRequest(billingAccountName, billingProfileName, invoiceSectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignmentListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleAssignmentListResult.DeserializeBillingRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public Response ListByInvoiceSection(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionRequest(billingAccountName, billingProfileName, invoiceSectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignmentListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleAssignmentListResult.DeserializeBillingRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingProfileRequest(string billingAccountName, string billingProfileName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/billingRoleAssignments", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingProfileAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignmentListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleAssignmentListResult.DeserializeBillingRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public Response ListByBillingProfile(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignmentListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleAssignmentListResult.DeserializeBillingRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingAccountNextPageRequest(string nextLink, string billingAccountName) - { - 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"); - return message; - } - - /// Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingAccountNextPageAsync(string nextLink, string billingAccountName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignmentListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleAssignmentListResult.DeserializeBillingRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// or is null. - public Response ListByBillingAccountNextPage(string nextLink, string billingAccountName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignmentListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleAssignmentListResult.DeserializeBillingRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByInvoiceSectionNextPageRequest(string nextLink, string billingAccountName, string billingProfileName, string invoiceSectionName) - { - 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"); - return message; - } - - /// Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , , or is null. - public async Task> ListByInvoiceSectionNextPageAsync(string nextLink, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionNextPageRequest(nextLink, billingAccountName, billingProfileName, invoiceSectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignmentListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleAssignmentListResult.DeserializeBillingRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , , or is null. - public Response ListByInvoiceSectionNextPage(string nextLink, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionNextPageRequest(nextLink, billingAccountName, billingProfileName, invoiceSectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignmentListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleAssignmentListResult.DeserializeBillingRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingProfileNextPageRequest(string nextLink, string billingAccountName, string billingProfileName) - { - 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"); - return message; - } - - /// Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByBillingProfileNextPageAsync(string nextLink, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignmentListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleAssignmentListResult.DeserializeBillingRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// , , or is null. - public Response ListByBillingProfileNextPage(string nextLink, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignmentListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleAssignmentListResult.DeserializeBillingRoleAssignmentListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingRoleDefinitionsOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingRoleDefinitionsOperations.cs deleted file mode 100644 index 40982fed31b2..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingRoleDefinitionsOperations.cs +++ /dev/null @@ -1,455 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The BillingRoleDefinitions service client. - public partial class BillingRoleDefinitionsOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal BillingRoleDefinitionsRestOperations RestClient { get; } - - /// Initializes a new instance of BillingRoleDefinitionsOperations for mocking. - protected BillingRoleDefinitionsOperations() - { - } - - /// Initializes a new instance of BillingRoleDefinitionsOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal BillingRoleDefinitionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new BillingRoleDefinitionsRestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Gets the definition for a role on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - public virtual async Task> GetByBillingAccountAsync(string billingAccountName, string billingRoleDefinitionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.GetByBillingAccount"); - scope.Start(); - try - { - return await RestClient.GetByBillingAccountAsync(billingAccountName, billingRoleDefinitionName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets the definition for a role on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - public virtual Response GetByBillingAccount(string billingAccountName, string billingRoleDefinitionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.GetByBillingAccount"); - scope.Start(); - try - { - return RestClient.GetByBillingAccount(billingAccountName, billingRoleDefinitionName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - public virtual async Task> GetByInvoiceSectionAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.GetByInvoiceSection"); - scope.Start(); - try - { - return await RestClient.GetByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - public virtual Response GetByInvoiceSection(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.GetByInvoiceSection"); - scope.Start(); - try - { - return RestClient.GetByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - public virtual async Task> GetByBillingProfileAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.GetByBillingProfile"); - scope.Start(); - try - { - return await RestClient.GetByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleDefinitionName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - public virtual Response GetByBillingProfile(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.GetByBillingProfile"); - scope.Start(); - try - { - return RestClient.GetByBillingProfile(billingAccountName, billingProfileName, billingRoleDefinitionName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public virtual AsyncPageable ListByBillingAccountAsync(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountAsync(billingAccountName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountNextPageAsync(nextLink, billingAccountName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public virtual Pageable ListByBillingAccount(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccount(billingAccountName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccountNextPage(nextLink, billingAccountName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public virtual AsyncPageable ListByInvoiceSectionAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = await RestClient.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = await RestClient.ListByInvoiceSectionNextPageAsync(nextLink, billingAccountName, billingProfileName, invoiceSectionName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public virtual Pageable ListByInvoiceSection(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = RestClient.ListByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = RestClient.ListByInvoiceSectionNextPage(nextLink, billingAccountName, billingProfileName, invoiceSectionName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByBillingProfileAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileAsync(billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileNextPageAsync(nextLink, billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByBillingProfile(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfile(billingAccountName, billingProfileName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingRoleDefinitionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfileNextPage(nextLink, billingAccountName, billingProfileName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingRoleDefinitionsRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingRoleDefinitionsRestOperations.cs deleted file mode 100644 index 8b4840184355..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingRoleDefinitionsRestOperations.cs +++ /dev/null @@ -1,824 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class BillingRoleDefinitionsRestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of BillingRoleDefinitionsRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public BillingRoleDefinitionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateGetByBillingAccountRequest(string billingAccountName, string billingRoleDefinitionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingRoleDefinitions/", false); - uri.AppendPath(billingRoleDefinitionName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets the definition for a role on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// or is null. - public async Task> GetByBillingAccountAsync(string billingAccountName, string billingRoleDefinitionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingRoleDefinitionName == null) - { - throw new ArgumentNullException(nameof(billingRoleDefinitionName)); - } - - using var message = CreateGetByBillingAccountRequest(billingAccountName, billingRoleDefinitionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinition value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleDefinition.DeserializeBillingRoleDefinition(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets the definition for a role on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// or is null. - public Response GetByBillingAccount(string billingAccountName, string billingRoleDefinitionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingRoleDefinitionName == null) - { - throw new ArgumentNullException(nameof(billingRoleDefinitionName)); - } - - using var message = CreateGetByBillingAccountRequest(billingAccountName, billingRoleDefinitionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinition value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleDefinition.DeserializeBillingRoleDefinition(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetByInvoiceSectionRequest(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/invoiceSections/", false); - uri.AppendPath(invoiceSectionName, true); - uri.AppendPath("/billingRoleDefinitions/", false); - uri.AppendPath(billingRoleDefinitionName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// , , , or is null. - public async Task> GetByInvoiceSectionAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - if (billingRoleDefinitionName == null) - { - throw new ArgumentNullException(nameof(billingRoleDefinitionName)); - } - - using var message = CreateGetByInvoiceSectionRequest(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinition value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleDefinition.DeserializeBillingRoleDefinition(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// , , , or is null. - public Response GetByInvoiceSection(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - if (billingRoleDefinitionName == null) - { - throw new ArgumentNullException(nameof(billingRoleDefinitionName)); - } - - using var message = CreateGetByInvoiceSectionRequest(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinition value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleDefinition.DeserializeBillingRoleDefinition(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetByBillingProfileRequest(string billingAccountName, string billingProfileName, string billingRoleDefinitionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/billingRoleDefinitions/", false); - uri.AppendPath(billingRoleDefinitionName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// , , or is null. - public async Task> GetByBillingProfileAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (billingRoleDefinitionName == null) - { - throw new ArgumentNullException(nameof(billingRoleDefinitionName)); - } - - using var message = CreateGetByBillingProfileRequest(billingAccountName, billingProfileName, billingRoleDefinitionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinition value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleDefinition.DeserializeBillingRoleDefinition(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// , , or is null. - public Response GetByBillingProfile(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (billingRoleDefinitionName == null) - { - throw new ArgumentNullException(nameof(billingRoleDefinitionName)); - } - - using var message = CreateGetByBillingProfileRequest(billingAccountName, billingProfileName, billingRoleDefinitionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinition value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleDefinition.DeserializeBillingRoleDefinition(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingAccountRequest(string billingAccountName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingRoleDefinitions", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public async Task> ListByBillingAccountAsync(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinitionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleDefinitionListResult.DeserializeBillingRoleDefinitionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public Response ListByBillingAccount(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinitionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleDefinitionListResult.DeserializeBillingRoleDefinitionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByInvoiceSectionRequest(string billingAccountName, string billingProfileName, string invoiceSectionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/invoiceSections/", false); - uri.AppendPath(invoiceSectionName, true); - uri.AppendPath("/billingRoleDefinitions", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByInvoiceSectionAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionRequest(billingAccountName, billingProfileName, invoiceSectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinitionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleDefinitionListResult.DeserializeBillingRoleDefinitionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public Response ListByInvoiceSection(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionRequest(billingAccountName, billingProfileName, invoiceSectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinitionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleDefinitionListResult.DeserializeBillingRoleDefinitionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingProfileRequest(string billingAccountName, string billingProfileName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/billingRoleDefinitions", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingProfileAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinitionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleDefinitionListResult.DeserializeBillingRoleDefinitionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public Response ListByBillingProfile(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinitionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleDefinitionListResult.DeserializeBillingRoleDefinitionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingAccountNextPageRequest(string nextLink, string billingAccountName) - { - 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"); - return message; - } - - /// Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingAccountNextPageAsync(string nextLink, string billingAccountName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinitionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleDefinitionListResult.DeserializeBillingRoleDefinitionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// or is null. - public Response ListByBillingAccountNextPage(string nextLink, string billingAccountName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinitionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleDefinitionListResult.DeserializeBillingRoleDefinitionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByInvoiceSectionNextPageRequest(string nextLink, string billingAccountName, string billingProfileName, string invoiceSectionName) - { - 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"); - return message; - } - - /// Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , , or is null. - public async Task> ListByInvoiceSectionNextPageAsync(string nextLink, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionNextPageRequest(nextLink, billingAccountName, billingProfileName, invoiceSectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinitionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleDefinitionListResult.DeserializeBillingRoleDefinitionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , , or is null. - public Response ListByInvoiceSectionNextPage(string nextLink, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionNextPageRequest(nextLink, billingAccountName, billingProfileName, invoiceSectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinitionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleDefinitionListResult.DeserializeBillingRoleDefinitionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingProfileNextPageRequest(string nextLink, string billingAccountName, string billingProfileName) - { - 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"); - return message; - } - - /// Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByBillingProfileNextPageAsync(string nextLink, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinitionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleDefinitionListResult.DeserializeBillingRoleDefinitionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// , , or is null. - public Response ListByBillingProfileNextPage(string nextLink, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinitionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleDefinitionListResult.DeserializeBillingRoleDefinitionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingSubscriptionsMoveHeaders.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingSubscriptionsMoveHeaders.cs deleted file mode 100644 index 44c2080f1608..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingSubscriptionsMoveHeaders.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure; -using Azure.Core; - -namespace Azure.ResourceManager.Billing -{ - internal partial class BillingSubscriptionsMoveHeaders - { - private readonly Response _response; - public BillingSubscriptionsMoveHeaders(Response response) - { - _response = response; - } - /// Location URI to poll for result. - public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; - /// Recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. - public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingSubscriptionsMoveOperation.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingSubscriptionsMoveOperation.cs deleted file mode 100644 index dd2849378326..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingSubscriptionsMoveOperation.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - public partial class BillingSubscriptionsMoveOperation : Operation, IOperationSource - { - private readonly ArmOperationHelpers _operation; - internal BillingSubscriptionsMoveOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) - { - _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "BillingSubscriptionsMoveOperation"); - } - /// - public override string Id => _operation.Id; - - /// - public override BillingSubscription Value => _operation.Value; - - /// - public override bool HasCompleted => _operation.HasCompleted; - - /// - public override bool HasValue => _operation.HasValue; - - /// - public override Response GetRawResponse() => _operation.GetRawResponse(); - - /// - public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - - /// - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); - - BillingSubscription IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream); - return BillingSubscription.DeserializeBillingSubscription(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return BillingSubscription.DeserializeBillingSubscription(document.RootElement); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingSubscriptionsOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingSubscriptionsOperations.cs deleted file mode 100644 index 77f4ecf77854..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingSubscriptionsOperations.cs +++ /dev/null @@ -1,606 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The BillingSubscriptions service client. - public partial class BillingSubscriptionsOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal BillingSubscriptionsRestOperations RestClient { get; } - - /// Initializes a new instance of BillingSubscriptionsOperations for mocking. - protected BillingSubscriptionsOperations() - { - } - - /// Initializes a new instance of BillingSubscriptionsOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The ID that uniquely identifies an Azure subscription. - /// server parameter. - internal BillingSubscriptionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) - { - RestClient = new BillingSubscriptionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement and Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - public virtual async Task> GetAsync(string billingAccountName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.Get"); - scope.Start(); - try - { - return await RestClient.GetAsync(billingAccountName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement and Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - public virtual Response Get(string billingAccountName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.Get"); - scope.Start(); - try - { - return RestClient.Get(billingAccountName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the update billing subscription operation. - /// The cancellation token to use. - public virtual async Task> UpdateAsync(string billingAccountName, BillingSubscription parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.Update"); - scope.Start(); - try - { - return await RestClient.UpdateAsync(billingAccountName, parameters, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the update billing subscription operation. - /// The cancellation token to use. - public virtual Response Update(string billingAccountName, BillingSubscription parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.Update"); - scope.Start(); - try - { - return RestClient.Update(billingAccountName, parameters, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the validate move eligibility operation. - /// The cancellation token to use. - public virtual async Task> ValidateMoveAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ValidateMove"); - scope.Start(); - try - { - return await RestClient.ValidateMoveAsync(billingAccountName, parameters, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the validate move eligibility operation. - /// The cancellation token to use. - public virtual Response ValidateMove(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ValidateMove"); - scope.Start(); - try - { - return RestClient.ValidateMove(billingAccountName, parameters, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByCustomerAsync(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByCustomer"); - scope.Start(); - try - { - var response = await RestClient.ListByCustomerAsync(billingAccountName, customerName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByCustomer"); - scope.Start(); - try - { - var response = await RestClient.ListByCustomerNextPageAsync(nextLink, billingAccountName, customerName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByCustomer(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByCustomer"); - scope.Start(); - try - { - var response = RestClient.ListByCustomer(billingAccountName, customerName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByCustomer"); - scope.Start(); - try - { - var response = RestClient.ListByCustomerNextPage(nextLink, billingAccountName, customerName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public virtual AsyncPageable ListByBillingAccountAsync(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountAsync(billingAccountName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountNextPageAsync(nextLink, billingAccountName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public virtual Pageable ListByBillingAccount(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccount(billingAccountName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccountNextPage(nextLink, billingAccountName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByBillingProfileAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileAsync(billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileNextPageAsync(nextLink, billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByBillingProfile(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfile(billingAccountName, billingProfileName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfileNextPage(nextLink, billingAccountName, billingProfileName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public virtual AsyncPageable ListByInvoiceSectionAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = await RestClient.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = await RestClient.ListByInvoiceSectionNextPageAsync(nextLink, billingAccountName, billingProfileName, invoiceSectionName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public virtual Pageable ListByInvoiceSection(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = RestClient.ListByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = RestClient.ListByInvoiceSectionNextPage(nextLink, billingAccountName, billingProfileName, invoiceSectionName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the move subscription operation. - /// The cancellation token to use. - /// or is null. - public virtual async Task StartMoveAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.StartMove"); - scope.Start(); - try - { - var originalResponse = await RestClient.MoveAsync(billingAccountName, parameters, cancellationToken).ConfigureAwait(false); - return new BillingSubscriptionsMoveOperation(_clientDiagnostics, _pipeline, RestClient.CreateMoveRequest(billingAccountName, parameters).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the move subscription operation. - /// The cancellation token to use. - /// or is null. - public virtual BillingSubscriptionsMoveOperation StartMove(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var scope = _clientDiagnostics.CreateScope("BillingSubscriptionsOperations.StartMove"); - scope.Start(); - try - { - var originalResponse = RestClient.Move(billingAccountName, parameters, cancellationToken); - return new BillingSubscriptionsMoveOperation(_clientDiagnostics, _pipeline, RestClient.CreateMoveRequest(billingAccountName, parameters).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingSubscriptionsRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingSubscriptionsRestOperations.cs deleted file mode 100644 index 3c6d9dda2dd4..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/BillingSubscriptionsRestOperations.cs +++ /dev/null @@ -1,1044 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class BillingSubscriptionsRestOperations - { - private string subscriptionId; - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of BillingSubscriptionsRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The ID that uniquely identifies an Azure subscription. - /// server parameter. - /// is null. - public BillingSubscriptionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) - { - if (subscriptionId == null) - { - throw new ArgumentNullException(nameof(subscriptionId)); - } - endpoint ??= new Uri("https://management.azure.com"); - - this.subscriptionId = subscriptionId; - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListByCustomerRequest(string billingAccountName, string customerName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/customers/", false); - uri.AppendPath(customerName, true); - uri.AppendPath("/billingSubscriptions", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// or is null. - public async Task> ListByCustomerAsync(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateListByCustomerRequest(billingAccountName, customerName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// or is null. - public Response ListByCustomer(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateListByCustomerRequest(billingAccountName, customerName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingAccountRequest(string billingAccountName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingSubscriptions", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public async Task> ListByBillingAccountAsync(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public Response ListByBillingAccount(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingProfileRequest(string billingAccountName, string billingProfileName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/billingSubscriptions", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingProfileAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public Response ListByBillingProfile(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByInvoiceSectionRequest(string billingAccountName, string billingProfileName, string invoiceSectionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/invoiceSections/", false); - uri.AppendPath(invoiceSectionName, true); - uri.AppendPath("/billingSubscriptions", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByInvoiceSectionAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionRequest(billingAccountName, billingProfileName, invoiceSectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public Response ListByInvoiceSection(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionRequest(billingAccountName, billingProfileName, invoiceSectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRequest(string billingAccountName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingSubscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement and Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public async Task> GetAsync(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateGetRequest(billingAccountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingSubscription value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingSubscription.DeserializeBillingSubscription(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement and Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// is null. - public Response Get(string billingAccountName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateGetRequest(billingAccountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingSubscription value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingSubscription.DeserializeBillingSubscription(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateUpdateRequest(string billingAccountName, BillingSubscription parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingSubscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - return message; - } - - /// Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the update billing subscription operation. - /// The cancellation token to use. - /// or is null. - public async Task> UpdateAsync(string billingAccountName, BillingSubscription parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateUpdateRequest(billingAccountName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingSubscription value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingSubscription.DeserializeBillingSubscription(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the update billing subscription operation. - /// The cancellation token to use. - /// or is null. - public Response Update(string billingAccountName, BillingSubscription parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateUpdateRequest(billingAccountName, parameters); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingSubscription value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingSubscription.DeserializeBillingSubscription(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateMoveRequest(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingSubscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/move", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - return message; - } - - /// Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the move subscription operation. - /// The cancellation token to use. - /// or is null. - public async Task> MoveAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateMoveRequest(billingAccountName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - var headers = new BillingSubscriptionsMoveHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - case 202: - return ResponseWithHeaders.FromValue(headers, message.Response); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the move subscription operation. - /// The cancellation token to use. - /// or is null. - public ResponseWithHeaders Move(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateMoveRequest(billingAccountName, parameters); - _pipeline.Send(message, cancellationToken); - var headers = new BillingSubscriptionsMoveHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - case 202: - return ResponseWithHeaders.FromValue(headers, message.Response); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateValidateMoveRequest(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingSubscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/validateMoveEligibility", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - return message; - } - - /// Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the validate move eligibility operation. - /// The cancellation token to use. - /// or is null. - public async Task> ValidateMoveAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateValidateMoveRequest(billingAccountName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ValidateSubscriptionTransferEligibilityResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ValidateSubscriptionTransferEligibilityResult.DeserializeValidateSubscriptionTransferEligibilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// Request parameters that are provided to the validate move eligibility operation. - /// The cancellation token to use. - /// or is null. - public Response ValidateMove(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateValidateMoveRequest(billingAccountName, parameters); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ValidateSubscriptionTransferEligibilityResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ValidateSubscriptionTransferEligibilityResult.DeserializeValidateSubscriptionTransferEligibilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByCustomerNextPageRequest(string nextLink, string billingAccountName, string customerName) - { - 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"); - return message; - } - - /// Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByCustomerNextPageAsync(string nextLink, string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateListByCustomerNextPageRequest(nextLink, billingAccountName, customerName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// , , or is null. - public Response ListByCustomerNextPage(string nextLink, string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateListByCustomerNextPageRequest(nextLink, billingAccountName, customerName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingAccountNextPageRequest(string nextLink, string billingAccountName) - { - 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"); - return message; - } - - /// Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingAccountNextPageAsync(string nextLink, string billingAccountName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The cancellation token to use. - /// or is null. - public Response ListByBillingAccountNextPage(string nextLink, string billingAccountName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingProfileNextPageRequest(string nextLink, string billingAccountName, string billingProfileName) - { - 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"); - return message; - } - - /// Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByBillingProfileNextPageAsync(string nextLink, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// , , or is null. - public Response ListByBillingProfileNextPage(string nextLink, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByInvoiceSectionNextPageRequest(string nextLink, string billingAccountName, string billingProfileName, string invoiceSectionName) - { - 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"); - return message; - } - - /// Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , , or is null. - public async Task> ListByInvoiceSectionNextPageAsync(string nextLink, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionNextPageRequest(nextLink, billingAccountName, billingProfileName, invoiceSectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , , or is null. - public Response ListByInvoiceSectionNextPage(string nextLink, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionNextPageRequest(nextLink, billingAccountName, billingProfileName, invoiceSectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingSubscriptionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingSubscriptionsListResult.DeserializeBillingSubscriptionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/CustomersOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/CustomersOperations.cs deleted file mode 100644 index d86f0b59deab..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/CustomersOperations.cs +++ /dev/null @@ -1,275 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The Customers service client. - public partial class CustomersOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal CustomersRestOperations RestClient { get; } - - /// Initializes a new instance of CustomersOperations for mocking. - protected CustomersOperations() - { - } - - /// Initializes a new instance of CustomersOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal CustomersOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new CustomersRestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// May be used to expand enabledAzurePlans and resellers. - /// The cancellation token to use. - public virtual async Task> GetAsync(string billingAccountName, string customerName, string expand = null, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("CustomersOperations.Get"); - scope.Start(); - try - { - return await RestClient.GetAsync(billingAccountName, customerName, expand, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// May be used to expand enabledAzurePlans and resellers. - /// The cancellation token to use. - public virtual Response Get(string billingAccountName, string customerName, string expand = null, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("CustomersOperations.Get"); - scope.Start(); - try - { - return RestClient.Get(billingAccountName, customerName, expand, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Used for searching customers by their name. Any customer with name containing the search text will be included in the response. - /// May be used to filter the list of customers. - /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByBillingProfileAsync(string billingAccountName, string billingProfileName, string search = null, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("CustomersOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileAsync(billingAccountName, billingProfileName, search, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("CustomersOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileNextPageAsync(nextLink, billingAccountName, billingProfileName, search, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Used for searching customers by their name. Any customer with name containing the search text will be included in the response. - /// May be used to filter the list of customers. - /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByBillingProfile(string billingAccountName, string billingProfileName, string search = null, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("CustomersOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfile(billingAccountName, billingProfileName, search, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("CustomersOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfileNextPage(nextLink, billingAccountName, billingProfileName, search, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// Used for searching customers by their name. Any customer with name containing the search text will be included in the response. - /// May be used to filter the list of customers. - /// The cancellation token to use. - /// is null. - public virtual AsyncPageable ListByBillingAccountAsync(string billingAccountName, string search = null, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("CustomersOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountAsync(billingAccountName, search, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("CustomersOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountNextPageAsync(nextLink, billingAccountName, search, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// Used for searching customers by their name. Any customer with name containing the search text will be included in the response. - /// May be used to filter the list of customers. - /// The cancellation token to use. - /// is null. - public virtual Pageable ListByBillingAccount(string billingAccountName, string search = null, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("CustomersOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccount(billingAccountName, search, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("CustomersOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccountNextPage(nextLink, billingAccountName, search, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/CustomersRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/CustomersRestOperations.cs deleted file mode 100644 index be584849cb2f..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/CustomersRestOperations.cs +++ /dev/null @@ -1,473 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class CustomersRestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of CustomersRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public CustomersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListByBillingProfileRequest(string billingAccountName, string billingProfileName, string search, 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.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/customers", false); - uri.AppendQuery("api-version", "2020-05-01", true); - if (search != null) - { - uri.AppendQuery("$search", search, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Used for searching customers by their name. Any customer with name containing the search text will be included in the response. - /// May be used to filter the list of customers. - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingProfileAsync(string billingAccountName, string billingProfileName, string search = null, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName, search, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - CustomerListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = CustomerListResult.DeserializeCustomerListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Used for searching customers by their name. Any customer with name containing the search text will be included in the response. - /// May be used to filter the list of customers. - /// The cancellation token to use. - /// or is null. - public Response ListByBillingProfile(string billingAccountName, string billingProfileName, string search = null, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName, search, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - CustomerListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = CustomerListResult.DeserializeCustomerListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingAccountRequest(string billingAccountName, string search, 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.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/customers", false); - uri.AppendQuery("api-version", "2020-05-01", true); - if (search != null) - { - uri.AppendQuery("$search", search, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// Used for searching customers by their name. Any customer with name containing the search text will be included in the response. - /// May be used to filter the list of customers. - /// The cancellation token to use. - /// is null. - public async Task> ListByBillingAccountAsync(string billingAccountName, string search = null, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName, search, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - CustomerListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = CustomerListResult.DeserializeCustomerListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// Used for searching customers by their name. Any customer with name containing the search text will be included in the response. - /// May be used to filter the list of customers. - /// The cancellation token to use. - /// is null. - public Response ListByBillingAccount(string billingAccountName, string search = null, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName, search, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - CustomerListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = CustomerListResult.DeserializeCustomerListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRequest(string billingAccountName, string customerName, string expand) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/customers/", false); - uri.AppendPath(customerName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// May be used to expand enabledAzurePlans and resellers. - /// The cancellation token to use. - /// or is null. - public async Task> GetAsync(string billingAccountName, string customerName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateGetRequest(billingAccountName, customerName, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - Customer value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = Customer.DeserializeCustomer(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// May be used to expand enabledAzurePlans and resellers. - /// The cancellation token to use. - /// or is null. - public Response Get(string billingAccountName, string customerName, string expand = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateGetRequest(billingAccountName, customerName, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - Customer value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = Customer.DeserializeCustomer(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingProfileNextPageRequest(string nextLink, string billingAccountName, string billingProfileName, string search, 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"); - return message; - } - - /// Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Used for searching customers by their name. Any customer with name containing the search text will be included in the response. - /// May be used to filter the list of customers. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByBillingProfileNextPageAsync(string nextLink, string billingAccountName, string billingProfileName, string search = null, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName, search, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - CustomerListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = CustomerListResult.DeserializeCustomerListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Used for searching customers by their name. Any customer with name containing the search text will be included in the response. - /// May be used to filter the list of customers. - /// The cancellation token to use. - /// , , or is null. - public Response ListByBillingProfileNextPage(string nextLink, string billingAccountName, string billingProfileName, string search = null, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName, search, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - CustomerListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = CustomerListResult.DeserializeCustomerListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingAccountNextPageRequest(string nextLink, string billingAccountName, string search, 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"); - return message; - } - - /// Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// Used for searching customers by their name. Any customer with name containing the search text will be included in the response. - /// May be used to filter the list of customers. - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingAccountNextPageAsync(string nextLink, string billingAccountName, string search = null, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName, search, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - CustomerListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = CustomerListResult.DeserializeCustomerListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// Used for searching customers by their name. Any customer with name containing the search text will be included in the response. - /// May be used to filter the list of customers. - /// The cancellation token to use. - /// or is null. - public Response ListByBillingAccountNextPage(string nextLink, string billingAccountName, string search = null, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName, search, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - CustomerListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = CustomerListResult.DeserializeCustomerListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/EnrollmentAccountsOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/EnrollmentAccountsOperations.cs deleted file mode 100644 index 7a2c04cb2f3a..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/EnrollmentAccountsOperations.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The EnrollmentAccounts service client. - public partial class EnrollmentAccountsOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal EnrollmentAccountsRestOperations RestClient { get; } - - /// Initializes a new instance of EnrollmentAccountsOperations for mocking. - protected EnrollmentAccountsOperations() - { - } - - /// Initializes a new instance of EnrollmentAccountsOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal EnrollmentAccountsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new EnrollmentAccountsRestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Gets a enrollment account by name. - /// Enrollment Account name. - /// The cancellation token to use. - public virtual async Task> GetAsync(string name, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("EnrollmentAccountsOperations.Get"); - scope.Start(); - try - { - return await RestClient.GetAsync(name, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a enrollment account by name. - /// Enrollment Account name. - /// The cancellation token to use. - public virtual Response Get(string name, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("EnrollmentAccountsOperations.Get"); - scope.Start(); - try - { - return RestClient.Get(name, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the enrollment accounts the caller has access to. - /// The cancellation token to use. - public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("EnrollmentAccountsOperations.List"); - scope.Start(); - try - { - var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("EnrollmentAccountsOperations.List"); - scope.Start(); - try - { - var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the enrollment accounts the caller has access to. - /// The cancellation token to use. - public virtual Pageable List(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("EnrollmentAccountsOperations.List"); - scope.Start(); - try - { - var response = RestClient.List(cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("EnrollmentAccountsOperations.List"); - scope.Start(); - try - { - var response = RestClient.ListNextPage(nextLink, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/EnrollmentAccountsRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/EnrollmentAccountsRestOperations.cs deleted file mode 100644 index 48b92a56513c..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/EnrollmentAccountsRestOperations.cs +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class EnrollmentAccountsRestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of EnrollmentAccountsRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public EnrollmentAccountsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/enrollmentAccounts", false); - uri.AppendQuery("api-version", "2018-03-01-preview", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the enrollment accounts the caller has access to. - /// The cancellation token to use. - public async Task> ListAsync(CancellationToken cancellationToken = default) - { - using var message = CreateListRequest(); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - EnrollmentAccountListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = EnrollmentAccountListResult.DeserializeEnrollmentAccountListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the enrollment accounts the caller has access to. - /// The cancellation token to use. - public Response List(CancellationToken cancellationToken = default) - { - using var message = CreateListRequest(); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - EnrollmentAccountListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = EnrollmentAccountListResult.DeserializeEnrollmentAccountListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRequest(string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/enrollmentAccounts/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", "2018-03-01-preview", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a enrollment account by name. - /// Enrollment Account name. - /// The cancellation token to use. - /// is null. - public async Task> GetAsync(string name, CancellationToken cancellationToken = default) - { - if (name == null) - { - throw new ArgumentNullException(nameof(name)); - } - - using var message = CreateGetRequest(name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - EnrollmentAccountSummary value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = EnrollmentAccountSummary.DeserializeEnrollmentAccountSummary(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets a enrollment account by name. - /// Enrollment Account name. - /// The cancellation token to use. - /// is null. - public Response Get(string name, CancellationToken cancellationToken = default) - { - if (name == null) - { - throw new ArgumentNullException(nameof(name)); - } - - using var message = CreateGetRequest(name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - EnrollmentAccountSummary value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = EnrollmentAccountSummary.DeserializeEnrollmentAccountSummary(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListNextPageRequest(string nextLink) - { - 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"); - return message; - } - - /// Lists the enrollment accounts the caller has access to. - /// The URL to the next page of results. - /// The cancellation token to use. - /// is null. - public async Task> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListNextPageRequest(nextLink); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - EnrollmentAccountListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = EnrollmentAccountListResult.DeserializeEnrollmentAccountListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the enrollment accounts the caller has access to. - /// The URL to the next page of results. - /// The cancellation token to use. - /// is null. - public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListNextPageRequest(nextLink); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - EnrollmentAccountListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = EnrollmentAccountListResult.DeserializeEnrollmentAccountListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InstructionsOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InstructionsOperations.cs deleted file mode 100644 index 7cd593489d01..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InstructionsOperations.cs +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The Instructions service client. - public partial class InstructionsOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal InstructionsRestOperations RestClient { get; } - - /// Initializes a new instance of InstructionsOperations for mocking. - protected InstructionsOperations() - { - } - - /// Initializes a new instance of InstructionsOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal InstructionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new InstructionsRestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Instruction Name. - /// The cancellation token to use. - public virtual async Task> GetAsync(string billingAccountName, string billingProfileName, string instructionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("InstructionsOperations.Get"); - scope.Start(); - try - { - return await RestClient.GetAsync(billingAccountName, billingProfileName, instructionName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Instruction Name. - /// The cancellation token to use. - public virtual Response Get(string billingAccountName, string billingProfileName, string instructionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("InstructionsOperations.Get"); - scope.Start(); - try - { - return RestClient.Get(billingAccountName, billingProfileName, instructionName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Creates or updates an instruction. These are custom billing instructions and are only applicable for certain customers. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Instruction Name. - /// The new instruction. - /// The cancellation token to use. - public virtual async Task> PutAsync(string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("InstructionsOperations.Put"); - scope.Start(); - try - { - return await RestClient.PutAsync(billingAccountName, billingProfileName, instructionName, parameters, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Creates or updates an instruction. These are custom billing instructions and are only applicable for certain customers. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Instruction Name. - /// The new instruction. - /// The cancellation token to use. - public virtual Response Put(string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("InstructionsOperations.Put"); - scope.Start(); - try - { - return RestClient.Put(billingAccountName, billingProfileName, instructionName, parameters, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the instructions by billing profile id. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByBillingProfileAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InstructionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileAsync(billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InstructionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileNextPageAsync(nextLink, billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the instructions by billing profile id. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByBillingProfile(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InstructionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfile(billingAccountName, billingProfileName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InstructionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfileNextPage(nextLink, billingAccountName, billingProfileName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InstructionsRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InstructionsRestOperations.cs deleted file mode 100644 index c74f809fb6d7..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InstructionsRestOperations.cs +++ /dev/null @@ -1,407 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class InstructionsRestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of InstructionsRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public InstructionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListByBillingProfileRequest(string billingAccountName, string billingProfileName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/instructions", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the instructions by billing profile id. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingProfileAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InstructionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InstructionListResult.DeserializeInstructionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the instructions by billing profile id. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public Response ListByBillingProfile(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InstructionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InstructionListResult.DeserializeInstructionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRequest(string billingAccountName, string billingProfileName, string instructionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/instructions/", false); - uri.AppendPath(instructionName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Instruction Name. - /// The cancellation token to use. - /// , , or is null. - public async Task> GetAsync(string billingAccountName, string billingProfileName, string instructionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (instructionName == null) - { - throw new ArgumentNullException(nameof(instructionName)); - } - - using var message = CreateGetRequest(billingAccountName, billingProfileName, instructionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - Instruction value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = Instruction.DeserializeInstruction(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Instruction Name. - /// The cancellation token to use. - /// , , or is null. - public Response Get(string billingAccountName, string billingProfileName, string instructionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (instructionName == null) - { - throw new ArgumentNullException(nameof(instructionName)); - } - - using var message = CreateGetRequest(billingAccountName, billingProfileName, instructionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - Instruction value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = Instruction.DeserializeInstruction(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreatePutRequest(string billingAccountName, string billingProfileName, string instructionName, Instruction parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/instructions/", false); - uri.AppendPath(instructionName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - return message; - } - - /// Creates or updates an instruction. These are custom billing instructions and are only applicable for certain customers. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Instruction Name. - /// The new instruction. - /// The cancellation token to use. - /// , , , or is null. - public async Task> PutAsync(string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (instructionName == null) - { - throw new ArgumentNullException(nameof(instructionName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreatePutRequest(billingAccountName, billingProfileName, instructionName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - Instruction value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = Instruction.DeserializeInstruction(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Creates or updates an instruction. These are custom billing instructions and are only applicable for certain customers. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Instruction Name. - /// The new instruction. - /// The cancellation token to use. - /// , , , or is null. - public Response Put(string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (instructionName == null) - { - throw new ArgumentNullException(nameof(instructionName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreatePutRequest(billingAccountName, billingProfileName, instructionName, parameters); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - Instruction value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = Instruction.DeserializeInstruction(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingProfileNextPageRequest(string nextLink, string billingAccountName, string billingProfileName) - { - 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"); - return message; - } - - /// Lists the instructions by billing profile id. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByBillingProfileNextPageAsync(string nextLink, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InstructionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InstructionListResult.DeserializeInstructionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the instructions by billing profile id. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// , , or is null. - public Response ListByBillingProfileNextPage(string nextLink, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InstructionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InstructionListResult.DeserializeInstructionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoiceSectionsCreateOrUpdateHeaders.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoiceSectionsCreateOrUpdateHeaders.cs deleted file mode 100644 index 7bf9a35cae66..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoiceSectionsCreateOrUpdateHeaders.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure; -using Azure.Core; - -namespace Azure.ResourceManager.Billing -{ - internal partial class InvoiceSectionsCreateOrUpdateHeaders - { - private readonly Response _response; - public InvoiceSectionsCreateOrUpdateHeaders(Response response) - { - _response = response; - } - /// Location URI to poll for result. - public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; - /// Recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. - public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoiceSectionsCreateOrUpdateOperation.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoiceSectionsCreateOrUpdateOperation.cs deleted file mode 100644 index 15fc5c6e9b92..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoiceSectionsCreateOrUpdateOperation.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - public partial class InvoiceSectionsCreateOrUpdateOperation : Operation, IOperationSource - { - private readonly ArmOperationHelpers _operation; - internal InvoiceSectionsCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) - { - _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "InvoiceSectionsCreateOrUpdateOperation"); - } - /// - public override string Id => _operation.Id; - - /// - public override InvoiceSection Value => _operation.Value; - - /// - public override bool HasCompleted => _operation.HasCompleted; - - /// - public override bool HasValue => _operation.HasValue; - - /// - public override Response GetRawResponse() => _operation.GetRawResponse(); - - /// - public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - - /// - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); - - InvoiceSection IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream); - return InvoiceSection.DeserializeInvoiceSection(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return InvoiceSection.DeserializeInvoiceSection(document.RootElement); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoiceSectionsOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoiceSectionsOperations.cs deleted file mode 100644 index e120f2886be3..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoiceSectionsOperations.cs +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The InvoiceSections service client. - public partial class InvoiceSectionsOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal InvoiceSectionsRestOperations RestClient { get; } - - /// Initializes a new instance of InvoiceSectionsOperations for mocking. - protected InvoiceSectionsOperations() - { - } - - /// Initializes a new instance of InvoiceSectionsOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal InvoiceSectionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new InvoiceSectionsRestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - public virtual async Task> GetAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("InvoiceSectionsOperations.Get"); - scope.Start(); - try - { - return await RestClient.GetAsync(billingAccountName, billingProfileName, invoiceSectionName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - public virtual Response Get(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("InvoiceSectionsOperations.Get"); - scope.Start(); - try - { - return RestClient.Get(billingAccountName, billingProfileName, invoiceSectionName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByBillingProfileAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoiceSectionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileAsync(billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoiceSectionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileNextPageAsync(nextLink, billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByBillingProfile(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoiceSectionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfile(billingAccountName, billingProfileName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoiceSectionsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfileNextPage(nextLink, billingAccountName, billingProfileName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The new or updated invoice section. - /// The cancellation token to use. - /// , , , or is null. - public virtual async Task StartCreateOrUpdateAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var scope = _clientDiagnostics.CreateScope("InvoiceSectionsOperations.StartCreateOrUpdate"); - scope.Start(); - try - { - var originalResponse = await RestClient.CreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, cancellationToken).ConfigureAwait(false); - return new InvoiceSectionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(billingAccountName, billingProfileName, invoiceSectionName, parameters).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The new or updated invoice section. - /// The cancellation token to use. - /// , , , or is null. - public virtual InvoiceSectionsCreateOrUpdateOperation StartCreateOrUpdate(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var scope = _clientDiagnostics.CreateScope("InvoiceSectionsOperations.StartCreateOrUpdate"); - scope.Start(); - try - { - var originalResponse = RestClient.CreateOrUpdate(billingAccountName, billingProfileName, invoiceSectionName, parameters, cancellationToken); - return new InvoiceSectionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(billingAccountName, billingProfileName, invoiceSectionName, parameters).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoiceSectionsRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoiceSectionsRestOperations.cs deleted file mode 100644 index 702784c8f2cb..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoiceSectionsRestOperations.cs +++ /dev/null @@ -1,401 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class InvoiceSectionsRestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of InvoiceSectionsRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public InvoiceSectionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListByBillingProfileRequest(string billingAccountName, string billingProfileName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/invoiceSections", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingProfileAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InvoiceSectionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InvoiceSectionListResult.DeserializeInvoiceSectionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public Response ListByBillingProfile(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InvoiceSectionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InvoiceSectionListResult.DeserializeInvoiceSectionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRequest(string billingAccountName, string billingProfileName, string invoiceSectionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/invoiceSections/", false); - uri.AppendPath(invoiceSectionName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public async Task> GetAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateGetRequest(billingAccountName, billingProfileName, invoiceSectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InvoiceSection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InvoiceSection.DeserializeInvoiceSection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The cancellation token to use. - /// , , or is null. - public Response Get(string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateGetRequest(billingAccountName, billingProfileName, invoiceSectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InvoiceSection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InvoiceSection.DeserializeInvoiceSection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateCreateOrUpdateRequest(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/invoiceSections/", false); - uri.AppendPath(invoiceSectionName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - return message; - } - - /// Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The new or updated invoice section. - /// The cancellation token to use. - /// , , , or is null. - public async Task> CreateOrUpdateAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateCreateOrUpdateRequest(billingAccountName, billingProfileName, invoiceSectionName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - var headers = new InvoiceSectionsCreateOrUpdateHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - case 202: - return ResponseWithHeaders.FromValue(headers, message.Response); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// The new or updated invoice section. - /// The cancellation token to use. - /// , , , or is null. - public ResponseWithHeaders CreateOrUpdate(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateCreateOrUpdateRequest(billingAccountName, billingProfileName, invoiceSectionName, parameters); - _pipeline.Send(message, cancellationToken); - var headers = new InvoiceSectionsCreateOrUpdateHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - case 202: - return ResponseWithHeaders.FromValue(headers, message.Response); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingProfileNextPageRequest(string nextLink, string billingAccountName, string billingProfileName) - { - 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"); - return message; - } - - /// Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByBillingProfileNextPageAsync(string nextLink, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InvoiceSectionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InvoiceSectionListResult.DeserializeInvoiceSectionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// , , or is null. - public Response ListByBillingProfileNextPage(string nextLink, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InvoiceSectionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InvoiceSectionListResult.DeserializeInvoiceSectionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadBillingSubscriptionInvoiceHeaders.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadBillingSubscriptionInvoiceHeaders.cs deleted file mode 100644 index 67cec83c45c8..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadBillingSubscriptionInvoiceHeaders.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure; -using Azure.Core; - -namespace Azure.ResourceManager.Billing -{ - internal partial class InvoicesDownloadBillingSubscriptionInvoiceHeaders - { - private readonly Response _response; - public InvoicesDownloadBillingSubscriptionInvoiceHeaders(Response response) - { - _response = response; - } - /// GET this URL to retrieve the status of the asynchronous operation. - public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; - /// The amount of delay to use while the status of the operation is checked. The value is expressed in seconds. - public string RetryAfter => _response.Headers.TryGetValue("Retry-After", out string value) ? value : null; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadBillingSubscriptionInvoiceOperation.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadBillingSubscriptionInvoiceOperation.cs deleted file mode 100644 index 09d655de8874..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadBillingSubscriptionInvoiceOperation.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// Gets a URL to download an invoice. - public partial class InvoicesDownloadBillingSubscriptionInvoiceOperation : Operation, IOperationSource - { - private readonly ArmOperationHelpers _operation; - internal InvoicesDownloadBillingSubscriptionInvoiceOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) - { - _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "InvoicesDownloadBillingSubscriptionInvoiceOperation"); - } - /// - public override string Id => _operation.Id; - - /// - public override DownloadUrl Value => _operation.Value; - - /// - public override bool HasCompleted => _operation.HasCompleted; - - /// - public override bool HasValue => _operation.HasValue; - - /// - public override Response GetRawResponse() => _operation.GetRawResponse(); - - /// - public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - - /// - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); - - DownloadUrl IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream); - return DownloadUrl.DeserializeDownloadUrl(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return DownloadUrl.DeserializeDownloadUrl(document.RootElement); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadInvoiceHeaders.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadInvoiceHeaders.cs deleted file mode 100644 index 6fad27843a3c..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadInvoiceHeaders.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure; -using Azure.Core; - -namespace Azure.ResourceManager.Billing -{ - internal partial class InvoicesDownloadInvoiceHeaders - { - private readonly Response _response; - public InvoicesDownloadInvoiceHeaders(Response response) - { - _response = response; - } - /// GET this URL to retrieve the status of the asynchronous operation. - public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; - /// The amount of delay to use while the status of the operation is checked. The value is expressed in seconds. - public string RetryAfter => _response.Headers.TryGetValue("Retry-After", out string value) ? value : null; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadInvoiceOperation.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadInvoiceOperation.cs deleted file mode 100644 index 9ffd8dd12a6d..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadInvoiceOperation.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - public partial class InvoicesDownloadInvoiceOperation : Operation, IOperationSource - { - private readonly ArmOperationHelpers _operation; - internal InvoicesDownloadInvoiceOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) - { - _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "InvoicesDownloadInvoiceOperation"); - } - /// - public override string Id => _operation.Id; - - /// - public override DownloadUrl Value => _operation.Value; - - /// - public override bool HasCompleted => _operation.HasCompleted; - - /// - public override bool HasValue => _operation.HasValue; - - /// - public override Response GetRawResponse() => _operation.GetRawResponse(); - - /// - public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - - /// - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); - - DownloadUrl IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream); - return DownloadUrl.DeserializeDownloadUrl(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return DownloadUrl.DeserializeDownloadUrl(document.RootElement); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadMultipleBillingProfileInvoicesHeaders.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadMultipleBillingProfileInvoicesHeaders.cs deleted file mode 100644 index 9ac68058ac37..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadMultipleBillingProfileInvoicesHeaders.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure; -using Azure.Core; - -namespace Azure.ResourceManager.Billing -{ - internal partial class InvoicesDownloadMultipleBillingProfileInvoicesHeaders - { - private readonly Response _response; - public InvoicesDownloadMultipleBillingProfileInvoicesHeaders(Response response) - { - _response = response; - } - /// GET this URL to retrieve the status of the asynchronous operation. - public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; - /// The amount of delay to use while the status of the operation is checked. The value is expressed in seconds. - public string RetryAfter => _response.Headers.TryGetValue("Retry-After", out string value) ? value : null; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadMultipleBillingProfileInvoicesOperation.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadMultipleBillingProfileInvoicesOperation.cs deleted file mode 100644 index 01b6d3f77d22..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadMultipleBillingProfileInvoicesOperation.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - public partial class InvoicesDownloadMultipleBillingProfileInvoicesOperation : Operation, IOperationSource - { - private readonly ArmOperationHelpers _operation; - internal InvoicesDownloadMultipleBillingProfileInvoicesOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) - { - _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "InvoicesDownloadMultipleBillingProfileInvoicesOperation"); - } - /// - public override string Id => _operation.Id; - - /// - public override DownloadUrl Value => _operation.Value; - - /// - public override bool HasCompleted => _operation.HasCompleted; - - /// - public override bool HasValue => _operation.HasValue; - - /// - public override Response GetRawResponse() => _operation.GetRawResponse(); - - /// - public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - - /// - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); - - DownloadUrl IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream); - return DownloadUrl.DeserializeDownloadUrl(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return DownloadUrl.DeserializeDownloadUrl(document.RootElement); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders.cs deleted file mode 100644 index 73c9b3f115eb..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure; -using Azure.Core; - -namespace Azure.ResourceManager.Billing -{ - internal partial class InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders - { - private readonly Response _response; - public InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders(Response response) - { - _response = response; - } - /// GET this URL to retrieve the status of the asynchronous operation. - public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; - /// The amount of delay to use while the status of the operation is checked. The value is expressed in seconds. - public string RetryAfter => _response.Headers.TryGetValue("Retry-After", out string value) ? value : null; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadMultipleBillingSubscriptionInvoicesOperation.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadMultipleBillingSubscriptionInvoicesOperation.cs deleted file mode 100644 index 9c27a64487ce..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesDownloadMultipleBillingSubscriptionInvoicesOperation.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. - public partial class InvoicesDownloadMultipleBillingSubscriptionInvoicesOperation : Operation, IOperationSource - { - private readonly ArmOperationHelpers _operation; - internal InvoicesDownloadMultipleBillingSubscriptionInvoicesOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) - { - _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "InvoicesDownloadMultipleBillingSubscriptionInvoicesOperation"); - } - /// - public override string Id => _operation.Id; - - /// - public override DownloadUrl Value => _operation.Value; - - /// - public override bool HasCompleted => _operation.HasCompleted; - - /// - public override bool HasValue => _operation.HasValue; - - /// - public override Response GetRawResponse() => _operation.GetRawResponse(); - - /// - public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - - /// - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); - - DownloadUrl IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream); - return DownloadUrl.DeserializeDownloadUrl(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return DownloadUrl.DeserializeDownloadUrl(document.RootElement); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesOperations.cs deleted file mode 100644 index 43f57d95b284..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesOperations.cs +++ /dev/null @@ -1,717 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The Invoices service client. - public partial class InvoicesOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal InvoicesRestOperations RestClient { get; } - - /// Initializes a new instance of InvoicesOperations for mocking. - protected InvoicesOperations() - { - } - - /// Initializes a new instance of InvoicesOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The ID that uniquely identifies an Azure subscription. - /// server parameter. - internal InvoicesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) - { - RestClient = new InvoicesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - public virtual async Task> GetAsync(string billingAccountName, string invoiceName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.Get"); - scope.Start(); - try - { - return await RestClient.GetAsync(billingAccountName, invoiceName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - public virtual Response Get(string billingAccountName, string invoiceName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.Get"); - scope.Start(); - try - { - return RestClient.Get(billingAccountName, invoiceName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - public virtual async Task> GetByIdAsync(string invoiceName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.GetById"); - scope.Start(); - try - { - return await RestClient.GetByIdAsync(invoiceName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - public virtual Response GetById(string invoiceName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.GetById"); - scope.Start(); - try - { - return RestClient.GetById(invoiceName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets an invoice by subscription ID and invoice ID. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - public virtual async Task> GetBySubscriptionAndInvoiceIdAsync(string invoiceName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.GetBySubscriptionAndInvoiceId"); - scope.Start(); - try - { - return await RestClient.GetBySubscriptionAndInvoiceIdAsync(invoiceName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets an invoice by subscription ID and invoice ID. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - public virtual Response GetBySubscriptionAndInvoiceId(string invoiceName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.GetBySubscriptionAndInvoiceId"); - scope.Start(); - try - { - return RestClient.GetBySubscriptionAndInvoiceId(invoiceName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The cancellation token to use. - /// , , or is null. - public virtual AsyncPageable ListByBillingAccountAsync(string billingAccountName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountAsync(billingAccountName, periodStartDate, periodEndDate, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountNextPageAsync(nextLink, billingAccountName, periodStartDate, periodEndDate, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The cancellation token to use. - /// , , or is null. - public virtual Pageable ListByBillingAccount(string billingAccountName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccount(billingAccountName, periodStartDate, periodEndDate, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccountNextPage(nextLink, billingAccountName, periodStartDate, periodEndDate, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The cancellation token to use. - /// , , , or is null. - public virtual AsyncPageable ListByBillingProfileAsync(string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileNextPageAsync(nextLink, billingAccountName, billingProfileName, periodStartDate, periodEndDate, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The cancellation token to use. - /// , , , or is null. - public virtual Pageable ListByBillingProfile(string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfile(billingAccountName, billingProfileName, periodStartDate, periodEndDate, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfileNextPage(nextLink, billingAccountName, billingProfileName, periodStartDate, periodEndDate, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the invoices for a subscription. - /// Invoice period start date. - /// Invoice period end date. - /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByBillingSubscriptionAsync(string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.ListByBillingSubscription"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingSubscriptionAsync(periodStartDate, periodEndDate, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.ListByBillingSubscription"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingSubscriptionNextPageAsync(nextLink, periodStartDate, periodEndDate, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the invoices for a subscription. - /// Invoice period start date. - /// Invoice period end date. - /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByBillingSubscription(string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.ListByBillingSubscription"); - scope.Start(); - try - { - var response = RestClient.ListByBillingSubscription(periodStartDate, periodEndDate, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.ListByBillingSubscription"); - scope.Start(); - try - { - var response = RestClient.ListByBillingSubscriptionNextPage(nextLink, periodStartDate, periodEndDate, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an invoice. - /// Download token with document source and document ID. - /// The cancellation token to use. - /// , , or is null. - public virtual async Task StartDownloadInvoiceAsync(string billingAccountName, string invoiceName, string downloadToken, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - if (downloadToken == null) - { - throw new ArgumentNullException(nameof(downloadToken)); - } - - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.StartDownloadInvoice"); - scope.Start(); - try - { - var originalResponse = await RestClient.DownloadInvoiceAsync(billingAccountName, invoiceName, downloadToken, cancellationToken).ConfigureAwait(false); - return new InvoicesDownloadInvoiceOperation(_clientDiagnostics, _pipeline, RestClient.CreateDownloadInvoiceRequest(billingAccountName, invoiceName, downloadToken).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an invoice. - /// Download token with document source and document ID. - /// The cancellation token to use. - /// , , or is null. - public virtual InvoicesDownloadInvoiceOperation StartDownloadInvoice(string billingAccountName, string invoiceName, string downloadToken, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - if (downloadToken == null) - { - throw new ArgumentNullException(nameof(downloadToken)); - } - - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.StartDownloadInvoice"); - scope.Start(); - try - { - var originalResponse = RestClient.DownloadInvoice(billingAccountName, invoiceName, downloadToken, cancellationToken); - return new InvoicesDownloadInvoiceOperation(_clientDiagnostics, _pipeline, RestClient.CreateDownloadInvoiceRequest(billingAccountName, invoiceName, downloadToken).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// An array of download urls for individual documents. - /// The cancellation token to use. - /// or is null. - public virtual async Task StartDownloadMultipleBillingProfileInvoicesAsync(string billingAccountName, IEnumerable downloadUrls, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (downloadUrls == null) - { - throw new ArgumentNullException(nameof(downloadUrls)); - } - - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.StartDownloadMultipleBillingProfileInvoices"); - scope.Start(); - try - { - var originalResponse = await RestClient.DownloadMultipleBillingProfileInvoicesAsync(billingAccountName, downloadUrls, cancellationToken).ConfigureAwait(false); - return new InvoicesDownloadMultipleBillingProfileInvoicesOperation(_clientDiagnostics, _pipeline, RestClient.CreateDownloadMultipleBillingProfileInvoicesRequest(billingAccountName, downloadUrls).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// An array of download urls for individual documents. - /// The cancellation token to use. - /// or is null. - public virtual InvoicesDownloadMultipleBillingProfileInvoicesOperation StartDownloadMultipleBillingProfileInvoices(string billingAccountName, IEnumerable downloadUrls, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (downloadUrls == null) - { - throw new ArgumentNullException(nameof(downloadUrls)); - } - - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.StartDownloadMultipleBillingProfileInvoices"); - scope.Start(); - try - { - var originalResponse = RestClient.DownloadMultipleBillingProfileInvoices(billingAccountName, downloadUrls, cancellationToken); - return new InvoicesDownloadMultipleBillingProfileInvoicesOperation(_clientDiagnostics, _pipeline, RestClient.CreateDownloadMultipleBillingProfileInvoicesRequest(billingAccountName, downloadUrls).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a URL to download an invoice. - /// The ID that uniquely identifies an invoice. - /// Download token with document source and document ID. - /// The cancellation token to use. - /// or is null. - public virtual async Task StartDownloadBillingSubscriptionInvoiceAsync(string invoiceName, string downloadToken, CancellationToken cancellationToken = default) - { - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - if (downloadToken == null) - { - throw new ArgumentNullException(nameof(downloadToken)); - } - - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.StartDownloadBillingSubscriptionInvoice"); - scope.Start(); - try - { - var originalResponse = await RestClient.DownloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken, cancellationToken).ConfigureAwait(false); - return new InvoicesDownloadBillingSubscriptionInvoiceOperation(_clientDiagnostics, _pipeline, RestClient.CreateDownloadBillingSubscriptionInvoiceRequest(invoiceName, downloadToken).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a URL to download an invoice. - /// The ID that uniquely identifies an invoice. - /// Download token with document source and document ID. - /// The cancellation token to use. - /// or is null. - public virtual InvoicesDownloadBillingSubscriptionInvoiceOperation StartDownloadBillingSubscriptionInvoice(string invoiceName, string downloadToken, CancellationToken cancellationToken = default) - { - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - if (downloadToken == null) - { - throw new ArgumentNullException(nameof(downloadToken)); - } - - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.StartDownloadBillingSubscriptionInvoice"); - scope.Start(); - try - { - var originalResponse = RestClient.DownloadBillingSubscriptionInvoice(invoiceName, downloadToken, cancellationToken); - return new InvoicesDownloadBillingSubscriptionInvoiceOperation(_clientDiagnostics, _pipeline, RestClient.CreateDownloadBillingSubscriptionInvoiceRequest(invoiceName, downloadToken).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. - /// An array of download urls for individual documents. - /// The cancellation token to use. - /// is null. - public virtual async Task StartDownloadMultipleBillingSubscriptionInvoicesAsync(IEnumerable downloadUrls, CancellationToken cancellationToken = default) - { - if (downloadUrls == null) - { - throw new ArgumentNullException(nameof(downloadUrls)); - } - - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.StartDownloadMultipleBillingSubscriptionInvoices"); - scope.Start(); - try - { - var originalResponse = await RestClient.DownloadMultipleBillingSubscriptionInvoicesAsync(downloadUrls, cancellationToken).ConfigureAwait(false); - return new InvoicesDownloadMultipleBillingSubscriptionInvoicesOperation(_clientDiagnostics, _pipeline, RestClient.CreateDownloadMultipleBillingSubscriptionInvoicesRequest(downloadUrls).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. - /// An array of download urls for individual documents. - /// The cancellation token to use. - /// is null. - public virtual InvoicesDownloadMultipleBillingSubscriptionInvoicesOperation StartDownloadMultipleBillingSubscriptionInvoices(IEnumerable downloadUrls, CancellationToken cancellationToken = default) - { - if (downloadUrls == null) - { - throw new ArgumentNullException(nameof(downloadUrls)); - } - - using var scope = _clientDiagnostics.CreateScope("InvoicesOperations.StartDownloadMultipleBillingSubscriptionInvoices"); - scope.Start(); - try - { - var originalResponse = RestClient.DownloadMultipleBillingSubscriptionInvoices(downloadUrls, cancellationToken); - return new InvoicesDownloadMultipleBillingSubscriptionInvoicesOperation(_clientDiagnostics, _pipeline, RestClient.CreateDownloadMultipleBillingSubscriptionInvoicesRequest(downloadUrls).Request, originalResponse); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesRestOperations.cs deleted file mode 100644 index edbb4140b178..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/InvoicesRestOperations.cs +++ /dev/null @@ -1,1157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class InvoicesRestOperations - { - private string subscriptionId; - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of InvoicesRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The ID that uniquely identifies an Azure subscription. - /// server parameter. - /// is null. - public InvoicesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) - { - if (subscriptionId == null) - { - throw new ArgumentNullException(nameof(subscriptionId)); - } - endpoint ??= new Uri("https://management.azure.com"); - - this.subscriptionId = subscriptionId; - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListByBillingAccountRequest(string billingAccountName, string periodStartDate, string periodEndDate) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/invoices", false); - uri.AppendQuery("api-version", "2020-05-01", true); - uri.AppendQuery("periodStartDate", periodStartDate, true); - uri.AppendQuery("periodEndDate", periodEndDate, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByBillingAccountAsync(string billingAccountName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName, periodStartDate, periodEndDate); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InvoiceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InvoiceListResult.DeserializeInvoiceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The cancellation token to use. - /// , , or is null. - public Response ListByBillingAccount(string billingAccountName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName, periodStartDate, periodEndDate); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InvoiceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InvoiceListResult.DeserializeInvoiceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingProfileRequest(string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/invoices", false); - uri.AppendQuery("api-version", "2020-05-01", true); - uri.AppendQuery("periodStartDate", periodStartDate, true); - uri.AppendQuery("periodEndDate", periodEndDate, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The cancellation token to use. - /// , , , or is null. - public async Task> ListByBillingProfileAsync(string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName, periodStartDate, periodEndDate); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InvoiceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InvoiceListResult.DeserializeInvoiceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The cancellation token to use. - /// , , , or is null. - public Response ListByBillingProfile(string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName, periodStartDate, periodEndDate); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InvoiceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InvoiceListResult.DeserializeInvoiceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRequest(string billingAccountName, string invoiceName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/invoices/", false); - uri.AppendPath(invoiceName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - /// or is null. - public async Task> GetAsync(string billingAccountName, string invoiceName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - - using var message = CreateGetRequest(billingAccountName, invoiceName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - Invoice value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = Invoice.DeserializeInvoice(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - /// or is null. - public Response Get(string billingAccountName, string invoiceName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - - using var message = CreateGetRequest(billingAccountName, invoiceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - Invoice value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = Invoice.DeserializeInvoice(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetByIdRequest(string invoiceName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/default/invoices/", false); - uri.AppendPath(invoiceName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - /// is null. - public async Task> GetByIdAsync(string invoiceName, CancellationToken cancellationToken = default) - { - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - - using var message = CreateGetByIdRequest(invoiceName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - Invoice value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = Invoice.DeserializeInvoice(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - /// is null. - public Response GetById(string invoiceName, CancellationToken cancellationToken = default) - { - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - - using var message = CreateGetByIdRequest(invoiceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - Invoice value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = Invoice.DeserializeInvoice(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDownloadInvoiceRequest(string billingAccountName, string invoiceName, string downloadToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/invoices/", false); - uri.AppendPath(invoiceName, true); - uri.AppendPath("/download", false); - uri.AppendQuery("api-version", "2020-05-01", true); - uri.AppendQuery("downloadToken", downloadToken, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an invoice. - /// Download token with document source and document ID. - /// The cancellation token to use. - /// , , or is null. - public async Task> DownloadInvoiceAsync(string billingAccountName, string invoiceName, string downloadToken, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - if (downloadToken == null) - { - throw new ArgumentNullException(nameof(downloadToken)); - } - - using var message = CreateDownloadInvoiceRequest(billingAccountName, invoiceName, downloadToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - var headers = new InvoicesDownloadInvoiceHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - case 202: - return ResponseWithHeaders.FromValue(headers, message.Response); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an invoice. - /// Download token with document source and document ID. - /// The cancellation token to use. - /// , , or is null. - public ResponseWithHeaders DownloadInvoice(string billingAccountName, string invoiceName, string downloadToken, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - if (downloadToken == null) - { - throw new ArgumentNullException(nameof(downloadToken)); - } - - using var message = CreateDownloadInvoiceRequest(billingAccountName, invoiceName, downloadToken); - _pipeline.Send(message, cancellationToken); - var headers = new InvoicesDownloadInvoiceHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - case 202: - return ResponseWithHeaders.FromValue(headers, message.Response); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDownloadMultipleBillingProfileInvoicesRequest(string billingAccountName, IEnumerable downloadUrls) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/downloadDocuments", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteStartArray(); - foreach (var item in downloadUrls) - { - content.JsonWriter.WriteStringValue(item); - } - content.JsonWriter.WriteEndArray(); - request.Content = content; - return message; - } - - /// Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// An array of download urls for individual documents. - /// The cancellation token to use. - /// or is null. - public async Task> DownloadMultipleBillingProfileInvoicesAsync(string billingAccountName, IEnumerable downloadUrls, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (downloadUrls == null) - { - throw new ArgumentNullException(nameof(downloadUrls)); - } - - using var message = CreateDownloadMultipleBillingProfileInvoicesRequest(billingAccountName, downloadUrls); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - var headers = new InvoicesDownloadMultipleBillingProfileInvoicesHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - case 202: - return ResponseWithHeaders.FromValue(headers, message.Response); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// An array of download urls for individual documents. - /// The cancellation token to use. - /// or is null. - public ResponseWithHeaders DownloadMultipleBillingProfileInvoices(string billingAccountName, IEnumerable downloadUrls, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (downloadUrls == null) - { - throw new ArgumentNullException(nameof(downloadUrls)); - } - - using var message = CreateDownloadMultipleBillingProfileInvoicesRequest(billingAccountName, downloadUrls); - _pipeline.Send(message, cancellationToken); - var headers = new InvoicesDownloadMultipleBillingProfileInvoicesHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - case 202: - return ResponseWithHeaders.FromValue(headers, message.Response); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingSubscriptionRequest(string periodStartDate, string periodEndDate) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/invoices", false); - uri.AppendQuery("periodStartDate", periodStartDate, true); - uri.AppendQuery("periodEndDate", periodEndDate, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the invoices for a subscription. - /// Invoice period start date. - /// Invoice period end date. - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingSubscriptionAsync(string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - using var message = CreateListByBillingSubscriptionRequest(periodStartDate, periodEndDate); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InvoiceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InvoiceListResult.DeserializeInvoiceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the invoices for a subscription. - /// Invoice period start date. - /// Invoice period end date. - /// The cancellation token to use. - /// or is null. - public Response ListByBillingSubscription(string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - using var message = CreateListByBillingSubscriptionRequest(periodStartDate, periodEndDate); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InvoiceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InvoiceListResult.DeserializeInvoiceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetBySubscriptionAndInvoiceIdRequest(string invoiceName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/invoices/", false); - uri.AppendPath(invoiceName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets an invoice by subscription ID and invoice ID. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - /// is null. - public async Task> GetBySubscriptionAndInvoiceIdAsync(string invoiceName, CancellationToken cancellationToken = default) - { - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - - using var message = CreateGetBySubscriptionAndInvoiceIdRequest(invoiceName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - Invoice value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = Invoice.DeserializeInvoice(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets an invoice by subscription ID and invoice ID. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - /// is null. - public Response GetBySubscriptionAndInvoiceId(string invoiceName, CancellationToken cancellationToken = default) - { - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - - using var message = CreateGetBySubscriptionAndInvoiceIdRequest(invoiceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - Invoice value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = Invoice.DeserializeInvoice(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDownloadBillingSubscriptionInvoiceRequest(string invoiceName, string downloadToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/invoices/", false); - uri.AppendPath(invoiceName, true); - uri.AppendPath("/download", false); - uri.AppendQuery("api-version", "2020-05-01", true); - uri.AppendQuery("downloadToken", downloadToken, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a URL to download an invoice. - /// The ID that uniquely identifies an invoice. - /// Download token with document source and document ID. - /// The cancellation token to use. - /// or is null. - public async Task> DownloadBillingSubscriptionInvoiceAsync(string invoiceName, string downloadToken, CancellationToken cancellationToken = default) - { - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - if (downloadToken == null) - { - throw new ArgumentNullException(nameof(downloadToken)); - } - - using var message = CreateDownloadBillingSubscriptionInvoiceRequest(invoiceName, downloadToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - var headers = new InvoicesDownloadBillingSubscriptionInvoiceHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - case 202: - return ResponseWithHeaders.FromValue(headers, message.Response); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets a URL to download an invoice. - /// The ID that uniquely identifies an invoice. - /// Download token with document source and document ID. - /// The cancellation token to use. - /// or is null. - public ResponseWithHeaders DownloadBillingSubscriptionInvoice(string invoiceName, string downloadToken, CancellationToken cancellationToken = default) - { - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - if (downloadToken == null) - { - throw new ArgumentNullException(nameof(downloadToken)); - } - - using var message = CreateDownloadBillingSubscriptionInvoiceRequest(invoiceName, downloadToken); - _pipeline.Send(message, cancellationToken); - var headers = new InvoicesDownloadBillingSubscriptionInvoiceHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - case 202: - return ResponseWithHeaders.FromValue(headers, message.Response); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDownloadMultipleBillingSubscriptionInvoicesRequest(IEnumerable downloadUrls) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/downloadDocuments", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteStartArray(); - foreach (var item in downloadUrls) - { - content.JsonWriter.WriteStringValue(item); - } - content.JsonWriter.WriteEndArray(); - request.Content = content; - return message; - } - - /// Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. - /// An array of download urls for individual documents. - /// The cancellation token to use. - /// is null. - public async Task> DownloadMultipleBillingSubscriptionInvoicesAsync(IEnumerable downloadUrls, CancellationToken cancellationToken = default) - { - if (downloadUrls == null) - { - throw new ArgumentNullException(nameof(downloadUrls)); - } - - using var message = CreateDownloadMultipleBillingSubscriptionInvoicesRequest(downloadUrls); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - var headers = new InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - case 202: - return ResponseWithHeaders.FromValue(headers, message.Response); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. - /// An array of download urls for individual documents. - /// The cancellation token to use. - /// is null. - public ResponseWithHeaders DownloadMultipleBillingSubscriptionInvoices(IEnumerable downloadUrls, CancellationToken cancellationToken = default) - { - if (downloadUrls == null) - { - throw new ArgumentNullException(nameof(downloadUrls)); - } - - using var message = CreateDownloadMultipleBillingSubscriptionInvoicesRequest(downloadUrls); - _pipeline.Send(message, cancellationToken); - var headers = new InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - case 202: - return ResponseWithHeaders.FromValue(headers, message.Response); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingAccountNextPageRequest(string nextLink, string billingAccountName, string periodStartDate, string periodEndDate) - { - 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"); - return message; - } - - /// Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The cancellation token to use. - /// , , , or is null. - public async Task> ListByBillingAccountNextPageAsync(string nextLink, string billingAccountName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName, periodStartDate, periodEndDate); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InvoiceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InvoiceListResult.DeserializeInvoiceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The cancellation token to use. - /// , , , or is null. - public Response ListByBillingAccountNextPage(string nextLink, string billingAccountName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName, periodStartDate, periodEndDate); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InvoiceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InvoiceListResult.DeserializeInvoiceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingProfileNextPageRequest(string nextLink, string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate) - { - 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"); - return message; - } - - /// Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The cancellation token to use. - /// , , , , or is null. - public async Task> ListByBillingProfileNextPageAsync(string nextLink, string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName, periodStartDate, periodEndDate); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InvoiceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InvoiceListResult.DeserializeInvoiceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. - /// The cancellation token to use. - /// , , , , or is null. - public Response ListByBillingProfileNextPage(string nextLink, string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName, periodStartDate, periodEndDate); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InvoiceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InvoiceListResult.DeserializeInvoiceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingSubscriptionNextPageRequest(string nextLink, string periodStartDate, string periodEndDate) - { - 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"); - return message; - } - - /// Lists the invoices for a subscription. - /// The URL to the next page of results. - /// Invoice period start date. - /// Invoice period end date. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByBillingSubscriptionNextPageAsync(string nextLink, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - using var message = CreateListByBillingSubscriptionNextPageRequest(nextLink, periodStartDate, periodEndDate); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InvoiceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InvoiceListResult.DeserializeInvoiceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the invoices for a subscription. - /// The URL to the next page of results. - /// Invoice period start date. - /// Invoice period end date. - /// The cancellation token to use. - /// , , or is null. - public Response ListByBillingSubscriptionNextPage(string nextLink, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (periodStartDate == null) - { - throw new ArgumentNullException(nameof(periodStartDate)); - } - if (periodEndDate == null) - { - throw new ArgumentNullException(nameof(periodEndDate)); - } - - using var message = CreateListByBillingSubscriptionNextPageRequest(nextLink, periodStartDate, periodEndDate); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InvoiceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InvoiceListResult.DeserializeInvoiceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AcceptanceMode.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AcceptanceMode.cs deleted file mode 100644 index 66f712ac9e69..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AcceptanceMode.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The mode of acceptance for an agreement. - public readonly partial struct AcceptanceMode : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public AcceptanceMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ClickToAcceptValue = "ClickToAccept"; - private const string ESignEmbeddedValue = "ESignEmbedded"; - private const string ESignOfflineValue = "ESignOffline"; - - /// ClickToAccept. - public static AcceptanceMode ClickToAccept { get; } = new AcceptanceMode(ClickToAcceptValue); - /// ESignEmbedded. - public static AcceptanceMode ESignEmbedded { get; } = new AcceptanceMode(ESignEmbeddedValue); - /// ESignOffline. - public static AcceptanceMode ESignOffline { get; } = new AcceptanceMode(ESignOfflineValue); - /// Determines if two values are the same. - public static bool operator ==(AcceptanceMode left, AcceptanceMode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AcceptanceMode left, AcceptanceMode right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator AcceptanceMode(string value) => new AcceptanceMode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AcceptanceMode other && Equals(other); - /// - public bool Equals(AcceptanceMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AccountStatus.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AccountStatus.cs deleted file mode 100644 index 8ca602ac005c..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AccountStatus.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The current status of the billing account. - public readonly partial struct AccountStatus : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public AccountStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ActiveValue = "Active"; - private const string DeletedValue = "Deleted"; - private const string DisabledValue = "Disabled"; - private const string ExpiredValue = "Expired"; - private const string TransferredValue = "Transferred"; - private const string ExtendedValue = "Extended"; - private const string TerminatedValue = "Terminated"; - - /// Active. - public static AccountStatus Active { get; } = new AccountStatus(ActiveValue); - /// Deleted. - public static AccountStatus Deleted { get; } = new AccountStatus(DeletedValue); - /// Disabled. - public static AccountStatus Disabled { get; } = new AccountStatus(DisabledValue); - /// Expired. - public static AccountStatus Expired { get; } = new AccountStatus(ExpiredValue); - /// Transferred. - public static AccountStatus Transferred { get; } = new AccountStatus(TransferredValue); - /// Extended. - public static AccountStatus Extended { get; } = new AccountStatus(ExtendedValue); - /// Terminated. - public static AccountStatus Terminated { get; } = new AccountStatus(TerminatedValue); - /// Determines if two values are the same. - public static bool operator ==(AccountStatus left, AccountStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AccountStatus left, AccountStatus right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator AccountStatus(string value) => new AccountStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AccountStatus other && Equals(other); - /// - public bool Equals(AccountStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AccountType.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AccountType.cs deleted file mode 100644 index 19d7c9a14bf6..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AccountType.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The type of customer. - public readonly partial struct AccountType : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public AccountType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EnterpriseValue = "Enterprise"; - private const string IndividualValue = "Individual"; - private const string PartnerValue = "Partner"; - - /// Enterprise. - public static AccountType Enterprise { get; } = new AccountType(EnterpriseValue); - /// Individual. - public static AccountType Individual { get; } = new AccountType(IndividualValue); - /// Partner. - public static AccountType Partner { get; } = new AccountType(PartnerValue); - /// Determines if two values are the same. - public static bool operator ==(AccountType left, AccountType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AccountType left, AccountType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator AccountType(string value) => new AccountType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AccountType other && Equals(other); - /// - public bool Equals(AccountType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AddressDetails.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AddressDetails.Serialization.cs deleted file mode 100644 index 9da5c4c3238e..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AddressDetails.Serialization.cs +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class AddressDetails : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(FirstName)) - { - writer.WritePropertyName("firstName"); - writer.WriteStringValue(FirstName); - } - if (Optional.IsDefined(LastName)) - { - writer.WritePropertyName("lastName"); - writer.WriteStringValue(LastName); - } - if (Optional.IsDefined(CompanyName)) - { - writer.WritePropertyName("companyName"); - writer.WriteStringValue(CompanyName); - } - writer.WritePropertyName("addressLine1"); - writer.WriteStringValue(AddressLine1); - if (Optional.IsDefined(AddressLine2)) - { - writer.WritePropertyName("addressLine2"); - writer.WriteStringValue(AddressLine2); - } - if (Optional.IsDefined(AddressLine3)) - { - writer.WritePropertyName("addressLine3"); - writer.WriteStringValue(AddressLine3); - } - if (Optional.IsDefined(City)) - { - writer.WritePropertyName("city"); - writer.WriteStringValue(City); - } - if (Optional.IsDefined(District)) - { - writer.WritePropertyName("district"); - writer.WriteStringValue(District); - } - if (Optional.IsDefined(Region)) - { - writer.WritePropertyName("region"); - writer.WriteStringValue(Region); - } - writer.WritePropertyName("country"); - writer.WriteStringValue(Country); - if (Optional.IsDefined(PostalCode)) - { - writer.WritePropertyName("postalCode"); - writer.WriteStringValue(PostalCode); - } - if (Optional.IsDefined(Email)) - { - writer.WritePropertyName("email"); - writer.WriteStringValue(Email); - } - if (Optional.IsDefined(PhoneNumber)) - { - writer.WritePropertyName("phoneNumber"); - writer.WriteStringValue(PhoneNumber); - } - writer.WriteEndObject(); - } - - internal static AddressDetails DeserializeAddressDetails(JsonElement element) - { - Optional firstName = default; - Optional lastName = default; - Optional companyName = default; - string addressLine1 = default; - Optional addressLine2 = default; - Optional addressLine3 = default; - Optional city = default; - Optional district = default; - Optional region = default; - string country = default; - Optional postalCode = default; - Optional email = default; - Optional phoneNumber = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("firstName")) - { - firstName = property.Value.GetString(); - continue; - } - if (property.NameEquals("lastName")) - { - lastName = property.Value.GetString(); - continue; - } - if (property.NameEquals("companyName")) - { - companyName = property.Value.GetString(); - continue; - } - if (property.NameEquals("addressLine1")) - { - addressLine1 = property.Value.GetString(); - continue; - } - if (property.NameEquals("addressLine2")) - { - addressLine2 = property.Value.GetString(); - continue; - } - if (property.NameEquals("addressLine3")) - { - addressLine3 = property.Value.GetString(); - continue; - } - if (property.NameEquals("city")) - { - city = property.Value.GetString(); - continue; - } - if (property.NameEquals("district")) - { - district = property.Value.GetString(); - continue; - } - if (property.NameEquals("region")) - { - region = property.Value.GetString(); - continue; - } - if (property.NameEquals("country")) - { - country = property.Value.GetString(); - continue; - } - if (property.NameEquals("postalCode")) - { - postalCode = property.Value.GetString(); - continue; - } - if (property.NameEquals("email")) - { - email = property.Value.GetString(); - continue; - } - if (property.NameEquals("phoneNumber")) - { - phoneNumber = property.Value.GetString(); - continue; - } - } - return new AddressDetails(firstName.Value, lastName.Value, companyName.Value, addressLine1, addressLine2.Value, addressLine3.Value, city.Value, district.Value, region.Value, country, postalCode.Value, email.Value, phoneNumber.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AddressDetails.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AddressDetails.cs deleted file mode 100644 index c436751d6228..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AddressDetails.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Address details. - public partial class AddressDetails - { - /// Initializes a new instance of AddressDetails. - /// Address line 1. - /// Country code uses ISO2, 2-digit format. - /// or is null. - public AddressDetails(string addressLine1, string country) - { - if (addressLine1 == null) - { - throw new ArgumentNullException(nameof(addressLine1)); - } - if (country == null) - { - throw new ArgumentNullException(nameof(country)); - } - - AddressLine1 = addressLine1; - Country = country; - } - - /// Initializes a new instance of AddressDetails. - /// First name. - /// Last name. - /// Company name. - /// Address line 1. - /// Address line 2. - /// Address line 3. - /// Address city. - /// Address district. - /// Address region. - /// Country code uses ISO2, 2-digit format. - /// Postal code. - /// Email address. - /// Phone number. - internal AddressDetails(string firstName, string lastName, string companyName, string addressLine1, string addressLine2, string addressLine3, string city, string district, string region, string country, string postalCode, string email, string phoneNumber) - { - FirstName = firstName; - LastName = lastName; - CompanyName = companyName; - AddressLine1 = addressLine1; - AddressLine2 = addressLine2; - AddressLine3 = addressLine3; - City = city; - District = district; - Region = region; - Country = country; - PostalCode = postalCode; - Email = email; - PhoneNumber = phoneNumber; - } - - /// First name. - public string FirstName { get; set; } - /// Last name. - public string LastName { get; set; } - /// Company name. - public string CompanyName { get; set; } - /// Address line 1. - public string AddressLine1 { get; set; } - /// Address line 2. - public string AddressLine2 { get; set; } - /// Address line 3. - public string AddressLine3 { get; set; } - /// Address city. - public string City { get; set; } - /// Address district. - public string District { get; set; } - /// Address region. - public string Region { get; set; } - /// Country code uses ISO2, 2-digit format. - public string Country { get; set; } - /// Postal code. - public string PostalCode { get; set; } - /// Email address. - public string Email { get; set; } - /// Phone number. - public string PhoneNumber { get; set; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AddressValidationStatus.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AddressValidationStatus.cs deleted file mode 100644 index b6389ade0a9a..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AddressValidationStatus.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Status of the address validation. - public readonly partial struct AddressValidationStatus : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public AddressValidationStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ValidValue = "Valid"; - private const string InvalidValue = "Invalid"; - - /// Valid. - public static AddressValidationStatus Valid { get; } = new AddressValidationStatus(ValidValue); - /// Invalid. - public static AddressValidationStatus Invalid { get; } = new AddressValidationStatus(InvalidValue); - /// Determines if two values are the same. - public static bool operator ==(AddressValidationStatus left, AddressValidationStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AddressValidationStatus left, AddressValidationStatus right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator AddressValidationStatus(string value) => new AddressValidationStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AddressValidationStatus other && Equals(other); - /// - public bool Equals(AddressValidationStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Agreement.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Agreement.Serialization.cs deleted file mode 100644 index 1d3caa530011..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Agreement.Serialization.cs +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class Agreement : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsCollectionDefined(Participants)) - { - writer.WritePropertyName("participants"); - writer.WriteStartArray(); - foreach (var item in Participants) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static Agreement DeserializeAgreement(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional agreementLink = default; - Optional category = default; - Optional acceptanceMode = default; - Optional effectiveDate = default; - Optional expirationDate = default; - Optional> participants = default; - Optional status = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("agreementLink")) - { - agreementLink = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("category")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - category = new Category(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("acceptanceMode")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - acceptanceMode = new AcceptanceMode(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("effectiveDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - effectiveDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("expirationDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - expirationDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("participants")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(Models.Participants.DeserializeParticipants(item)); - } - participants = array; - continue; - } - if (property0.NameEquals("status")) - { - status = property0.Value.GetString(); - continue; - } - } - continue; - } - } - return new Agreement(id.Value, name.Value, type.Value, agreementLink.Value, Optional.ToNullable(category), Optional.ToNullable(acceptanceMode), Optional.ToNullable(effectiveDate), Optional.ToNullable(expirationDate), Optional.ToList(participants), status.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Agreement.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Agreement.cs deleted file mode 100644 index 2950654d8752..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Agreement.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// An agreement. - public partial class Agreement : Resource - { - /// Initializes a new instance of Agreement. - public Agreement() - { - Participants = new ChangeTrackingList(); - } - - /// Initializes a new instance of Agreement. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The URL to download the agreement. - /// The category of the agreement signed by a customer. - /// The mode of acceptance for an agreement. - /// The date from which the agreement is effective. - /// The date when the agreement expires. - /// The list of participants that participates in acceptance of an agreement. - /// The current status of the agreement. - internal Agreement(string id, string name, string type, string agreementLink, Category? category, AcceptanceMode? acceptanceMode, DateTimeOffset? effectiveDate, DateTimeOffset? expirationDate, IList participants, string status) : base(id, name, type) - { - AgreementLink = agreementLink; - Category = category; - AcceptanceMode = acceptanceMode; - EffectiveDate = effectiveDate; - ExpirationDate = expirationDate; - Participants = participants; - Status = status; - } - - /// The URL to download the agreement. - public string AgreementLink { get; } - /// The category of the agreement signed by a customer. - public Category? Category { get; } - /// The mode of acceptance for an agreement. - public AcceptanceMode? AcceptanceMode { get; } - /// The date from which the agreement is effective. - public DateTimeOffset? EffectiveDate { get; } - /// The date when the agreement expires. - public DateTimeOffset? ExpirationDate { get; } - /// The list of participants that participates in acceptance of an agreement. - public IList Participants { get; } - /// The current status of the agreement. - public string Status { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AgreementListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AgreementListResult.Serialization.cs deleted file mode 100644 index 0f37bccc6bf3..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AgreementListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class AgreementListResult - { - internal static AgreementListResult DeserializeAgreementListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(Agreement.DeserializeAgreement(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new AgreementListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AgreementListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AgreementListResult.cs deleted file mode 100644 index 6d45ce252c4f..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AgreementListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Result of listing agreements. - public partial class AgreementListResult - { - /// Initializes a new instance of AgreementListResult. - internal AgreementListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of AgreementListResult. - /// The list of agreements. - /// The link (url) to the next page of results. - internal AgreementListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of agreements. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AgreementType.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AgreementType.cs deleted file mode 100644 index 5fa9cc478c4f..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AgreementType.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The type of agreement. - public readonly partial struct AgreementType : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public AgreementType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string MicrosoftCustomerAgreementValue = "MicrosoftCustomerAgreement"; - private const string EnterpriseAgreementValue = "EnterpriseAgreement"; - private const string MicrosoftOnlineServicesProgramValue = "MicrosoftOnlineServicesProgram"; - private const string MicrosoftPartnerAgreementValue = "MicrosoftPartnerAgreement"; - - /// MicrosoftCustomerAgreement. - public static AgreementType MicrosoftCustomerAgreement { get; } = new AgreementType(MicrosoftCustomerAgreementValue); - /// EnterpriseAgreement. - public static AgreementType EnterpriseAgreement { get; } = new AgreementType(EnterpriseAgreementValue); - /// MicrosoftOnlineServicesProgram. - public static AgreementType MicrosoftOnlineServicesProgram { get; } = new AgreementType(MicrosoftOnlineServicesProgramValue); - /// MicrosoftPartnerAgreement. - public static AgreementType MicrosoftPartnerAgreement { get; } = new AgreementType(MicrosoftPartnerAgreementValue); - /// Determines if two values are the same. - public static bool operator ==(AgreementType left, AgreementType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AgreementType left, AgreementType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator AgreementType(string value) => new AgreementType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AgreementType other && Equals(other); - /// - public bool Equals(AgreementType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Amount.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Amount.Serialization.cs deleted file mode 100644 index f7e3a954b802..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Amount.Serialization.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class Amount - { - internal static Amount DeserializeAmount(JsonElement element) - { - Optional currency = default; - Optional value = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("currency")) - { - currency = property.Value.GetString(); - continue; - } - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - value = property.Value.GetSingle(); - continue; - } - } - return new Amount(currency.Value, Optional.ToNullable(value)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Amount.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Amount.cs deleted file mode 100644 index fac88e60594b..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Amount.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// The amount. - public partial class Amount - { - /// Initializes a new instance of Amount. - internal Amount() - { - } - - /// Initializes a new instance of Amount. - /// The currency for the amount value. - /// Amount value. - internal Amount(string currency, float? value) - { - Currency = currency; - Value = value; - } - - /// The currency for the amount value. - public string Currency { get; } - /// Amount value. - public float? Value { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AutoRenew.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AutoRenew.cs deleted file mode 100644 index 87f3d3ed0efa..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AutoRenew.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Indicates whether auto renewal is turned on or off for a product. - public readonly partial struct AutoRenew : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public AutoRenew(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string OffValue = "Off"; - private const string OnValue = "On"; - - /// Off. - public static AutoRenew Off { get; } = new AutoRenew(OffValue); - /// On. - public static AutoRenew On { get; } = new AutoRenew(OnValue); - /// Determines if two values are the same. - public static bool operator ==(AutoRenew left, AutoRenew right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AutoRenew left, AutoRenew right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator AutoRenew(string value) => new AutoRenew(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AutoRenew other && Equals(other); - /// - public bool Equals(AutoRenew other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AvailableBalance.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AvailableBalance.Serialization.cs deleted file mode 100644 index 711f1c232e7f..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AvailableBalance.Serialization.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class AvailableBalance : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static AvailableBalance DeserializeAvailableBalance(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional amount = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("amount")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - amount = Amount.DeserializeAmount(property0.Value); - continue; - } - } - continue; - } - } - return new AvailableBalance(id.Value, name.Value, type.Value, amount.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AvailableBalance.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AvailableBalance.cs deleted file mode 100644 index 73a65d8a34cd..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AvailableBalance.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// The latest Azure credit balance. This is the balance available for pay now. - public partial class AvailableBalance : Resource - { - /// Initializes a new instance of AvailableBalance. - public AvailableBalance() - { - } - - /// Initializes a new instance of AvailableBalance. - /// Resource Id. - /// Resource name. - /// Resource type. - /// Balance amount. - internal AvailableBalance(string id, string name, string type, Amount amount) : base(id, name, type) - { - Amount = amount; - } - - /// Balance amount. - public Amount Amount { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AzurePlan.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AzurePlan.Serialization.cs deleted file mode 100644 index 14a9c362211f..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AzurePlan.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class AzurePlan : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(SkuId)) - { - writer.WritePropertyName("skuId"); - writer.WriteStringValue(SkuId); - } - writer.WriteEndObject(); - } - - internal static AzurePlan DeserializeAzurePlan(JsonElement element) - { - Optional skuId = default; - Optional skuDescription = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("skuId")) - { - skuId = property.Value.GetString(); - continue; - } - if (property.NameEquals("skuDescription")) - { - skuDescription = property.Value.GetString(); - continue; - } - } - return new AzurePlan(skuId.Value, skuDescription.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AzurePlan.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AzurePlan.cs deleted file mode 100644 index 4c3898c8c730..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/AzurePlan.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// Details of the Azure plan. - public partial class AzurePlan - { - /// Initializes a new instance of AzurePlan. - public AzurePlan() - { - } - - /// Initializes a new instance of AzurePlan. - /// The sku id. - /// The sku description. - internal AzurePlan(string skuId, string skuDescription) - { - SkuId = skuId; - SkuDescription = skuDescription; - } - - /// The sku id. - public string SkuId { get; set; } - /// The sku description. - public string SkuDescription { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccount.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccount.Serialization.cs deleted file mode 100644 index 8fadca46823c..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccount.Serialization.cs +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingAccount : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"); - writer.WriteStringValue(DisplayName); - } - if (Optional.IsDefined(SoldTo)) - { - writer.WritePropertyName("soldTo"); - writer.WriteObjectValue(SoldTo); - } - if (Optional.IsDefined(BillingProfiles)) - { - writer.WritePropertyName("billingProfiles"); - writer.WriteObjectValue(BillingProfiles); - } - if (Optional.IsCollectionDefined(Departments)) - { - writer.WritePropertyName("departments"); - writer.WriteStartArray(); - foreach (var item in Departments) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(EnrollmentAccounts)) - { - writer.WritePropertyName("enrollmentAccounts"); - writer.WriteStartArray(); - foreach (var item in EnrollmentAccounts) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static BillingAccount DeserializeBillingAccount(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional displayName = default; - Optional soldTo = default; - Optional agreementType = default; - Optional accountType = default; - Optional accountStatus = default; - Optional billingProfiles = default; - Optional enrollmentDetails = default; - Optional> departments = default; - Optional> enrollmentAccounts = default; - Optional hasReadAccess = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("displayName")) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("soldTo")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - soldTo = AddressDetails.DeserializeAddressDetails(property0.Value); - continue; - } - if (property0.NameEquals("agreementType")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - agreementType = new AgreementType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("accountType")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - accountType = new AccountType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("accountStatus")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - accountStatus = new AccountStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("billingProfiles")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - billingProfiles = BillingProfilesOnExpand.DeserializeBillingProfilesOnExpand(property0.Value); - continue; - } - if (property0.NameEquals("enrollmentDetails")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - enrollmentDetails = Enrollment.DeserializeEnrollment(property0.Value); - continue; - } - if (property0.NameEquals("departments")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(Department.DeserializeDepartment(item)); - } - departments = array; - continue; - } - if (property0.NameEquals("enrollmentAccounts")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(EnrollmentAccount.DeserializeEnrollmentAccount(item)); - } - enrollmentAccounts = array; - continue; - } - if (property0.NameEquals("hasReadAccess")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - hasReadAccess = property0.Value.GetBoolean(); - continue; - } - } - continue; - } - } - return new BillingAccount(id.Value, name.Value, type.Value, displayName.Value, soldTo.Value, Optional.ToNullable(agreementType), Optional.ToNullable(accountType), Optional.ToNullable(accountStatus), billingProfiles.Value, enrollmentDetails.Value, Optional.ToList(departments), Optional.ToList(enrollmentAccounts), Optional.ToNullable(hasReadAccess)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccount.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccount.cs deleted file mode 100644 index ad122d5e719c..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccount.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// A billing account. - public partial class BillingAccount : Resource - { - /// Initializes a new instance of BillingAccount. - public BillingAccount() - { - Departments = new ChangeTrackingList(); - EnrollmentAccounts = new ChangeTrackingList(); - } - - /// Initializes a new instance of BillingAccount. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The billing account name. - /// The address of the individual or organization that is responsible for the billing account. - /// The type of agreement. - /// The type of customer. - /// The current status of the billing account. - /// The billing profiles associated with the billing account. By default this is not populated, unless it's specified in $expand. - /// The details about the associated legacy enrollment. By default this is not populated, unless it's specified in $expand. - /// The departments associated to the enrollment. - /// The accounts associated to the enrollment. - /// Indicates whether user has read access to the billing account. - internal BillingAccount(string id, string name, string type, string displayName, AddressDetails soldTo, AgreementType? agreementType, AccountType? accountType, AccountStatus? accountStatus, BillingProfilesOnExpand billingProfiles, Enrollment enrollmentDetails, IList departments, IList enrollmentAccounts, bool? hasReadAccess) : base(id, name, type) - { - DisplayName = displayName; - SoldTo = soldTo; - AgreementType = agreementType; - AccountType = accountType; - AccountStatus = accountStatus; - BillingProfiles = billingProfiles; - EnrollmentDetails = enrollmentDetails; - Departments = departments; - EnrollmentAccounts = enrollmentAccounts; - HasReadAccess = hasReadAccess; - } - - /// The billing account name. - public string DisplayName { get; set; } - /// The address of the individual or organization that is responsible for the billing account. - public AddressDetails SoldTo { get; set; } - /// The type of agreement. - public AgreementType? AgreementType { get; } - /// The type of customer. - public AccountType? AccountType { get; } - /// The current status of the billing account. - public AccountStatus? AccountStatus { get; } - /// The billing profiles associated with the billing account. By default this is not populated, unless it's specified in $expand. - public BillingProfilesOnExpand BillingProfiles { get; set; } - /// The details about the associated legacy enrollment. By default this is not populated, unless it's specified in $expand. - public Enrollment EnrollmentDetails { get; } - /// The departments associated to the enrollment. - public IList Departments { get; } - /// The accounts associated to the enrollment. - public IList EnrollmentAccounts { get; } - /// Indicates whether user has read access to the billing account. - public bool? HasReadAccess { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccountListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccountListResult.Serialization.cs deleted file mode 100644 index f8e95607cb7e..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccountListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingAccountListResult - { - internal static BillingAccountListResult DeserializeBillingAccountListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(BillingAccount.DeserializeBillingAccount(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new BillingAccountListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccountListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccountListResult.cs deleted file mode 100644 index cec5870ce037..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccountListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The list of billing accounts. - public partial class BillingAccountListResult - { - /// Initializes a new instance of BillingAccountListResult. - internal BillingAccountListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of BillingAccountListResult. - /// The list of billing accounts. - /// The link (url) to the next page of results. - internal BillingAccountListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of billing accounts. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccountUpdateRequest.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccountUpdateRequest.Serialization.cs deleted file mode 100644 index cb0a18d74ef1..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccountUpdateRequest.Serialization.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingAccountUpdateRequest : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"); - writer.WriteStringValue(DisplayName); - } - if (Optional.IsDefined(SoldTo)) - { - writer.WritePropertyName("soldTo"); - writer.WriteObjectValue(SoldTo); - } - if (Optional.IsDefined(BillingProfiles)) - { - writer.WritePropertyName("billingProfiles"); - writer.WriteObjectValue(BillingProfiles); - } - if (Optional.IsCollectionDefined(Departments)) - { - writer.WritePropertyName("departments"); - writer.WriteStartArray(); - foreach (var item in Departments) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(EnrollmentAccounts)) - { - writer.WritePropertyName("enrollmentAccounts"); - writer.WriteStartArray(); - foreach (var item in EnrollmentAccounts) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccountUpdateRequest.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccountUpdateRequest.cs deleted file mode 100644 index 45157aa55264..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingAccountUpdateRequest.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The request properties of the billing account that can be updated. - public partial class BillingAccountUpdateRequest - { - /// Initializes a new instance of BillingAccountUpdateRequest. - public BillingAccountUpdateRequest() - { - Departments = new ChangeTrackingList(); - EnrollmentAccounts = new ChangeTrackingList(); - } - - /// The billing account name. - public string DisplayName { get; set; } - /// The address of the individual or organization that is responsible for the billing account. - public AddressDetails SoldTo { get; set; } - /// The type of agreement. - public AgreementType? AgreementType { get; } - /// The type of customer. - public AccountType? AccountType { get; } - /// The current status of the billing account. - public AccountStatus? AccountStatus { get; } - /// The billing profiles associated with the billing account. By default this is not populated, unless it's specified in $expand. - public BillingProfilesOnExpand BillingProfiles { get; set; } - /// The details about the associated legacy enrollment. By default this is not populated, unless it's specified in $expand. - public Enrollment EnrollmentDetails { get; } - /// The departments associated to the enrollment. - public IList Departments { get; } - /// The accounts associated to the enrollment. - public IList EnrollmentAccounts { get; } - /// Indicates whether user has read access to the billing account. - public bool? HasReadAccess { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingFrequency.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingFrequency.cs deleted file mode 100644 index d42fca06a0de..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingFrequency.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The frequency at which the product will be billed. - public readonly partial struct BillingFrequency : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public BillingFrequency(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string OneTimeValue = "OneTime"; - private const string MonthlyValue = "Monthly"; - private const string UsageBasedValue = "UsageBased"; - - /// OneTime. - public static BillingFrequency OneTime { get; } = new BillingFrequency(OneTimeValue); - /// Monthly. - public static BillingFrequency Monthly { get; } = new BillingFrequency(MonthlyValue); - /// UsageBased. - public static BillingFrequency UsageBased { get; } = new BillingFrequency(UsageBasedValue); - /// Determines if two values are the same. - public static bool operator ==(BillingFrequency left, BillingFrequency right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(BillingFrequency left, BillingFrequency right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator BillingFrequency(string value) => new BillingFrequency(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is BillingFrequency other && Equals(other); - /// - public bool Equals(BillingFrequency other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPeriod.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPeriod.Serialization.cs deleted file mode 100644 index 6e2141b29e4c..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPeriod.Serialization.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingPeriod : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static BillingPeriod DeserializeBillingPeriod(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional billingPeriodStartDate = default; - Optional billingPeriodEndDate = default; - Optional> invoiceIds = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("billingPeriodStartDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - billingPeriodStartDate = property0.Value.GetDateTimeOffset("D"); - continue; - } - if (property0.NameEquals("billingPeriodEndDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - billingPeriodEndDate = property0.Value.GetDateTimeOffset("D"); - continue; - } - if (property0.NameEquals("invoiceIds")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - invoiceIds = array; - continue; - } - } - continue; - } - } - return new BillingPeriod(id.Value, name.Value, type.Value, Optional.ToNullable(billingPeriodStartDate), Optional.ToNullable(billingPeriodEndDate), Optional.ToList(invoiceIds)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPeriod.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPeriod.cs deleted file mode 100644 index 71913f398eb5..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPeriod.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// A billing period resource. - public partial class BillingPeriod : Resource - { - /// Initializes a new instance of BillingPeriod. - public BillingPeriod() - { - InvoiceIds = new ChangeTrackingList(); - } - - /// Initializes a new instance of BillingPeriod. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The start of the date range covered by the billing period. - /// The end of the date range covered by the billing period. - /// Array of invoice ids that associated with. - internal BillingPeriod(string id, string name, string type, DateTimeOffset? billingPeriodStartDate, DateTimeOffset? billingPeriodEndDate, IReadOnlyList invoiceIds) : base(id, name, type) - { - BillingPeriodStartDate = billingPeriodStartDate; - BillingPeriodEndDate = billingPeriodEndDate; - InvoiceIds = invoiceIds; - } - - /// The start of the date range covered by the billing period. - public DateTimeOffset? BillingPeriodStartDate { get; } - /// The end of the date range covered by the billing period. - public DateTimeOffset? BillingPeriodEndDate { get; } - /// Array of invoice ids that associated with. - public IReadOnlyList InvoiceIds { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPeriodsListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPeriodsListResult.Serialization.cs deleted file mode 100644 index 137653c80956..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPeriodsListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingPeriodsListResult - { - internal static BillingPeriodsListResult DeserializeBillingPeriodsListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(BillingPeriod.DeserializeBillingPeriod(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new BillingPeriodsListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPeriodsListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPeriodsListResult.cs deleted file mode 100644 index 18bd82239076..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPeriodsListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Result of listing billing periods. It contains a list of available billing periods in reverse chronological order. - public partial class BillingPeriodsListResult - { - /// Initializes a new instance of BillingPeriodsListResult. - internal BillingPeriodsListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of BillingPeriodsListResult. - /// The list of billing periods. - /// The link (url) to the next page of results. - internal BillingPeriodsListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of billing periods. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPermissionsListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPermissionsListResult.Serialization.cs deleted file mode 100644 index 1e39b1f1e10e..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPermissionsListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingPermissionsListResult - { - internal static BillingPermissionsListResult DeserializeBillingPermissionsListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(BillingPermissionsProperties.DeserializeBillingPermissionsProperties(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new BillingPermissionsListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPermissionsListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPermissionsListResult.cs deleted file mode 100644 index 7b7c77b4c587..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPermissionsListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Result of list billingPermissions a caller has on a billing account. - public partial class BillingPermissionsListResult - { - /// Initializes a new instance of BillingPermissionsListResult. - internal BillingPermissionsListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of BillingPermissionsListResult. - /// The list of billingPermissions a caller has on a billing account. - /// The link (url) to the next page of results. - internal BillingPermissionsListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of billingPermissions a caller has on a billing account. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPermissionsProperties.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPermissionsProperties.Serialization.cs deleted file mode 100644 index c37f23264728..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPermissionsProperties.Serialization.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingPermissionsProperties : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WriteEndObject(); - } - - internal static BillingPermissionsProperties DeserializeBillingPermissionsProperties(JsonElement element) - { - Optional> actions = default; - Optional> notActions = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("actions")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - actions = array; - continue; - } - if (property.NameEquals("notActions")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - notActions = array; - continue; - } - } - return new BillingPermissionsProperties(Optional.ToList(actions), Optional.ToList(notActions)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPermissionsProperties.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPermissionsProperties.cs deleted file mode 100644 index 61220d49415d..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingPermissionsProperties.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The set of allowed action and not allowed actions a caller has on a billing account. - public partial class BillingPermissionsProperties - { - /// Initializes a new instance of BillingPermissionsProperties. - public BillingPermissionsProperties() - { - Actions = new ChangeTrackingList(); - NotActions = new ChangeTrackingList(); - } - - /// Initializes a new instance of BillingPermissionsProperties. - /// The set of actions that the caller is allowed to perform. - /// The set of actions that the caller is not allowed to perform. - internal BillingPermissionsProperties(IReadOnlyList actions, IReadOnlyList notActions) - { - Actions = actions; - NotActions = notActions; - } - - /// The set of actions that the caller is allowed to perform. - public IReadOnlyList Actions { get; } - /// The set of actions that the caller is not allowed to perform. - public IReadOnlyList NotActions { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfile.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfile.Serialization.cs deleted file mode 100644 index 4156beac4cf9..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfile.Serialization.cs +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingProfile : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"); - writer.WriteStringValue(DisplayName); - } - if (Optional.IsDefined(PoNumber)) - { - writer.WritePropertyName("poNumber"); - writer.WriteStringValue(PoNumber); - } - if (Optional.IsDefined(BillTo)) - { - writer.WritePropertyName("billTo"); - writer.WriteObjectValue(BillTo); - } - if (Optional.IsDefined(InvoiceEmailOptIn)) - { - writer.WritePropertyName("invoiceEmailOptIn"); - writer.WriteBooleanValue(InvoiceEmailOptIn.Value); - } - if (Optional.IsCollectionDefined(EnabledAzurePlans)) - { - writer.WritePropertyName("enabledAzurePlans"); - writer.WriteStartArray(); - foreach (var item in EnabledAzurePlans) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(InvoiceSections)) - { - writer.WritePropertyName("invoiceSections"); - writer.WriteObjectValue(InvoiceSections); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static BillingProfile DeserializeBillingProfile(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional displayName = default; - Optional poNumber = default; - Optional billingRelationshipType = default; - Optional billTo = default; - Optional indirectRelationshipInfo = default; - Optional invoiceEmailOptIn = default; - Optional invoiceDay = default; - Optional currency = default; - Optional> enabledAzurePlans = default; - Optional invoiceSections = default; - Optional hasReadAccess = default; - Optional systemId = default; - Optional status = default; - Optional statusReasonCode = default; - Optional spendingLimit = default; - Optional> targetClouds = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("displayName")) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("poNumber")) - { - poNumber = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("billingRelationshipType")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - billingRelationshipType = new BillingRelationshipType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("billTo")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - billTo = AddressDetails.DeserializeAddressDetails(property0.Value); - continue; - } - if (property0.NameEquals("indirectRelationshipInfo")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - indirectRelationshipInfo = IndirectRelationshipInfo.DeserializeIndirectRelationshipInfo(property0.Value); - continue; - } - if (property0.NameEquals("invoiceEmailOptIn")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - invoiceEmailOptIn = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("invoiceDay")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - invoiceDay = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("currency")) - { - currency = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("enabledAzurePlans")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(AzurePlan.DeserializeAzurePlan(item)); - } - enabledAzurePlans = array; - continue; - } - if (property0.NameEquals("invoiceSections")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - invoiceSections = InvoiceSectionsOnExpand.DeserializeInvoiceSectionsOnExpand(property0.Value); - continue; - } - if (property0.NameEquals("hasReadAccess")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - hasReadAccess = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("systemId")) - { - systemId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("status")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - status = new BillingProfileStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("statusReasonCode")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - statusReasonCode = new StatusReasonCode(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("spendingLimit")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - spendingLimit = new SpendingLimit(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("targetClouds")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(new TargetCloud(item.GetString())); - } - targetClouds = array; - continue; - } - } - continue; - } - } - return new BillingProfile(id.Value, name.Value, type.Value, displayName.Value, poNumber.Value, Optional.ToNullable(billingRelationshipType), billTo.Value, indirectRelationshipInfo.Value, Optional.ToNullable(invoiceEmailOptIn), Optional.ToNullable(invoiceDay), currency.Value, Optional.ToList(enabledAzurePlans), invoiceSections.Value, Optional.ToNullable(hasReadAccess), systemId.Value, Optional.ToNullable(status), Optional.ToNullable(statusReasonCode), Optional.ToNullable(spendingLimit), Optional.ToList(targetClouds)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfile.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfile.cs deleted file mode 100644 index 4acf6171f54b..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfile.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// A billing profile. - public partial class BillingProfile : Resource - { - /// Initializes a new instance of BillingProfile. - public BillingProfile() - { - EnabledAzurePlans = new ChangeTrackingList(); - TargetClouds = new ChangeTrackingList(); - } - - /// Initializes a new instance of BillingProfile. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The name of the billing profile. - /// The purchase order name that will appear on the invoices generated for the billing profile. - /// Identifies which services and purchases are paid by a billing profile. - /// Billing address. - /// Identifies the billing profile that is linked to another billing profile in indirect purchase motion. - /// Flag controlling whether the invoices for the billing profile are sent through email. - /// The day of the month when the invoice for the billing profile is generated. - /// The currency in which the charges for the billing profile are billed. - /// Information about the enabled azure plans. - /// The invoice sections associated to the billing profile. By default this is not populated, unless it's specified in $expand. - /// Indicates whether user has read access to the billing profile. - /// The system generated unique identifier for a billing profile. - /// The status of the billing profile. - /// Reason for the specified billing profile status. - /// The billing profile spending limit. - /// Identifies the cloud environments that are associated with a billing profile. This is a system managed optional field and gets updated as the billing profile gets associated with accounts in various clouds. - internal BillingProfile(string id, string name, string type, string displayName, string poNumber, BillingRelationshipType? billingRelationshipType, AddressDetails billTo, IndirectRelationshipInfo indirectRelationshipInfo, bool? invoiceEmailOptIn, int? invoiceDay, string currency, IList enabledAzurePlans, InvoiceSectionsOnExpand invoiceSections, bool? hasReadAccess, string systemId, BillingProfileStatus? status, StatusReasonCode? statusReasonCode, SpendingLimit? spendingLimit, IReadOnlyList targetClouds) : base(id, name, type) - { - DisplayName = displayName; - PoNumber = poNumber; - BillingRelationshipType = billingRelationshipType; - BillTo = billTo; - IndirectRelationshipInfo = indirectRelationshipInfo; - InvoiceEmailOptIn = invoiceEmailOptIn; - InvoiceDay = invoiceDay; - Currency = currency; - EnabledAzurePlans = enabledAzurePlans; - InvoiceSections = invoiceSections; - HasReadAccess = hasReadAccess; - SystemId = systemId; - Status = status; - StatusReasonCode = statusReasonCode; - SpendingLimit = spendingLimit; - TargetClouds = targetClouds; - } - - /// The name of the billing profile. - public string DisplayName { get; set; } - /// The purchase order name that will appear on the invoices generated for the billing profile. - public string PoNumber { get; set; } - /// Identifies which services and purchases are paid by a billing profile. - public BillingRelationshipType? BillingRelationshipType { get; } - /// Billing address. - public AddressDetails BillTo { get; set; } - /// Identifies the billing profile that is linked to another billing profile in indirect purchase motion. - public IndirectRelationshipInfo IndirectRelationshipInfo { get; } - /// Flag controlling whether the invoices for the billing profile are sent through email. - public bool? InvoiceEmailOptIn { get; set; } - /// The day of the month when the invoice for the billing profile is generated. - public int? InvoiceDay { get; } - /// The currency in which the charges for the billing profile are billed. - public string Currency { get; } - /// Information about the enabled azure plans. - public IList EnabledAzurePlans { get; } - /// The invoice sections associated to the billing profile. By default this is not populated, unless it's specified in $expand. - public InvoiceSectionsOnExpand InvoiceSections { get; set; } - /// Indicates whether user has read access to the billing profile. - public bool? HasReadAccess { get; } - /// The system generated unique identifier for a billing profile. - public string SystemId { get; } - /// The status of the billing profile. - public BillingProfileStatus? Status { get; } - /// Reason for the specified billing profile status. - public StatusReasonCode? StatusReasonCode { get; } - /// The billing profile spending limit. - public SpendingLimit? SpendingLimit { get; } - /// Identifies the cloud environments that are associated with a billing profile. This is a system managed optional field and gets updated as the billing profile gets associated with accounts in various clouds. - public IReadOnlyList TargetClouds { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileCreationRequest.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileCreationRequest.cs deleted file mode 100644 index 85ae00a7951b..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileCreationRequest.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The request parameters for creating a new billing profile. - internal partial class BillingProfileCreationRequest - { - /// Initializes a new instance of BillingProfileCreationRequest. - internal BillingProfileCreationRequest() - { - EnabledAzurePlans = new ChangeTrackingList(); - } - - /// The name of the billing profile. - public string DisplayName { get; } - /// The purchase order name that will appear on the invoices generated for the billing profile. - public string PoNumber { get; } - /// The address of the individual or organization that is responsible for the billing profile. - public AddressDetails BillTo { get; } - /// Flag controlling whether the invoices for the billing profile are sent through email. - public bool? InvoiceEmailOptIn { get; } - /// Enabled azure plans for the billing profile. - public IReadOnlyList EnabledAzurePlans { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileListResult.Serialization.cs deleted file mode 100644 index 8225456f35cc..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingProfileListResult - { - internal static BillingProfileListResult DeserializeBillingProfileListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(BillingProfile.DeserializeBillingProfile(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new BillingProfileListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileListResult.cs deleted file mode 100644 index 98980ad75187..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The list of billing profiles. - public partial class BillingProfileListResult - { - /// Initializes a new instance of BillingProfileListResult. - internal BillingProfileListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of BillingProfileListResult. - /// The list of billing profiles. - /// The link (url) to the next page of results. - internal BillingProfileListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of billing profiles. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileSpendingLimit.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileSpendingLimit.cs deleted file mode 100644 index d9675e16f37e..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileSpendingLimit.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The billing profile spending limit. - public readonly partial struct BillingProfileSpendingLimit : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public BillingProfileSpendingLimit(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string OffValue = "Off"; - private const string OnValue = "On"; - - /// Off. - public static BillingProfileSpendingLimit Off { get; } = new BillingProfileSpendingLimit(OffValue); - /// On. - public static BillingProfileSpendingLimit On { get; } = new BillingProfileSpendingLimit(OnValue); - /// Determines if two values are the same. - public static bool operator ==(BillingProfileSpendingLimit left, BillingProfileSpendingLimit right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(BillingProfileSpendingLimit left, BillingProfileSpendingLimit right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator BillingProfileSpendingLimit(string value) => new BillingProfileSpendingLimit(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is BillingProfileSpendingLimit other && Equals(other); - /// - public bool Equals(BillingProfileSpendingLimit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileStatus.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileStatus.cs deleted file mode 100644 index bc18c83f5333..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileStatus.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The status of the billing profile. - public readonly partial struct BillingProfileStatus : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public BillingProfileStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ActiveValue = "Active"; - private const string DisabledValue = "Disabled"; - private const string WarnedValue = "Warned"; - - /// Active. - public static BillingProfileStatus Active { get; } = new BillingProfileStatus(ActiveValue); - /// Disabled. - public static BillingProfileStatus Disabled { get; } = new BillingProfileStatus(DisabledValue); - /// Warned. - public static BillingProfileStatus Warned { get; } = new BillingProfileStatus(WarnedValue); - /// Determines if two values are the same. - public static bool operator ==(BillingProfileStatus left, BillingProfileStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(BillingProfileStatus left, BillingProfileStatus right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator BillingProfileStatus(string value) => new BillingProfileStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is BillingProfileStatus other && Equals(other); - /// - public bool Equals(BillingProfileStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileStatusReasonCode.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileStatusReasonCode.cs deleted file mode 100644 index 66bd246322ba..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfileStatusReasonCode.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Reason for the specified billing profile status. - public readonly partial struct BillingProfileStatusReasonCode : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public BillingProfileStatusReasonCode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string PastDueValue = "PastDue"; - private const string SpendingLimitReachedValue = "SpendingLimitReached"; - private const string SpendingLimitExpiredValue = "SpendingLimitExpired"; - - /// PastDue. - public static BillingProfileStatusReasonCode PastDue { get; } = new BillingProfileStatusReasonCode(PastDueValue); - /// SpendingLimitReached. - public static BillingProfileStatusReasonCode SpendingLimitReached { get; } = new BillingProfileStatusReasonCode(SpendingLimitReachedValue); - /// SpendingLimitExpired. - public static BillingProfileStatusReasonCode SpendingLimitExpired { get; } = new BillingProfileStatusReasonCode(SpendingLimitExpiredValue); - /// Determines if two values are the same. - public static bool operator ==(BillingProfileStatusReasonCode left, BillingProfileStatusReasonCode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(BillingProfileStatusReasonCode left, BillingProfileStatusReasonCode right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator BillingProfileStatusReasonCode(string value) => new BillingProfileStatusReasonCode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is BillingProfileStatusReasonCode other && Equals(other); - /// - public bool Equals(BillingProfileStatusReasonCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfilesOnExpand.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfilesOnExpand.Serialization.cs deleted file mode 100644 index d281976ed334..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfilesOnExpand.Serialization.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingProfilesOnExpand : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsCollectionDefined(Value)) - { - writer.WritePropertyName("value"); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - } - - internal static BillingProfilesOnExpand DeserializeBillingProfilesOnExpand(JsonElement element) - { - Optional hasMoreResults = default; - Optional> value = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("hasMoreResults")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - hasMoreResults = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(BillingProfile.DeserializeBillingProfile(item)); - } - value = array; - continue; - } - } - return new BillingProfilesOnExpand(Optional.ToNullable(hasMoreResults), Optional.ToList(value)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfilesOnExpand.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfilesOnExpand.cs deleted file mode 100644 index defe524aa7c1..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProfilesOnExpand.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The billing profiles associated with the billing account. By default this is not populated, unless it's specified in $expand. - public partial class BillingProfilesOnExpand - { - /// Initializes a new instance of BillingProfilesOnExpand. - public BillingProfilesOnExpand() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of BillingProfilesOnExpand. - /// Indicates whether there are more billing profiles than the ones listed in this collection. The collection lists a maximum of 50 billing profiles. To get all billing profiles, use the list billing profiles API. - /// The billing profiles associated with the billing account. - internal BillingProfilesOnExpand(bool? hasMoreResults, IList value) - { - HasMoreResults = hasMoreResults; - Value = value; - } - - /// Indicates whether there are more billing profiles than the ones listed in this collection. The collection lists a maximum of 50 billing profiles. To get all billing profiles, use the list billing profiles API. - public bool? HasMoreResults { get; } - /// The billing profiles associated with the billing account. - public IList Value { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProperty.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProperty.Serialization.cs deleted file mode 100644 index 2735c6715e90..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProperty.Serialization.cs +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingProperty : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(CostCenter)) - { - writer.WritePropertyName("costCenter"); - writer.WriteStringValue(CostCenter); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static BillingProperty DeserializeBillingProperty(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional accountAdminNotificationEmailAddress = default; - Optional billingTenantId = default; - Optional billingAccountId = default; - Optional billingAccountDisplayName = default; - Optional billingProfileId = default; - Optional billingProfileDisplayName = default; - Optional billingProfileStatus = default; - Optional billingProfileStatusReasonCode = default; - Optional billingProfileSpendingLimit = default; - Optional costCenter = default; - Optional invoiceSectionId = default; - Optional invoiceSectionDisplayName = default; - Optional isAccountAdmin = default; - Optional productId = default; - Optional productName = default; - Optional skuId = default; - Optional skuDescription = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("accountAdminNotificationEmailAddress")) - { - accountAdminNotificationEmailAddress = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("billingTenantId")) - { - billingTenantId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("billingAccountId")) - { - billingAccountId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("billingAccountDisplayName")) - { - billingAccountDisplayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("billingProfileId")) - { - billingProfileId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("billingProfileDisplayName")) - { - billingProfileDisplayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("billingProfileStatus")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - billingProfileStatus = new BillingProfileStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("billingProfileStatusReasonCode")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - billingProfileStatusReasonCode = new BillingProfileStatusReasonCode(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("billingProfileSpendingLimit")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - billingProfileSpendingLimit = new BillingProfileSpendingLimit(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("costCenter")) - { - costCenter = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("invoiceSectionId")) - { - invoiceSectionId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("invoiceSectionDisplayName")) - { - invoiceSectionDisplayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("isAccountAdmin")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - isAccountAdmin = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("productId")) - { - productId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("productName")) - { - productName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("skuId")) - { - skuId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("skuDescription")) - { - skuDescription = property0.Value.GetString(); - continue; - } - } - continue; - } - } - return new BillingProperty(id.Value, name.Value, type.Value, accountAdminNotificationEmailAddress.Value, billingTenantId.Value, billingAccountId.Value, billingAccountDisplayName.Value, billingProfileId.Value, billingProfileDisplayName.Value, Optional.ToNullable(billingProfileStatus), Optional.ToNullable(billingProfileStatusReasonCode), Optional.ToNullable(billingProfileSpendingLimit), costCenter.Value, invoiceSectionId.Value, invoiceSectionDisplayName.Value, Optional.ToNullable(isAccountAdmin), productId.Value, productName.Value, skuId.Value, skuDescription.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProperty.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProperty.cs deleted file mode 100644 index b7f12114de50..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingProperty.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// A billing property. - public partial class BillingProperty : Resource - { - /// Initializes a new instance of BillingProperty. - public BillingProperty() - { - } - - /// Initializes a new instance of BillingProperty. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The email address on which the account admin gets all Azure notifications. - /// The Azure AD tenant ID of the billing account for the subscription. - /// The ID of the billing account to which the subscription is billed. - /// The name of the billing account to which the subscription is billed. - /// The ID of the billing profile to which the subscription is billed. - /// The name of the billing profile to which the subscription is billed. - /// The status of the billing profile. - /// Reason for the specified billing profile status. - /// The billing profile spending limit. - /// The cost center applied to the subscription. - /// The ID of the invoice section to which the subscription is billed. - /// The name of the invoice section to which the subscription is billed. - /// Indicates whether user is the account admin. - /// The product ID of the Azure plan. - /// The product name of the Azure plan. - /// The sku ID of the Azure plan for the subscription. - /// The sku description of the Azure plan for the subscription. - internal BillingProperty(string id, string name, string type, string accountAdminNotificationEmailAddress, string billingTenantId, string billingAccountId, string billingAccountDisplayName, string billingProfileId, string billingProfileDisplayName, BillingProfileStatus? billingProfileStatus, BillingProfileStatusReasonCode? billingProfileStatusReasonCode, BillingProfileSpendingLimit? billingProfileSpendingLimit, string costCenter, string invoiceSectionId, string invoiceSectionDisplayName, bool? isAccountAdmin, string productId, string productName, string skuId, string skuDescription) : base(id, name, type) - { - AccountAdminNotificationEmailAddress = accountAdminNotificationEmailAddress; - BillingTenantId = billingTenantId; - BillingAccountId = billingAccountId; - BillingAccountDisplayName = billingAccountDisplayName; - BillingProfileId = billingProfileId; - BillingProfileDisplayName = billingProfileDisplayName; - BillingProfileStatus = billingProfileStatus; - BillingProfileStatusReasonCode = billingProfileStatusReasonCode; - BillingProfileSpendingLimit = billingProfileSpendingLimit; - CostCenter = costCenter; - InvoiceSectionId = invoiceSectionId; - InvoiceSectionDisplayName = invoiceSectionDisplayName; - IsAccountAdmin = isAccountAdmin; - ProductId = productId; - ProductName = productName; - SkuId = skuId; - SkuDescription = skuDescription; - } - - /// The email address on which the account admin gets all Azure notifications. - public string AccountAdminNotificationEmailAddress { get; } - /// The Azure AD tenant ID of the billing account for the subscription. - public string BillingTenantId { get; } - /// The ID of the billing account to which the subscription is billed. - public string BillingAccountId { get; } - /// The name of the billing account to which the subscription is billed. - public string BillingAccountDisplayName { get; } - /// The ID of the billing profile to which the subscription is billed. - public string BillingProfileId { get; } - /// The name of the billing profile to which the subscription is billed. - public string BillingProfileDisplayName { get; } - /// The status of the billing profile. - public BillingProfileStatus? BillingProfileStatus { get; } - /// Reason for the specified billing profile status. - public BillingProfileStatusReasonCode? BillingProfileStatusReasonCode { get; } - /// The billing profile spending limit. - public BillingProfileSpendingLimit? BillingProfileSpendingLimit { get; } - /// The cost center applied to the subscription. - public string CostCenter { get; set; } - /// The ID of the invoice section to which the subscription is billed. - public string InvoiceSectionId { get; } - /// The name of the invoice section to which the subscription is billed. - public string InvoiceSectionDisplayName { get; } - /// Indicates whether user is the account admin. - public bool? IsAccountAdmin { get; } - /// The product ID of the Azure plan. - public string ProductId { get; } - /// The product name of the Azure plan. - public string ProductName { get; } - /// The sku ID of the Azure plan for the subscription. - public string SkuId { get; } - /// The sku description of the Azure plan for the subscription. - public string SkuDescription { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRelationshipType.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRelationshipType.cs deleted file mode 100644 index 827e1a682143..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRelationshipType.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Identifies which services and purchases are paid by a billing profile. - public readonly partial struct BillingRelationshipType : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public BillingRelationshipType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string DirectValue = "Direct"; - private const string IndirectCustomerValue = "IndirectCustomer"; - private const string IndirectPartnerValue = "IndirectPartner"; - private const string CSPPartnerValue = "CSPPartner"; - - /// Direct. - public static BillingRelationshipType Direct { get; } = new BillingRelationshipType(DirectValue); - /// IndirectCustomer. - public static BillingRelationshipType IndirectCustomer { get; } = new BillingRelationshipType(IndirectCustomerValue); - /// IndirectPartner. - public static BillingRelationshipType IndirectPartner { get; } = new BillingRelationshipType(IndirectPartnerValue); - /// CSPPartner. - public static BillingRelationshipType CSPPartner { get; } = new BillingRelationshipType(CSPPartnerValue); - /// Determines if two values are the same. - public static bool operator ==(BillingRelationshipType left, BillingRelationshipType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(BillingRelationshipType left, BillingRelationshipType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator BillingRelationshipType(string value) => new BillingRelationshipType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is BillingRelationshipType other && Equals(other); - /// - public bool Equals(BillingRelationshipType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleAssignment.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleAssignment.Serialization.cs deleted file mode 100644 index 451a1091e4cf..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleAssignment.Serialization.cs +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingRoleAssignment : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(PrincipalId)) - { - writer.WritePropertyName("principalId"); - writer.WriteStringValue(PrincipalId); - } - if (Optional.IsDefined(PrincipalTenantId)) - { - writer.WritePropertyName("principalTenantId"); - writer.WriteStringValue(PrincipalTenantId); - } - if (Optional.IsDefined(RoleDefinitionId)) - { - writer.WritePropertyName("roleDefinitionId"); - writer.WriteStringValue(RoleDefinitionId); - } - if (Optional.IsDefined(UserAuthenticationType)) - { - writer.WritePropertyName("userAuthenticationType"); - writer.WriteStringValue(UserAuthenticationType); - } - if (Optional.IsDefined(UserEmailAddress)) - { - writer.WritePropertyName("userEmailAddress"); - writer.WriteStringValue(UserEmailAddress); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static BillingRoleAssignment DeserializeBillingRoleAssignment(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional createdOn = default; - Optional createdByPrincipalTenantId = default; - Optional createdByPrincipalId = default; - Optional createdByUserEmailAddress = default; - Optional principalId = default; - Optional principalTenantId = default; - Optional roleDefinitionId = default; - Optional scope = default; - Optional userAuthenticationType = default; - Optional userEmailAddress = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("createdOn")) - { - createdOn = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("createdByPrincipalTenantId")) - { - createdByPrincipalTenantId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("createdByPrincipalId")) - { - createdByPrincipalId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("createdByUserEmailAddress")) - { - createdByUserEmailAddress = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("principalId")) - { - principalId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("principalTenantId")) - { - principalTenantId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("roleDefinitionId")) - { - roleDefinitionId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("scope")) - { - scope = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("userAuthenticationType")) - { - userAuthenticationType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("userEmailAddress")) - { - userEmailAddress = property0.Value.GetString(); - continue; - } - } - continue; - } - } - return new BillingRoleAssignment(id.Value, name.Value, type.Value, createdOn.Value, createdByPrincipalTenantId.Value, createdByPrincipalId.Value, createdByUserEmailAddress.Value, principalId.Value, principalTenantId.Value, roleDefinitionId.Value, scope.Value, userAuthenticationType.Value, userEmailAddress.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleAssignment.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleAssignment.cs deleted file mode 100644 index c3ede3275786..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleAssignment.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// The role assignment. - public partial class BillingRoleAssignment : Resource - { - /// Initializes a new instance of BillingRoleAssignment. - public BillingRoleAssignment() - { - } - - /// Initializes a new instance of BillingRoleAssignment. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The date the role assignment was created. - /// The tenant Id of the user who created the role assignment. - /// The principal Id of the user who created the role assignment. - /// The email address of the user who created the role assignment. - /// The principal id of the user to whom the role was assigned. - /// The principal tenant id of the user to whom the role was assigned. - /// The ID of the role definition. - /// The scope at which the role was assigned. - /// The authentication type. - /// The email address of the user. - internal BillingRoleAssignment(string id, string name, string type, string createdOn, string createdByPrincipalTenantId, string createdByPrincipalId, string createdByUserEmailAddress, string principalId, string principalTenantId, string roleDefinitionId, string scope, string userAuthenticationType, string userEmailAddress) : base(id, name, type) - { - CreatedOn = createdOn; - CreatedByPrincipalTenantId = createdByPrincipalTenantId; - CreatedByPrincipalId = createdByPrincipalId; - CreatedByUserEmailAddress = createdByUserEmailAddress; - PrincipalId = principalId; - PrincipalTenantId = principalTenantId; - RoleDefinitionId = roleDefinitionId; - Scope = scope; - UserAuthenticationType = userAuthenticationType; - UserEmailAddress = userEmailAddress; - } - - /// The date the role assignment was created. - public string CreatedOn { get; } - /// The tenant Id of the user who created the role assignment. - public string CreatedByPrincipalTenantId { get; } - /// The principal Id of the user who created the role assignment. - public string CreatedByPrincipalId { get; } - /// The email address of the user who created the role assignment. - public string CreatedByUserEmailAddress { get; } - /// The principal id of the user to whom the role was assigned. - public string PrincipalId { get; set; } - /// The principal tenant id of the user to whom the role was assigned. - public string PrincipalTenantId { get; set; } - /// The ID of the role definition. - public string RoleDefinitionId { get; set; } - /// The scope at which the role was assigned. - public string Scope { get; } - /// The authentication type. - public string UserAuthenticationType { get; set; } - /// The email address of the user. - public string UserEmailAddress { get; set; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleAssignmentListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleAssignmentListResult.Serialization.cs deleted file mode 100644 index 4a7aca888dec..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleAssignmentListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingRoleAssignmentListResult - { - internal static BillingRoleAssignmentListResult DeserializeBillingRoleAssignmentListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(BillingRoleAssignment.DeserializeBillingRoleAssignment(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new BillingRoleAssignmentListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleAssignmentListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleAssignmentListResult.cs deleted file mode 100644 index 2e33750aae60..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleAssignmentListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The list of role assignments. - public partial class BillingRoleAssignmentListResult - { - /// Initializes a new instance of BillingRoleAssignmentListResult. - internal BillingRoleAssignmentListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of BillingRoleAssignmentListResult. - /// The list of role assignments. - /// The link (url) to the next page of results. - internal BillingRoleAssignmentListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of role assignments. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleDefinition.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleDefinition.Serialization.cs deleted file mode 100644 index ab1e789fd679..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleDefinition.Serialization.cs +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingRoleDefinition : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsCollectionDefined(Permissions)) - { - writer.WritePropertyName("permissions"); - writer.WriteStartArray(); - foreach (var item in Permissions) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static BillingRoleDefinition DeserializeBillingRoleDefinition(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional description = default; - Optional> permissions = default; - Optional roleName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("description")) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("permissions")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(BillingPermissionsProperties.DeserializeBillingPermissionsProperties(item)); - } - permissions = array; - continue; - } - if (property0.NameEquals("roleName")) - { - roleName = property0.Value.GetString(); - continue; - } - } - continue; - } - } - return new BillingRoleDefinition(id.Value, name.Value, type.Value, description.Value, Optional.ToList(permissions), roleName.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleDefinition.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleDefinition.cs deleted file mode 100644 index e0ad14c4043b..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleDefinition.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The properties of a role definition. - public partial class BillingRoleDefinition : Resource - { - /// Initializes a new instance of BillingRoleDefinition. - public BillingRoleDefinition() - { - Permissions = new ChangeTrackingList(); - } - - /// Initializes a new instance of BillingRoleDefinition. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The role description. - /// The billingPermissions the role has. - /// The name of the role. - internal BillingRoleDefinition(string id, string name, string type, string description, IList permissions, string roleName) : base(id, name, type) - { - Description = description; - Permissions = permissions; - RoleName = roleName; - } - - /// The role description. - public string Description { get; } - /// The billingPermissions the role has. - public IList Permissions { get; } - /// The name of the role. - public string RoleName { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleDefinitionListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleDefinitionListResult.Serialization.cs deleted file mode 100644 index d7e299ae2af1..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleDefinitionListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingRoleDefinitionListResult - { - internal static BillingRoleDefinitionListResult DeserializeBillingRoleDefinitionListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(BillingRoleDefinition.DeserializeBillingRoleDefinition(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new BillingRoleDefinitionListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleDefinitionListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleDefinitionListResult.cs deleted file mode 100644 index d2177f6fe044..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingRoleDefinitionListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The list of role definitions. - public partial class BillingRoleDefinitionListResult - { - /// Initializes a new instance of BillingRoleDefinitionListResult. - internal BillingRoleDefinitionListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of BillingRoleDefinitionListResult. - /// The role definitions. - /// The link (url) to the next page of results. - internal BillingRoleDefinitionListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The role definitions. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingSubscription.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingSubscription.Serialization.cs deleted file mode 100644 index e812c2e65647..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingSubscription.Serialization.cs +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingSubscription : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(SubscriptionBillingStatus)) - { - writer.WritePropertyName("subscriptionBillingStatus"); - writer.WriteStringValue(SubscriptionBillingStatus.Value.ToString()); - } - if (Optional.IsDefined(CostCenter)) - { - writer.WritePropertyName("costCenter"); - writer.WriteStringValue(CostCenter); - } - if (Optional.IsDefined(SkuId)) - { - writer.WritePropertyName("skuId"); - writer.WriteStringValue(SkuId); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static BillingSubscription DeserializeBillingSubscription(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional displayName = default; - Optional subscriptionId = default; - Optional subscriptionBillingStatus = default; - Optional lastMonthCharges = default; - Optional monthToDateCharges = default; - Optional billingProfileId = default; - Optional billingProfileDisplayName = default; - Optional costCenter = default; - Optional customerId = default; - Optional customerDisplayName = default; - Optional invoiceSectionId = default; - Optional invoiceSectionDisplayName = default; - Optional reseller = default; - Optional skuId = default; - Optional skuDescription = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("displayName")) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("subscriptionId")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - subscriptionId = property0.Value.GetGuid(); - continue; - } - if (property0.NameEquals("subscriptionBillingStatus")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - subscriptionBillingStatus = new BillingSubscriptionStatusType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("lastMonthCharges")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - lastMonthCharges = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("monthToDateCharges")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - monthToDateCharges = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("billingProfileId")) - { - billingProfileId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("billingProfileDisplayName")) - { - billingProfileDisplayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("costCenter")) - { - costCenter = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("customerId")) - { - customerId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("customerDisplayName")) - { - customerDisplayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("invoiceSectionId")) - { - invoiceSectionId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("invoiceSectionDisplayName")) - { - invoiceSectionDisplayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("reseller")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - reseller = Reseller.DeserializeReseller(property0.Value); - continue; - } - if (property0.NameEquals("skuId")) - { - skuId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("skuDescription")) - { - skuDescription = property0.Value.GetString(); - continue; - } - } - continue; - } - } - return new BillingSubscription(id.Value, name.Value, type.Value, displayName.Value, Optional.ToNullable(subscriptionId), Optional.ToNullable(subscriptionBillingStatus), lastMonthCharges.Value, monthToDateCharges.Value, billingProfileId.Value, billingProfileDisplayName.Value, costCenter.Value, customerId.Value, customerDisplayName.Value, invoiceSectionId.Value, invoiceSectionDisplayName.Value, reseller.Value, skuId.Value, skuDescription.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingSubscription.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingSubscription.cs deleted file mode 100644 index 2706793619ed..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingSubscription.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Billing.Models -{ - /// A billing subscription. - public partial class BillingSubscription : Resource - { - /// Initializes a new instance of BillingSubscription. - public BillingSubscription() - { - } - - /// Initializes a new instance of BillingSubscription. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The name of the subscription. - /// The ID of the subscription. - /// The current billing status of the subscription. - /// The last month charges. - /// The current month to date charges. - /// The ID of the billing profile to which the subscription is billed. - /// The name of the billing profile to which the subscription is billed. - /// The cost center applied to the subscription. - /// The ID of the customer for whom the subscription was created. The field is applicable only for Microsoft Partner Agreement billing account. - /// The name of the customer for whom the subscription was created. The field is applicable only for Microsoft Partner Agreement billing account. - /// The ID of the invoice section to which the subscription is billed. - /// The name of the invoice section to which the subscription is billed. - /// Reseller for this subscription. - /// The sku ID of the Azure plan for the subscription. - /// The sku description of the Azure plan for the subscription. - internal BillingSubscription(string id, string name, string type, string displayName, Guid? subscriptionId, BillingSubscriptionStatusType? subscriptionBillingStatus, Amount lastMonthCharges, Amount monthToDateCharges, string billingProfileId, string billingProfileDisplayName, string costCenter, string customerId, string customerDisplayName, string invoiceSectionId, string invoiceSectionDisplayName, Reseller reseller, string skuId, string skuDescription) : base(id, name, type) - { - DisplayName = displayName; - SubscriptionId = subscriptionId; - SubscriptionBillingStatus = subscriptionBillingStatus; - LastMonthCharges = lastMonthCharges; - MonthToDateCharges = monthToDateCharges; - BillingProfileId = billingProfileId; - BillingProfileDisplayName = billingProfileDisplayName; - CostCenter = costCenter; - CustomerId = customerId; - CustomerDisplayName = customerDisplayName; - InvoiceSectionId = invoiceSectionId; - InvoiceSectionDisplayName = invoiceSectionDisplayName; - Reseller = reseller; - SkuId = skuId; - SkuDescription = skuDescription; - } - - /// The name of the subscription. - public string DisplayName { get; } - /// The ID of the subscription. - public Guid? SubscriptionId { get; } - /// The current billing status of the subscription. - public BillingSubscriptionStatusType? SubscriptionBillingStatus { get; set; } - /// The last month charges. - public Amount LastMonthCharges { get; } - /// The current month to date charges. - public Amount MonthToDateCharges { get; } - /// The ID of the billing profile to which the subscription is billed. - public string BillingProfileId { get; } - /// The name of the billing profile to which the subscription is billed. - public string BillingProfileDisplayName { get; } - /// The cost center applied to the subscription. - public string CostCenter { get; set; } - /// The ID of the customer for whom the subscription was created. The field is applicable only for Microsoft Partner Agreement billing account. - public string CustomerId { get; } - /// The name of the customer for whom the subscription was created. The field is applicable only for Microsoft Partner Agreement billing account. - public string CustomerDisplayName { get; } - /// The ID of the invoice section to which the subscription is billed. - public string InvoiceSectionId { get; } - /// The name of the invoice section to which the subscription is billed. - public string InvoiceSectionDisplayName { get; } - /// Reseller for this subscription. - public Reseller Reseller { get; } - /// The sku ID of the Azure plan for the subscription. - public string SkuId { get; set; } - /// The sku description of the Azure plan for the subscription. - public string SkuDescription { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingSubscriptionStatusType.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingSubscriptionStatusType.cs deleted file mode 100644 index 64fc7c574e2a..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingSubscriptionStatusType.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The current billing status of the subscription. - public readonly partial struct BillingSubscriptionStatusType : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public BillingSubscriptionStatusType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ActiveValue = "Active"; - private const string InactiveValue = "Inactive"; - private const string AbandonedValue = "Abandoned"; - private const string DeletedValue = "Deleted"; - private const string WarningValue = "Warning"; - - /// Active. - public static BillingSubscriptionStatusType Active { get; } = new BillingSubscriptionStatusType(ActiveValue); - /// Inactive. - public static BillingSubscriptionStatusType Inactive { get; } = new BillingSubscriptionStatusType(InactiveValue); - /// Abandoned. - public static BillingSubscriptionStatusType Abandoned { get; } = new BillingSubscriptionStatusType(AbandonedValue); - /// Deleted. - public static BillingSubscriptionStatusType Deleted { get; } = new BillingSubscriptionStatusType(DeletedValue); - /// Warning. - public static BillingSubscriptionStatusType Warning { get; } = new BillingSubscriptionStatusType(WarningValue); - /// Determines if two values are the same. - public static bool operator ==(BillingSubscriptionStatusType left, BillingSubscriptionStatusType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(BillingSubscriptionStatusType left, BillingSubscriptionStatusType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator BillingSubscriptionStatusType(string value) => new BillingSubscriptionStatusType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is BillingSubscriptionStatusType other && Equals(other); - /// - public bool Equals(BillingSubscriptionStatusType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingSubscriptionsListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingSubscriptionsListResult.Serialization.cs deleted file mode 100644 index bbb605cfd64a..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingSubscriptionsListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class BillingSubscriptionsListResult - { - internal static BillingSubscriptionsListResult DeserializeBillingSubscriptionsListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(BillingSubscription.DeserializeBillingSubscription(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new BillingSubscriptionsListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingSubscriptionsListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingSubscriptionsListResult.cs deleted file mode 100644 index c357c8d51c0e..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/BillingSubscriptionsListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The list of billing subscriptions. - public partial class BillingSubscriptionsListResult - { - /// Initializes a new instance of BillingSubscriptionsListResult. - internal BillingSubscriptionsListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of BillingSubscriptionsListResult. - /// The list of billing subscriptions. - /// The link (url) to the next page of results. - internal BillingSubscriptionsListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of billing subscriptions. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Category.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Category.cs deleted file mode 100644 index e2dcc27a49be..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Category.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The category of the agreement signed by a customer. - public readonly partial struct Category : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public Category(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string MicrosoftCustomerAgreementValue = "MicrosoftCustomerAgreement"; - private const string AffiliatePurchaseTermsValue = "AffiliatePurchaseTerms"; - private const string OtherValue = "Other"; - - /// MicrosoftCustomerAgreement. - public static Category MicrosoftCustomerAgreement { get; } = new Category(MicrosoftCustomerAgreementValue); - /// AffiliatePurchaseTerms. - public static Category AffiliatePurchaseTerms { get; } = new Category(AffiliatePurchaseTermsValue); - /// Other. - public static Category Other { get; } = new Category(OtherValue); - /// Determines if two values are the same. - public static bool operator ==(Category left, Category right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(Category left, Category right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator Category(string value) => new Category(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is Category other && Equals(other); - /// - public bool Equals(Category other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Customer.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Customer.Serialization.cs deleted file mode 100644 index c02cc7bfb24f..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Customer.Serialization.cs +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class Customer : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"); - writer.WriteStringValue(DisplayName); - } - if (Optional.IsCollectionDefined(EnabledAzurePlans)) - { - writer.WritePropertyName("enabledAzurePlans"); - writer.WriteStartArray(); - foreach (var item in EnabledAzurePlans) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(Resellers)) - { - writer.WritePropertyName("resellers"); - writer.WriteStartArray(); - foreach (var item in Resellers) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static Customer DeserializeCustomer(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional billingProfileId = default; - Optional billingProfileDisplayName = default; - Optional displayName = default; - Optional> enabledAzurePlans = default; - Optional> resellers = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("billingProfileId")) - { - billingProfileId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("billingProfileDisplayName")) - { - billingProfileDisplayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("displayName")) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("enabledAzurePlans")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(AzurePlan.DeserializeAzurePlan(item)); - } - enabledAzurePlans = array; - continue; - } - if (property0.NameEquals("resellers")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(Reseller.DeserializeReseller(item)); - } - resellers = array; - continue; - } - } - continue; - } - } - return new Customer(id.Value, name.Value, type.Value, billingProfileId.Value, billingProfileDisplayName.Value, displayName.Value, Optional.ToList(enabledAzurePlans), Optional.ToList(resellers)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Customer.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Customer.cs deleted file mode 100644 index 02f95fb3a1b3..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Customer.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// A partner's customer. - public partial class Customer : Resource - { - /// Initializes a new instance of Customer. - public Customer() - { - EnabledAzurePlans = new ChangeTrackingList(); - Resellers = new ChangeTrackingList(); - } - - /// Initializes a new instance of Customer. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The ID of the billing profile for the invoice section. - /// The name of the billing profile for the invoice section. - /// The name of the customer. - /// Azure plans enabled for the customer. - /// The list of resellers for which an Azure plan is enabled for the customer. - internal Customer(string id, string name, string type, string billingProfileId, string billingProfileDisplayName, string displayName, IList enabledAzurePlans, IList resellers) : base(id, name, type) - { - BillingProfileId = billingProfileId; - BillingProfileDisplayName = billingProfileDisplayName; - DisplayName = displayName; - EnabledAzurePlans = enabledAzurePlans; - Resellers = resellers; - } - - /// The ID of the billing profile for the invoice section. - public string BillingProfileId { get; } - /// The name of the billing profile for the invoice section. - public string BillingProfileDisplayName { get; } - /// The name of the customer. - public string DisplayName { get; set; } - /// Azure plans enabled for the customer. - public IList EnabledAzurePlans { get; } - /// The list of resellers for which an Azure plan is enabled for the customer. - public IList Resellers { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/CustomerListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/CustomerListResult.Serialization.cs deleted file mode 100644 index 1b8fd9b822cb..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/CustomerListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class CustomerListResult - { - internal static CustomerListResult DeserializeCustomerListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(Customer.DeserializeCustomer(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new CustomerListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/CustomerListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/CustomerListResult.cs deleted file mode 100644 index fa9646435dc3..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/CustomerListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The list of customers. - public partial class CustomerListResult - { - /// Initializes a new instance of CustomerListResult. - internal CustomerListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of CustomerListResult. - /// The list of customers. - /// The link (url) to the next page of results. - internal CustomerListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of customers. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/CustomerPolicy.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/CustomerPolicy.Serialization.cs deleted file mode 100644 index 64b4ef2a7b49..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/CustomerPolicy.Serialization.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class CustomerPolicy : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(ViewCharges)) - { - writer.WritePropertyName("viewCharges"); - writer.WriteStringValue(ViewCharges.Value.ToString()); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static CustomerPolicy DeserializeCustomerPolicy(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional viewCharges = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("viewCharges")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - viewCharges = new ViewCharges(property0.Value.GetString()); - continue; - } - } - continue; - } - } - return new CustomerPolicy(id.Value, name.Value, type.Value, Optional.ToNullable(viewCharges)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/CustomerPolicy.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/CustomerPolicy.cs deleted file mode 100644 index 157ebebf6b74..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/CustomerPolicy.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// The customer's Policy. - public partial class CustomerPolicy : Resource - { - /// Initializes a new instance of CustomerPolicy. - public CustomerPolicy() - { - } - - /// Initializes a new instance of CustomerPolicy. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. - internal CustomerPolicy(string id, string name, string type, ViewCharges? viewCharges) : base(id, name, type) - { - ViewCharges = viewCharges; - } - - /// The policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. - public ViewCharges? ViewCharges { get; set; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Department.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Department.Serialization.cs deleted file mode 100644 index bb98b398d1c8..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Department.Serialization.cs +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class Department : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(DepartmentName)) - { - writer.WritePropertyName("departmentName"); - writer.WriteStringValue(DepartmentName); - } - if (Optional.IsDefined(CostCenter)) - { - writer.WritePropertyName("costCenter"); - writer.WriteStringValue(CostCenter); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"); - writer.WriteStringValue(Status); - } - if (Optional.IsCollectionDefined(EnrollmentAccounts)) - { - writer.WritePropertyName("enrollmentAccounts"); - writer.WriteStartArray(); - foreach (var item in EnrollmentAccounts) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static Department DeserializeDepartment(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional departmentName = default; - Optional costCenter = default; - Optional status = default; - Optional> enrollmentAccounts = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("departmentName")) - { - departmentName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("costCenter")) - { - costCenter = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("status")) - { - status = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("enrollmentAccounts")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(EnrollmentAccount.DeserializeEnrollmentAccount(item)); - } - enrollmentAccounts = array; - continue; - } - } - continue; - } - } - return new Department(id.Value, name.Value, type.Value, departmentName.Value, costCenter.Value, status.Value, Optional.ToList(enrollmentAccounts)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Department.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Department.cs deleted file mode 100644 index 2c82e3d99b0c..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Department.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// A department. - public partial class Department : Resource - { - /// Initializes a new instance of Department. - public Department() - { - EnrollmentAccounts = new ChangeTrackingList(); - } - - /// Initializes a new instance of Department. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The name of the department. - /// The cost center associated with the department. - /// The status of the department. - /// Associated enrollment accounts. By default this is not populated, unless it's specified in $expand. - internal Department(string id, string name, string type, string departmentName, string costCenter, string status, IList enrollmentAccounts) : base(id, name, type) - { - DepartmentName = departmentName; - CostCenter = costCenter; - Status = status; - EnrollmentAccounts = enrollmentAccounts; - } - - /// The name of the department. - public string DepartmentName { get; set; } - /// The cost center associated with the department. - public string CostCenter { get; set; } - /// The status of the department. - public string Status { get; set; } - /// Associated enrollment accounts. By default this is not populated, unless it's specified in $expand. - public IList EnrollmentAccounts { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Document.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Document.Serialization.cs deleted file mode 100644 index 518fafa9b4eb..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Document.Serialization.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class Document - { - internal static Document DeserializeDocument(JsonElement element) - { - Optional kind = default; - Optional url = default; - Optional source = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("kind")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - kind = new DocumentType(property.Value.GetString()); - continue; - } - if (property.NameEquals("url")) - { - url = property.Value.GetString(); - continue; - } - if (property.NameEquals("source")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - source = new DocumentSource(property.Value.GetString()); - continue; - } - } - return new Document(Optional.ToNullable(kind), url.Value, Optional.ToNullable(source)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Document.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Document.cs deleted file mode 100644 index 59e75c5d5109..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Document.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// The properties of a document. - public partial class Document - { - /// Initializes a new instance of Document. - internal Document() - { - } - - /// Initializes a new instance of Document. - /// The type of the document. - /// Document URL. - /// The source of the document. ENF for Brazil and DRS for rest of the world. - internal Document(DocumentType? kind, string url, DocumentSource? source) - { - Kind = kind; - Url = url; - Source = source; - } - - /// The type of the document. - public DocumentType? Kind { get; } - /// Document URL. - public string Url { get; } - /// The source of the document. ENF for Brazil and DRS for rest of the world. - public DocumentSource? Source { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/DocumentSource.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/DocumentSource.cs deleted file mode 100644 index e1340957719b..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/DocumentSource.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The source of the document. ENF for Brazil and DRS for rest of the world. - public readonly partial struct DocumentSource : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public DocumentSource(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string DRSValue = "DRS"; - private const string ENFValue = "ENF"; - - /// DRS. - public static DocumentSource DRS { get; } = new DocumentSource(DRSValue); - /// ENF. - public static DocumentSource ENF { get; } = new DocumentSource(ENFValue); - /// Determines if two values are the same. - public static bool operator ==(DocumentSource left, DocumentSource right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(DocumentSource left, DocumentSource right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator DocumentSource(string value) => new DocumentSource(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is DocumentSource other && Equals(other); - /// - public bool Equals(DocumentSource other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/DocumentType.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/DocumentType.cs deleted file mode 100644 index 5fde235bb576..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/DocumentType.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The type of the document. - public readonly partial struct DocumentType : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public DocumentType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string InvoiceValue = "Invoice"; - private const string VoidNoteValue = "VoidNote"; - private const string TaxReceiptValue = "TaxReceipt"; - private const string CreditNoteValue = "CreditNote"; - - /// Invoice. - public static DocumentType Invoice { get; } = new DocumentType(InvoiceValue); - /// VoidNote. - public static DocumentType VoidNote { get; } = new DocumentType(VoidNoteValue); - /// TaxReceipt. - public static DocumentType TaxReceipt { get; } = new DocumentType(TaxReceiptValue); - /// CreditNote. - public static DocumentType CreditNote { get; } = new DocumentType(CreditNoteValue); - /// Determines if two values are the same. - public static bool operator ==(DocumentType left, DocumentType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(DocumentType left, DocumentType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator DocumentType(string value) => new DocumentType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is DocumentType other && Equals(other); - /// - public bool Equals(DocumentType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/DownloadUrl.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/DownloadUrl.Serialization.cs deleted file mode 100644 index 3f41db835812..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/DownloadUrl.Serialization.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class DownloadUrl - { - internal static DownloadUrl DeserializeDownloadUrl(JsonElement element) - { - Optional expiryTime = default; - Optional url = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("expiryTime")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - expiryTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("url")) - { - url = property.Value.GetString(); - continue; - } - } - return new DownloadUrl(Optional.ToNullable(expiryTime), url.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/DownloadUrl.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/DownloadUrl.cs deleted file mode 100644 index b4c74a06d9b8..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/DownloadUrl.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Billing.Models -{ - /// A secure URL that can be used to download a an entity until the URL expires. - public partial class DownloadUrl - { - /// Initializes a new instance of DownloadUrl. - internal DownloadUrl() - { - } - - /// Initializes a new instance of DownloadUrl. - /// The time in UTC when the download URL will expire. - /// The URL to the PDF file. - internal DownloadUrl(DateTimeOffset? expiryTime, string url) - { - ExpiryTime = expiryTime; - Url = url; - } - - /// The time in UTC when the download URL will expire. - public DateTimeOffset? ExpiryTime { get; } - /// The URL to the PDF file. - public string Url { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Enrollment.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Enrollment.Serialization.cs deleted file mode 100644 index c6eb310e143f..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Enrollment.Serialization.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class Enrollment - { - internal static Enrollment DeserializeEnrollment(JsonElement element) - { - Optional startDate = default; - Optional endDate = default; - Optional currency = default; - Optional channel = default; - Optional policies = default; - Optional language = default; - Optional countryCode = default; - Optional status = default; - Optional billingCycle = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("startDate")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - startDate = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("endDate")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - endDate = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("currency")) - { - currency = property.Value.GetString(); - continue; - } - if (property.NameEquals("channel")) - { - channel = property.Value.GetString(); - continue; - } - if (property.NameEquals("policies")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - policies = EnrollmentPolicies.DeserializeEnrollmentPolicies(property.Value); - continue; - } - if (property.NameEquals("language")) - { - language = property.Value.GetString(); - continue; - } - if (property.NameEquals("countryCode")) - { - countryCode = property.Value.GetString(); - continue; - } - if (property.NameEquals("status")) - { - status = property.Value.GetString(); - continue; - } - if (property.NameEquals("billingCycle")) - { - billingCycle = property.Value.GetString(); - continue; - } - } - return new Enrollment(Optional.ToNullable(startDate), Optional.ToNullable(endDate), currency.Value, channel.Value, policies.Value, language.Value, countryCode.Value, status.Value, billingCycle.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Enrollment.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Enrollment.cs deleted file mode 100644 index 4e752b1118bc..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Enrollment.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The properties of an enrollment. - public partial class Enrollment - { - /// Initializes a new instance of Enrollment. - internal Enrollment() - { - } - - /// Initializes a new instance of Enrollment. - /// The start date of the enrollment. - /// The end date of the enrollment. - /// The billing currency for the enrollment. - /// The channel type of the enrollment. - /// The policies for Enterprise Agreement enrollments. - /// The language for the enrollment. - /// The country code of the enrollment. - /// The current status of the enrollment. - /// The billing cycle for the enrollment. - internal Enrollment(DateTimeOffset? startDate, DateTimeOffset? endDate, string currency, string channel, EnrollmentPolicies policies, string language, string countryCode, string status, string billingCycle) - { - StartDate = startDate; - EndDate = endDate; - Currency = currency; - Channel = channel; - Policies = policies; - Language = language; - CountryCode = countryCode; - Status = status; - BillingCycle = billingCycle; - } - - /// The start date of the enrollment. - public DateTimeOffset? StartDate { get; } - /// The end date of the enrollment. - public DateTimeOffset? EndDate { get; } - /// The billing currency for the enrollment. - public string Currency { get; } - /// The channel type of the enrollment. - public string Channel { get; } - /// The policies for Enterprise Agreement enrollments. - public EnrollmentPolicies Policies { get; } - /// The language for the enrollment. - public string Language { get; } - /// The country code of the enrollment. - public string CountryCode { get; } - /// The current status of the enrollment. - public string Status { get; } - /// The billing cycle for the enrollment. - public string BillingCycle { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccount.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccount.Serialization.cs deleted file mode 100644 index cc110f9f6e4f..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccount.Serialization.cs +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class EnrollmentAccount : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(AccountName)) - { - writer.WritePropertyName("accountName"); - writer.WriteStringValue(AccountName); - } - if (Optional.IsDefined(CostCenter)) - { - writer.WritePropertyName("costCenter"); - writer.WriteStringValue(CostCenter); - } - if (Optional.IsDefined(AccountOwner)) - { - writer.WritePropertyName("accountOwner"); - writer.WriteStringValue(AccountOwner); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"); - writer.WriteStringValue(Status); - } - if (Optional.IsDefined(StartDate)) - { - writer.WritePropertyName("startDate"); - writer.WriteStringValue(StartDate.Value, "O"); - } - if (Optional.IsDefined(EndDate)) - { - writer.WritePropertyName("endDate"); - writer.WriteStringValue(EndDate.Value, "O"); - } - if (Optional.IsDefined(Department)) - { - writer.WritePropertyName("department"); - writer.WriteObjectValue(Department); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static EnrollmentAccount DeserializeEnrollmentAccount(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional accountName = default; - Optional costCenter = default; - Optional accountOwner = default; - Optional status = default; - Optional startDate = default; - Optional endDate = default; - Optional department = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("accountName")) - { - accountName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("costCenter")) - { - costCenter = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("accountOwner")) - { - accountOwner = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("status")) - { - status = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("startDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - startDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("endDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - endDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("department")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - department = Department.DeserializeDepartment(property0.Value); - continue; - } - } - continue; - } - } - return new EnrollmentAccount(id.Value, name.Value, type.Value, accountName.Value, costCenter.Value, accountOwner.Value, status.Value, Optional.ToNullable(startDate), Optional.ToNullable(endDate), department.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccount.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccount.cs deleted file mode 100644 index ecb36a2f4050..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccount.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Billing.Models -{ - /// An enrollment account. - public partial class EnrollmentAccount : Resource - { - /// Initializes a new instance of EnrollmentAccount. - public EnrollmentAccount() - { - } - - /// Initializes a new instance of EnrollmentAccount. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The name of the enrollment account. - /// The cost center associated with the enrollment account. - /// The owner of the enrollment account. - /// The status of the enrollment account. - /// The start date of the enrollment account. - /// The end date of the enrollment account. - /// Associated department. By default this is not populated, unless it's specified in $expand. - internal EnrollmentAccount(string id, string name, string type, string accountName, string costCenter, string accountOwner, string status, DateTimeOffset? startDate, DateTimeOffset? endDate, Department department) : base(id, name, type) - { - AccountName = accountName; - CostCenter = costCenter; - AccountOwner = accountOwner; - Status = status; - StartDate = startDate; - EndDate = endDate; - Department = department; - } - - /// The name of the enrollment account. - public string AccountName { get; set; } - /// The cost center associated with the enrollment account. - public string CostCenter { get; set; } - /// The owner of the enrollment account. - public string AccountOwner { get; set; } - /// The status of the enrollment account. - public string Status { get; set; } - /// The start date of the enrollment account. - public DateTimeOffset? StartDate { get; set; } - /// The end date of the enrollment account. - public DateTimeOffset? EndDate { get; set; } - /// Associated department. By default this is not populated, unless it's specified in $expand. - public Department Department { get; set; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccountContext.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccountContext.cs deleted file mode 100644 index b0f6b6860eb1..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccountContext.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The enrollment account context. - internal partial class EnrollmentAccountContext - { - /// Initializes a new instance of EnrollmentAccountContext. - internal EnrollmentAccountContext() - { - } - - /// The cost center associated with the enrollment account. - public string CostCenter { get; } - /// The start date of the enrollment account. - public DateTimeOffset? StartDate { get; } - /// The end date of the enrollment account. - public DateTimeOffset? EndDate { get; } - /// The ID of the enrollment account. - public string EnrollmentAccountName { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccountListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccountListResult.Serialization.cs deleted file mode 100644 index ab17b7048f12..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccountListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class EnrollmentAccountListResult - { - internal static EnrollmentAccountListResult DeserializeEnrollmentAccountListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(EnrollmentAccountSummary.DeserializeEnrollmentAccountSummary(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new EnrollmentAccountListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccountListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccountListResult.cs deleted file mode 100644 index c76413c75445..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccountListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Result of listing enrollment accounts. - public partial class EnrollmentAccountListResult - { - /// Initializes a new instance of EnrollmentAccountListResult. - internal EnrollmentAccountListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of EnrollmentAccountListResult. - /// The list of enrollment accounts. - /// The link (url) to the next page of results. - internal EnrollmentAccountListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of enrollment accounts. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccountSummary.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccountSummary.Serialization.cs deleted file mode 100644 index 034d28b6a9ae..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccountSummary.Serialization.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class EnrollmentAccountSummary : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static EnrollmentAccountSummary DeserializeEnrollmentAccountSummary(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional principalName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("principalName")) - { - principalName = property0.Value.GetString(); - continue; - } - } - continue; - } - } - return new EnrollmentAccountSummary(id.Value, name.Value, type.Value, principalName.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccountSummary.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccountSummary.cs deleted file mode 100644 index 7c9172eb7311..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentAccountSummary.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// An enrollment account resource. - public partial class EnrollmentAccountSummary : Resource - { - /// Initializes a new instance of EnrollmentAccountSummary. - public EnrollmentAccountSummary() - { - } - - /// Initializes a new instance of EnrollmentAccountSummary. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The account owner's principal name. - internal EnrollmentAccountSummary(string id, string name, string type, string principalName) : base(id, name, type) - { - PrincipalName = principalName; - } - - /// The account owner's principal name. - public string PrincipalName { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentPolicies.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentPolicies.Serialization.cs deleted file mode 100644 index e766a52e4a81..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentPolicies.Serialization.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class EnrollmentPolicies - { - internal static EnrollmentPolicies DeserializeEnrollmentPolicies(JsonElement element) - { - Optional accountOwnerViewCharges = default; - Optional departmentAdminViewCharges = default; - Optional marketplacesEnabled = default; - Optional reservedInstancesEnabled = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("accountOwnerViewCharges")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - accountOwnerViewCharges = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("departmentAdminViewCharges")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - departmentAdminViewCharges = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("marketplacesEnabled")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - marketplacesEnabled = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("reservedInstancesEnabled")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - reservedInstancesEnabled = property.Value.GetBoolean(); - continue; - } - } - return new EnrollmentPolicies(Optional.ToNullable(accountOwnerViewCharges), Optional.ToNullable(departmentAdminViewCharges), Optional.ToNullable(marketplacesEnabled), Optional.ToNullable(reservedInstancesEnabled)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentPolicies.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentPolicies.cs deleted file mode 100644 index 18cfac8a4017..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/EnrollmentPolicies.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// The policies for Enterprise Agreement enrollments. - public partial class EnrollmentPolicies - { - /// Initializes a new instance of EnrollmentPolicies. - internal EnrollmentPolicies() - { - } - - /// Initializes a new instance of EnrollmentPolicies. - /// The policy that controls whether Account Owners can view charges. - /// The policy that controls whether Department Administrators can view charges. - /// The policy that controls whether Azure marketplace purchases are allowed in the enrollment. - /// The policy that controls whether Azure reservation purchases are allowed in the enrollment. - internal EnrollmentPolicies(bool? accountOwnerViewCharges, bool? departmentAdminViewCharges, bool? marketplacesEnabled, bool? reservedInstancesEnabled) - { - AccountOwnerViewCharges = accountOwnerViewCharges; - DepartmentAdminViewCharges = departmentAdminViewCharges; - MarketplacesEnabled = marketplacesEnabled; - ReservedInstancesEnabled = reservedInstancesEnabled; - } - - /// The policy that controls whether Account Owners can view charges. - public bool? AccountOwnerViewCharges { get; } - /// The policy that controls whether Department Administrators can view charges. - public bool? DepartmentAdminViewCharges { get; } - /// The policy that controls whether Azure marketplace purchases are allowed in the enrollment. - public bool? MarketplacesEnabled { get; } - /// The policy that controls whether Azure reservation purchases are allowed in the enrollment. - public bool? ReservedInstancesEnabled { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorDetails.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorDetails.Serialization.cs deleted file mode 100644 index a6ae5f4c6a80..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorDetails.Serialization.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - internal partial class ErrorDetails - { - internal static ErrorDetails DeserializeErrorDetails(JsonElement element) - { - Optional code = default; - Optional message = default; - Optional target = default; - Optional> details = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code")) - { - code = property.Value.GetString(); - continue; - } - if (property.NameEquals("message")) - { - message = property.Value.GetString(); - continue; - } - if (property.NameEquals("target")) - { - target = property.Value.GetString(); - continue; - } - if (property.NameEquals("details")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ErrorSubDetailsItem.DeserializeErrorSubDetailsItem(item)); - } - details = array; - continue; - } - } - return new ErrorDetails(code.Value, message.Value, target.Value, Optional.ToList(details)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorDetails.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorDetails.cs deleted file mode 100644 index a3676c594816..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorDetails.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The details of the error. - internal partial class ErrorDetails - { - /// Initializes a new instance of ErrorDetails. - internal ErrorDetails() - { - Details = new ChangeTrackingList(); - } - - /// Initializes a new instance of ErrorDetails. - /// Error code. - /// Error message indicating why the operation failed. - /// The target of the particular error. - /// The sub details of the error. - internal ErrorDetails(string code, string message, string target, IReadOnlyList details) - { - Code = code; - Message = message; - Target = target; - Details = details; - } - - /// Error code. - public string Code { get; } - /// Error message indicating why the operation failed. - public string Message { get; } - /// The target of the particular error. - public string Target { get; } - /// The sub details of the error. - public IReadOnlyList Details { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorResponse.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorResponse.Serialization.cs deleted file mode 100644 index 407be51dce9d..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorResponse.Serialization.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - internal partial class ErrorResponse - { - internal static ErrorResponse DeserializeErrorResponse(JsonElement element) - { - Optional error = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("error")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - error = ErrorDetails.DeserializeErrorDetails(property.Value); - continue; - } - } - return new ErrorResponse(error.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorResponse.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorResponse.cs deleted file mode 100644 index cbfb0499aa6a..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorResponse.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. - internal partial class ErrorResponse - { - /// Initializes a new instance of ErrorResponse. - internal ErrorResponse() - { - } - - /// Initializes a new instance of ErrorResponse. - /// The details of the error. - internal ErrorResponse(ErrorDetails error) - { - Error = error; - } - - /// The details of the error. - public ErrorDetails Error { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorSubDetailsItem.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorSubDetailsItem.Serialization.cs deleted file mode 100644 index 67ef36e69947..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorSubDetailsItem.Serialization.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - internal partial class ErrorSubDetailsItem - { - internal static ErrorSubDetailsItem DeserializeErrorSubDetailsItem(JsonElement element) - { - Optional code = default; - Optional message = default; - Optional target = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code")) - { - code = property.Value.GetString(); - continue; - } - if (property.NameEquals("message")) - { - message = property.Value.GetString(); - continue; - } - if (property.NameEquals("target")) - { - target = property.Value.GetString(); - continue; - } - } - return new ErrorSubDetailsItem(code.Value, message.Value, target.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorSubDetailsItem.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorSubDetailsItem.cs deleted file mode 100644 index 40520732f7d3..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ErrorSubDetailsItem.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// The ErrorSubDetailsItem. - internal partial class ErrorSubDetailsItem - { - /// Initializes a new instance of ErrorSubDetailsItem. - internal ErrorSubDetailsItem() - { - } - - /// Initializes a new instance of ErrorSubDetailsItem. - /// Error code. - /// Error message indicating why the operation failed. - /// The target of the particular error. - internal ErrorSubDetailsItem(string code, string message, string target) - { - Code = code; - Message = message; - Target = target; - } - - /// Error code. - public string Code { get; } - /// Error message indicating why the operation failed. - public string Message { get; } - /// The target of the particular error. - public string Target { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/IndirectRelationshipInfo.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/IndirectRelationshipInfo.Serialization.cs deleted file mode 100644 index cf9a9a8119b3..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/IndirectRelationshipInfo.Serialization.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class IndirectRelationshipInfo - { - internal static IndirectRelationshipInfo DeserializeIndirectRelationshipInfo(JsonElement element) - { - Optional billingAccountName = default; - Optional billingProfileName = default; - Optional displayName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("billingAccountName")) - { - billingAccountName = property.Value.GetString(); - continue; - } - if (property.NameEquals("billingProfileName")) - { - billingProfileName = property.Value.GetString(); - continue; - } - if (property.NameEquals("displayName")) - { - displayName = property.Value.GetString(); - continue; - } - } - return new IndirectRelationshipInfo(billingAccountName.Value, billingProfileName.Value, displayName.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/IndirectRelationshipInfo.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/IndirectRelationshipInfo.cs deleted file mode 100644 index 2b8785cb94ab..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/IndirectRelationshipInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// The billing profile details of the partner of the customer for an indirect motion. - public partial class IndirectRelationshipInfo - { - /// Initializes a new instance of IndirectRelationshipInfo. - internal IndirectRelationshipInfo() - { - } - - /// Initializes a new instance of IndirectRelationshipInfo. - /// The billing account name of the partner or the customer for an indirect motion. - /// The billing profile name of the partner or the customer for an indirect motion. - /// The display name of the partner or customer for an indirect motion. - internal IndirectRelationshipInfo(string billingAccountName, string billingProfileName, string displayName) - { - BillingAccountName = billingAccountName; - BillingProfileName = billingProfileName; - DisplayName = displayName; - } - - /// The billing account name of the partner or the customer for an indirect motion. - public string BillingAccountName { get; } - /// The billing profile name of the partner or the customer for an indirect motion. - public string BillingProfileName { get; } - /// The display name of the partner or customer for an indirect motion. - public string DisplayName { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Instruction.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Instruction.Serialization.cs deleted file mode 100644 index 6c96ae7f450b..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Instruction.Serialization.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class Instruction : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(Amount)) - { - writer.WritePropertyName("amount"); - writer.WriteNumberValue(Amount.Value); - } - if (Optional.IsDefined(StartDate)) - { - writer.WritePropertyName("startDate"); - writer.WriteStringValue(StartDate.Value, "O"); - } - if (Optional.IsDefined(EndDate)) - { - writer.WritePropertyName("endDate"); - writer.WriteStringValue(EndDate.Value, "O"); - } - if (Optional.IsDefined(CreationDate)) - { - writer.WritePropertyName("creationDate"); - writer.WriteStringValue(CreationDate.Value, "O"); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static Instruction DeserializeInstruction(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional amount = default; - Optional startDate = default; - Optional endDate = default; - Optional creationDate = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("amount")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - amount = property0.Value.GetSingle(); - continue; - } - if (property0.NameEquals("startDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - startDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("endDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - endDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("creationDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - creationDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - } - continue; - } - } - return new Instruction(id.Value, name.Value, type.Value, Optional.ToNullable(amount), Optional.ToNullable(startDate), Optional.ToNullable(endDate), Optional.ToNullable(creationDate)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Instruction.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Instruction.cs deleted file mode 100644 index 2f7112e763bb..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Instruction.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Billing.Models -{ - /// An instruction. - public partial class Instruction : Resource - { - /// Initializes a new instance of Instruction. - public Instruction() - { - } - - /// Initializes a new instance of Instruction. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The amount budgeted for this billing instruction. - /// The date this billing instruction goes into effect. - /// The date this billing instruction is no longer in effect. - /// The date this billing instruction was created. - internal Instruction(string id, string name, string type, float? amount, DateTimeOffset? startDate, DateTimeOffset? endDate, DateTimeOffset? creationDate) : base(id, name, type) - { - Amount = amount; - StartDate = startDate; - EndDate = endDate; - CreationDate = creationDate; - } - - /// The amount budgeted for this billing instruction. - public float? Amount { get; set; } - /// The date this billing instruction goes into effect. - public DateTimeOffset? StartDate { get; set; } - /// The date this billing instruction is no longer in effect. - public DateTimeOffset? EndDate { get; set; } - /// The date this billing instruction was created. - public DateTimeOffset? CreationDate { get; set; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InstructionListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InstructionListResult.Serialization.cs deleted file mode 100644 index 2349d3cfd407..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InstructionListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class InstructionListResult - { - internal static InstructionListResult DeserializeInstructionListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(Instruction.DeserializeInstruction(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new InstructionListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InstructionListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InstructionListResult.cs deleted file mode 100644 index a8b61c4c4dc3..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InstructionListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The list of billing instructions used during invoice generation. - public partial class InstructionListResult - { - /// Initializes a new instance of InstructionListResult. - internal InstructionListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of InstructionListResult. - /// The list of billing instructions used during invoice generation. - /// The link (url) to the next page of results. - internal InstructionListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of billing instructions used during invoice generation. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Invoice.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Invoice.Serialization.cs deleted file mode 100644 index 6566ba016687..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Invoice.Serialization.cs +++ /dev/null @@ -1,324 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class Invoice : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static Invoice DeserializeInvoice(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional dueDate = default; - Optional invoiceDate = default; - Optional status = default; - Optional amountDue = default; - Optional azurePrepaymentApplied = default; - Optional billedAmount = default; - Optional creditAmount = default; - Optional freeAzureCreditApplied = default; - Optional subTotal = default; - Optional taxAmount = default; - Optional totalAmount = default; - Optional invoicePeriodStartDate = default; - Optional invoicePeriodEndDate = default; - Optional invoiceType = default; - Optional isMonthlyInvoice = default; - Optional billingProfileId = default; - Optional billingProfileDisplayName = default; - Optional purchaseOrderNumber = default; - Optional> documents = default; - Optional> payments = default; - Optional> rebillDetails = default; - Optional documentType = default; - Optional billedDocumentId = default; - Optional creditForDocumentId = default; - Optional subscriptionId = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("dueDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - dueDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("invoiceDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - invoiceDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("status")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - status = new InvoiceStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("amountDue")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - amountDue = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("azurePrepaymentApplied")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - azurePrepaymentApplied = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("billedAmount")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - billedAmount = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("creditAmount")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - creditAmount = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("freeAzureCreditApplied")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - freeAzureCreditApplied = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("subTotal")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - subTotal = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("taxAmount")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - taxAmount = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("totalAmount")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - totalAmount = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("invoicePeriodStartDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - invoicePeriodStartDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("invoicePeriodEndDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - invoicePeriodEndDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("invoiceType")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - invoiceType = new InvoiceType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("isMonthlyInvoice")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - isMonthlyInvoice = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("billingProfileId")) - { - billingProfileId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("billingProfileDisplayName")) - { - billingProfileDisplayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("purchaseOrderNumber")) - { - purchaseOrderNumber = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("documents")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(Document.DeserializeDocument(item)); - } - documents = array; - continue; - } - if (property0.NameEquals("payments")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(PaymentProperties.DeserializePaymentProperties(item)); - } - payments = array; - continue; - } - if (property0.NameEquals("rebillDetails")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property1 in property0.Value.EnumerateObject()) - { - dictionary.Add(property1.Name, Models.RebillDetails.DeserializeRebillDetails(property1.Value)); - } - rebillDetails = dictionary; - continue; - } - if (property0.NameEquals("documentType")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - documentType = new InvoiceDocumentType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("billedDocumentId")) - { - billedDocumentId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("creditForDocumentId")) - { - creditForDocumentId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("subscriptionId")) - { - subscriptionId = property0.Value.GetString(); - continue; - } - } - continue; - } - } - return new Invoice(id.Value, name.Value, type.Value, Optional.ToNullable(dueDate), Optional.ToNullable(invoiceDate), Optional.ToNullable(status), amountDue.Value, azurePrepaymentApplied.Value, billedAmount.Value, creditAmount.Value, freeAzureCreditApplied.Value, subTotal.Value, taxAmount.Value, totalAmount.Value, Optional.ToNullable(invoicePeriodStartDate), Optional.ToNullable(invoicePeriodEndDate), Optional.ToNullable(invoiceType), Optional.ToNullable(isMonthlyInvoice), billingProfileId.Value, billingProfileDisplayName.Value, purchaseOrderNumber.Value, Optional.ToList(documents), Optional.ToList(payments), Optional.ToDictionary(rebillDetails), Optional.ToNullable(documentType), billedDocumentId.Value, creditForDocumentId.Value, subscriptionId.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Invoice.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Invoice.cs deleted file mode 100644 index 7bb910889f6a..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Invoice.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// An invoice. - public partial class Invoice : Resource - { - /// Initializes a new instance of Invoice. - public Invoice() - { - Documents = new ChangeTrackingList(); - Payments = new ChangeTrackingList(); - RebillDetails = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of Invoice. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The due date for the invoice. - /// The date when the invoice was generated. - /// The current status of the invoice. - /// The amount due as of now. - /// The amount of Azure prepayment applied to the charges. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. - /// The total charges for the invoice billing period. - /// The total refund for returns and cancellations during the invoice billing period. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. - /// The amount of free Azure credits applied to the charges. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. - /// The pre-tax amount due. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. - /// The amount of tax charged for the billing period. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. - /// The amount due when the invoice was generated. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. - /// The start date of the billing period for which the invoice is generated. - /// The end date of the billing period for which the invoice is generated. - /// Invoice type. - /// Specifies if the invoice is generated as part of monthly invoicing cycle or not. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. - /// The ID of the billing profile for which the invoice is generated. - /// The name of the billing profile for which the invoice is generated. - /// An optional purchase order number for the invoice. - /// List of documents available to download such as invoice and tax receipt. - /// List of payments. - /// Rebill details for an invoice. - /// The type of the document. - /// The Id of the active invoice which is originally billed after this invoice was voided. This field is applicable to the void invoices only. - /// The Id of the invoice which got voided and this credit note was issued as a result. This field is applicable to the credit notes only. - /// The ID of the subscription for which the invoice is generated. - internal Invoice(string id, string name, string type, DateTimeOffset? dueDate, DateTimeOffset? invoiceDate, InvoiceStatus? status, Amount amountDue, Amount azurePrepaymentApplied, Amount billedAmount, Amount creditAmount, Amount freeAzureCreditApplied, Amount subTotal, Amount taxAmount, Amount totalAmount, DateTimeOffset? invoicePeriodStartDate, DateTimeOffset? invoicePeriodEndDate, InvoiceType? invoiceType, bool? isMonthlyInvoice, string billingProfileId, string billingProfileDisplayName, string purchaseOrderNumber, IReadOnlyList documents, IReadOnlyList payments, IReadOnlyDictionary rebillDetails, InvoiceDocumentType? documentType, string billedDocumentId, string creditForDocumentId, string subscriptionId) : base(id, name, type) - { - DueDate = dueDate; - InvoiceDate = invoiceDate; - Status = status; - AmountDue = amountDue; - AzurePrepaymentApplied = azurePrepaymentApplied; - BilledAmount = billedAmount; - CreditAmount = creditAmount; - FreeAzureCreditApplied = freeAzureCreditApplied; - SubTotal = subTotal; - TaxAmount = taxAmount; - TotalAmount = totalAmount; - InvoicePeriodStartDate = invoicePeriodStartDate; - InvoicePeriodEndDate = invoicePeriodEndDate; - InvoiceType = invoiceType; - IsMonthlyInvoice = isMonthlyInvoice; - BillingProfileId = billingProfileId; - BillingProfileDisplayName = billingProfileDisplayName; - PurchaseOrderNumber = purchaseOrderNumber; - Documents = documents; - Payments = payments; - RebillDetails = rebillDetails; - DocumentType = documentType; - BilledDocumentId = billedDocumentId; - CreditForDocumentId = creditForDocumentId; - SubscriptionId = subscriptionId; - } - - /// The due date for the invoice. - public DateTimeOffset? DueDate { get; } - /// The date when the invoice was generated. - public DateTimeOffset? InvoiceDate { get; } - /// The current status of the invoice. - public InvoiceStatus? Status { get; } - /// The amount due as of now. - public Amount AmountDue { get; } - /// The amount of Azure prepayment applied to the charges. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. - public Amount AzurePrepaymentApplied { get; } - /// The total charges for the invoice billing period. - public Amount BilledAmount { get; } - /// The total refund for returns and cancellations during the invoice billing period. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. - public Amount CreditAmount { get; } - /// The amount of free Azure credits applied to the charges. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. - public Amount FreeAzureCreditApplied { get; } - /// The pre-tax amount due. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. - public Amount SubTotal { get; } - /// The amount of tax charged for the billing period. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. - public Amount TaxAmount { get; } - /// The amount due when the invoice was generated. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. - public Amount TotalAmount { get; } - /// The start date of the billing period for which the invoice is generated. - public DateTimeOffset? InvoicePeriodStartDate { get; } - /// The end date of the billing period for which the invoice is generated. - public DateTimeOffset? InvoicePeriodEndDate { get; } - /// Invoice type. - public InvoiceType? InvoiceType { get; } - /// Specifies if the invoice is generated as part of monthly invoicing cycle or not. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. - public bool? IsMonthlyInvoice { get; } - /// The ID of the billing profile for which the invoice is generated. - public string BillingProfileId { get; } - /// The name of the billing profile for which the invoice is generated. - public string BillingProfileDisplayName { get; } - /// An optional purchase order number for the invoice. - public string PurchaseOrderNumber { get; } - /// List of documents available to download such as invoice and tax receipt. - public IReadOnlyList Documents { get; } - /// List of payments. - public IReadOnlyList Payments { get; } - /// Rebill details for an invoice. - public IReadOnlyDictionary RebillDetails { get; } - /// The type of the document. - public InvoiceDocumentType? DocumentType { get; } - /// The Id of the active invoice which is originally billed after this invoice was voided. This field is applicable to the void invoices only. - public string BilledDocumentId { get; } - /// The Id of the invoice which got voided and this credit note was issued as a result. This field is applicable to the credit notes only. - public string CreditForDocumentId { get; } - /// The ID of the subscription for which the invoice is generated. - public string SubscriptionId { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceDocumentType.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceDocumentType.cs deleted file mode 100644 index dde3bb84e2fb..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceDocumentType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The type of the document. - public readonly partial struct InvoiceDocumentType : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public InvoiceDocumentType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string InvoiceValue = "Invoice"; - private const string CreditNoteValue = "CreditNote"; - - /// Invoice. - public static InvoiceDocumentType Invoice { get; } = new InvoiceDocumentType(InvoiceValue); - /// CreditNote. - public static InvoiceDocumentType CreditNote { get; } = new InvoiceDocumentType(CreditNoteValue); - /// Determines if two values are the same. - public static bool operator ==(InvoiceDocumentType left, InvoiceDocumentType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(InvoiceDocumentType left, InvoiceDocumentType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator InvoiceDocumentType(string value) => new InvoiceDocumentType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InvoiceDocumentType other && Equals(other); - /// - public bool Equals(InvoiceDocumentType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceListResult.Serialization.cs deleted file mode 100644 index 77f5ed97f596..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class InvoiceListResult - { - internal static InvoiceListResult DeserializeInvoiceListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(Invoice.DeserializeInvoice(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new InvoiceListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceListResult.cs deleted file mode 100644 index 9e86c14a3bba..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The list of invoices. - public partial class InvoiceListResult - { - /// Initializes a new instance of InvoiceListResult. - internal InvoiceListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of InvoiceListResult. - /// The list of invoices. - /// The link (url) to the next page of results. - internal InvoiceListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of invoices. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSection.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSection.Serialization.cs deleted file mode 100644 index 622378a90008..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSection.Serialization.cs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class InvoiceSection : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"); - writer.WriteStringValue(DisplayName); - } - if (Optional.IsCollectionDefined(Labels)) - { - writer.WritePropertyName("labels"); - writer.WriteStartObject(); - foreach (var item in Labels) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static InvoiceSection DeserializeInvoiceSection(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional displayName = default; - Optional> labels = default; - Optional state = default; - Optional systemId = default; - Optional targetCloud = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("displayName")) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("labels")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property1 in property0.Value.EnumerateObject()) - { - dictionary.Add(property1.Name, property1.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property0.NameEquals("state")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - state = new InvoiceSectionState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("systemId")) - { - systemId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("targetCloud")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - targetCloud = new TargetCloud(property0.Value.GetString()); - continue; - } - } - continue; - } - } - return new InvoiceSection(id.Value, name.Value, type.Value, displayName.Value, Optional.ToDictionary(labels), Optional.ToNullable(state), systemId.Value, Optional.ToNullable(targetCloud)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSection.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSection.cs deleted file mode 100644 index 96ed84daaee8..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSection.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// An invoice section. - public partial class InvoiceSection : Resource - { - /// Initializes a new instance of InvoiceSection. - public InvoiceSection() - { - Labels = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of InvoiceSection. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The name of the invoice section. - /// Dictionary of metadata associated with the invoice section. - /// Identifies the state of an invoice section. - /// The system generated unique identifier for an invoice section. - /// Identifies the cloud environments that are associated with an invoice section. This is a system managed optional field and gets updated as the invoice section gets associated with accounts in various clouds. - internal InvoiceSection(string id, string name, string type, string displayName, IDictionary labels, InvoiceSectionState? state, string systemId, TargetCloud? targetCloud) : base(id, name, type) - { - DisplayName = displayName; - Labels = labels; - State = state; - SystemId = systemId; - TargetCloud = targetCloud; - } - - /// The name of the invoice section. - public string DisplayName { get; set; } - /// Dictionary of metadata associated with the invoice section. - public IDictionary Labels { get; } - /// Identifies the state of an invoice section. - public InvoiceSectionState? State { get; } - /// The system generated unique identifier for an invoice section. - public string SystemId { get; } - /// Identifies the cloud environments that are associated with an invoice section. This is a system managed optional field and gets updated as the invoice section gets associated with accounts in various clouds. - public TargetCloud? TargetCloud { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionCreationRequest.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionCreationRequest.cs deleted file mode 100644 index f458ac8c0eb8..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionCreationRequest.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// The properties of the invoice section. - internal partial class InvoiceSectionCreationRequest - { - /// Initializes a new instance of InvoiceSectionCreationRequest. - internal InvoiceSectionCreationRequest() - { - } - - /// The name of the invoice section. - public string DisplayName { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionListResult.Serialization.cs deleted file mode 100644 index e363e0759956..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class InvoiceSectionListResult - { - internal static InvoiceSectionListResult DeserializeInvoiceSectionListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(InvoiceSection.DeserializeInvoiceSection(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new InvoiceSectionListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionListResult.cs deleted file mode 100644 index d9ebd9100fef..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The list of invoice sections. - public partial class InvoiceSectionListResult - { - /// Initializes a new instance of InvoiceSectionListResult. - internal InvoiceSectionListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of InvoiceSectionListResult. - /// The list of invoice sections. - /// The link (url) to the next page of results. - internal InvoiceSectionListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of invoice sections. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionListWithCreateSubPermissionResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionListWithCreateSubPermissionResult.Serialization.cs deleted file mode 100644 index 9fd6d0a992f2..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionListWithCreateSubPermissionResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class InvoiceSectionListWithCreateSubPermissionResult - { - internal static InvoiceSectionListWithCreateSubPermissionResult DeserializeInvoiceSectionListWithCreateSubPermissionResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(InvoiceSectionWithCreateSubPermission.DeserializeInvoiceSectionWithCreateSubPermission(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new InvoiceSectionListWithCreateSubPermissionResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionListWithCreateSubPermissionResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionListWithCreateSubPermissionResult.cs deleted file mode 100644 index 2590e3c44640..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionListWithCreateSubPermissionResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The list of invoice section properties with create subscription permission. - public partial class InvoiceSectionListWithCreateSubPermissionResult - { - /// Initializes a new instance of InvoiceSectionListWithCreateSubPermissionResult. - internal InvoiceSectionListWithCreateSubPermissionResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of InvoiceSectionListWithCreateSubPermissionResult. - /// The list of invoice section properties with create subscription permission. - /// The link (url) to the next page of results. - internal InvoiceSectionListWithCreateSubPermissionResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of invoice section properties with create subscription permission. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionState.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionState.cs deleted file mode 100644 index 39b3d4008834..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionState.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Identifies the state of an invoice section. - public readonly partial struct InvoiceSectionState : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public InvoiceSectionState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ActiveValue = "Active"; - private const string RestrictedValue = "Restricted"; - - /// Active. - public static InvoiceSectionState Active { get; } = new InvoiceSectionState(ActiveValue); - /// Restricted. - public static InvoiceSectionState Restricted { get; } = new InvoiceSectionState(RestrictedValue); - /// Determines if two values are the same. - public static bool operator ==(InvoiceSectionState left, InvoiceSectionState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(InvoiceSectionState left, InvoiceSectionState right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator InvoiceSectionState(string value) => new InvoiceSectionState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InvoiceSectionState other && Equals(other); - /// - public bool Equals(InvoiceSectionState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionWithCreateSubPermission.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionWithCreateSubPermission.Serialization.cs deleted file mode 100644 index dc869fa19c61..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionWithCreateSubPermission.Serialization.cs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class InvoiceSectionWithCreateSubPermission - { - internal static InvoiceSectionWithCreateSubPermission DeserializeInvoiceSectionWithCreateSubPermission(JsonElement element) - { - Optional invoiceSectionId = default; - Optional invoiceSectionDisplayName = default; - Optional invoiceSectionSystemId = default; - Optional billingProfileId = default; - Optional billingProfileDisplayName = default; - Optional billingProfileStatus = default; - Optional billingProfileStatusReasonCode = default; - Optional billingProfileSpendingLimit = default; - Optional billingProfileSystemId = default; - Optional> enabledAzurePlans = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("invoiceSectionId")) - { - invoiceSectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("invoiceSectionDisplayName")) - { - invoiceSectionDisplayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("invoiceSectionSystemId")) - { - invoiceSectionSystemId = property.Value.GetString(); - continue; - } - if (property.NameEquals("billingProfileId")) - { - billingProfileId = property.Value.GetString(); - continue; - } - if (property.NameEquals("billingProfileDisplayName")) - { - billingProfileDisplayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("billingProfileStatus")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - billingProfileStatus = new BillingProfileStatus(property.Value.GetString()); - continue; - } - if (property.NameEquals("billingProfileStatusReasonCode")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - billingProfileStatusReasonCode = new StatusReasonCodeForBillingProfile(property.Value.GetString()); - continue; - } - if (property.NameEquals("billingProfileSpendingLimit")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - billingProfileSpendingLimit = new SpendingLimitForBillingProfile(property.Value.GetString()); - continue; - } - if (property.NameEquals("billingProfileSystemId")) - { - billingProfileSystemId = property.Value.GetString(); - continue; - } - if (property.NameEquals("enabledAzurePlans")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AzurePlan.DeserializeAzurePlan(item)); - } - enabledAzurePlans = array; - continue; - } - } - return new InvoiceSectionWithCreateSubPermission(invoiceSectionId.Value, invoiceSectionDisplayName.Value, invoiceSectionSystemId.Value, billingProfileId.Value, billingProfileDisplayName.Value, Optional.ToNullable(billingProfileStatus), Optional.ToNullable(billingProfileStatusReasonCode), Optional.ToNullable(billingProfileSpendingLimit), billingProfileSystemId.Value, Optional.ToList(enabledAzurePlans)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionWithCreateSubPermission.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionWithCreateSubPermission.cs deleted file mode 100644 index ea1c489e25cd..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionWithCreateSubPermission.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Invoice section properties with create subscription permission. - public partial class InvoiceSectionWithCreateSubPermission - { - /// Initializes a new instance of InvoiceSectionWithCreateSubPermission. - internal InvoiceSectionWithCreateSubPermission() - { - EnabledAzurePlans = new ChangeTrackingList(); - } - - /// Initializes a new instance of InvoiceSectionWithCreateSubPermission. - /// The ID of the invoice section. - /// The name of the invoice section. - /// The system generated unique identifier for an invoice section. - /// The ID of the billing profile for the invoice section. - /// The name of the billing profile for the invoice section. - /// The status of the billing profile. - /// Reason for the specified billing profile status. - /// The billing profile spending limit. - /// The system generated unique identifier for a billing profile. - /// Enabled azure plans for the associated billing profile. - internal InvoiceSectionWithCreateSubPermission(string invoiceSectionId, string invoiceSectionDisplayName, string invoiceSectionSystemId, string billingProfileId, string billingProfileDisplayName, BillingProfileStatus? billingProfileStatus, StatusReasonCodeForBillingProfile? billingProfileStatusReasonCode, SpendingLimitForBillingProfile? billingProfileSpendingLimit, string billingProfileSystemId, IReadOnlyList enabledAzurePlans) - { - InvoiceSectionId = invoiceSectionId; - InvoiceSectionDisplayName = invoiceSectionDisplayName; - InvoiceSectionSystemId = invoiceSectionSystemId; - BillingProfileId = billingProfileId; - BillingProfileDisplayName = billingProfileDisplayName; - BillingProfileStatus = billingProfileStatus; - BillingProfileStatusReasonCode = billingProfileStatusReasonCode; - BillingProfileSpendingLimit = billingProfileSpendingLimit; - BillingProfileSystemId = billingProfileSystemId; - EnabledAzurePlans = enabledAzurePlans; - } - - /// The ID of the invoice section. - public string InvoiceSectionId { get; } - /// The name of the invoice section. - public string InvoiceSectionDisplayName { get; } - /// The system generated unique identifier for an invoice section. - public string InvoiceSectionSystemId { get; } - /// The ID of the billing profile for the invoice section. - public string BillingProfileId { get; } - /// The name of the billing profile for the invoice section. - public string BillingProfileDisplayName { get; } - /// The status of the billing profile. - public BillingProfileStatus? BillingProfileStatus { get; } - /// Reason for the specified billing profile status. - public StatusReasonCodeForBillingProfile? BillingProfileStatusReasonCode { get; } - /// The billing profile spending limit. - public SpendingLimitForBillingProfile? BillingProfileSpendingLimit { get; } - /// The system generated unique identifier for a billing profile. - public string BillingProfileSystemId { get; } - /// Enabled azure plans for the associated billing profile. - public IReadOnlyList EnabledAzurePlans { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionsOnExpand.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionsOnExpand.Serialization.cs deleted file mode 100644 index c48fd57292b2..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionsOnExpand.Serialization.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class InvoiceSectionsOnExpand : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsCollectionDefined(Value)) - { - writer.WritePropertyName("value"); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - } - - internal static InvoiceSectionsOnExpand DeserializeInvoiceSectionsOnExpand(JsonElement element) - { - Optional hasMoreResults = default; - Optional> value = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("hasMoreResults")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - hasMoreResults = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(InvoiceSection.DeserializeInvoiceSection(item)); - } - value = array; - continue; - } - } - return new InvoiceSectionsOnExpand(Optional.ToNullable(hasMoreResults), Optional.ToList(value)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionsOnExpand.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionsOnExpand.cs deleted file mode 100644 index 3343dfd90f2b..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceSectionsOnExpand.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The invoice sections associated to the billing profile. By default this is not populated, unless it's specified in $expand. - public partial class InvoiceSectionsOnExpand - { - /// Initializes a new instance of InvoiceSectionsOnExpand. - public InvoiceSectionsOnExpand() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of InvoiceSectionsOnExpand. - /// Indicates whether there are more invoice sections than the ones listed in this collection. The collection lists a maximum of 50 invoice sections. To get all invoice sections, use the list invoice sections API. - /// The invoice sections associated to the billing profile. - internal InvoiceSectionsOnExpand(bool? hasMoreResults, IList value) - { - HasMoreResults = hasMoreResults; - Value = value; - } - - /// Indicates whether there are more invoice sections than the ones listed in this collection. The collection lists a maximum of 50 invoice sections. To get all invoice sections, use the list invoice sections API. - public bool? HasMoreResults { get; } - /// The invoice sections associated to the billing profile. - public IList Value { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceStatus.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceStatus.cs deleted file mode 100644 index 5aba8ff93400..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceStatus.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The current status of the invoice. - public readonly partial struct InvoiceStatus : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public InvoiceStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string DueValue = "Due"; - private const string OverDueValue = "OverDue"; - private const string PaidValue = "Paid"; - private const string VoidValue = "Void"; - - /// Due. - public static InvoiceStatus Due { get; } = new InvoiceStatus(DueValue); - /// OverDue. - public static InvoiceStatus OverDue { get; } = new InvoiceStatus(OverDueValue); - /// Paid. - public static InvoiceStatus Paid { get; } = new InvoiceStatus(PaidValue); - /// Void. - public static InvoiceStatus Void { get; } = new InvoiceStatus(VoidValue); - /// Determines if two values are the same. - public static bool operator ==(InvoiceStatus left, InvoiceStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(InvoiceStatus left, InvoiceStatus right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator InvoiceStatus(string value) => new InvoiceStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InvoiceStatus other && Equals(other); - /// - public bool Equals(InvoiceStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceType.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceType.cs deleted file mode 100644 index 8b238802f605..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/InvoiceType.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Invoice type. - public readonly partial struct InvoiceType : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public InvoiceType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AzureServiceValue = "AzureService"; - private const string AzureMarketplaceValue = "AzureMarketplace"; - private const string AzureSupportValue = "AzureSupport"; - - /// AzureService. - public static InvoiceType AzureService { get; } = new InvoiceType(AzureServiceValue); - /// AzureMarketplace. - public static InvoiceType AzureMarketplace { get; } = new InvoiceType(AzureMarketplaceValue); - /// AzureSupport. - public static InvoiceType AzureSupport { get; } = new InvoiceType(AzureSupportValue); - /// Determines if two values are the same. - public static bool operator ==(InvoiceType left, InvoiceType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(InvoiceType left, InvoiceType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator InvoiceType(string value) => new InvoiceType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InvoiceType other && Equals(other); - /// - public bool Equals(InvoiceType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/MarketplacePurchasesPolicy.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/MarketplacePurchasesPolicy.cs deleted file mode 100644 index 573ad4a2d24b..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/MarketplacePurchasesPolicy.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The policy that controls whether Azure marketplace purchases are allowed for a billing profile. - public readonly partial struct MarketplacePurchasesPolicy : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public MarketplacePurchasesPolicy(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AllAllowedValue = "AllAllowed"; - private const string OnlyFreeAllowedValue = "OnlyFreeAllowed"; - private const string NotAllowedValue = "NotAllowed"; - - /// AllAllowed. - public static MarketplacePurchasesPolicy AllAllowed { get; } = new MarketplacePurchasesPolicy(AllAllowedValue); - /// OnlyFreeAllowed. - public static MarketplacePurchasesPolicy OnlyFreeAllowed { get; } = new MarketplacePurchasesPolicy(OnlyFreeAllowedValue); - /// NotAllowed. - public static MarketplacePurchasesPolicy NotAllowed { get; } = new MarketplacePurchasesPolicy(NotAllowedValue); - /// Determines if two values are the same. - public static bool operator ==(MarketplacePurchasesPolicy left, MarketplacePurchasesPolicy right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(MarketplacePurchasesPolicy left, MarketplacePurchasesPolicy right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator MarketplacePurchasesPolicy(string value) => new MarketplacePurchasesPolicy(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is MarketplacePurchasesPolicy other && Equals(other); - /// - public bool Equals(MarketplacePurchasesPolicy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Operation.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Operation.Serialization.cs deleted file mode 100644 index 80d46cc73341..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Operation.Serialization.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class Operation - { - internal static Operation DeserializeOperation(JsonElement element) - { - Optional name = default; - Optional display = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("display")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - display = OperationDisplay.DeserializeOperationDisplay(property.Value); - continue; - } - } - return new Operation(name.Value, display.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Operation.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Operation.cs deleted file mode 100644 index fb47764d9f67..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Operation.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// A Billing REST API operation. - public partial class Operation - { - /// Initializes a new instance of Operation. - internal Operation() - { - } - - /// Initializes a new instance of Operation. - /// Operation name: {provider}/{resource}/{operation}. - /// The object that represents the operation. - internal Operation(string name, OperationDisplay display) - { - Name = name; - Display = display; - } - - /// Operation name: {provider}/{resource}/{operation}. - public string Name { get; } - /// The object that represents the operation. - public OperationDisplay Display { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/OperationDisplay.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/OperationDisplay.Serialization.cs deleted file mode 100644 index 49749f5ba203..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/OperationDisplay.Serialization.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class OperationDisplay - { - internal static OperationDisplay DeserializeOperationDisplay(JsonElement element) - { - Optional provider = default; - Optional resource = default; - Optional operation = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("provider")) - { - provider = property.Value.GetString(); - continue; - } - if (property.NameEquals("resource")) - { - resource = property.Value.GetString(); - continue; - } - if (property.NameEquals("operation")) - { - operation = property.Value.GetString(); - continue; - } - } - return new OperationDisplay(provider.Value, resource.Value, operation.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/OperationDisplay.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/OperationDisplay.cs deleted file mode 100644 index df125d9dbb50..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/OperationDisplay.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// The object that represents the operation. - public partial class OperationDisplay - { - /// Initializes a new instance of OperationDisplay. - internal OperationDisplay() - { - } - - /// Initializes a new instance of OperationDisplay. - /// Service provider: Microsoft.Billing. - /// Resource on which the operation is performed such as invoice and billing subscription. - /// Operation type such as read, write and delete. - internal OperationDisplay(string provider, string resource, string operation) - { - Provider = provider; - Resource = resource; - Operation = operation; - } - - /// Service provider: Microsoft.Billing. - public string Provider { get; } - /// Resource on which the operation is performed such as invoice and billing subscription. - public string Resource { get; } - /// Operation type such as read, write and delete. - public string Operation { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/OperationListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/OperationListResult.Serialization.cs deleted file mode 100644 index 0970d10c973e..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/OperationListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class OperationListResult - { - internal static OperationListResult DeserializeOperationListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(Operation.DeserializeOperation(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new OperationListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/OperationListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/OperationListResult.cs deleted file mode 100644 index b6ce141956b0..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/OperationListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The list of billing operations and a URL link to get the next set of results. - public partial class OperationListResult - { - /// Initializes a new instance of OperationListResult. - internal OperationListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of OperationListResult. - /// The list of billing operations supported by the Microsoft.Billing resource provider. - /// URL to get the next set of operation list results if there are any. - internal OperationListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of billing operations supported by the Microsoft.Billing resource provider. - public IReadOnlyList Value { get; } - /// URL to get the next set of operation list results if there are any. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Participants.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Participants.Serialization.cs deleted file mode 100644 index 16111b0d617c..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Participants.Serialization.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class Participants : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WriteEndObject(); - } - - internal static Participants DeserializeParticipants(JsonElement element) - { - Optional status = default; - Optional statusDate = default; - Optional email = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("status")) - { - status = property.Value.GetString(); - continue; - } - if (property.NameEquals("statusDate")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - statusDate = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("email")) - { - email = property.Value.GetString(); - continue; - } - } - return new Participants(status.Value, Optional.ToNullable(statusDate), email.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Participants.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Participants.cs deleted file mode 100644 index cb4bcaa8b80a..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Participants.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The details about a participant. - public partial class Participants - { - /// Initializes a new instance of Participants. - public Participants() - { - } - - /// Initializes a new instance of Participants. - /// The acceptance status of the participant. - /// The date when the status got changed. - /// The email address of the participant. - internal Participants(string status, DateTimeOffset? statusDate, string email) - { - Status = status; - StatusDate = statusDate; - Email = email; - } - - /// The acceptance status of the participant. - public string Status { get; } - /// The date when the status got changed. - public DateTimeOffset? StatusDate { get; } - /// The email address of the participant. - public string Email { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/PaymentMethodFamily.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/PaymentMethodFamily.cs deleted file mode 100644 index 01c77903b40e..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/PaymentMethodFamily.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The family of payment method. - public readonly partial struct PaymentMethodFamily : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public PaymentMethodFamily(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string CreditsValue = "Credits"; - private const string CheckWireValue = "CheckWire"; - private const string CreditCardValue = "CreditCard"; - private const string NoneValue = "None"; - - /// Credits. - public static PaymentMethodFamily Credits { get; } = new PaymentMethodFamily(CreditsValue); - /// CheckWire. - public static PaymentMethodFamily CheckWire { get; } = new PaymentMethodFamily(CheckWireValue); - /// CreditCard. - public static PaymentMethodFamily CreditCard { get; } = new PaymentMethodFamily(CreditCardValue); - /// None. - public static PaymentMethodFamily None { get; } = new PaymentMethodFamily(NoneValue); - /// Determines if two values are the same. - public static bool operator ==(PaymentMethodFamily left, PaymentMethodFamily right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(PaymentMethodFamily left, PaymentMethodFamily right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator PaymentMethodFamily(string value) => new PaymentMethodFamily(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is PaymentMethodFamily other && Equals(other); - /// - public bool Equals(PaymentMethodFamily other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/PaymentProperties.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/PaymentProperties.Serialization.cs deleted file mode 100644 index e80fd491f207..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/PaymentProperties.Serialization.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class PaymentProperties - { - internal static PaymentProperties DeserializePaymentProperties(JsonElement element) - { - Optional paymentType = default; - Optional amount = default; - Optional date = default; - Optional paymentMethodFamily = default; - Optional paymentMethodType = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("paymentType")) - { - paymentType = property.Value.GetString(); - continue; - } - if (property.NameEquals("amount")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - amount = Amount.DeserializeAmount(property.Value); - continue; - } - if (property.NameEquals("date")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - date = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("paymentMethodFamily")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - paymentMethodFamily = new PaymentMethodFamily(property.Value.GetString()); - continue; - } - if (property.NameEquals("paymentMethodType")) - { - paymentMethodType = property.Value.GetString(); - continue; - } - } - return new PaymentProperties(paymentType.Value, amount.Value, Optional.ToNullable(date), Optional.ToNullable(paymentMethodFamily), paymentMethodType.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/PaymentProperties.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/PaymentProperties.cs deleted file mode 100644 index ae57ba8ca22d..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/PaymentProperties.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The properties of a payment. - public partial class PaymentProperties - { - /// Initializes a new instance of PaymentProperties. - internal PaymentProperties() - { - } - - /// Initializes a new instance of PaymentProperties. - /// The type of payment. - /// The paid amount. - /// The date when the payment was made. - /// The family of payment method. - /// The type of payment method. - internal PaymentProperties(string paymentType, Amount amount, DateTimeOffset? date, PaymentMethodFamily? paymentMethodFamily, string paymentMethodType) - { - PaymentType = paymentType; - Amount = amount; - Date = date; - PaymentMethodFamily = paymentMethodFamily; - PaymentMethodType = paymentMethodType; - } - - /// The type of payment. - public string PaymentType { get; } - /// The paid amount. - public Amount Amount { get; } - /// The date when the payment was made. - public DateTimeOffset? Date { get; } - /// The family of payment method. - public PaymentMethodFamily? PaymentMethodFamily { get; } - /// The type of payment method. - public string PaymentMethodType { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Policy.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Policy.Serialization.cs deleted file mode 100644 index 6ef4d4db6293..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Policy.Serialization.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class Policy : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(MarketplacePurchases)) - { - writer.WritePropertyName("marketplacePurchases"); - writer.WriteStringValue(MarketplacePurchases.Value.ToString()); - } - if (Optional.IsDefined(ReservationPurchases)) - { - writer.WritePropertyName("reservationPurchases"); - writer.WriteStringValue(ReservationPurchases.Value.ToString()); - } - if (Optional.IsDefined(ViewCharges)) - { - writer.WritePropertyName("viewCharges"); - writer.WriteStringValue(ViewCharges.Value.ToString()); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static Policy DeserializePolicy(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional marketplacePurchases = default; - Optional reservationPurchases = default; - Optional viewCharges = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("marketplacePurchases")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - marketplacePurchases = new MarketplacePurchasesPolicy(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("reservationPurchases")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - reservationPurchases = new ReservationPurchasesPolicy(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("viewCharges")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - viewCharges = new ViewChargesPolicy(property0.Value.GetString()); - continue; - } - } - continue; - } - } - return new Policy(id.Value, name.Value, type.Value, Optional.ToNullable(marketplacePurchases), Optional.ToNullable(reservationPurchases), Optional.ToNullable(viewCharges)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Policy.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Policy.cs deleted file mode 100644 index 6307e6437de6..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Policy.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// A policy. - public partial class Policy : Resource - { - /// Initializes a new instance of Policy. - public Policy() - { - } - - /// Initializes a new instance of Policy. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The policy that controls whether Azure marketplace purchases are allowed for a billing profile. - /// The policy that controls whether Azure reservation purchases are allowed for a billing profile. - /// The policy that controls whether users with Azure RBAC access to a subscription can view its charges. - internal Policy(string id, string name, string type, MarketplacePurchasesPolicy? marketplacePurchases, ReservationPurchasesPolicy? reservationPurchases, ViewChargesPolicy? viewCharges) : base(id, name, type) - { - MarketplacePurchases = marketplacePurchases; - ReservationPurchases = reservationPurchases; - ViewCharges = viewCharges; - } - - /// The policy that controls whether Azure marketplace purchases are allowed for a billing profile. - public MarketplacePurchasesPolicy? MarketplacePurchases { get; set; } - /// The policy that controls whether Azure reservation purchases are allowed for a billing profile. - public ReservationPurchasesPolicy? ReservationPurchases { get; set; } - /// The policy that controls whether users with Azure RBAC access to a subscription can view its charges. - public ViewChargesPolicy? ViewCharges { get; set; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Product.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Product.Serialization.cs deleted file mode 100644 index 91f91f7525ed..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Product.Serialization.cs +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class Product : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(AutoRenew)) - { - writer.WritePropertyName("autoRenew"); - writer.WriteStringValue(AutoRenew.Value.ToString()); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"); - writer.WriteStringValue(Status.Value.ToString()); - } - if (Optional.IsDefined(BillingFrequency)) - { - writer.WritePropertyName("billingFrequency"); - writer.WriteStringValue(BillingFrequency.Value.ToString()); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static Product DeserializeProduct(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional autoRenew = default; - Optional displayName = default; - Optional purchaseDate = default; - Optional productTypeId = default; - Optional productType = default; - Optional status = default; - Optional endDate = default; - Optional billingFrequency = default; - Optional lastCharge = default; - Optional lastChargeDate = default; - Optional quantity = default; - Optional skuId = default; - Optional skuDescription = default; - Optional tenantId = default; - Optional availabilityId = default; - Optional invoiceSectionId = default; - Optional invoiceSectionDisplayName = default; - Optional billingProfileId = default; - Optional billingProfileDisplayName = default; - Optional customerId = default; - Optional customerDisplayName = default; - Optional reseller = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("autoRenew")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - autoRenew = new AutoRenew(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("displayName")) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("purchaseDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - purchaseDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("productTypeId")) - { - productTypeId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("productType")) - { - productType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("status")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - status = new ProductStatusType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("endDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - endDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("billingFrequency")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - billingFrequency = new BillingFrequency(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("lastCharge")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - lastCharge = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("lastChargeDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - lastChargeDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("quantity")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - quantity = property0.Value.GetSingle(); - continue; - } - if (property0.NameEquals("skuId")) - { - skuId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("skuDescription")) - { - skuDescription = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("tenantId")) - { - tenantId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("availabilityId")) - { - availabilityId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("invoiceSectionId")) - { - invoiceSectionId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("invoiceSectionDisplayName")) - { - invoiceSectionDisplayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("billingProfileId")) - { - billingProfileId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("billingProfileDisplayName")) - { - billingProfileDisplayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("customerId")) - { - customerId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("customerDisplayName")) - { - customerDisplayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("reseller")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - reseller = Reseller.DeserializeReseller(property0.Value); - continue; - } - } - continue; - } - } - return new Product(id.Value, name.Value, type.Value, Optional.ToNullable(autoRenew), displayName.Value, Optional.ToNullable(purchaseDate), productTypeId.Value, productType.Value, Optional.ToNullable(status), Optional.ToNullable(endDate), Optional.ToNullable(billingFrequency), lastCharge.Value, Optional.ToNullable(lastChargeDate), Optional.ToNullable(quantity), skuId.Value, skuDescription.Value, tenantId.Value, availabilityId.Value, invoiceSectionId.Value, invoiceSectionDisplayName.Value, billingProfileId.Value, billingProfileDisplayName.Value, customerId.Value, customerDisplayName.Value, reseller.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Product.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Product.cs deleted file mode 100644 index 8e75718f5b40..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Product.cs +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Billing.Models -{ - /// A product. - public partial class Product : Resource - { - /// Initializes a new instance of Product. - public Product() - { - } - - /// Initializes a new instance of Product. - /// Resource Id. - /// Resource name. - /// Resource type. - /// Indicates whether auto renewal is turned on or off for a product. - /// The display name of the product. - /// The date when the product was purchased. - /// The ID of the type of product. - /// The description of the type of product. - /// The current status of the product. - /// The date when the product will be renewed or canceled. - /// The frequency at which the product will be billed. - /// The last month charges. - /// The date of the last charge. - /// The quantity purchased for the product. - /// The sku ID of the product. - /// The sku description of the product. - /// The id of the tenant in which the product is used. - /// The availability of the product. - /// The ID of the invoice section to which the product is billed. - /// The name of the invoice section to which the product is billed. - /// The ID of the billing profile to which the product is billed. - /// The name of the billing profile to which the product is billed. - /// The ID of the customer for whom the product was purchased. The field is applicable only for Microsoft Partner Agreement billing account. - /// The name of the customer for whom the product was purchased. The field is applicable only for Microsoft Partner Agreement billing account. - /// Reseller for this product. - internal Product(string id, string name, string type, AutoRenew? autoRenew, string displayName, DateTimeOffset? purchaseDate, string productTypeId, string productType, ProductStatusType? status, DateTimeOffset? endDate, BillingFrequency? billingFrequency, Amount lastCharge, DateTimeOffset? lastChargeDate, float? quantity, string skuId, string skuDescription, string tenantId, string availabilityId, string invoiceSectionId, string invoiceSectionDisplayName, string billingProfileId, string billingProfileDisplayName, string customerId, string customerDisplayName, Reseller reseller) : base(id, name, type) - { - AutoRenew = autoRenew; - DisplayName = displayName; - PurchaseDate = purchaseDate; - ProductTypeId = productTypeId; - ProductType = productType; - Status = status; - EndDate = endDate; - BillingFrequency = billingFrequency; - LastCharge = lastCharge; - LastChargeDate = lastChargeDate; - Quantity = quantity; - SkuId = skuId; - SkuDescription = skuDescription; - TenantId = tenantId; - AvailabilityId = availabilityId; - InvoiceSectionId = invoiceSectionId; - InvoiceSectionDisplayName = invoiceSectionDisplayName; - BillingProfileId = billingProfileId; - BillingProfileDisplayName = billingProfileDisplayName; - CustomerId = customerId; - CustomerDisplayName = customerDisplayName; - Reseller = reseller; - } - - /// Indicates whether auto renewal is turned on or off for a product. - public AutoRenew? AutoRenew { get; set; } - /// The display name of the product. - public string DisplayName { get; } - /// The date when the product was purchased. - public DateTimeOffset? PurchaseDate { get; } - /// The ID of the type of product. - public string ProductTypeId { get; } - /// The description of the type of product. - public string ProductType { get; } - /// The current status of the product. - public ProductStatusType? Status { get; set; } - /// The date when the product will be renewed or canceled. - public DateTimeOffset? EndDate { get; } - /// The frequency at which the product will be billed. - public BillingFrequency? BillingFrequency { get; set; } - /// The last month charges. - public Amount LastCharge { get; } - /// The date of the last charge. - public DateTimeOffset? LastChargeDate { get; } - /// The quantity purchased for the product. - public float? Quantity { get; } - /// The sku ID of the product. - public string SkuId { get; } - /// The sku description of the product. - public string SkuDescription { get; } - /// The id of the tenant in which the product is used. - public string TenantId { get; } - /// The availability of the product. - public string AvailabilityId { get; } - /// The ID of the invoice section to which the product is billed. - public string InvoiceSectionId { get; } - /// The name of the invoice section to which the product is billed. - public string InvoiceSectionDisplayName { get; } - /// The ID of the billing profile to which the product is billed. - public string BillingProfileId { get; } - /// The name of the billing profile to which the product is billed. - public string BillingProfileDisplayName { get; } - /// The ID of the customer for whom the product was purchased. The field is applicable only for Microsoft Partner Agreement billing account. - public string CustomerId { get; } - /// The name of the customer for whom the product was purchased. The field is applicable only for Microsoft Partner Agreement billing account. - public string CustomerDisplayName { get; } - /// Reseller for this product. - public Reseller Reseller { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ProductStatusType.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ProductStatusType.cs deleted file mode 100644 index f5cc4cb082de..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ProductStatusType.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The current status of the product. - public readonly partial struct ProductStatusType : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public ProductStatusType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ActiveValue = "Active"; - private const string InactiveValue = "Inactive"; - private const string PastDueValue = "PastDue"; - private const string ExpiringValue = "Expiring"; - private const string ExpiredValue = "Expired"; - private const string DisabledValue = "Disabled"; - private const string CancelledValue = "Cancelled"; - private const string AutoRenewValue = "AutoRenew"; - - /// Active. - public static ProductStatusType Active { get; } = new ProductStatusType(ActiveValue); - /// Inactive. - public static ProductStatusType Inactive { get; } = new ProductStatusType(InactiveValue); - /// PastDue. - public static ProductStatusType PastDue { get; } = new ProductStatusType(PastDueValue); - /// Expiring. - public static ProductStatusType Expiring { get; } = new ProductStatusType(ExpiringValue); - /// Expired. - public static ProductStatusType Expired { get; } = new ProductStatusType(ExpiredValue); - /// Disabled. - public static ProductStatusType Disabled { get; } = new ProductStatusType(DisabledValue); - /// Cancelled. - public static ProductStatusType Cancelled { get; } = new ProductStatusType(CancelledValue); - /// AutoRenew. - public static ProductStatusType AutoRenew { get; } = new ProductStatusType(AutoRenewValue); - /// Determines if two values are the same. - public static bool operator ==(ProductStatusType left, ProductStatusType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ProductStatusType left, ProductStatusType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator ProductStatusType(string value) => new ProductStatusType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ProductStatusType other && Equals(other); - /// - public bool Equals(ProductStatusType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ProductTransferValidationErrorCode.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ProductTransferValidationErrorCode.cs deleted file mode 100644 index bdec9c758dad..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ProductTransferValidationErrorCode.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Error code of the transfer validation response. - public readonly partial struct ProductTransferValidationErrorCode : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public ProductTransferValidationErrorCode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string InvalidSourceValue = "InvalidSource"; - private const string ProductNotActiveValue = "ProductNotActive"; - private const string InsufficientPermissionOnSourceValue = "InsufficientPermissionOnSource"; - private const string InsufficientPermissionOnDestinationValue = "InsufficientPermissionOnDestination"; - private const string DestinationBillingProfilePastDueValue = "DestinationBillingProfilePastDue"; - private const string ProductTypeNotSupportedValue = "ProductTypeNotSupported"; - private const string CrossBillingAccountNotAllowedValue = "CrossBillingAccountNotAllowed"; - private const string NotAvailableForDestinationMarketValue = "NotAvailableForDestinationMarket"; - private const string OneTimePurchaseProductTransferNotAllowedValue = "OneTimePurchaseProductTransferNotAllowed"; - - /// InvalidSource. - public static ProductTransferValidationErrorCode InvalidSource { get; } = new ProductTransferValidationErrorCode(InvalidSourceValue); - /// ProductNotActive. - public static ProductTransferValidationErrorCode ProductNotActive { get; } = new ProductTransferValidationErrorCode(ProductNotActiveValue); - /// InsufficientPermissionOnSource. - public static ProductTransferValidationErrorCode InsufficientPermissionOnSource { get; } = new ProductTransferValidationErrorCode(InsufficientPermissionOnSourceValue); - /// InsufficientPermissionOnDestination. - public static ProductTransferValidationErrorCode InsufficientPermissionOnDestination { get; } = new ProductTransferValidationErrorCode(InsufficientPermissionOnDestinationValue); - /// DestinationBillingProfilePastDue. - public static ProductTransferValidationErrorCode DestinationBillingProfilePastDue { get; } = new ProductTransferValidationErrorCode(DestinationBillingProfilePastDueValue); - /// ProductTypeNotSupported. - public static ProductTransferValidationErrorCode ProductTypeNotSupported { get; } = new ProductTransferValidationErrorCode(ProductTypeNotSupportedValue); - /// CrossBillingAccountNotAllowed. - public static ProductTransferValidationErrorCode CrossBillingAccountNotAllowed { get; } = new ProductTransferValidationErrorCode(CrossBillingAccountNotAllowedValue); - /// NotAvailableForDestinationMarket. - public static ProductTransferValidationErrorCode NotAvailableForDestinationMarket { get; } = new ProductTransferValidationErrorCode(NotAvailableForDestinationMarketValue); - /// OneTimePurchaseProductTransferNotAllowed. - public static ProductTransferValidationErrorCode OneTimePurchaseProductTransferNotAllowed { get; } = new ProductTransferValidationErrorCode(OneTimePurchaseProductTransferNotAllowedValue); - /// Determines if two values are the same. - public static bool operator ==(ProductTransferValidationErrorCode left, ProductTransferValidationErrorCode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ProductTransferValidationErrorCode left, ProductTransferValidationErrorCode right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator ProductTransferValidationErrorCode(string value) => new ProductTransferValidationErrorCode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ProductTransferValidationErrorCode other && Equals(other); - /// - public bool Equals(ProductTransferValidationErrorCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ProductsListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ProductsListResult.Serialization.cs deleted file mode 100644 index b5a4839c4788..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ProductsListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class ProductsListResult - { - internal static ProductsListResult DeserializeProductsListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(Product.DeserializeProduct(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new ProductsListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ProductsListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ProductsListResult.cs deleted file mode 100644 index d63a52926029..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ProductsListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The list of products. It contains a list of available product summaries in reverse chronological order by purchase date. - public partial class ProductsListResult - { - /// Initializes a new instance of ProductsListResult. - internal ProductsListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of ProductsListResult. - /// The list of products. - /// The link (url) to the next page of results. - internal ProductsListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of products. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/RebillDetails.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/RebillDetails.Serialization.cs deleted file mode 100644 index 67e8f4dc95a1..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/RebillDetails.Serialization.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class RebillDetails - { - internal static RebillDetails DeserializeRebillDetails(JsonElement element) - { - Optional creditNoteDocumentId = default; - Optional invoiceDocumentId = default; - Optional> rebillDetails = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("creditNoteDocumentId")) - { - creditNoteDocumentId = property.Value.GetString(); - continue; - } - if (property.NameEquals("invoiceDocumentId")) - { - invoiceDocumentId = property.Value.GetString(); - continue; - } - if (property.NameEquals("rebillDetails")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, DeserializeRebillDetails(property0.Value)); - } - rebillDetails = dictionary; - continue; - } - } - return new RebillDetails(creditNoteDocumentId.Value, invoiceDocumentId.Value, Optional.ToDictionary(rebillDetails)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/RebillDetails.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/RebillDetails.cs deleted file mode 100644 index 71f2d6d953b9..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/RebillDetails.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The rebill details of an invoice. - public partial class RebillDetails - { - /// Initializes a new instance of RebillDetails. - internal RebillDetails() - { - RebillDetailsValue = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of RebillDetails. - /// The ID of credit note. - /// The ID of invoice. - /// Rebill details for an invoice. - internal RebillDetails(string creditNoteDocumentId, string invoiceDocumentId, IReadOnlyDictionary rebillDetailsValue) - { - CreditNoteDocumentId = creditNoteDocumentId; - InvoiceDocumentId = invoiceDocumentId; - RebillDetailsValue = rebillDetailsValue; - } - - /// The ID of credit note. - public string CreditNoteDocumentId { get; } - /// The ID of invoice. - public string InvoiceDocumentId { get; } - /// Rebill details for an invoice. - public IReadOnlyDictionary RebillDetailsValue { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Reseller.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Reseller.Serialization.cs deleted file mode 100644 index 125e9e1f4e6e..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Reseller.Serialization.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class Reseller : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WriteEndObject(); - } - - internal static Reseller DeserializeReseller(JsonElement element) - { - Optional resellerId = default; - Optional description = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resellerId")) - { - resellerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("description")) - { - description = property.Value.GetString(); - continue; - } - } - return new Reseller(resellerId.Value, description.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Reseller.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Reseller.cs deleted file mode 100644 index eac87ededbff..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Reseller.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// Details of the reseller. - public partial class Reseller - { - /// Initializes a new instance of Reseller. - public Reseller() - { - } - - /// Initializes a new instance of Reseller. - /// The MPN ID of the reseller. - /// The name of the reseller. - internal Reseller(string resellerId, string description) - { - ResellerId = resellerId; - Description = description; - } - - /// The MPN ID of the reseller. - public string ResellerId { get; } - /// The name of the reseller. - public string Description { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ReservationPurchasesPolicy.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ReservationPurchasesPolicy.cs deleted file mode 100644 index 6bee0092aa8f..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ReservationPurchasesPolicy.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The policy that controls whether Azure reservation purchases are allowed for a billing profile. - public readonly partial struct ReservationPurchasesPolicy : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public ReservationPurchasesPolicy(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AllowedValue = "Allowed"; - private const string NotAllowedValue = "NotAllowed"; - - /// Allowed. - public static ReservationPurchasesPolicy Allowed { get; } = new ReservationPurchasesPolicy(AllowedValue); - /// NotAllowed. - public static ReservationPurchasesPolicy NotAllowed { get; } = new ReservationPurchasesPolicy(NotAllowedValue); - /// Determines if two values are the same. - public static bool operator ==(ReservationPurchasesPolicy left, ReservationPurchasesPolicy right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ReservationPurchasesPolicy left, ReservationPurchasesPolicy right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator ReservationPurchasesPolicy(string value) => new ReservationPurchasesPolicy(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ReservationPurchasesPolicy other && Equals(other); - /// - public bool Equals(ReservationPurchasesPolicy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ReservationType.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ReservationType.cs deleted file mode 100644 index de488d329046..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ReservationType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The type of transaction. - public readonly partial struct ReservationType : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public ReservationType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string PurchaseValue = "Purchase"; - private const string UsageChargeValue = "Usage Charge"; - - /// Purchase. - public static ReservationType Purchase { get; } = new ReservationType(PurchaseValue); - /// Usage Charge. - public static ReservationType UsageCharge { get; } = new ReservationType(UsageChargeValue); - /// Determines if two values are the same. - public static bool operator ==(ReservationType left, ReservationType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ReservationType left, ReservationType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator ReservationType(string value) => new ReservationType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ReservationType other && Equals(other); - /// - public bool Equals(ReservationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Resource.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Resource.Serialization.cs deleted file mode 100644 index bf63d9e519c8..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Resource.Serialization.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class Resource : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WriteEndObject(); - } - - internal static Resource DeserializeResource(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - } - return new Resource(id.Value, name.Value, type.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Resource.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Resource.cs deleted file mode 100644 index b717abf894b3..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Resource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// The Resource model definition. - public partial class Resource - { - /// Initializes a new instance of Resource. - public Resource() - { - } - - /// Initializes a new instance of Resource. - /// Resource Id. - /// Resource name. - /// Resource type. - internal Resource(string id, string name, string type) - { - Id = id; - Name = name; - Type = type; - } - - /// Resource Id. - public string Id { get; } - /// Resource name. - public string Name { get; } - /// Resource type. - public string Type { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/SpendingLimit.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/SpendingLimit.cs deleted file mode 100644 index a6d7f64f88f1..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/SpendingLimit.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The billing profile spending limit. - public readonly partial struct SpendingLimit : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public SpendingLimit(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string OffValue = "Off"; - private const string OnValue = "On"; - - /// Off. - public static SpendingLimit Off { get; } = new SpendingLimit(OffValue); - /// On. - public static SpendingLimit On { get; } = new SpendingLimit(OnValue); - /// Determines if two values are the same. - public static bool operator ==(SpendingLimit left, SpendingLimit right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(SpendingLimit left, SpendingLimit right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator SpendingLimit(string value) => new SpendingLimit(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is SpendingLimit other && Equals(other); - /// - public bool Equals(SpendingLimit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/SpendingLimitForBillingProfile.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/SpendingLimitForBillingProfile.cs deleted file mode 100644 index 9a343fec45e7..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/SpendingLimitForBillingProfile.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The billing profile spending limit. - public readonly partial struct SpendingLimitForBillingProfile : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public SpendingLimitForBillingProfile(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string OffValue = "Off"; - private const string OnValue = "On"; - - /// Off. - public static SpendingLimitForBillingProfile Off { get; } = new SpendingLimitForBillingProfile(OffValue); - /// On. - public static SpendingLimitForBillingProfile On { get; } = new SpendingLimitForBillingProfile(OnValue); - /// Determines if two values are the same. - public static bool operator ==(SpendingLimitForBillingProfile left, SpendingLimitForBillingProfile right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(SpendingLimitForBillingProfile left, SpendingLimitForBillingProfile right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator SpendingLimitForBillingProfile(string value) => new SpendingLimitForBillingProfile(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is SpendingLimitForBillingProfile other && Equals(other); - /// - public bool Equals(SpendingLimitForBillingProfile other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/StatusReasonCode.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/StatusReasonCode.cs deleted file mode 100644 index 0c87484c9e06..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/StatusReasonCode.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Reason for the specified billing profile status. - public readonly partial struct StatusReasonCode : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public StatusReasonCode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string PastDueValue = "PastDue"; - private const string SpendingLimitReachedValue = "SpendingLimitReached"; - private const string SpendingLimitExpiredValue = "SpendingLimitExpired"; - - /// PastDue. - public static StatusReasonCode PastDue { get; } = new StatusReasonCode(PastDueValue); - /// SpendingLimitReached. - public static StatusReasonCode SpendingLimitReached { get; } = new StatusReasonCode(SpendingLimitReachedValue); - /// SpendingLimitExpired. - public static StatusReasonCode SpendingLimitExpired { get; } = new StatusReasonCode(SpendingLimitExpiredValue); - /// Determines if two values are the same. - public static bool operator ==(StatusReasonCode left, StatusReasonCode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(StatusReasonCode left, StatusReasonCode right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator StatusReasonCode(string value) => new StatusReasonCode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is StatusReasonCode other && Equals(other); - /// - public bool Equals(StatusReasonCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/StatusReasonCodeForBillingProfile.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/StatusReasonCodeForBillingProfile.cs deleted file mode 100644 index 98a8065f6e28..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/StatusReasonCodeForBillingProfile.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Reason for the specified billing profile status. - public readonly partial struct StatusReasonCodeForBillingProfile : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public StatusReasonCodeForBillingProfile(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string PastDueValue = "PastDue"; - private const string SpendingLimitReachedValue = "SpendingLimitReached"; - private const string SpendingLimitExpiredValue = "SpendingLimitExpired"; - - /// PastDue. - public static StatusReasonCodeForBillingProfile PastDue { get; } = new StatusReasonCodeForBillingProfile(PastDueValue); - /// SpendingLimitReached. - public static StatusReasonCodeForBillingProfile SpendingLimitReached { get; } = new StatusReasonCodeForBillingProfile(SpendingLimitReachedValue); - /// SpendingLimitExpired. - public static StatusReasonCodeForBillingProfile SpendingLimitExpired { get; } = new StatusReasonCodeForBillingProfile(SpendingLimitExpiredValue); - /// Determines if two values are the same. - public static bool operator ==(StatusReasonCodeForBillingProfile left, StatusReasonCodeForBillingProfile right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(StatusReasonCodeForBillingProfile left, StatusReasonCodeForBillingProfile right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator StatusReasonCodeForBillingProfile(string value) => new StatusReasonCodeForBillingProfile(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is StatusReasonCodeForBillingProfile other && Equals(other); - /// - public bool Equals(StatusReasonCodeForBillingProfile other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/SubscriptionTransferValidationErrorCode.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/SubscriptionTransferValidationErrorCode.cs deleted file mode 100644 index 9fe529da1803..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/SubscriptionTransferValidationErrorCode.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Error code of the transfer validation response. - public readonly partial struct SubscriptionTransferValidationErrorCode : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public SubscriptionTransferValidationErrorCode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string InvalidSourceValue = "InvalidSource"; - private const string SubscriptionNotActiveValue = "SubscriptionNotActive"; - private const string InsufficientPermissionOnSourceValue = "InsufficientPermissionOnSource"; - private const string InsufficientPermissionOnDestinationValue = "InsufficientPermissionOnDestination"; - private const string DestinationBillingProfilePastDueValue = "DestinationBillingProfilePastDue"; - private const string SubscriptionTypeNotSupportedValue = "SubscriptionTypeNotSupported"; - private const string CrossBillingAccountNotAllowedValue = "CrossBillingAccountNotAllowed"; - private const string NotAvailableForDestinationMarketValue = "NotAvailableForDestinationMarket"; - - /// InvalidSource. - public static SubscriptionTransferValidationErrorCode InvalidSource { get; } = new SubscriptionTransferValidationErrorCode(InvalidSourceValue); - /// SubscriptionNotActive. - public static SubscriptionTransferValidationErrorCode SubscriptionNotActive { get; } = new SubscriptionTransferValidationErrorCode(SubscriptionNotActiveValue); - /// InsufficientPermissionOnSource. - public static SubscriptionTransferValidationErrorCode InsufficientPermissionOnSource { get; } = new SubscriptionTransferValidationErrorCode(InsufficientPermissionOnSourceValue); - /// InsufficientPermissionOnDestination. - public static SubscriptionTransferValidationErrorCode InsufficientPermissionOnDestination { get; } = new SubscriptionTransferValidationErrorCode(InsufficientPermissionOnDestinationValue); - /// DestinationBillingProfilePastDue. - public static SubscriptionTransferValidationErrorCode DestinationBillingProfilePastDue { get; } = new SubscriptionTransferValidationErrorCode(DestinationBillingProfilePastDueValue); - /// SubscriptionTypeNotSupported. - public static SubscriptionTransferValidationErrorCode SubscriptionTypeNotSupported { get; } = new SubscriptionTransferValidationErrorCode(SubscriptionTypeNotSupportedValue); - /// CrossBillingAccountNotAllowed. - public static SubscriptionTransferValidationErrorCode CrossBillingAccountNotAllowed { get; } = new SubscriptionTransferValidationErrorCode(CrossBillingAccountNotAllowedValue); - /// NotAvailableForDestinationMarket. - public static SubscriptionTransferValidationErrorCode NotAvailableForDestinationMarket { get; } = new SubscriptionTransferValidationErrorCode(NotAvailableForDestinationMarketValue); - /// Determines if two values are the same. - public static bool operator ==(SubscriptionTransferValidationErrorCode left, SubscriptionTransferValidationErrorCode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(SubscriptionTransferValidationErrorCode left, SubscriptionTransferValidationErrorCode right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator SubscriptionTransferValidationErrorCode(string value) => new SubscriptionTransferValidationErrorCode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is SubscriptionTransferValidationErrorCode other && Equals(other); - /// - public bool Equals(SubscriptionTransferValidationErrorCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TargetCloud.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TargetCloud.cs deleted file mode 100644 index bda79ee862ab..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TargetCloud.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Possible cloud environments. - public readonly partial struct TargetCloud : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public TargetCloud(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string USGovValue = "USGov"; - private const string USNatValue = "USNat"; - private const string USSecValue = "USSec"; - - /// USGov. - public static TargetCloud USGov { get; } = new TargetCloud(USGovValue); - /// USNat. - public static TargetCloud USNat { get; } = new TargetCloud(USNatValue); - /// USSec. - public static TargetCloud USSec { get; } = new TargetCloud(USSecValue); - /// Determines if two values are the same. - public static bool operator ==(TargetCloud left, TargetCloud right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(TargetCloud left, TargetCloud right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator TargetCloud(string value) => new TargetCloud(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is TargetCloud other && Equals(other); - /// - public bool Equals(TargetCloud other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Transaction.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Transaction.Serialization.cs deleted file mode 100644 index 49fa2b2c8a48..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Transaction.Serialization.cs +++ /dev/null @@ -1,364 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class Transaction : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(Kind)) - { - writer.WritePropertyName("kind"); - writer.WriteStringValue(Kind.Value.ToString()); - } - if (Optional.IsDefined(TransactionType)) - { - writer.WritePropertyName("transactionType"); - writer.WriteStringValue(TransactionType.Value.ToString()); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static Transaction DeserializeTransaction(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional kind = default; - Optional date = default; - Optional invoice = default; - Optional invoiceId = default; - Optional orderId = default; - Optional orderName = default; - Optional productFamily = default; - Optional productTypeId = default; - Optional productType = default; - Optional productDescription = default; - Optional transactionType = default; - Optional transactionAmount = default; - Optional quantity = default; - Optional invoiceSectionId = default; - Optional invoiceSectionDisplayName = default; - Optional billingProfileId = default; - Optional billingProfileDisplayName = default; - Optional customerId = default; - Optional customerDisplayName = default; - Optional subscriptionId = default; - Optional subscriptionName = default; - Optional azurePlan = default; - Optional azureCreditApplied = default; - Optional billingCurrency = default; - Optional discount = default; - Optional effectivePrice = default; - Optional exchangeRate = default; - Optional marketPrice = default; - Optional pricingCurrency = default; - Optional servicePeriodStartDate = default; - Optional servicePeriodEndDate = default; - Optional subTotal = default; - Optional tax = default; - Optional unitOfMeasure = default; - Optional units = default; - Optional unitType = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("kind")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - kind = new TransactionTypeKind(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("date")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - date = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("invoice")) - { - invoice = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("invoiceId")) - { - invoiceId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("orderId")) - { - orderId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("orderName")) - { - orderName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("productFamily")) - { - productFamily = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("productTypeId")) - { - productTypeId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("productType")) - { - productType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("productDescription")) - { - productDescription = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("transactionType")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - transactionType = new ReservationType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("transactionAmount")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - transactionAmount = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("quantity")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - quantity = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("invoiceSectionId")) - { - invoiceSectionId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("invoiceSectionDisplayName")) - { - invoiceSectionDisplayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("billingProfileId")) - { - billingProfileId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("billingProfileDisplayName")) - { - billingProfileDisplayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("customerId")) - { - customerId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("customerDisplayName")) - { - customerDisplayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("subscriptionId")) - { - subscriptionId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("subscriptionName")) - { - subscriptionName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("azurePlan")) - { - azurePlan = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("azureCreditApplied")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - azureCreditApplied = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("billingCurrency")) - { - billingCurrency = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("discount")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - discount = property0.Value.GetSingle(); - continue; - } - if (property0.NameEquals("effectivePrice")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - effectivePrice = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("exchangeRate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - exchangeRate = property0.Value.GetSingle(); - continue; - } - if (property0.NameEquals("marketPrice")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - marketPrice = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("pricingCurrency")) - { - pricingCurrency = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("servicePeriodStartDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - servicePeriodStartDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("servicePeriodEndDate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - servicePeriodEndDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("subTotal")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - subTotal = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("tax")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - tax = Amount.DeserializeAmount(property0.Value); - continue; - } - if (property0.NameEquals("unitOfMeasure")) - { - unitOfMeasure = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("units")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - units = property0.Value.GetSingle(); - continue; - } - if (property0.NameEquals("unitType")) - { - unitType = property0.Value.GetString(); - continue; - } - } - continue; - } - } - return new Transaction(id.Value, name.Value, type.Value, Optional.ToNullable(kind), Optional.ToNullable(date), invoice.Value, invoiceId.Value, orderId.Value, orderName.Value, productFamily.Value, productTypeId.Value, productType.Value, productDescription.Value, Optional.ToNullable(transactionType), transactionAmount.Value, Optional.ToNullable(quantity), invoiceSectionId.Value, invoiceSectionDisplayName.Value, billingProfileId.Value, billingProfileDisplayName.Value, customerId.Value, customerDisplayName.Value, subscriptionId.Value, subscriptionName.Value, azurePlan.Value, azureCreditApplied.Value, billingCurrency.Value, Optional.ToNullable(discount), effectivePrice.Value, Optional.ToNullable(exchangeRate), marketPrice.Value, pricingCurrency.Value, Optional.ToNullable(servicePeriodStartDate), Optional.ToNullable(servicePeriodEndDate), subTotal.Value, tax.Value, unitOfMeasure.Value, Optional.ToNullable(units), unitType.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Transaction.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Transaction.cs deleted file mode 100644 index 303abb47e2f9..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/Transaction.cs +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Billing.Models -{ - /// A transaction. - public partial class Transaction : Resource - { - /// Initializes a new instance of Transaction. - public Transaction() - { - } - - /// Initializes a new instance of Transaction. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The kind of transaction. Options are all or reservation. - /// The date of transaction. - /// Invoice on which the transaction was billed or 'pending' if the transaction is not billed. - /// The ID of the invoice on which the transaction was billed. This field is only applicable for transactions which are billed. - /// The order ID of the reservation. The field is only applicable for transaction of kind reservation. - /// The name of the reservation order. The field is only applicable for transactions of kind reservation. - /// The family of the product for which the transaction took place. - /// The ID of the product type for which the transaction took place. - /// The type of the product for which the transaction took place. - /// The description of the product for which the transaction took place. - /// The type of transaction. - /// The charge associated with the transaction. - /// The quantity purchased in the transaction. - /// The ID of the invoice section which will be billed for the transaction. - /// The name of the invoice section which will be billed for the transaction. - /// The ID of the billing profile which will be billed for the transaction. - /// The name of the billing profile which will be billed for the transaction. - /// The ID of the customer for which the transaction took place. The field is applicable only for Microsoft Partner Agreement billing account. - /// The name of the customer for which the transaction took place. The field is applicable only for Microsoft Partner Agreement billing account. - /// The ID of the subscription that was used for the transaction. The field is only applicable for transaction of kind reservation. - /// The name of the subscription that was used for the transaction. The field is only applicable for transaction of kind reservation. - /// The type of azure plan of the subscription that was used for the transaction. - /// The amount of any Azure credits automatically applied to this transaction. - /// The ISO 4217 code for the currency in which this transaction is billed. - /// The percentage discount, if any, applied to this transaction. - /// The price of the product after applying any discounts. - /// The exchange rate used to convert charged amount to billing currency, if applicable. - /// The retail price of the product. - /// The ISO 4217 code for the currency in which the product is priced. - /// The date of the purchase of the product, or the start date of the month in which usage started. - /// The end date of the product term, or the end date of the month in which usage ended. - /// The pre-tax charged amount for the transaction. - /// The tax amount applied to the transaction. - /// The unit of measure used to bill for the product. For example, compute services are billed per hour. - /// The number of units used for a given product. - /// The description for the unit of measure for a given product. - internal Transaction(string id, string name, string type, TransactionTypeKind? kind, DateTimeOffset? date, string invoice, string invoiceId, string orderId, string orderName, string productFamily, string productTypeId, string productType, string productDescription, ReservationType? transactionType, Amount transactionAmount, int? quantity, string invoiceSectionId, string invoiceSectionDisplayName, string billingProfileId, string billingProfileDisplayName, string customerId, string customerDisplayName, string subscriptionId, string subscriptionName, string azurePlan, Amount azureCreditApplied, string billingCurrency, float? discount, Amount effectivePrice, float? exchangeRate, Amount marketPrice, string pricingCurrency, DateTimeOffset? servicePeriodStartDate, DateTimeOffset? servicePeriodEndDate, Amount subTotal, Amount tax, string unitOfMeasure, float? units, string unitType) : base(id, name, type) - { - Kind = kind; - Date = date; - Invoice = invoice; - InvoiceId = invoiceId; - OrderId = orderId; - OrderName = orderName; - ProductFamily = productFamily; - ProductTypeId = productTypeId; - ProductType = productType; - ProductDescription = productDescription; - TransactionType = transactionType; - TransactionAmount = transactionAmount; - Quantity = quantity; - InvoiceSectionId = invoiceSectionId; - InvoiceSectionDisplayName = invoiceSectionDisplayName; - BillingProfileId = billingProfileId; - BillingProfileDisplayName = billingProfileDisplayName; - CustomerId = customerId; - CustomerDisplayName = customerDisplayName; - SubscriptionId = subscriptionId; - SubscriptionName = subscriptionName; - AzurePlan = azurePlan; - AzureCreditApplied = azureCreditApplied; - BillingCurrency = billingCurrency; - Discount = discount; - EffectivePrice = effectivePrice; - ExchangeRate = exchangeRate; - MarketPrice = marketPrice; - PricingCurrency = pricingCurrency; - ServicePeriodStartDate = servicePeriodStartDate; - ServicePeriodEndDate = servicePeriodEndDate; - SubTotal = subTotal; - Tax = tax; - UnitOfMeasure = unitOfMeasure; - Units = units; - UnitType = unitType; - } - - /// The kind of transaction. Options are all or reservation. - public TransactionTypeKind? Kind { get; set; } - /// The date of transaction. - public DateTimeOffset? Date { get; } - /// Invoice on which the transaction was billed or 'pending' if the transaction is not billed. - public string Invoice { get; } - /// The ID of the invoice on which the transaction was billed. This field is only applicable for transactions which are billed. - public string InvoiceId { get; } - /// The order ID of the reservation. The field is only applicable for transaction of kind reservation. - public string OrderId { get; } - /// The name of the reservation order. The field is only applicable for transactions of kind reservation. - public string OrderName { get; } - /// The family of the product for which the transaction took place. - public string ProductFamily { get; } - /// The ID of the product type for which the transaction took place. - public string ProductTypeId { get; } - /// The type of the product for which the transaction took place. - public string ProductType { get; } - /// The description of the product for which the transaction took place. - public string ProductDescription { get; } - /// The type of transaction. - public ReservationType? TransactionType { get; set; } - /// The charge associated with the transaction. - public Amount TransactionAmount { get; } - /// The quantity purchased in the transaction. - public int? Quantity { get; } - /// The ID of the invoice section which will be billed for the transaction. - public string InvoiceSectionId { get; } - /// The name of the invoice section which will be billed for the transaction. - public string InvoiceSectionDisplayName { get; } - /// The ID of the billing profile which will be billed for the transaction. - public string BillingProfileId { get; } - /// The name of the billing profile which will be billed for the transaction. - public string BillingProfileDisplayName { get; } - /// The ID of the customer for which the transaction took place. The field is applicable only for Microsoft Partner Agreement billing account. - public string CustomerId { get; } - /// The name of the customer for which the transaction took place. The field is applicable only for Microsoft Partner Agreement billing account. - public string CustomerDisplayName { get; } - /// The ID of the subscription that was used for the transaction. The field is only applicable for transaction of kind reservation. - public string SubscriptionId { get; } - /// The name of the subscription that was used for the transaction. The field is only applicable for transaction of kind reservation. - public string SubscriptionName { get; } - /// The type of azure plan of the subscription that was used for the transaction. - public string AzurePlan { get; } - /// The amount of any Azure credits automatically applied to this transaction. - public Amount AzureCreditApplied { get; } - /// The ISO 4217 code for the currency in which this transaction is billed. - public string BillingCurrency { get; } - /// The percentage discount, if any, applied to this transaction. - public float? Discount { get; } - /// The price of the product after applying any discounts. - public Amount EffectivePrice { get; } - /// The exchange rate used to convert charged amount to billing currency, if applicable. - public float? ExchangeRate { get; } - /// The retail price of the product. - public Amount MarketPrice { get; } - /// The ISO 4217 code for the currency in which the product is priced. - public string PricingCurrency { get; } - /// The date of the purchase of the product, or the start date of the month in which usage started. - public DateTimeOffset? ServicePeriodStartDate { get; } - /// The end date of the product term, or the end date of the month in which usage ended. - public DateTimeOffset? ServicePeriodEndDate { get; } - /// The pre-tax charged amount for the transaction. - public Amount SubTotal { get; } - /// The tax amount applied to the transaction. - public Amount Tax { get; } - /// The unit of measure used to bill for the product. For example, compute services are billed per hour. - public string UnitOfMeasure { get; } - /// The number of units used for a given product. - public float? Units { get; } - /// The description for the unit of measure for a given product. - public string UnitType { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransactionListResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransactionListResult.Serialization.cs deleted file mode 100644 index 6b34ead42dbb..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransactionListResult.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class TransactionListResult - { - internal static TransactionListResult DeserializeTransactionListResult(JsonElement element) - { - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(Transaction.DeserializeTransaction(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink")) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new TransactionListResult(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransactionListResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransactionListResult.cs deleted file mode 100644 index 5c133454e211..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransactionListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The list of transactions. - public partial class TransactionListResult - { - /// Initializes a new instance of TransactionListResult. - internal TransactionListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of TransactionListResult. - /// The list of transactions. - /// The link (url) to the next page of results. - internal TransactionListResult(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// The list of transactions. - public IReadOnlyList Value { get; } - /// The link (url) to the next page of results. - public string NextLink { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransactionTypeKind.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransactionTypeKind.cs deleted file mode 100644 index 4e7e45428ae7..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransactionTypeKind.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The kind of transaction. Options are all or reservation. - public readonly partial struct TransactionTypeKind : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public TransactionTypeKind(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AllValue = "all"; - private const string ReservationValue = "reservation"; - - /// all. - public static TransactionTypeKind All { get; } = new TransactionTypeKind(AllValue); - /// reservation. - public static TransactionTypeKind Reservation { get; } = new TransactionTypeKind(ReservationValue); - /// Determines if two values are the same. - public static bool operator ==(TransactionTypeKind left, TransactionTypeKind right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(TransactionTypeKind left, TransactionTypeKind right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator TransactionTypeKind(string value) => new TransactionTypeKind(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is TransactionTypeKind other && Equals(other); - /// - public bool Equals(TransactionTypeKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransferBillingSubscriptionRequestProperties.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransferBillingSubscriptionRequestProperties.Serialization.cs deleted file mode 100644 index 52e9a70ddd69..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransferBillingSubscriptionRequestProperties.Serialization.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class TransferBillingSubscriptionRequestProperties : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("destinationInvoiceSectionId"); - writer.WriteStringValue(DestinationInvoiceSectionId); - writer.WriteEndObject(); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransferBillingSubscriptionRequestProperties.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransferBillingSubscriptionRequestProperties.cs deleted file mode 100644 index 50c5e6f40be2..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransferBillingSubscriptionRequestProperties.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Request parameters to transfer billing subscription. - public partial class TransferBillingSubscriptionRequestProperties - { - /// Initializes a new instance of TransferBillingSubscriptionRequestProperties. - /// The destination invoice section id. - /// is null. - public TransferBillingSubscriptionRequestProperties(string destinationInvoiceSectionId) - { - if (destinationInvoiceSectionId == null) - { - throw new ArgumentNullException(nameof(destinationInvoiceSectionId)); - } - - DestinationInvoiceSectionId = destinationInvoiceSectionId; - } - - /// The destination invoice section id. - public string DestinationInvoiceSectionId { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransferProductRequestProperties.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransferProductRequestProperties.Serialization.cs deleted file mode 100644 index 63a8094d92d4..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransferProductRequestProperties.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class TransferProductRequestProperties : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(DestinationInvoiceSectionId)) - { - writer.WritePropertyName("destinationInvoiceSectionId"); - writer.WriteStringValue(DestinationInvoiceSectionId); - } - writer.WriteEndObject(); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransferProductRequestProperties.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransferProductRequestProperties.cs deleted file mode 100644 index 3c2d17031a5d..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/TransferProductRequestProperties.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// The properties of the product to initiate a transfer. - public partial class TransferProductRequestProperties - { - /// Initializes a new instance of TransferProductRequestProperties. - public TransferProductRequestProperties() - { - } - - /// The destination invoice section id. - public string DestinationInvoiceSectionId { get; set; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateAddressResponse.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateAddressResponse.Serialization.cs deleted file mode 100644 index 603950c32cdb..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateAddressResponse.Serialization.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class ValidateAddressResponse - { - internal static ValidateAddressResponse DeserializeValidateAddressResponse(JsonElement element) - { - Optional status = default; - Optional> suggestedAddresses = default; - Optional validationMessage = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("status")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - status = new AddressValidationStatus(property.Value.GetString()); - continue; - } - if (property.NameEquals("suggestedAddresses")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AddressDetails.DeserializeAddressDetails(item)); - } - suggestedAddresses = array; - continue; - } - if (property.NameEquals("validationMessage")) - { - validationMessage = property.Value.GetString(); - continue; - } - } - return new ValidateAddressResponse(Optional.ToNullable(status), Optional.ToList(suggestedAddresses), validationMessage.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateAddressResponse.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateAddressResponse.cs deleted file mode 100644 index db9eb3e040cd..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateAddressResponse.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - /// Result of the address validation. - public partial class ValidateAddressResponse - { - /// Initializes a new instance of ValidateAddressResponse. - internal ValidateAddressResponse() - { - SuggestedAddresses = new ChangeTrackingList(); - } - - /// Initializes a new instance of ValidateAddressResponse. - /// status of the address validation. - /// The list of suggested addresses. - /// Validation error message. - internal ValidateAddressResponse(AddressValidationStatus? status, IReadOnlyList suggestedAddresses, string validationMessage) - { - Status = status; - SuggestedAddresses = suggestedAddresses; - ValidationMessage = validationMessage; - } - - /// status of the address validation. - public AddressValidationStatus? Status { get; } - /// The list of suggested addresses. - public IReadOnlyList SuggestedAddresses { get; } - /// Validation error message. - public string ValidationMessage { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateProductTransferEligibilityError.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateProductTransferEligibilityError.Serialization.cs deleted file mode 100644 index bdbfd272c0ce..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateProductTransferEligibilityError.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class ValidateProductTransferEligibilityError - { - internal static ValidateProductTransferEligibilityError DeserializeValidateProductTransferEligibilityError(JsonElement element) - { - Optional code = default; - Optional message = default; - Optional details = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - code = new ProductTransferValidationErrorCode(property.Value.GetString()); - continue; - } - if (property.NameEquals("message")) - { - message = property.Value.GetString(); - continue; - } - if (property.NameEquals("details")) - { - details = property.Value.GetString(); - continue; - } - } - return new ValidateProductTransferEligibilityError(Optional.ToNullable(code), message.Value, details.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateProductTransferEligibilityError.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateProductTransferEligibilityError.cs deleted file mode 100644 index bcaf3683d2b4..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateProductTransferEligibilityError.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// Error details of the product transfer eligibility validation. - public partial class ValidateProductTransferEligibilityError - { - /// Initializes a new instance of ValidateProductTransferEligibilityError. - internal ValidateProductTransferEligibilityError() - { - } - - /// Initializes a new instance of ValidateProductTransferEligibilityError. - /// Error code for the product transfer validation. - /// The error message. - /// Detailed error message explaining the error. - internal ValidateProductTransferEligibilityError(ProductTransferValidationErrorCode? code, string message, string details) - { - Code = code; - Message = message; - Details = details; - } - - /// Error code for the product transfer validation. - public ProductTransferValidationErrorCode? Code { get; } - /// The error message. - public string Message { get; } - /// Detailed error message explaining the error. - public string Details { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateProductTransferEligibilityResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateProductTransferEligibilityResult.Serialization.cs deleted file mode 100644 index ab4d9cc3e7d7..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateProductTransferEligibilityResult.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class ValidateProductTransferEligibilityResult - { - internal static ValidateProductTransferEligibilityResult DeserializeValidateProductTransferEligibilityResult(JsonElement element) - { - Optional isMoveEligible = default; - Optional errorDetails = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("isMoveEligible")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - isMoveEligible = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("errorDetails")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - errorDetails = ValidateProductTransferEligibilityError.DeserializeValidateProductTransferEligibilityError(property.Value); - continue; - } - } - return new ValidateProductTransferEligibilityResult(Optional.ToNullable(isMoveEligible), errorDetails.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateProductTransferEligibilityResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateProductTransferEligibilityResult.cs deleted file mode 100644 index 5093b28dd32c..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateProductTransferEligibilityResult.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// Result of the product transfer eligibility validation. - public partial class ValidateProductTransferEligibilityResult - { - /// Initializes a new instance of ValidateProductTransferEligibilityResult. - internal ValidateProductTransferEligibilityResult() - { - } - - /// Initializes a new instance of ValidateProductTransferEligibilityResult. - /// Specifies whether the transfer is eligible or not. - /// Validation error details. - internal ValidateProductTransferEligibilityResult(bool? isMoveEligible, ValidateProductTransferEligibilityError errorDetails) - { - IsMoveEligible = isMoveEligible; - ErrorDetails = errorDetails; - } - - /// Specifies whether the transfer is eligible or not. - public bool? IsMoveEligible { get; } - /// Validation error details. - public ValidateProductTransferEligibilityError ErrorDetails { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateSubscriptionTransferEligibilityError.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateSubscriptionTransferEligibilityError.Serialization.cs deleted file mode 100644 index 7d6521ecf780..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateSubscriptionTransferEligibilityError.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class ValidateSubscriptionTransferEligibilityError - { - internal static ValidateSubscriptionTransferEligibilityError DeserializeValidateSubscriptionTransferEligibilityError(JsonElement element) - { - Optional code = default; - Optional message = default; - Optional details = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - code = new SubscriptionTransferValidationErrorCode(property.Value.GetString()); - continue; - } - if (property.NameEquals("message")) - { - message = property.Value.GetString(); - continue; - } - if (property.NameEquals("details")) - { - details = property.Value.GetString(); - continue; - } - } - return new ValidateSubscriptionTransferEligibilityError(Optional.ToNullable(code), message.Value, details.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs deleted file mode 100644 index 366e29e65bb5..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// Error details of the transfer eligibility validation. - public partial class ValidateSubscriptionTransferEligibilityError - { - /// Initializes a new instance of ValidateSubscriptionTransferEligibilityError. - internal ValidateSubscriptionTransferEligibilityError() - { - } - - /// Initializes a new instance of ValidateSubscriptionTransferEligibilityError. - /// Error code for the product transfer validation. - /// The error message. - /// Detailed error message explaining the error. - internal ValidateSubscriptionTransferEligibilityError(SubscriptionTransferValidationErrorCode? code, string message, string details) - { - Code = code; - Message = message; - Details = details; - } - - /// Error code for the product transfer validation. - public SubscriptionTransferValidationErrorCode? Code { get; } - /// The error message. - public string Message { get; } - /// Detailed error message explaining the error. - public string Details { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateSubscriptionTransferEligibilityResult.Serialization.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateSubscriptionTransferEligibilityResult.Serialization.cs deleted file mode 100644 index 95bf06b19576..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateSubscriptionTransferEligibilityResult.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Billing.Models -{ - public partial class ValidateSubscriptionTransferEligibilityResult - { - internal static ValidateSubscriptionTransferEligibilityResult DeserializeValidateSubscriptionTransferEligibilityResult(JsonElement element) - { - Optional isMoveEligible = default; - Optional errorDetails = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("isMoveEligible")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - isMoveEligible = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("errorDetails")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - errorDetails = ValidateSubscriptionTransferEligibilityError.DeserializeValidateSubscriptionTransferEligibilityError(property.Value); - continue; - } - } - return new ValidateSubscriptionTransferEligibilityResult(Optional.ToNullable(isMoveEligible), errorDetails.Value); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs deleted file mode 100644 index 397fc74f718e..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Billing.Models -{ - /// Result of the transfer eligibility validation. - public partial class ValidateSubscriptionTransferEligibilityResult - { - /// Initializes a new instance of ValidateSubscriptionTransferEligibilityResult. - internal ValidateSubscriptionTransferEligibilityResult() - { - } - - /// Initializes a new instance of ValidateSubscriptionTransferEligibilityResult. - /// Specifies whether the subscription is eligible to be transferred. - /// Validation error details. - internal ValidateSubscriptionTransferEligibilityResult(bool? isMoveEligible, ValidateSubscriptionTransferEligibilityError errorDetails) - { - IsMoveEligible = isMoveEligible; - ErrorDetails = errorDetails; - } - - /// Specifies whether the subscription is eligible to be transferred. - public bool? IsMoveEligible { get; } - /// Validation error details. - public ValidateSubscriptionTransferEligibilityError ErrorDetails { get; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ViewCharges.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ViewCharges.cs deleted file mode 100644 index 91c9a57aac8a..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ViewCharges.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. - public readonly partial struct ViewCharges : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public ViewCharges(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AllowedValue = "Allowed"; - private const string NotAllowedValue = "NotAllowed"; - - /// Allowed. - public static ViewCharges Allowed { get; } = new ViewCharges(AllowedValue); - /// NotAllowed. - public static ViewCharges NotAllowed { get; } = new ViewCharges(NotAllowedValue); - /// Determines if two values are the same. - public static bool operator ==(ViewCharges left, ViewCharges right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ViewCharges left, ViewCharges right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator ViewCharges(string value) => new ViewCharges(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ViewCharges other && Equals(other); - /// - public bool Equals(ViewCharges other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ViewChargesPolicy.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ViewChargesPolicy.cs deleted file mode 100644 index c5fece40add7..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Models/ViewChargesPolicy.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Billing.Models -{ - /// The policy that controls whether users with Azure RBAC access to a subscription can view its charges. - public readonly partial struct ViewChargesPolicy : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public ViewChargesPolicy(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AllowedValue = "Allowed"; - private const string NotAllowedValue = "NotAllowed"; - - /// Allowed. - public static ViewChargesPolicy Allowed { get; } = new ViewChargesPolicy(AllowedValue); - /// NotAllowed. - public static ViewChargesPolicy NotAllowed { get; } = new ViewChargesPolicy(NotAllowedValue); - /// Determines if two values are the same. - public static bool operator ==(ViewChargesPolicy left, ViewChargesPolicy right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ViewChargesPolicy left, ViewChargesPolicy right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator ViewChargesPolicy(string value) => new ViewChargesPolicy(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ViewChargesPolicy other && Equals(other); - /// - public bool Equals(ViewChargesPolicy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Operations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Operations.cs deleted file mode 100644 index e8a9905182ee..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/Operations.cs +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The service client. - public partial class Operations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal RestOperations RestClient { get; } - - /// Initializes a new instance of Operations for mocking. - protected Operations() - { - } - - /// Initializes a new instance of Operations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal Operations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new RestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Lists the available billing REST API operations. - /// The cancellation token to use. - public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("Operations.List"); - scope.Start(); - try - { - var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("Operations.List"); - scope.Start(); - try - { - var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the available billing REST API operations. - /// The cancellation token to use. - public virtual Pageable List(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("Operations.List"); - scope.Start(); - try - { - var response = RestClient.List(cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("Operations.List"); - scope.Start(); - try - { - var response = RestClient.ListNextPage(nextLink, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/PoliciesOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/PoliciesOperations.cs deleted file mode 100644 index 2c8daf3c2d77..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/PoliciesOperations.cs +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The Policies service client. - public partial class PoliciesOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal PoliciesRestOperations RestClient { get; } - - /// Initializes a new instance of PoliciesOperations for mocking. - protected PoliciesOperations() - { - } - - /// Initializes a new instance of PoliciesOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal PoliciesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new PoliciesRestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - public virtual async Task> GetByBillingProfileAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PoliciesOperations.GetByBillingProfile"); - scope.Start(); - try - { - return await RestClient.GetByBillingProfileAsync(billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - public virtual Response GetByBillingProfile(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PoliciesOperations.GetByBillingProfile"); - scope.Start(); - try - { - return RestClient.GetByBillingProfile(billingAccountName, billingProfileName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Request parameters that are provided to the update policies operation. - /// The cancellation token to use. - public virtual async Task> UpdateAsync(string billingAccountName, string billingProfileName, Policy parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PoliciesOperations.Update"); - scope.Start(); - try - { - return await RestClient.UpdateAsync(billingAccountName, billingProfileName, parameters, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Request parameters that are provided to the update policies operation. - /// The cancellation token to use. - public virtual Response Update(string billingAccountName, string billingProfileName, Policy parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PoliciesOperations.Update"); - scope.Start(); - try - { - return RestClient.Update(billingAccountName, billingProfileName, parameters, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - public virtual async Task> GetByCustomerAsync(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PoliciesOperations.GetByCustomer"); - scope.Start(); - try - { - return await RestClient.GetByCustomerAsync(billingAccountName, customerName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - public virtual Response GetByCustomer(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PoliciesOperations.GetByCustomer"); - scope.Start(); - try - { - return RestClient.GetByCustomer(billingAccountName, customerName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// Request parameters that are provided to the update policies operation. - /// The cancellation token to use. - public virtual async Task> UpdateCustomerAsync(string billingAccountName, string customerName, CustomerPolicy parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PoliciesOperations.UpdateCustomer"); - scope.Start(); - try - { - return await RestClient.UpdateCustomerAsync(billingAccountName, customerName, parameters, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// Request parameters that are provided to the update policies operation. - /// The cancellation token to use. - public virtual Response UpdateCustomer(string billingAccountName, string customerName, CustomerPolicy parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PoliciesOperations.UpdateCustomer"); - scope.Start(); - try - { - return RestClient.UpdateCustomer(billingAccountName, customerName, parameters, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/PoliciesRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/PoliciesRestOperations.cs deleted file mode 100644 index b258cc2ec020..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/PoliciesRestOperations.cs +++ /dev/null @@ -1,394 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class PoliciesRestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of PoliciesRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public PoliciesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateGetByBillingProfileRequest(string billingAccountName, string billingProfileName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/policies/default", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public async Task> GetByBillingProfileAsync(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateGetByBillingProfileRequest(billingAccountName, billingProfileName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - Policy value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = Policy.DeserializePolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - /// or is null. - public Response GetByBillingProfile(string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateGetByBillingProfileRequest(billingAccountName, billingProfileName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - Policy value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = Policy.DeserializePolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateUpdateRequest(string billingAccountName, string billingProfileName, Policy parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/policies/default", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - return message; - } - - /// Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Request parameters that are provided to the update policies operation. - /// The cancellation token to use. - /// , , or is null. - public async Task> UpdateAsync(string billingAccountName, string billingProfileName, Policy parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateUpdateRequest(billingAccountName, billingProfileName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - Policy value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = Policy.DeserializePolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// Request parameters that are provided to the update policies operation. - /// The cancellation token to use. - /// , , or is null. - public Response Update(string billingAccountName, string billingProfileName, Policy parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateUpdateRequest(billingAccountName, billingProfileName, parameters); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - Policy value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = Policy.DeserializePolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetByCustomerRequest(string billingAccountName, string customerName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/customers/", false); - uri.AppendPath(customerName, true); - uri.AppendPath("/policies/default", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// or is null. - public async Task> GetByCustomerAsync(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateGetByCustomerRequest(billingAccountName, customerName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - CustomerPolicy value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = CustomerPolicy.DeserializeCustomerPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// or is null. - public Response GetByCustomer(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateGetByCustomerRequest(billingAccountName, customerName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - CustomerPolicy value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = CustomerPolicy.DeserializeCustomerPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateUpdateCustomerRequest(string billingAccountName, string customerName, CustomerPolicy parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/customers/", false); - uri.AppendPath(customerName, true); - uri.AppendPath("/policies/default", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - return message; - } - - /// Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// Request parameters that are provided to the update policies operation. - /// The cancellation token to use. - /// , , or is null. - public async Task> UpdateCustomerAsync(string billingAccountName, string customerName, CustomerPolicy parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateUpdateCustomerRequest(billingAccountName, customerName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - CustomerPolicy value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = CustomerPolicy.DeserializeCustomerPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// Request parameters that are provided to the update policies operation. - /// The cancellation token to use. - /// , , or is null. - public Response UpdateCustomer(string billingAccountName, string customerName, CustomerPolicy parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateUpdateCustomerRequest(billingAccountName, customerName, parameters); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - CustomerPolicy value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = CustomerPolicy.DeserializeCustomerPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/ProductsMoveHeaders.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/ProductsMoveHeaders.cs deleted file mode 100644 index 3a7f37c523e7..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/ProductsMoveHeaders.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure; -using Azure.Core; - -namespace Azure.ResourceManager.Billing -{ - internal partial class ProductsMoveHeaders - { - private readonly Response _response; - public ProductsMoveHeaders(Response response) - { - _response = response; - } - /// Location URI to poll for result. - public string Location => _response.Headers.TryGetValue("Location", out string value) ? value : null; - /// Recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. - public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/ProductsOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/ProductsOperations.cs deleted file mode 100644 index f1d65e1c71a2..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/ProductsOperations.cs +++ /dev/null @@ -1,597 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The Products service client. - public partial class ProductsOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal ProductsRestOperations RestClient { get; } - - /// Initializes a new instance of ProductsOperations for mocking. - protected ProductsOperations() - { - } - - /// Initializes a new instance of ProductsOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal ProductsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new ProductsRestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// The cancellation token to use. - public virtual async Task> GetAsync(string billingAccountName, string productName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.Get"); - scope.Start(); - try - { - return await RestClient.GetAsync(billingAccountName, productName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// The cancellation token to use. - public virtual Response Get(string billingAccountName, string productName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.Get"); - scope.Start(); - try - { - return RestClient.Get(billingAccountName, productName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// Request parameters that are provided to the update product operation. - /// The cancellation token to use. - public virtual async Task> UpdateAsync(string billingAccountName, string productName, Product parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.Update"); - scope.Start(); - try - { - return await RestClient.UpdateAsync(billingAccountName, productName, parameters, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// Request parameters that are provided to the update product operation. - /// The cancellation token to use. - public virtual Response Update(string billingAccountName, string productName, Product parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.Update"); - scope.Start(); - try - { - return RestClient.Update(billingAccountName, productName, parameters, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// Request parameters that are provided to the move product operation. - /// The cancellation token to use. - public virtual async Task> MoveAsync(string billingAccountName, string productName, TransferProductRequestProperties parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.Move"); - scope.Start(); - try - { - return await RestClient.MoveAsync(billingAccountName, productName, parameters, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// Request parameters that are provided to the move product operation. - /// The cancellation token to use. - public virtual Response Move(string billingAccountName, string productName, TransferProductRequestProperties parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.Move"); - scope.Start(); - try - { - return RestClient.Move(billingAccountName, productName, parameters, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// Request parameters that are provided to the validate move eligibility operation. - /// The cancellation token to use. - public virtual async Task> ValidateMoveAsync(string billingAccountName, string productName, TransferProductRequestProperties parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ValidateMove"); - scope.Start(); - try - { - return await RestClient.ValidateMoveAsync(billingAccountName, productName, parameters, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// Request parameters that are provided to the validate move eligibility operation. - /// The cancellation token to use. - public virtual Response ValidateMove(string billingAccountName, string productName, TransferProductRequestProperties parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ValidateMove"); - scope.Start(); - try - { - return RestClient.ValidateMove(billingAccountName, productName, parameters, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByCustomerAsync(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByCustomer"); - scope.Start(); - try - { - var response = await RestClient.ListByCustomerAsync(billingAccountName, customerName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByCustomer"); - scope.Start(); - try - { - var response = await RestClient.ListByCustomerNextPageAsync(nextLink, billingAccountName, customerName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByCustomer(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByCustomer"); - scope.Start(); - try - { - var response = RestClient.ListByCustomer(billingAccountName, customerName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByCustomer"); - scope.Start(); - try - { - var response = RestClient.ListByCustomerNextPage(nextLink, billingAccountName, customerName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// is null. - public virtual AsyncPageable ListByBillingAccountAsync(string billingAccountName, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountAsync(billingAccountName, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingAccountNextPageAsync(nextLink, billingAccountName, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// is null. - public virtual Pageable ListByBillingAccount(string billingAccountName, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccount(billingAccountName, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByBillingAccount"); - scope.Start(); - try - { - var response = RestClient.ListByBillingAccountNextPage(nextLink, billingAccountName, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByBillingProfileAsync(string billingAccountName, string billingProfileName, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileAsync(billingAccountName, billingProfileName, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = await RestClient.ListByBillingProfileNextPageAsync(nextLink, billingAccountName, billingProfileName, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByBillingProfile(string billingAccountName, string billingProfileName, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfile(billingAccountName, billingProfileName, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByBillingProfile"); - scope.Start(); - try - { - var response = RestClient.ListByBillingProfileNextPage(nextLink, billingAccountName, billingProfileName, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// , , or is null. - public virtual AsyncPageable ListByInvoiceSectionAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = await RestClient.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = await RestClient.ListByInvoiceSectionNextPageAsync(nextLink, billingAccountName, billingProfileName, invoiceSectionName, filter, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// , , or is null. - public virtual Pageable ListByInvoiceSection(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = RestClient.ListByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ProductsOperations.ListByInvoiceSection"); - scope.Start(); - try - { - var response = RestClient.ListByInvoiceSectionNextPage(nextLink, billingAccountName, billingProfileName, invoiceSectionName, filter, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/ProductsRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/ProductsRestOperations.cs deleted file mode 100644 index 7688bc1a03b4..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/ProductsRestOperations.cs +++ /dev/null @@ -1,1112 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class ProductsRestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of ProductsRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public ProductsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListByCustomerRequest(string billingAccountName, string customerName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/customers/", false); - uri.AppendPath(customerName, true); - uri.AppendPath("/products", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// or is null. - public async Task> ListByCustomerAsync(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateListByCustomerRequest(billingAccountName, customerName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// or is null. - public Response ListByCustomer(string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateListByCustomerRequest(billingAccountName, customerName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingAccountRequest(string billingAccountName, 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.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/products", false); - uri.AppendQuery("api-version", "2020-05-01", true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// is null. - public async Task> ListByBillingAccountAsync(string billingAccountName, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// is null. - public Response ListByBillingAccount(string billingAccountName, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountRequest(billingAccountName, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingProfileRequest(string billingAccountName, string billingProfileName, 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.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/products", false); - uri.AppendQuery("api-version", "2020-05-01", true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingProfileAsync(string billingAccountName, string billingProfileName, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// or is null. - public Response ListByBillingProfile(string billingAccountName, string billingProfileName, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileRequest(billingAccountName, billingProfileName, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByInvoiceSectionRequest(string billingAccountName, string billingProfileName, string invoiceSectionName, 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.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/invoiceSections/", false); - uri.AppendPath(invoiceSectionName, true); - uri.AppendPath("/products", false); - uri.AppendQuery("api-version", "2020-05-01", true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByInvoiceSectionAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionRequest(billingAccountName, billingProfileName, invoiceSectionName, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// , , or is null. - public Response ListByInvoiceSection(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = null, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionRequest(billingAccountName, billingProfileName, invoiceSectionName, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRequest(string billingAccountName, string productName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/products/", false); - uri.AppendPath(productName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// The cancellation token to use. - /// or is null. - public async Task> GetAsync(string billingAccountName, string productName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (productName == null) - { - throw new ArgumentNullException(nameof(productName)); - } - - using var message = CreateGetRequest(billingAccountName, productName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - Product value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = Product.DeserializeProduct(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// The cancellation token to use. - /// or is null. - public Response Get(string billingAccountName, string productName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (productName == null) - { - throw new ArgumentNullException(nameof(productName)); - } - - using var message = CreateGetRequest(billingAccountName, productName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - Product value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = Product.DeserializeProduct(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateUpdateRequest(string billingAccountName, string productName, Product parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/products/", false); - uri.AppendPath(productName, true); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - return message; - } - - /// Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// Request parameters that are provided to the update product operation. - /// The cancellation token to use. - /// , , or is null. - public async Task> UpdateAsync(string billingAccountName, string productName, Product parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (productName == null) - { - throw new ArgumentNullException(nameof(productName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateUpdateRequest(billingAccountName, productName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - Product value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = Product.DeserializeProduct(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// Request parameters that are provided to the update product operation. - /// The cancellation token to use. - /// , , or is null. - public Response Update(string billingAccountName, string productName, Product parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (productName == null) - { - throw new ArgumentNullException(nameof(productName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateUpdateRequest(billingAccountName, productName, parameters); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - Product value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = Product.DeserializeProduct(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateMoveRequest(string billingAccountName, string productName, TransferProductRequestProperties parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/products/", false); - uri.AppendPath(productName, true); - uri.AppendPath("/move", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - return message; - } - - /// Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// Request parameters that are provided to the move product operation. - /// The cancellation token to use. - /// , , or is null. - public async Task> MoveAsync(string billingAccountName, string productName, TransferProductRequestProperties parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (productName == null) - { - throw new ArgumentNullException(nameof(productName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateMoveRequest(billingAccountName, productName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - var headers = new ProductsMoveHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - { - Product value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = Product.DeserializeProduct(document.RootElement); - return ResponseWithHeaders.FromValue(value, headers, message.Response); - } - case 202: - return ResponseWithHeaders.FromValue(null, headers, message.Response); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// Request parameters that are provided to the move product operation. - /// The cancellation token to use. - /// , , or is null. - public ResponseWithHeaders Move(string billingAccountName, string productName, TransferProductRequestProperties parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (productName == null) - { - throw new ArgumentNullException(nameof(productName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateMoveRequest(billingAccountName, productName, parameters); - _pipeline.Send(message, cancellationToken); - var headers = new ProductsMoveHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - { - Product value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = Product.DeserializeProduct(document.RootElement); - return ResponseWithHeaders.FromValue(value, headers, message.Response); - } - case 202: - return ResponseWithHeaders.FromValue(null, headers, message.Response); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateValidateMoveRequest(string billingAccountName, string productName, TransferProductRequestProperties parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/products/", false); - uri.AppendPath(productName, true); - uri.AppendPath("/validateMoveEligibility", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - return message; - } - - /// Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// Request parameters that are provided to the validate move eligibility operation. - /// The cancellation token to use. - /// , , or is null. - public async Task> ValidateMoveAsync(string billingAccountName, string productName, TransferProductRequestProperties parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (productName == null) - { - throw new ArgumentNullException(nameof(productName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateValidateMoveRequest(billingAccountName, productName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ValidateProductTransferEligibilityResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ValidateProductTransferEligibilityResult.DeserializeValidateProductTransferEligibilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a product. - /// Request parameters that are provided to the validate move eligibility operation. - /// The cancellation token to use. - /// , , or is null. - public Response ValidateMove(string billingAccountName, string productName, TransferProductRequestProperties parameters, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (productName == null) - { - throw new ArgumentNullException(nameof(productName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateValidateMoveRequest(billingAccountName, productName, parameters); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ValidateProductTransferEligibilityResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ValidateProductTransferEligibilityResult.DeserializeValidateProductTransferEligibilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByCustomerNextPageRequest(string nextLink, string billingAccountName, string customerName) - { - 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"); - return message; - } - - /// Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByCustomerNextPageAsync(string nextLink, string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateListByCustomerNextPageRequest(nextLink, billingAccountName, customerName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a customer. - /// The cancellation token to use. - /// , , or is null. - public Response ListByCustomerNextPage(string nextLink, string billingAccountName, string customerName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (customerName == null) - { - throw new ArgumentNullException(nameof(customerName)); - } - - using var message = CreateListByCustomerNextPageRequest(nextLink, billingAccountName, customerName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingAccountNextPageRequest(string nextLink, string billingAccountName, 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"); - return message; - } - - /// Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// or is null. - public async Task> ListByBillingAccountNextPageAsync(string nextLink, string billingAccountName, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// or is null. - public Response ListByBillingAccountNextPage(string nextLink, string billingAccountName, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - - using var message = CreateListByBillingAccountNextPageRequest(nextLink, billingAccountName, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByBillingProfileNextPageRequest(string nextLink, string billingAccountName, string billingProfileName, 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"); - return message; - } - - /// Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByBillingProfileNextPageAsync(string nextLink, string billingAccountName, string billingProfileName, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// , , or is null. - public Response ListByBillingProfileNextPage(string nextLink, string billingAccountName, string billingProfileName, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - - using var message = CreateListByBillingProfileNextPageRequest(nextLink, billingAccountName, billingProfileName, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByInvoiceSectionNextPageRequest(string nextLink, string billingAccountName, string billingProfileName, string invoiceSectionName, 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"); - return message; - } - - /// Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// , , , or is null. - public async Task> ListByInvoiceSectionNextPageAsync(string nextLink, string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionNextPageRequest(nextLink, billingAccountName, billingProfileName, invoiceSectionName, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice section. - /// May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). - /// The cancellation token to use. - /// , , , or is null. - public Response ListByInvoiceSectionNextPage(string nextLink, string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (billingProfileName == null) - { - throw new ArgumentNullException(nameof(billingProfileName)); - } - if (invoiceSectionName == null) - { - throw new ArgumentNullException(nameof(invoiceSectionName)); - } - - using var message = CreateListByInvoiceSectionNextPageRequest(nextLink, billingAccountName, billingProfileName, invoiceSectionName, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ProductsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ProductsListResult.DeserializeProductsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/RestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/RestOperations.cs deleted file mode 100644 index 51d42acb8881..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/RestOperations.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class RestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of RestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public RestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/operations", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the available billing REST API operations. - /// The cancellation token to use. - public async Task> ListAsync(CancellationToken cancellationToken = default) - { - using var message = CreateListRequest(); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OperationListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = OperationListResult.DeserializeOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the available billing REST API operations. - /// The cancellation token to use. - public Response List(CancellationToken cancellationToken = default) - { - using var message = CreateListRequest(); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OperationListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = OperationListResult.DeserializeOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListNextPageRequest(string nextLink) - { - 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"); - return message; - } - - /// Lists the available billing REST API operations. - /// The URL to the next page of results. - /// The cancellation token to use. - /// is null. - public async Task> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListNextPageRequest(nextLink); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OperationListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = OperationListResult.DeserializeOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the available billing REST API operations. - /// The URL to the next page of results. - /// The cancellation token to use. - /// is null. - public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListNextPageRequest(nextLink); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OperationListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = OperationListResult.DeserializeOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/TransactionsOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/TransactionsOperations.cs deleted file mode 100644 index a4e49c410fee..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/TransactionsOperations.cs +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - /// The Transactions service client. - public partial class TransactionsOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal TransactionsRestOperations RestClient { get; } - - /// Initializes a new instance of TransactionsOperations for mocking. - protected TransactionsOperations() - { - } - - /// Initializes a new instance of TransactionsOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - internal TransactionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - RestClient = new TransactionsRestOperations(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByInvoiceAsync(string billingAccountName, string invoiceName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("TransactionsOperations.ListByInvoice"); - scope.Start(); - try - { - var response = await RestClient.ListByInvoiceAsync(billingAccountName, invoiceName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("TransactionsOperations.ListByInvoice"); - scope.Start(); - try - { - var response = await RestClient.ListByInvoiceNextPageAsync(nextLink, billingAccountName, invoiceName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByInvoice(string billingAccountName, string invoiceName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("TransactionsOperations.ListByInvoice"); - scope.Start(); - try - { - var response = RestClient.ListByInvoice(billingAccountName, invoiceName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("TransactionsOperations.ListByInvoice"); - scope.Start(); - try - { - var response = RestClient.ListByInvoiceNextPage(nextLink, billingAccountName, invoiceName, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/TransactionsRestOperations.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/TransactionsRestOperations.cs deleted file mode 100644 index 172ec15ef2e3..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Generated/TransactionsRestOperations.cs +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Billing.Models; - -namespace Azure.ResourceManager.Billing -{ - internal partial class TransactionsRestOperations - { - private Uri endpoint; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of TransactionsRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// server parameter. - public TransactionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) - { - endpoint ??= new Uri("https://management.azure.com"); - - this.endpoint = endpoint; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListByInvoiceRequest(string billingAccountName, string invoiceName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/invoices/", false); - uri.AppendPath(invoiceName, true); - uri.AppendPath("/transactions", false); - uri.AppendQuery("api-version", "2020-05-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - /// or is null. - public async Task> ListByInvoiceAsync(string billingAccountName, string invoiceName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - - using var message = CreateListByInvoiceRequest(billingAccountName, invoiceName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - TransactionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = TransactionListResult.DeserializeTransactionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - /// or is null. - public Response ListByInvoice(string billingAccountName, string invoiceName, CancellationToken cancellationToken = default) - { - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - - using var message = CreateListByInvoiceRequest(billingAccountName, invoiceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - TransactionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = TransactionListResult.DeserializeTransactionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByInvoiceNextPageRequest(string nextLink, string billingAccountName, string invoiceName) - { - 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"); - return message; - } - - /// Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - /// , , or is null. - public async Task> ListByInvoiceNextPageAsync(string nextLink, string billingAccountName, string invoiceName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - - using var message = CreateListByInvoiceNextPageRequest(nextLink, billingAccountName, invoiceName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - TransactionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = TransactionListResult.DeserializeTransactionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. - /// The URL to the next page of results. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - /// , , or is null. - public Response ListByInvoiceNextPage(string nextLink, string billingAccountName, string invoiceName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (billingAccountName == null) - { - throw new ArgumentNullException(nameof(billingAccountName)); - } - if (invoiceName == null) - { - throw new ArgumentNullException(nameof(invoiceName)); - } - - using var message = CreateListByInvoiceNextPageRequest(nextLink, billingAccountName, invoiceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - TransactionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = TransactionListResult.DeserializeTransactionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Properties/AssemblyInfo.cs b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Properties/AssemblyInfo.cs deleted file mode 100644 index 7522e6485bd5..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Runtime.CompilerServices; - -[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Billing")] - -[assembly: InternalsVisibleTo("Azure.ResourceManager.Billing.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/README.md b/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/README.md deleted file mode 100644 index 5d02ef0f2913..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Azure.ResourceManager.Billing/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# Azure Billing Management client library for .NET - -This package follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html) which provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more. - -## Getting started - -### Install the package - -Install the Azure Billing management library for .NET with [NuGet](https://www.nuget.org/): - -```PowerShell -Install-Package Azure.ResourceManager.Billing -Version 1.0.0-preview.1 -``` - -### Prerequisites - -* You must have an [Azure subscription](https://azure.microsoft.com/free/) - -### Authenticate the Client - -To create an authenticated client and start interacting with Azure resources, please see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/master/doc/mgmt_preview_quickstart.md) - -## Key concepts - -Key concepts of the Azure .NET SDK can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html) - -## Documentation - -Documentation is available to help you learn how to use this package - -- [Quickstart](https://github.com/Azure/azure-sdk-for-net/blob/master/doc/mgmt_preview_quickstart.md) -- [API References](https://docs.microsoft.com/dotnet/api/?view=azure-dotnet) -- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/identity/Azure.Identity/README.md) - -## Examples - -Code samples for using the management library for .NET can be found in the following locations -- [.NET Management Library Code Samples](https://docs.microsoft.com/samples/browse/?branch=master&languages=csharp&term=managing%20using%20Azure%20.NET%20SDK) - -## Troubleshooting - -- File an issue via [Github - Issues](https://github.com/Azure/azure-sdk-for-net/issues) -- Check [previous - questions](https://stackoverflow.com/questions/tagged/azure+.net) - or ask new ones on Stack Overflow using azure and .net tags. - - -## Next steps - -For more information on Azure SDK, please refer to [this website](https://azure.github.io/azure-sdk/) - -## Contributing - -For details on contributing to this repository, see the contributing -guide. - -This project welcomes contributions and suggestions. Most contributions -require you to agree to a Contributor License Agreement (CLA) declaring -that you have the right to, and actually do, grant us the rights to use -your contribution. For details, visit . - -When you submit a pull request, a CLA-bot will automatically determine -whether you need to provide a CLA and decorate the PR appropriately -(e.g., label, comment). Simply follow the instructions provided by the -bot. You will only need to do this once across all repositories using -our CLA. - -This project has adopted the Microsoft Open Source Code of Conduct. For -more information see the Code of Conduct FAQ or contact - with any additional questions or comments. - - -[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization -[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Fsdk%2Ftemplate%2FAzure.Template%2FREADME.png) \ No newline at end of file diff --git a/sdk/resourcemanager/Proto.Client/billing/BillingAccount.cs b/sdk/resourcemanager/Proto.Client/billing/BillingAccount.cs deleted file mode 100644 index e85851b9eb43..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/BillingAccount.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Threading; -using System.Threading.Tasks; -using Azure.ResourceManager.Core; - -namespace Proto.Billing -{ - /// - /// A class representing an availability set along with the instance operations that can be performed on it. - /// - public class BillingAccount : BillingAccountOperations - { - /// - /// Initializes a new instance of the class. - /// - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal BillingAccount(ResourceOperationsBase options, BillingAccountData resource) - : base(options, resource.Id) - { - Data = resource; - } - - /// - /// Gets or sets the availability set data. - /// - public BillingAccountData Data { get; private set; } - - /// - protected override BillingAccount GetResource(CancellationToken cancellation = default) - { - return this; - } - - /// - protected override Task GetResourceAsync(CancellationToken cancellation = default) - { - return Task.FromResult(this); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/BillingAccountOperations.cs b/sdk/resourcemanager/Proto.Client/billing/BillingAccountOperations.cs deleted file mode 100644 index 8633be2068c3..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/BillingAccountOperations.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using Azure.ResourceManager.Billing; -using Azure.ResourceManager.Core; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Billing -{ - /// - /// A class representing the operations that can be performed over a specific availability set. - /// - public class BillingAccountOperations : ResourceOperationsBase - { - /// - /// Initializes a new instance of the class. - /// - /// An instance of that has an id for an availability set. - internal BillingAccountOperations(GenericResourceOperations genericOperations) - : base(genericOperations, genericOperations.Id) - { - } - - //TODO : dicuss ways to not pass in Subscription subscription for tenant only resources - internal BillingAccountOperations(TenantOperations tenant, string billingAccountId) - : base(tenant, $"/providers/{ResourceType}/{billingAccountId}") - { - } - - /// - /// 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 BillingAccountOperations(ResourceOperationsBase options, ResourceIdentifier id) - : base(options, id) - { - } - - /// - /// Gets the resource type definition for an availability set. - /// - public static readonly ResourceType ResourceType = "Microsoft.Billing/billingAccounts"; - - /// - protected override ResourceType ValidResourceType => ResourceType; - - private BillingAccountsOperations Operations => new BillingManagementClient( - BaseUri, - Guid.Empty.ToString(), - Credential, - ClientOptions.Convert()).BillingAccounts; - - - /// - public override Response Get(CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.Name, cancellationToken: cancellationToken); - return Response.FromValue(new BillingAccount(this, new BillingAccountData(response.Value)), response.GetRawResponse()); - } - - /// - public override async Task> GetAsync(CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new BillingAccount(this, new BillingAccountData(response.Value)), response.GetRawResponse()); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/CHANGELOG.md b/sdk/resourcemanager/Proto.Client/billing/CHANGELOG.md deleted file mode 100644 index 5c312e4ea9be..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -# Release History - -## 1.0.0-beta.1 (Unreleased) - --Initial checkin diff --git a/sdk/resourcemanager/Proto.Client/billing/Extensions/TenantExtensions.cs b/sdk/resourcemanager/Proto.Client/billing/Extensions/TenantExtensions.cs deleted file mode 100644 index 9c3ac6df5a36..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Extensions/TenantExtensions.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.ResourceManager.Core; -using System; - -namespace Proto.Billing -{ - /// - /// A class to add extension methods to an ArmClient. - /// - public static class TenantExtensions - { - - /// - /// Gets the BillingAccountsOperations. - /// - /// The instance the method will execute against. - /// Returns an object representing the operations that can be performed over a specific . - public static BillingAccountOperations GetBillingAccountsOperations(this TenantOperations tenant, string billingAccountId) - { - if (string.IsNullOrEmpty(billingAccountId)) - throw new ArgumentException(nameof(billingAccountId)); - return new BillingAccountOperations(tenant, billingAccountId); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Placeholder/BillingAccountData.cs b/sdk/resourcemanager/Proto.Client/billing/Placeholder/BillingAccountData.cs deleted file mode 100644 index ad5941becfff..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Placeholder/BillingAccountData.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Core.Adapters; - -namespace Proto.Billing -{ - /// - /// A class representing the availability set data model. - /// - public class BillingAccountData : TrackedResource - { - - /// - /// Initializes a new instance of the class. - /// - /// The availability set to initialize. - public BillingAccountData(Azure.ResourceManager.Billing.Models.BillingAccount billingAccount) - : base(billingAccount.Id, "westus", billingAccount) - { - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/billing/Proto.Billing.csproj b/sdk/resourcemanager/Proto.Client/billing/Proto.Billing.csproj deleted file mode 100644 index f3037c85f139..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/Proto.Billing.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - 1.0.0-beta.1 - netstandard2.0 - Proto.Billing - latest - false - false - - - - - - - - - - - - - $(NoWarn);AZC0001;CA1303;SA0001;SA1629; SA1101;SA1200;SA1208;SA1309;SA1633; - - diff --git a/sdk/resourcemanager/Proto.Client/billing/README.MD b/sdk/resourcemanager/Proto.Client/billing/README.MD deleted file mode 100644 index 747a007572af..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/README.MD +++ /dev/null @@ -1,3 +0,0 @@ -# Proto Authorization - -Prototype version of Azure.ResourceManager.Billing used to showcase and test the new prototype track 2 management plane SDK \ No newline at end of file diff --git a/sdk/resourcemanager/Proto.Client/billing/TrackedResource.cs b/sdk/resourcemanager/Proto.Client/billing/TrackedResource.cs deleted file mode 100644 index 0d44251e00d7..000000000000 --- a/sdk/resourcemanager/Proto.Client/billing/TrackedResource.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.ResourceManager.Core.Adapters -{ - /// - /// A class representing a generic tracked resource in Azure. - /// - /// The type of the underlying resource id - /// The type of the underlying model this class wraps - public abstract class TrackedResource : TrackedResource - where TIdentifier : TenantResourceIdentifier - where TModel : class - { - /// - /// Initializes a new instance of the class. - /// - /// The identifier of the resource that is the target of operations. - /// The location of the resource. - /// The model to copy from. - protected TrackedResource(TIdentifier id, LocationData location, TModel data) - : base(id, id?.Name, id?.ResourceType, location, null) - { - Model = data; - } - - /// - /// Gets or sets the Model this resource is based off. - /// - public virtual TModel Model { get; set; } - - /// - /// Converts from a into the TModel. - /// - /// The tracked resource convert from. - public static implicit operator TModel(TrackedResource other) - { - return other.Model; - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Adapters/PhWrappingAsyncPageable.cs b/sdk/resourcemanager/Proto.Client/compute/Adapters/PhWrappingAsyncPageable.cs deleted file mode 100644 index 43a76a766317..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Adapters/PhWrappingAsyncPageable.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Azure.ResourceManager.Core -{ - /// - /// Returns an AsyncPageable that transforms each page of contents after they are retrieved from the server - /// according to the profived transformation function - /// - /// The model returned by existing AsyncPageable methods. - /// The to convert TModel into. - public class PhWrappingAsyncPageable : AsyncPageable - where TOperations : class - where TModel : class - { - private readonly Func _converter; - private readonly IEnumerable> _wrapped; - - /// - /// Initializes a new instance of the class for mocking. - /// - protected PhWrappingAsyncPageable() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - public PhWrappingAsyncPageable(AsyncPageable wrapped, Func converter) - { - _wrapped = new[] { wrapped }; - _converter = converter; - } - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - public PhWrappingAsyncPageable(IEnumerable> wrapped, Func converter) - { - _wrapped = wrapped; - _converter = converter; - } - - /// - public override async IAsyncEnumerable> AsPages( - string continuationToken = null, - int? pageSizeHint = null) - { - foreach (var pageEnum in _wrapped) - { - await foreach (var page in pageEnum.AsPages().WithCancellation(CancellationToken)) - { - yield return new WrappingPage(page, _converter); - } - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Adapters/PhWrappingPageable.cs b/sdk/resourcemanager/Proto.Client/compute/Adapters/PhWrappingPageable.cs deleted file mode 100644 index c11077cb0107..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Adapters/PhWrappingPageable.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.Core -{ - /// - /// This class allows performing conversions on pages of data as they are accessed - used in the prototype to convett - /// between underlying model types and the new model types that extend Resource, - /// and also for returning Operations classes for those underlying objects. - /// - /// The type parameter of the Pageable we are wrapping. - /// The desired type parameter of the returned pageable. - public class PhWrappingPageable : Pageable - where TOperations : class - where TModel : class - { - private readonly Func _converter; - private readonly IEnumerable> _wrapped; - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - public PhWrappingPageable(Pageable wrapped, Func converter) - { - _wrapped = new[] { wrapped }; - _converter = converter; - } - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - public PhWrappingPageable(IEnumerable> wrapped, Func converter) - { - _wrapped = wrapped; - _converter = converter; - } - - /// - public override IEnumerable> AsPages(string continuationToken = null, int? pageSizeHint = null) - { - foreach (var pages in _wrapped) - { - foreach (var page in pages.AsPages()) - { - yield return new WrappingPage(page, _converter); - } - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Adapters/WrappingPage.cs b/sdk/resourcemanager/Proto.Client/compute/Adapters/WrappingPage.cs deleted file mode 100644 index df1faea2f915..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Adapters/WrappingPage.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.ResourceManager.Core -{ - /// - /// A class representing a wrapper over - /// - /// The type parameter we are wrapping. - /// The desired type parameter of the returned page. - internal class WrappingPage : Page - where TOperations : class - where TModel : class - { - private readonly Func _converter; - private readonly Page _wrapped; - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - internal WrappingPage(Page wrapped, Func converter) - { - _wrapped = wrapped; - _converter = converter; - } - - /// - public override IReadOnlyList Values => _wrapped.Values.Select(_converter).ToList(); - - /// - public override string ContinuationToken => _wrapped.ContinuationToken; - - /// - public override Response GetRawResponse() - { - return _wrapped.GetRawResponse(); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/AvailabilitySet.cs b/sdk/resourcemanager/Proto.Client/compute/AvailabilitySet.cs deleted file mode 100644 index b1efc8d02a23..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/AvailabilitySet.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Azure.ResourceManager.Core; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Compute -{ - /// - /// A class representing an availability set along with the instance operations that can be performed on it. - /// - public class AvailabilitySet : AvailabilitySetOperations - { - /// - /// Initializes a new instance of the class. - /// - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal AvailabilitySet(ResourceOperationsBase options, AvailabilitySetData resource) - : base(options, resource.Id) - { - Data = resource; - } - - /// - /// Gets or sets the availability set data. - /// - public AvailabilitySetData Data { get; private set; } - - /// - protected override AvailabilitySet GetResource(CancellationToken cancellation = default) - { - return this; - } - - /// - protected override Task GetResourceAsync(CancellationToken cancellation = default) - { - return Task.FromResult(this); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/AvailabilitySetBuilder.cs b/sdk/resourcemanager/Proto.Client/compute/AvailabilitySetBuilder.cs deleted file mode 100644 index 6e69a63042d4..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/AvailabilitySetBuilder.cs +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Compute -{ - /// - /// A class representing a builder object used to create availability sets. - /// - public class AvailabilitySetBuilder - { - /// - /// Initializes a new instance of the class. - /// - /// The container object to create the resource in. - /// The data required to create the resource. - public AvailabilitySetBuilder(AvailabilitySetContainer container, AvailabilitySetData resource) - { - Resource = resource; - UnTypedContainer = container; - } - - /// - /// Gets the resource object to create. - /// - protected AvailabilitySetData Resource { get; private set; } - - /// - /// Gets the resource name. - /// - protected string ResourceName { get; private set; } - - /// - /// Gets the container object to create the resource in. - /// - protected AvailabilitySetContainer UnTypedContainer { get; private set; } - - /// - /// Creates the resource object to send to the Azure API. - /// - /// The resource to create. - public AvailabilitySetData Build() - { - ThrowIfNotValid(); - OnBeforeBuild(); - InternalBuild(); - OnAfterBuild(); - - return Resource; - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - /// Name cannot be null or a whitespace. - public Response CreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return UnTypedContainer.CreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this resource. - /// Name cannot be null or a whitespace. - public async Task> CreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await UnTypedContainer.CreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public Operation StartCreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return UnTypedContainer.StartCreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public async Task> StartCreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await UnTypedContainer.StartCreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// Determines whether or not the resource is valid. - /// - /// The message indicating what is wrong with the resource. - /// Whether or not the resource is valid. - protected virtual bool IsValid(out string message) - { - message = string.Empty; - - return true; - } - - /// - /// Perform any tasks necessary after the resource is built - /// - protected virtual void OnAfterBuild() - { - } - - /// - /// Perform any tasks necessary before the resource is built - /// - protected virtual void OnBeforeBuild() - { - } - - private static void InternalBuild() - { - } - - private void ThrowIfNotValid() - { - if (!IsValid(out var message)) - { - throw new InvalidOperationException(message); - } - } - } -} \ No newline at end of file diff --git a/sdk/resourcemanager/Proto.Client/compute/AvailabilitySetContainer.cs b/sdk/resourcemanager/Proto.Client/compute/AvailabilitySetContainer.cs deleted file mode 100644 index 97f96ce61a61..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/AvailabilitySetContainer.cs +++ /dev/null @@ -1,168 +0,0 @@ -using Azure; -using Azure.ResourceManager.Compute; -using Azure.ResourceManager.Core; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Compute -{ - /// - /// A class representing collection of availability set and their operations over a resource group. - /// - public class AvailabilitySetContainer : ResourceContainerBase - { - /// - /// Initializes a new instance of the class. - /// - /// The parent resource group. - internal AvailabilitySetContainer(ResourceGroupOperations resourceGroup) - : base(resourceGroup) - { - } - - /// - protected override ResourceType ValidResourceType => ResourceGroupOperations.ResourceType; - - /// - /// Typed Resource Identifier for the container. - /// - public new ResourceGroupResourceIdentifier Id => base.Id as ResourceGroupResourceIdentifier; - - /// - /// The operation to create or update an availability set. Please note some properties can be set only during creation. - /// - /// The name of the availability set. - /// The desired availability set configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - /// Name of the availability set cannot be null or a whitespace. - /// resourceDetails cannot be null. - public Response CreateOrUpdate(string name, AvailabilitySetData resourceDetails, CancellationToken cancellationToken = default) - { - var response = Operations.CreateOrUpdate(Id.ResourceGroupName, name, resourceDetails.Model); - return Response.FromValue(new AvailabilitySet(Parent, new AvailabilitySetData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to create or update an availability set. Please note some properties can be set only during creation. - /// - /// The name of the availability set. - /// The desired availability set configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this resource group. - /// Name of the availability set cannot be null or a whitespace. - /// resourceDetails cannot be null. - public async Task> CreateOrUpdateAsync(string name, AvailabilitySetData resourceDetails, CancellationToken cancellationToken = default) - { - var containerId = Id as ResourceGroupResourceIdentifier; - var response = await Operations.CreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AvailabilitySet(Parent, new AvailabilitySetData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to create or update an availability set. Please note some properties can be set only during creation. - /// - /// The name of the availability set. - /// The desired availability set configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name of the availability set cannot be null or a whitespace. - /// resourceDetails cannot be null. - public Operation StartCreateOrUpdate(string name, AvailabilitySetData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - Operations.CreateOrUpdate(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken), - a => new AvailabilitySet(Parent, new AvailabilitySetData(a))); - } - - /// - /// The operation to create or update an availability set. Please note some properties can be set only during creation. - /// - /// The name of the availability set. - /// The desired availability set configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name of the availability set cannot be null or a whitespace. - /// resourceDetails cannot be null. - public async Task> StartCreateOrUpdateAsync(string name, AvailabilitySetData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - await Operations.CreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken).ConfigureAwait(false), - a => new AvailabilitySet(Parent, new AvailabilitySetData(a))); - } - - /// - /// Constructs an object used to create an availability set. - /// - /// The sku name of the resource. - /// The location of the resource. - /// A builder with and . - public AvailabilitySetBuilder Construct(string skuName, LocationData location = null) - { - var parent = GetParentResource(); - var availabilitySet = new Azure.ResourceManager.Compute.Models.AvailabilitySet(location ?? parent.Data.Location) - { - PlatformUpdateDomainCount = 5, - PlatformFaultDomainCount = 2, - Sku = new Azure.ResourceManager.Compute.Models.Sku() { Name = skuName } - }; - - return new AvailabilitySetBuilder(this, new AvailabilitySetData(availabilitySet)); - } - - /// - /// Filters the list of availability set for this resource group represented as generic resources. - /// - /// The filter used in this operation. - /// The number of results to return. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of resource that may take multiple service requests to iterate over. - public Pageable ListAsGenericResource(string nameFilter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(AvailabilitySetData.ResourceType); - filters.SubstringFilter = nameFilter; - return ResourceListOperations.ListAtContext(Parent as ResourceGroupOperations, filters, top, cancellationToken); - } - - /// - /// Filters the list of availability set for this resource group represented as generic resources. - /// - /// The filter used in this operation. - /// The number of results to return. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of resource that may take multiple service requests to iterate over. - public AsyncPageable ListAsGenericResourceAsync(string nameFilter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(AvailabilitySetData.ResourceType); - filters.SubstringFilter = nameFilter; - return ResourceListOperations.ListAtContextAsync(Parent as ResourceGroupOperations, filters, top, cancellationToken); - } - - private AvailabilitySetsOperations Operations => new ComputeManagementClient( - BaseUri, - Id.SubscriptionId, - Credential, - ClientOptions.Convert()).AvailabilitySets; - - - /// - public Response Get(string availabilitySetName, CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, availabilitySetName); - return Response.FromValue(new AvailabilitySet(Parent, new AvailabilitySetData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> GetAsync(string availabilitySetName, CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, availabilitySetName, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AvailabilitySet(Parent, new AvailabilitySetData(response.Value)), response.GetRawResponse()); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/AvailabilitySetOperations.cs b/sdk/resourcemanager/Proto.Client/compute/AvailabilitySetOperations.cs deleted file mode 100644 index faaf7ab3d332..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/AvailabilitySetOperations.cs +++ /dev/null @@ -1,278 +0,0 @@ -using Azure; -using Azure.ResourceManager.Compute; -using Azure.ResourceManager.Compute.Models; -using Azure.ResourceManager.Core; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Compute -{ - /// - /// A class representing the operations that can be performed over a specific availability set. - /// - public class AvailabilitySetOperations : ResourceOperationsBase - { - /// - /// Initializes a new instance of the class. - /// - /// An instance of that has an id for an availability set. - internal AvailabilitySetOperations(GenericResourceOperations genericOperations) - : base(genericOperations, genericOperations.Id) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The client parameters to use in these operations. - /// The name of the availability set to use. - internal AvailabilitySetOperations(ResourceGroupOperations resourceGroup, string availabilitySetName) - : base(resourceGroup, resourceGroup.Id.AppendProviderResource(ResourceType.Namespace, ResourceType.Type, availabilitySetName)) - { - } - - /// - /// 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. - protected AvailabilitySetOperations(ResourceOperationsBase options, ResourceGroupResourceIdentifier id) - : base(options, id) - { - } - - /// - /// Gets the resource type definition for an availability set. - /// - public static readonly ResourceType ResourceType = "Microsoft.Compute/availabilitySets"; - - /// - protected override ResourceType ValidResourceType => ResourceType; - - private AvailabilitySetsOperations Operations => new ComputeManagementClient( - BaseUri, - Id.SubscriptionId, - Credential, - ClientOptions.Convert()).AvailabilitySets; - - /// - public Response Delete(CancellationToken cancellationToken = default) - { - return Operations.Delete(Id.ResourceGroupName, Id.Name, cancellationToken); - } - - /// - public async Task DeleteAsync(CancellationToken cancellationToken = default) - { - return await Operations.DeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken); - } - - /// - public Operation StartDelete(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(Operations.Delete(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - public async Task StartDeleteAsync(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(await Operations.DeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - public override Response Get(CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, Id.Name); - return Response.FromValue(new AvailabilitySet(this, new AvailabilitySetData(response.Value)), response.GetRawResponse()); - } - - /// - public async override Task> GetAsync(CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AvailabilitySet(this, new AvailabilitySetData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to update an availability set. - /// - /// The parameters to update. - /// The operation of the updated resource. - public Response Update(AvailabilitySetUpdate patchable, CancellationToken cancellationToken = default) - { - var response = Operations.Update(Id.ResourceGroupName, Id.Name, patchable, cancellationToken); - return Response.FromValue(new AvailabilitySet(this, new AvailabilitySetData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to update an availability set. - /// - /// The parameters to update. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns the operation of the updated resource. - public async Task> UpdateAsync(AvailabilitySetUpdate patchable, CancellationToken cancellationToken = default) - { - var response = await Operations.UpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AvailabilitySet(this, new AvailabilitySetData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to update an availability set. - /// - /// The parameters to update. - /// The operation of the updated resource. - public Operation StartUpdate(AvailabilitySetUpdate patchable, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - Operations.Update(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - a => new AvailabilitySet(this, new AvailabilitySetData(a))); - } - - /// - /// The operation to update an availability set. - /// - /// The parameters to update. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns the operation of the updated resource. - public async Task> StartUpdateAsync(AvailabilitySetUpdate patchable, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - await Operations.UpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - a => new AvailabilitySet(this, new AvailabilitySetData(a))); - } - - /// - public Response AddTag(string key, string value, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new AvailabilitySetUpdate(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - return Update(patchable, cancellationToken); - } - - /// - public async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new AvailabilitySetUpdate(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - return await UpdateAsync(patchable, cancellationToken); - } - - /// - public Operation StartAddTag(string key, string value, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new AvailabilitySetUpdate(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - return StartUpdate(patchable, cancellationToken); - } - - /// - public async Task> StartAddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new AvailabilitySetUpdate(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - return await StartUpdateAsync(patchable, cancellationToken); - } - - /// - public Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new AvailabilitySetUpdate(); - patchable.Tags.ReplaceWith(tags); - return Update(patchable, cancellationToken); - } - - /// - public async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new AvailabilitySetUpdate(); - patchable.Tags.ReplaceWith(tags); - return await UpdateAsync(patchable, cancellationToken); - } - - /// - public Operation StartSetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new AvailabilitySetUpdate(); - patchable.Tags.ReplaceWith(tags); - return StartUpdate(patchable, cancellationToken); - } - - /// - public async Task> StartSetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new AvailabilitySetUpdate(); - patchable.Tags.ReplaceWith(tags); - return await StartUpdateAsync(patchable, cancellationToken); - } - - /// - public Response RemoveTag(string key, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new AvailabilitySetUpdate(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - return Update(patchable, cancellationToken); - } - - /// - public async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new AvailabilitySetUpdate(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - return await UpdateAsync(patchable, cancellationToken); - } - - /// - public Operation StartRemoveTag(string key, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new AvailabilitySetUpdate(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - return StartUpdate(patchable, cancellationToken); - } - - /// - public async Task> StartRemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new AvailabilitySetUpdate(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - return await StartUpdateAsync(patchable, cancellationToken); - } - - /// - /// Lists all available geo-locations. - /// - /// A collection of location that may take multiple service requests to iterate over. - public IEnumerable ListAvailableLocations(CancellationToken cancellationToken = default) - { - return ListAvailableLocations(ResourceType, cancellationToken); - } - - /// - /// Lists all available geo-locations. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of location that may take multiple service requests to iterate over. - /// The default subscription id is null. - public async Task> ListAvailableLocationsAsync(CancellationToken cancellationToken = default) - { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/CHANGELOG.md b/sdk/resourcemanager/Proto.Client/compute/CHANGELOG.md deleted file mode 100644 index 5c312e4ea9be..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -# Release History - -## 1.0.0-beta.1 (Unreleased) - --Initial checkin diff --git a/sdk/resourcemanager/Proto.Client/compute/ComputeRestApiVersions.cs b/sdk/resourcemanager/Proto.Client/compute/ComputeRestApiVersions.cs deleted file mode 100644 index e9f12a385023..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/ComputeRestApiVersions.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace Proto.Compute -{ - /// - /// A class representing which api version to use for each compute resource. - /// - public class ComputeRestApiVersions - { - internal ComputeRestApiVersions() - { - VirtualMachinesVersion = VirtualMachinesApiVersions.Default; - AvailabilitySetsVersion = AvailabilitySetsApiVersions.Default; - } - - /// - /// Gets or sets the virtual machine api version. - /// - public VirtualMachinesApiVersions VirtualMachinesVersion { get; set; } - - /// - /// Gets or sets the availability set api version. - /// - public AvailabilitySetsApiVersions AvailabilitySetsVersion { get; set; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Convenience/VirtualMachineModelBuilder.cs b/sdk/resourcemanager/Proto.Client/compute/Convenience/VirtualMachineModelBuilder.cs deleted file mode 100644 index 2a9ebfaabcc4..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Convenience/VirtualMachineModelBuilder.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Azure.ResourceManager.Core; -using System; - -namespace Proto.Compute.Convenience -{ - /// - /// A class representing a builder object to help create a virtual machine. - /// - public class VirtualMachineModelBuilder : VirtualMachineModelBuilderBase - { - /// - /// Initializes a new instance of the class. - /// - /// The container to create the virtual machine in. - /// The data model representing the virtual machine to create. - public VirtualMachineModelBuilder(VirtualMachineContainer containerOperations, VirtualMachineData vm): base(containerOperations, vm) - { - // TODO: GENERATOR Update Builder after models are incorporated in generated models - // _model.Name = vmName; - //_model = new VirtualMachine(location); - } - - /// - /// Attaches a disk to the virtual machine to be created. - /// - /// The disk to attach. - /// An instance of - public VirtualMachineModelBuilderBase AttachDataDisk(TrackedResource azureEntity) - { - throw new NotImplementedException(); - } - - /// - public override VirtualMachineModelBuilderBase UseWindowsImage(string adminUser, string password) - { - throw new NotImplementedException(); - } - - /// - public override VirtualMachineModelBuilderBase UseLinuxImage(string adminUser, string password) - { - throw new NotImplementedException(); - } - - /// - public override VirtualMachineModelBuilderBase RequiredNetworkInterface(ResourceIdentifier nicResourceId) - { - throw new NotImplementedException(); - } - - /// - public override VirtualMachineModelBuilderBase RequiredAvalabilitySet(ResourceIdentifier asetResourceId) - { - throw new NotImplementedException(); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Convenience/VirtualMachineModelBuilderBase.cs b/sdk/resourcemanager/Proto.Client/compute/Convenience/VirtualMachineModelBuilderBase.cs deleted file mode 100644 index 30b40a026f69..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Convenience/VirtualMachineModelBuilderBase.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Azure.ResourceManager.Core; - -namespace Proto.Compute.Convenience -{ - /// - /// A class representing the base for a builder object to help create a virtual machine. - /// - public abstract class VirtualMachineModelBuilderBase : VirtualMachineBuilder - { - /// - /// Initializes a new instance of . - /// - /// The that the virtual machine will be built in. - /// The data model representing the virtual machine to create. - protected VirtualMachineModelBuilderBase(VirtualMachineContainer containerOperations, VirtualMachineData vm) - : base(containerOperations, vm) - { - } - - /// - /// Tells the builder to use a windows image. - /// - /// The admin username for the virtual machine. - /// The asmin password for the virtual machine. - /// An instance of . - public abstract VirtualMachineModelBuilderBase UseWindowsImage(string adminUser, string password); - - /// - /// Tells the builder to use a linux image. - /// - /// The admin username for the virtual machine. - /// The asmin password for the virtual machine. - /// An instance of . - public abstract VirtualMachineModelBuilderBase UseLinuxImage(string adminUser, string password); - - /// - /// Tells the builder to use a specific network interface. - /// - /// The network interface identifier. - /// An instance of . - public abstract VirtualMachineModelBuilderBase RequiredNetworkInterface(ResourceIdentifier nicResourceId); - - /// - /// Tells the builder to use a specific availability set. - /// - /// The availability set identifier. - /// An instance of . - public abstract VirtualMachineModelBuilderBase RequiredAvalabilitySet(ResourceIdentifier asetResourceId); - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Convenience/VirtualMachineScaleSetBuilder.cs b/sdk/resourcemanager/Proto.Client/compute/Convenience/VirtualMachineScaleSetBuilder.cs deleted file mode 100644 index 64e2342dd4bd..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Convenience/VirtualMachineScaleSetBuilder.cs +++ /dev/null @@ -1,81 +0,0 @@ -using Azure.ResourceManager.Core; -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.ResourceManager.Compute.Models; - -namespace Proto.Compute -{ - /// - /// A class representing a builder object to help create a virtual machine. - /// - public partial class VirtualMachineScaleSetBuilder - { - public VirtualMachineScaleSetBuilder WithUseWindowsImage(string computerNamePrefix, string adminUser, string password) - { - _model.VirtualMachineProfile.OsProfile = new VirtualMachineScaleSetOSProfile() - { - ComputerNamePrefix = computerNamePrefix, - AdminUsername = adminUser, - AdminPassword = password, - WindowsConfiguration = new WindowsConfiguration { TimeZone = "Pacific Standard Time", ProvisionVMAgent = true } - }; - - return this; - } - - public VirtualMachineScaleSetBuilder WithUseLinuxImage(string computerNamePrefix, string adminUser, string password) - { - _model.VirtualMachineProfile.OsProfile = new VirtualMachineScaleSetOSProfile() - { - ComputerNamePrefix = computerNamePrefix, - AdminUsername = adminUser, - AdminPassword = password, - LinuxConfiguration = new LinuxConfiguration - { - DisablePasswordAuthentication = false, - ProvisionVMAgent = true - } - }; - - return this; - } - - public VirtualMachineScaleSetBuilder WithRequiredPrimaryNetworkInterface( - string name, - ResourceIdentifier subNetResourceId, - ICollection backendAddressPoolResourceIds, - ICollection inboundNatPoolResourceIds) - { - var ipconfig = new VirtualMachineScaleSetIPConfiguration($"{name}PrimaryIPConfig") - { - Subnet = new ApiEntityReference() { Id = subNetResourceId }, - }; - foreach (var id in backendAddressPoolResourceIds) - { - ipconfig.LoadBalancerBackendAddressPools.Add( - new Azure.ResourceManager.Compute.Models.SubResource { Id = id }); - } - foreach (var id in inboundNatPoolResourceIds) - { - ipconfig.LoadBalancerInboundNatPools.Add( - new Azure.ResourceManager.Compute.Models.SubResource { Id = id }); - } - - var nicConfig = new VirtualMachineScaleSetNetworkConfiguration(name) - { - Primary = true, - }; - nicConfig.IpConfigurations.Add(ipconfig); - - _model.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.Add(nicConfig); - - return this; - } - - public VirtualMachineScaleSetBuilder WithRequiredLoadBalancer(ResourceIdentifier asetResourceId) - { - return this; - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Extensions/ArmClientExtensions.cs b/sdk/resourcemanager/Proto.Client/compute/Extensions/ArmClientExtensions.cs deleted file mode 100644 index a20f2017a0cf..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Extensions/ArmClientExtensions.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Azure.ResourceManager.Core; -using System; - -namespace Proto.Compute -{ - /// - /// A class to add extension methods to an ArmClient. - /// - public static class ArmClientExtensions - { - - /// - /// Gets the AvailabilitySetOperations. - /// - /// The instance the method will execute against. - /// The ResourceIdentifier of the resource that is the target of operations. - /// Returns an object representing the operations that can be performed over a specific . - /// ResourceIdentifier provided is not for an AvailabilitySet. - /// ResourceIdentifier cannot be null. - public static AvailabilitySetOperations GetAvailabilitySetOperations(this ArmClient client, ResourceGroupResourceIdentifier resourceId) - { - if (resourceId is null) - throw new ArgumentNullException(nameof(resourceId)); - if (resourceId.ResourceType != AvailabilitySetOperations.ResourceType) - throw new ArgumentException($"{nameof(resourceId.ResourceType)} provided is not for an AvailabilitySet.", nameof(resourceId.ResourceType)); - - return new AvailabilitySetOperations(client.GetResourceGroupOperations(resourceId), resourceId.Name); - } - - /// - /// Gets the VirtualMachineOperations. - /// - /// The instance the method will execute against. - /// The ResourceIdentifier of the resource that is the target of operations. - /// Returns an object representing the operations that can be performed over a specific . - /// ResourceIdentifier provided is not for a VirtualMachine. - /// ResourceIdentifier cannot be null. - public static VirtualMachineOperations GetVirtualMachineOperations(this ArmClient client, ResourceGroupResourceIdentifier resourceId) - { - if (resourceId is null) - throw new ArgumentNullException(nameof(resourceId)); - if (resourceId.ResourceType != VirtualMachineOperations.ResourceType) - throw new ArgumentException($"{nameof(resourceId.ResourceType)} provided is not for a VirtualMachine.", nameof(resourceId.ResourceType)); - - return new VirtualMachineOperations(client.GetResourceGroupOperations(resourceId), resourceId.Name); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Extensions/AzureResourceManagerClientOptionsExtensions.cs b/sdk/resourcemanager/Proto.Client/compute/Extensions/AzureResourceManagerClientOptionsExtensions.cs deleted file mode 100644 index 6f067253b344..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Extensions/AzureResourceManagerClientOptionsExtensions.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Azure.ResourceManager.Core; - -namespace Proto.Compute.Extensions -{ - /// - /// A class to add extension methods to ArmClientOptions. - /// - public static class ArmClientOptionsExtensions - { - /// - /// Adds a method to ArmClientOptions which returns all the versions to all resources inside the compute resource provider. - /// - /// The instance the method will execute against. - /// Returns a response with the operation for this resource. - public static ComputeRestApiVersions GetComputeRestApiVersions(this ArmClientOptions ArmClientOptions) - { - return ArmClientOptions.GetOverrideObject(() => new ComputeRestApiVersions()) as ComputeRestApiVersions; - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Extensions/ResourceGroupExtensions.cs b/sdk/resourcemanager/Proto.Client/compute/Extensions/ResourceGroupExtensions.cs deleted file mode 100644 index dd3190efe995..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Extensions/ResourceGroupExtensions.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Azure.ResourceManager.Core; -using System; - -namespace Proto.Compute -{ - /// - /// A class to add extension methods to ResourceGroup. - /// - public static class ResourceGroupExtensions - { - /// - /// Gets an object representing a VirtualMachineContainer along with the instance operations that can be performed on it. - /// - /// The instance the method will execute against. - /// Returns a object. - public static VirtualMachineContainer GetVirtualMachines(this ResourceGroupOperations resourceGroup) - { - return new VirtualMachineContainer(resourceGroup); - } - - /// - /// Gets an object representing a VirtualMachineScaleSetContainer along with the instance operations that can be performed on it. - /// - /// The instance the method will execute against. - /// Returns a object. - public static VirtualMachineScaleSetContainer GetVirtualMachineScaleSet(this ResourceGroupOperations resourceGroup) - { - return new VirtualMachineScaleSetContainer(resourceGroup); - } - - /// - /// Gets an object representing a AvailabilitySetContainer along with the instance operations that can be performed on it. - /// - /// The instance the method will execute against. - /// Returns an object. - public static AvailabilitySetContainer GetAvailabilitySets(this ResourceGroupOperations resourceGroup) - { - return new AvailabilitySetContainer(resourceGroup); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Extensions/SubscriptionExtensions.cs b/sdk/resourcemanager/Proto.Client/compute/Extensions/SubscriptionExtensions.cs deleted file mode 100644 index 05712367db44..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Extensions/SubscriptionExtensions.cs +++ /dev/null @@ -1,162 +0,0 @@ -using Azure; -using Azure.Core; -using Azure.ResourceManager.Compute; -using Azure.ResourceManager.Core; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Compute -{ - /// - /// Extension methods for convenient access on SubscriptionOperations in a client - /// - public static class SubscriptionExtensions - { - private static ComputeManagementClient GetComputeClient(Uri baseUri, string subscriptionGuid, TokenCredential credential, ArmClientOptions clientOptions) - { - return new ComputeManagementClient( - baseUri, - subscriptionGuid, - credential, - clientOptions.Convert()); - } - - #region Virtual Machine List Operations - /// - /// Lists the VirtualMachines for this SubscriptionOperations. - /// - /// The instance the method will execute against. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static Pageable ListVirtualMachines(this SubscriptionOperations subscription) - { - return subscription.UseClientContext( - (baseUri, credential, options, pipeline) => - { - ComputeManagementClient computeClient = GetComputeClient(baseUri, subscription.Id.SubscriptionId, credential, options); - var vmOperations = computeClient.VirtualMachines; - var result = vmOperations.ListAll(); - return new PhWrappingPageable( - result, - s => new VirtualMachine(subscription, new VirtualMachineData(s))); - } - ); - } - - /// - /// Lists the VirtualMachines for this SubscriptionOperations. - /// - /// The instance the method will execute against. - /// An async collection of resource operations that may take multiple service requests to iterate over. - public static AsyncPageable ListVirtualMachinesAsync(this SubscriptionOperations subscription) - { - return subscription.UseClientContext( - (baseUri, credential, options, pipeline) => - { - ComputeManagementClient computeClient = GetComputeClient(baseUri, subscription.Id.SubscriptionId, credential, options); - var vmOperations = computeClient.VirtualMachines; - var result = vmOperations.ListAllAsync(); - return new PhWrappingAsyncPageable( - result, - s => new VirtualMachine(subscription, new VirtualMachineData(s))); - } - ); - } - - /// - /// Filters the list of VMs for a SubscriptionOperations represented as generic resources. - /// - /// The instance the method will execute against. - /// The string to filter the list. - /// The number of results to return. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of resource operations that may take multiple service requests to iterate over. - public static Pageable ListVirtualMachinesByName(this SubscriptionOperations subscription, string filter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(VirtualMachineOperations.ResourceType); - filters.SubstringFilter = filter; - return ResourceListOperations.ListAtContext(subscription, filters, top, cancellationToken); - } - - /// - /// Filters the list of VMs for a SubscriptionOperations represented as generic resources. - /// - /// The instance the method will execute against. - /// The string to filter the list. - /// The number of results to return. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of resource operations that may take multiple service requests to iterate over. - public static AsyncPageable ListVirtualMachinesByNameAsync(this SubscriptionOperations subscription, string filter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(VirtualMachineOperations.ResourceType); - filters.SubstringFilter = filter; - return ResourceListOperations.ListAtContextAsync(subscription, filters, top, cancellationToken); - } - #endregion - - #region AvailabilitySet List Operations - /// - /// Lists the AvailabilitySets for this SubscriptionOperations. - /// - /// The instance the method will execute against. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static Pageable ListAvailabilitySets(this SubscriptionOperations subscription) - { - return subscription.UseClientContext( - (baseUri, credential, options, pipeline) => - { - ComputeManagementClient computeClient = GetComputeClient(baseUri, subscription.Id.SubscriptionId, credential, options); - var availabilitySetOperations = computeClient.AvailabilitySets; - var result = availabilitySetOperations.ListBySubscription(); - return new PhWrappingPageable( - result, - s => new AvailabilitySet(subscription, new AvailabilitySetData(s))); - } - ); - } - - /// - /// Lists the AvailabilitySets for this SubscriptionOperations. - /// - /// The instance the method will execute against. - /// An async collection of resource operations that may take multiple service requests to iterate over. - public static AsyncPageable ListAvailabilitySetsAsync(this SubscriptionOperations subscription) - { - return subscription.UseClientContext( - (baseUri, credential, options, pipeline) => - { - ComputeManagementClient computeClient = GetComputeClient(baseUri, subscription.Id.SubscriptionId, credential, options); - var availabilitySetOperations = computeClient.AvailabilitySets; - var result = availabilitySetOperations.ListBySubscriptionAsync(); - return new PhWrappingAsyncPageable( - result, - s => new AvailabilitySet(subscription, new AvailabilitySetData(s))); - } - ); - } - #endregion - - #region VMImage Operations - /// - /// Lists the Virtual Machine Extension Images Container for this SubscriptionOperations. - /// - /// The instance the method will execute against. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static VirtualMachineExtensionImageContainer GetVmExtensionImages(this SubscriptionOperations subscription) - { - return new VirtualMachineExtensionImageContainer(subscription); - } - - /// - /// Lists the Virtual Machine Images Container for this SubscriptionOperations. - /// - /// The instance the method will execute against. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static VirtualMachineImageContainer GetVmImages(this SubscriptionOperations subscription) - { - return new VirtualMachineImageContainer(subscription); - } - - #endregion - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Placeholder/AvailabilitySetData.cs b/sdk/resourcemanager/Proto.Client/compute/Placeholder/AvailabilitySetData.cs deleted file mode 100644 index 344e3b119c8d..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Placeholder/AvailabilitySetData.cs +++ /dev/null @@ -1,71 +0,0 @@ -using Azure.ResourceManager.Compute.Models; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Core.Adapters; -using System; -using System.Collections.Generic; - -namespace Proto.Compute -{ - /// - /// A class representing the availability set data model. - /// - public class AvailabilitySetData : TrackedResource - { - /// - /// Gets the resource type definition for an availability set. - /// - public static ResourceType ResourceType => "Microsoft.Compute/availabilitySets"; - - /// - /// Initializes a new instance of the class. - /// - /// The availability set to initialize. - public AvailabilitySetData(Azure.ResourceManager.Compute.Models.AvailabilitySet aset) - : base(aset.Id, aset.Location, aset) - { - } - - /// Resource tags. - public override IDictionary Tags => Model.Tags; - - /// Resource name. - public override string Name => Model.Name; - - /// Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'. - public Azure.ResourceManager.Compute.Models.Sku Sku - { - get => Model.Sku; - set => Model.Sku = value; - } - - /// The number of update domains that the availaility set can span. - public int? PlatformUpdateDomainCount - { - get => Model.PlatformUpdateDomainCount; - set => Model.PlatformUpdateDomainCount = value; - } - - /// The number of fault domains that the availaility set can span. - public int? PlatformFaultDomainCount - { - get => Model.PlatformFaultDomainCount; - set => Model.PlatformFaultDomainCount = value; - } - - /// A list of references to all virtual machines in the availability set. - public IList VirtualMachines - { - get => Model.VirtualMachines; - } - - /// Specifies information about the proximity placement group that the availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01. - public Azure.ResourceManager.Compute.Models.SubResource ProximityPlacementGroup - { - get => Model.ProximityPlacementGroup; - set => Model.ProximityPlacementGroup = value; - } - - /// The resource status information. - public IReadOnlyList Statuses => Model.Statuses; - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Placeholder/PhArmOperation.cs b/sdk/resourcemanager/Proto.Client/compute/Placeholder/PhArmOperation.cs deleted file mode 100644 index 2088f514d6ef..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Placeholder/PhArmOperation.cs +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; - -namespace Proto.Compute -{ - /// - /// A class representing an arm operation wrapper object. - /// - /// The to convert TModel into. - /// The model returned by existing Operation methods. - public class PhArmOperation : Operation - where TOperations : class - where TModel : class - { - private readonly Func _converter; - private readonly Operation _wrappedOperation; - private readonly Operation _wrappedResponseOperation; - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - public PhArmOperation(Operation wrapped, Func converter) - { - if (wrapped is null) - { - throw new ArgumentNullException(nameof(wrapped)); - } - - if (converter is null) - { - throw new ArgumentNullException(nameof(converter)); - } - - _wrappedOperation = wrapped; - _converter = converter; - } - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - public PhArmOperation(Response wrapped, Func converter) - { - if (wrapped is null) - { - throw new ArgumentNullException(nameof(wrapped)); - } - - if (converter is null) - { - throw new ArgumentNullException(nameof(converter)); - } - - _wrappedResponseOperation = new PhValueArmOperation(wrapped); - _converter = converter; - } - - /// - /// Initializes a new instance of the class for mocking. - /// - protected PhArmOperation() - { - } - - /// - public override string Id => _wrappedOperation?.Id; - - /// - public override TOperations Value => _converter(_doesWrapOperation ? _wrappedOperation.Value : _wrappedResponseOperation.Value); - - /// - public override bool HasCompleted => _doesWrapOperation ? _wrappedOperation.HasCompleted : _wrappedResponseOperation.HasCompleted; - - /// - public override bool HasValue => _doesWrapOperation ? _wrappedOperation.HasValue : _wrappedResponseOperation.HasValue; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "")] - private bool _doesWrapOperation => _wrappedResponseOperation is null; - - /// - public override Response GetRawResponse() - { - return _doesWrapOperation ? _wrappedOperation.GetRawResponse() : _wrappedResponseOperation.GetRawResponse(); - } - - /// - public override Response UpdateStatus(CancellationToken cancellationToken = default) - { - return _doesWrapOperation ? _wrappedOperation.UpdateStatus(cancellationToken) : _wrappedResponseOperation.UpdateStatus(cancellationToken); - } - - /// - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) - { - return _doesWrapOperation - ? _wrappedOperation.UpdateStatusAsync(cancellationToken) - : _wrappedResponseOperation.UpdateStatusAsync(cancellationToken); - } - - /// - public override async ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) - { - var task = WaitForCompletionAsync(OperationInternals.DefaultPollingInterval, cancellationToken); - return await task.ConfigureAwait(false); - } - - /// - public override async ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) - { - var value = _doesWrapOperation - ? await _wrappedOperation.WaitForCompletionAsync(pollingInterval, cancellationToken).ConfigureAwait(false) - : await _wrappedResponseOperation.WaitForCompletionAsync(pollingInterval, cancellationToken).ConfigureAwait(false); - return Response.FromValue(_converter(value.Value), GetRawResponse()); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Placeholder/PhValueArmOperation.cs b/sdk/resourcemanager/Proto.Client/compute/Placeholder/PhValueArmOperation.cs deleted file mode 100644 index 3cd7d16faa08..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Placeholder/PhValueArmOperation.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; - -namespace Proto.Compute -{ - /// - /// A class representing an arm operation wrapper object. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1618:Generic type parameters should be documented", Justification = "")] - internal class PhValueArmOperation : Operation - where TOperations : class - { - private readonly Operation _wrappedOperation; - private readonly OperationOrResponseInternals _wrappedResponseOperation; - - /// - /// Initializes a new instance of the class for mocking. - /// - protected PhValueArmOperation() - { - } - - /// - /// Initializes a new instance of the . - /// - /// The operation object to wrap. - public PhValueArmOperation(Operation wrapped) - { - if (wrapped is null) - throw new ArgumentNullException(nameof(wrapped)); - - _wrappedOperation = wrapped; - } - - /// - /// Initializes a new instance of the . - /// - /// The response object to wrap. - public PhValueArmOperation(Response wrapped) - { - if (wrapped is null) - throw new ArgumentNullException(nameof(wrapped)); - - _wrappedResponseOperation = new OperationOrResponseInternals(wrapped); - } - - private bool _doesWrapOperation => _wrappedResponseOperation is null; - - public override TOperations Value => _doesWrapOperation ? _wrappedOperation.Value : _wrappedResponseOperation.Value; - - public override bool HasValue => _doesWrapOperation ? _wrappedOperation.HasValue : _wrappedResponseOperation.HasValue; - - public override string Id => _wrappedOperation?.Id; - - public override bool HasCompleted => _doesWrapOperation ? _wrappedOperation.HasCompleted : _wrappedResponseOperation.HasCompleted; - - public override Response GetRawResponse() => _doesWrapOperation? _wrappedOperation.GetRawResponse() : _wrappedResponseOperation.GetRawResponse(); - - public override Response UpdateStatus(CancellationToken cancellationToken = default) => _doesWrapOperation ? _wrappedOperation.UpdateStatus(cancellationToken) : _wrappedResponseOperation.UpdateStatus(cancellationToken); - - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _doesWrapOperation ? _wrappedOperation.UpdateStatusAsync(cancellationToken) : _wrappedResponseOperation.UpdateStatusAsync(cancellationToken); - - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _doesWrapOperation ? _wrappedOperation.WaitForCompletionAsync(cancellationToken) : _wrappedResponseOperation.WaitForCompletionAsync(cancellationToken); - - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) => _doesWrapOperation ? _wrappedOperation.WaitForCompletionAsync(pollingInterval, cancellationToken) : _wrappedResponseOperation.WaitForCompletionAsync(pollingInterval, cancellationToken); - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Placeholder/PhVoidArmOperation.cs b/sdk/resourcemanager/Proto.Client/compute/Placeholder/PhVoidArmOperation.cs deleted file mode 100644 index 3791c5bad335..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Placeholder/PhVoidArmOperation.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; - -namespace Proto.Compute -{ - /// - /// A class representing an arm operation wrapper object. - /// - public class PhVoidArmOperation : Operation - { - private readonly Operation _wrappedOperation; - private readonly OperationOrResponseInternals _wrappedResponseOperation; - - /// - /// Initializes a new instance of the class for mocking. - /// - protected PhVoidArmOperation() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - public PhVoidArmOperation(Operation wrapped) - { - if (wrapped is null) - throw new ArgumentNullException(nameof(wrapped)); - - _wrappedOperation = wrapped; - } - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - public PhVoidArmOperation(Response wrapped) - { - if (wrapped is null) - throw new ArgumentNullException(nameof(wrapped)); - - _wrappedResponseOperation = new OperationOrResponseInternals(wrapped); - } - - private bool _doesWrapOperation => _wrappedResponseOperation is null; - - /// - public override string Id => _wrappedOperation?.Id; - - /// - public override bool HasCompleted => _doesWrapOperation ? _wrappedOperation.HasCompleted : _wrappedResponseOperation.HasCompleted; - - /// - public override Response GetRawResponse() => _doesWrapOperation ? _wrappedOperation.GetRawResponse() : _wrappedResponseOperation.GetRawResponse(); - - /// - public override Response UpdateStatus(CancellationToken cancellationToken = default) => - _doesWrapOperation - ? _wrappedOperation.UpdateStatus(cancellationToken) - : _wrappedResponseOperation.UpdateStatus(cancellationToken); - - /// - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => - _doesWrapOperation - ? _wrappedOperation.UpdateStatusAsync(cancellationToken) - : _wrappedResponseOperation.UpdateStatusAsync(cancellationToken); - - /// - public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => - WaitForCompletionResponseAsync(OperationInternals.DefaultPollingInterval, cancellationToken); - - /// - public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) => - _doesWrapOperation - ? _wrappedOperation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken) - : _wrappedResponseOperation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Placeholder/RollingUpgradeStatusInfo.cs b/sdk/resourcemanager/Proto.Client/compute/Placeholder/RollingUpgradeStatusInfo.cs deleted file mode 100644 index dcbe732f5af6..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Placeholder/RollingUpgradeStatusInfo.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.ResourceManager.Compute.Models; -using Azure.ResourceManager.Core; - -namespace Proto.Compute -{ - /// The status of the latest virtual machine scale set rolling upgrade. - public partial class RollingUpgradeStatusInfo : Resource - { - /// - /// Initializes a new instance of the class. - /// - public RollingUpgradeStatusInfo(Azure.ResourceManager.Compute.Models.RollingUpgradeStatusInfo rollingUpgradeStatusInfo) - : base(rollingUpgradeStatusInfo.Id, rollingUpgradeStatusInfo.Name, RollingUpgradeOperations.ResourceType) - { - Model = rollingUpgradeStatusInfo; - } - - /// - /// Gets or sets the Model this resource is based of. - /// - public virtual Azure.ResourceManager.Compute.Models.RollingUpgradeStatusInfo Model { get; } - - /// - /// Gets the subnet id. - /// - public override string Name => Model.Name; - - /// The rolling upgrade policies applied for this upgrade. - public RollingUpgradePolicy Policy => Model.Policy; - - /// Information about the current running state of the overall upgrade. - public RollingUpgradeRunningStatus RunningStatus => Model.RunningStatus; - - /// Information about the number of virtual machine instances in each upgrade state. - public RollingUpgradeProgressInfo Progress => Model.Progress; - - /// Error details for this upgrade, if there are any. - public ApiError Error => Model.Error; - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Placeholder/VirtualMachineData.cs b/sdk/resourcemanager/Proto.Client/compute/Placeholder/VirtualMachineData.cs deleted file mode 100644 index 1da7d4ae52b6..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Placeholder/VirtualMachineData.cs +++ /dev/null @@ -1,176 +0,0 @@ -using Azure.ResourceManager.Compute.Models; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Core.Adapters; -using System; -using System.Collections.Generic; - -namespace Proto.Compute -{ - /// - /// A class representing the VirtualMachine data model. - /// - public class VirtualMachineData : TrackedResource - { - /// - /// Initializes a new instance of the class. - /// - /// The virtual machine to initialize. - public VirtualMachineData(Azure.ResourceManager.Compute.Models.VirtualMachine vm) : base(vm.Id, vm.Location, vm) - { - } - - /// Resource tags. - public override IDictionary Tags => Model.Tags; - - /// Resource name. - public override string Name => Model.Name; - - /// The virtual machine instance view. - public VirtualMachineInstanceView InstanceView => Model.InstanceView; - - /// The provisioning state, which only appears in the response. - public string ProvisioningState => Model.ProvisioningState; - - /// Specifies information about the dedicated host that the virtual machine resides in. <br><br>Minimum api-version: 2018-10-01. - public Azure.ResourceManager.Compute.Models.SubResource Host - { - get => Model.Host; - set => Model.Host = value; - } - - /// Specifies the billing related details of a Azure Spot virtual machine. <br><br>Minimum api-version: 2019-03-01. - public BillingProfile BillingProfile - { - get => Model.BillingProfile; - set => Model.BillingProfile = value; - } - - /// Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. <br><br>For Azure Spot virtual machines, the only supported value is 'Deallocate' and the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. - public VirtualMachineEvictionPolicyTypes? EvictionPolicy - { - get => Model.EvictionPolicy; - set => Model.EvictionPolicy = value; - } - - /// Specifies the priority for the virtual machine. <br><br>Minimum api-version: 2019-03-01. - public VirtualMachinePriorityTypes? Priority - { - get => Model.Priority; - set => Model.Priority = value; - } - - /// Specifies information about the proximity placement group that the virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01. - public Azure.ResourceManager.Compute.Models.SubResource ProximityPlacementGroup - { - get => Model.ProximityPlacementGroup; - set => Model.ProximityPlacementGroup = value; - } - - /// Specifies information about the virtual machine scale set that the virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale set at creation time. An existing VM cannot be added to a virtual machine scale set. <br><br>This property cannot exist along with a non-null properties.availabilitySet reference. <br><br>Minimum api‐version: 2019‐03‐01. - public Azure.ResourceManager.Compute.Models.SubResource VirtualMachineScaleSet - { - get => Model.VirtualMachineScaleSet; - set => Model.VirtualMachineScaleSet = value; - } - - /// Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Manage the availability of virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). <br><br> For more information on Azure planned maintenance, see [Planned maintenance for virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. <br><br>This property cannot exist along with a non-null properties.virtualMachineScaleSet reference. - public Azure.ResourceManager.Compute.Models.SubResource AvailabilitySet - { - get => Model.AvailabilitySet; - set => Model.AvailabilitySet = value; - } - - /// Specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15. - public DiagnosticsProfile DiagnosticsProfile - { - get => Model.DiagnosticsProfile; - set => Model.DiagnosticsProfile = value; - } - - /// Specifies the network interfaces of the virtual machine. - public NetworkProfile NetworkProfile - { - get => Model.NetworkProfile; - set => Model.NetworkProfile = value; - } - - /// Specifies the operating system settings used while creating the virtual machine. Some of the settings cannot be changed once VM is provisioned. - public OSProfile OsProfile - { - get => Model.OsProfile; - set => Model.OsProfile = value; - } - - /// Specifies additional capabilities enabled or disabled on the virtual machine. - public AdditionalCapabilities AdditionalCapabilities - { - get => Model.AdditionalCapabilities; - set => Model.AdditionalCapabilities = value; - } - - /// Specifies the storage settings for the virtual machine disks. - public StorageProfile StorageProfile - { - get => Model.StorageProfile; - set => Model.StorageProfile = value; - } - - /// Specifies the hardware settings for the virtual machine. - public HardwareProfile HardwareProfile - { - get => Model.HardwareProfile; - set => Model.HardwareProfile = value; - } - - /// The virtual machine zones. - public IList Zones - { - get => Model.Zones; - } - - /// The identity of the virtual machine, if configured. - public ResourceIdentity Identity - { - get => VmIdentityToIdentity(Model.Identity); - } - - private ResourceIdentity VmIdentityToIdentity(VirtualMachineIdentity vmIdentity) - { - SystemAssignedIdentity systemAssignedIdentity = new SystemAssignedIdentity(new Guid(vmIdentity.TenantId), new Guid(vmIdentity.PrincipalId)); - var userAssignedIdentities = new Dictionary(); - if (vmIdentity.UserAssignedIdentities != null) - { - foreach (var entry in vmIdentity.UserAssignedIdentities) - { - var resourceId = new ResourceGroupResourceIdentifier(entry.Key); - var userAssignedIdentity = new UserAssignedIdentity(new Guid(entry.Value.ClientId), new Guid(entry.Value.PrincipalId)); - userAssignedIdentities[resourceId] = userAssignedIdentity; - } - } - - return new ResourceIdentity(systemAssignedIdentity, userAssignedIdentities); - } - - /// - /// Gets the virtual machine extensions. - /// - public IReadOnlyList Resources => Model.Resources; - - /// Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. - public Azure.ResourceManager.Compute.Models.Plan Plan - { - get => Model.Plan; - set => Model.Plan = value; - } - - /// Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. <br><br> Possible values are: <br><br> Windows_Client <br><br> Windows_Server <br><br> If this element is included in a request for an update, the value must match the initial value. This value cannot be updated. <br><br> For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Minimum api-version: 2015-06-15. - public string LicenseType - { - get => Model.LicenseType; - set => Model.LicenseType = value; - } - - /// Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. - public string VmId => Model.VmId; - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Placeholder/VirtualMachineScaleSetData.cs b/sdk/resourcemanager/Proto.Client/compute/Placeholder/VirtualMachineScaleSetData.cs deleted file mode 100644 index 9112bb437bad..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Placeholder/VirtualMachineScaleSetData.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.ResourceManager.Compute.Models; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Core.Adapters; -using System.Collections.Generic; - -namespace Proto.Compute -{ - /// A class representing the VirtualMachineScaleSet data model. - public partial class VirtualMachineScaleSetData : TrackedResource - { - /// Initializes a new instance of VirtualMachineScaleSetData. - public VirtualMachineScaleSetData(Azure.ResourceManager.Compute.Models.VirtualMachineScaleSet vmScaleSet) - : base(vmScaleSet.Id, vmScaleSet.Location, vmScaleSet) - { - Sku = vmScaleSet.Sku; - Plan = vmScaleSet.Plan; - Identity = vmScaleSet.Identity; - Zones = vmScaleSet.Zones; - UpgradePolicy = vmScaleSet.UpgradePolicy; - AutomaticRepairsPolicy = vmScaleSet.AutomaticRepairsPolicy; - VirtualMachineProfile = vmScaleSet.VirtualMachineProfile; - ProvisioningState = vmScaleSet.ProvisioningState; - Overprovision = vmScaleSet.Overprovision; - DoNotRunExtensionsOnOverprovisionedVMs = vmScaleSet.DoNotRunExtensionsOnOverprovisionedVMs; - UniqueId = vmScaleSet.UniqueId; - SinglePlacementGroup = vmScaleSet.SinglePlacementGroup; - ZoneBalance = vmScaleSet.ZoneBalance; - PlatformFaultDomainCount = vmScaleSet.PlatformFaultDomainCount; - ProximityPlacementGroup = vmScaleSet.ProximityPlacementGroup; - AdditionalCapabilities = vmScaleSet.AdditionalCapabilities; - ScaleInPolicy = vmScaleSet.ScaleInPolicy; - } - - /// The virtual machine scale set sku. - public Azure.ResourceManager.Compute.Models.Sku Sku { get; set; } - /// Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. - public Azure.ResourceManager.Compute.Models.Plan Plan { get; set; } - /// The identity of the virtual machine scale set, if configured. - public VirtualMachineScaleSetIdentity Identity { get; set; } - /// The virtual machine scale set zones. NOTE: Availability zones can only be set when you create the scale set. - public IList Zones { get; } - /// The upgrade policy. - public UpgradePolicy UpgradePolicy { get; set; } - /// Policy for automatic repairs. - public AutomaticRepairsPolicy AutomaticRepairsPolicy { get; set; } - /// The virtual machine profile. - public VirtualMachineScaleSetVMProfile VirtualMachineProfile { get; set; } - /// The provisioning state, which only appears in the response. - public string ProvisioningState { get; } - /// Specifies whether the Virtual Machine Scale Set should be overprovisioned. - public bool? Overprovision { get; set; } - /// When Overprovision is enabled, extensions are launched only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions do not run on the extra overprovisioned VMs. - public bool? DoNotRunExtensionsOnOverprovisionedVMs { get; set; } - /// Specifies the ID which uniquely identifies a Virtual Machine Scale Set. - public string UniqueId { get; } - /// When true this limits the scale set to a single placement group, of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if singlePlacementGroup is false, it may not be modified to true. - public bool? SinglePlacementGroup { get; set; } - /// Whether to force strictly even Virtual Machine distribution cross x-zones in case there is zone outage. - public bool? ZoneBalance { get; set; } - /// Fault Domain count for each placement group. - public int? PlatformFaultDomainCount { get; set; } - /// Specifies information about the proximity placement group that the virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. - public Azure.ResourceManager.Compute.Models.SubResource ProximityPlacementGroup { get; set; } - /// Specifies information about the dedicated host group that the virtual machine scale set resides in. <br><br>Minimum api-version: 2020-06-01. - public Azure.ResourceManager.Compute.Models.SubResource HostGroup { get; set; } - /// Specifies additional capabilities enabled or disabled on the Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to support attaching managed data disks with UltraSSD_LRS storage account type. - public AdditionalCapabilities AdditionalCapabilities { get; set; } - /// Specifies the scale-in policy that decides which virtual machines are chosen for removal when a Virtual Machine Scale Set is scaled-in. - public ScaleInPolicy ScaleInPolicy { get; set; } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/Proto.Compute.csproj b/sdk/resourcemanager/Proto.Client/compute/Proto.Compute.csproj deleted file mode 100644 index ed273344410d..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/Proto.Compute.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - 1.0.0-beta.1 - netstandard2.0 - Proto.Compute - latest - false - true - - - - - - - - - - - - - - diff --git a/sdk/resourcemanager/Proto.Client/compute/README.MD b/sdk/resourcemanager/Proto.Client/compute/README.MD deleted file mode 100644 index c5d39b78c6da..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/README.MD +++ /dev/null @@ -1,3 +0,0 @@ -# Proto Compute - -Prototype version of Azure.ResourceManager.Compute used to showcase and test the new prototype track 2 management plane SDK \ No newline at end of file diff --git a/sdk/resourcemanager/Proto.Client/compute/RollingUpgrade.cs b/sdk/resourcemanager/Proto.Client/compute/RollingUpgrade.cs deleted file mode 100644 index de0f42b4e991..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/RollingUpgrade.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -using System.Threading; -using System.Threading.Tasks; -using Azure.ResourceManager.Core; - -#nullable disable - -namespace Proto.Compute -{ - /// A Class representing a VirtualMachineScaleSetRollingUpgrade along with the instance operations that can be performed on it. - public class RollingUpgrade : RollingUpgradeOperations - { - /// - /// Gets the data representing this VirtualMachine. - /// - public RollingUpgradeStatusInfo Data { get; private set; } - - /// - /// Initializes a new instance of the class. - /// - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal RollingUpgrade(OperationsBase operations, RollingUpgradeStatusInfo resource) - : base(operations) - { - Data = resource; - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/RollingUpgradeOperations.cs b/sdk/resourcemanager/Proto.Client/compute/RollingUpgradeOperations.cs deleted file mode 100644 index 3b3f63759a39..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/RollingUpgradeOperations.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure; -using Azure.ResourceManager.Compute; -using Azure.ResourceManager.Core; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Compute -{ - /// A class representing the operations that can be performed over a specific VirtualMachineScaleSetRollingUpgrade. - public partial class RollingUpgradeOperations : SingletonOperationsBase - { - /// Initializes a new instance of VirtualMachineScaleSetRollingUpgradeOperations for mocking. - protected RollingUpgradeOperations() - { - } - - /// - /// 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. - protected internal RollingUpgradeOperations(OperationsBase operation) - : base(operation) - { - } - - public static readonly ResourceType ResourceType = "Microsoft.Compute/virtualMachineScaleSets"; - - protected override ResourceType ValidResourceType => ResourceType.RootResourceType; - - private VirtualMachineScaleSetRollingUpgradesOperations Operations => new ComputeManagementClient( - BaseUri, - ParentId.SubscriptionId, - Credential, - ClientOptions.Convert()).VirtualMachineScaleSetRollingUpgrades; - - // Note: Singleton may have different operations such as GET/PUT/PATCH/POST or a combination of these - // Individual methods will be generated as they are declared - public Response Get(CancellationToken cancellationToken = default) - { - var response = Operations.GetLatest(ParentId.ResourceGroupName, ParentId.Name, cancellationToken); - return Response.FromValue(new RollingUpgrade(Parent, new RollingUpgradeStatusInfo(response.Value)), response.GetRawResponse()); - } - - public async Task> GetAsync(CancellationToken cancellationToken = default) - { - var response = await Operations.GetLatestAsync(ParentId.ResourceGroupName, ParentId.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new RollingUpgrade(Parent, new RollingUpgradeStatusInfo(response.Value)), response.GetRawResponse()); - } - - // Note: Singleton may have different operations such as GET/PUT/PATCH/POST or a combination of these - // Individual methods will be generated as they are declared - public Response Cancel(CancellationToken cancellationToken = default) - { - return Operations - .StartCancel(ParentId.ResourceGroupName, ParentId.Name, cancellationToken) - .WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - public async Task CancelAsync(CancellationToken cancellationToken = default) - { - return (await Operations - .StartCancel(ParentId.ResourceGroupName, ParentId.Name, cancellationToken) - .WaitForCompletionAsync(cancellationToken)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/TrackedResource.cs b/sdk/resourcemanager/Proto.Client/compute/TrackedResource.cs deleted file mode 100644 index 0d44251e00d7..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/TrackedResource.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.ResourceManager.Core.Adapters -{ - /// - /// A class representing a generic tracked resource in Azure. - /// - /// The type of the underlying resource id - /// The type of the underlying model this class wraps - public abstract class TrackedResource : TrackedResource - where TIdentifier : TenantResourceIdentifier - where TModel : class - { - /// - /// Initializes a new instance of the class. - /// - /// The identifier of the resource that is the target of operations. - /// The location of the resource. - /// The model to copy from. - protected TrackedResource(TIdentifier id, LocationData location, TModel data) - : base(id, id?.Name, id?.ResourceType, location, null) - { - Model = data; - } - - /// - /// Gets or sets the Model this resource is based off. - /// - public virtual TModel Model { get; set; } - - /// - /// Converts from a into the TModel. - /// - /// The tracked resource convert from. - public static implicit operator TModel(TrackedResource other) - { - return other.Model; - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/VersionOverrides/AvailabilitySetsApiVersions.cs b/sdk/resourcemanager/Proto.Client/compute/VersionOverrides/AvailabilitySetsApiVersions.cs deleted file mode 100644 index f78d45cd10f5..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/VersionOverrides/AvailabilitySetsApiVersions.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Azure.ResourceManager.Core; - -namespace Proto.Compute -{ - /// - /// A class representing the valid api versions for an availability set. - /// - public class AvailabilitySetsApiVersions : ApiVersionsBase - { - /// - /// Api version for 2020/05/01. - /// - public static readonly AvailabilitySetsApiVersions V2020_06_01 = new AvailabilitySetsApiVersions("2020-06-01"); - - /// - /// Api version for 2019/12/01. - /// - public static readonly AvailabilitySetsApiVersions V2019_12_01 = new AvailabilitySetsApiVersions("2019-12-01"); - - /// - /// Default api version to use. - /// - public static readonly AvailabilitySetsApiVersions Default = V2020_06_01; - - public override ResourceType ResourceType => AvailabilitySetOperations.ResourceType; - - private AvailabilitySetsApiVersions(string value) : base(value) { } - - /// - /// Converts an api version into a string. - /// - /// The api version instnace to convert. - public static implicit operator string(AvailabilitySetsApiVersions version) - { - if (version == null) - return null; - return version.ToString(); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/VersionOverrides/VirtualMachinesApiVersions.cs b/sdk/resourcemanager/Proto.Client/compute/VersionOverrides/VirtualMachinesApiVersions.cs deleted file mode 100644 index e1e5b98c54d2..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/VersionOverrides/VirtualMachinesApiVersions.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Azure.ResourceManager.Core; - -namespace Proto.Compute -{ - /// - /// A class representing the valid api versions for a virtual machine. - /// - public class VirtualMachinesApiVersions : ApiVersionsBase - { - /// - /// Api version 2020/06/01 - /// - public static readonly VirtualMachinesApiVersions V2020_06_01 = new VirtualMachinesApiVersions("2020-06-01"); - - /// - /// Api version 2019/12/01 - /// - public static readonly VirtualMachinesApiVersions V2019_12_01 = new VirtualMachinesApiVersions("2019-12-01"); - - /// - /// Default api version to use. - /// - public static readonly VirtualMachinesApiVersions Default = V2020_06_01; - - /// - public override ResourceType ResourceType => VirtualMachineOperations.ResourceType; - - private VirtualMachinesApiVersions(string value) : base(value) { } - - /// - /// Converts an api version into a string. - /// - /// The api version instnace to convert. - public static implicit operator string(VirtualMachinesApiVersions version) - { - if (version == null) - return null; - return version.ToString(); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/VirtualMachine.cs b/sdk/resourcemanager/Proto.Client/compute/VirtualMachine.cs deleted file mode 100644 index 2fec3f059e30..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/VirtualMachine.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using Azure.ResourceManager.Core; - -namespace Proto.Compute -{ - /// - /// Class representing a VirtualMachine along with the instance operations that can be performed on it. - /// - public class VirtualMachine : VirtualMachineOperations - { - /// - /// Gets the data representing this VirtualMachine. - /// - public VirtualMachineData Data { get; private set; } - - /// - /// Initializes a new instance of the class. - /// - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal VirtualMachine(ResourceOperationsBase operations, VirtualMachineData resource) - : base(operations, resource.Id) - { - Data = resource; - } - - /// - protected override VirtualMachine GetResource(CancellationToken cancellation = default) - { - return this; - } - - /// - protected override Task GetResourceAsync(CancellationToken cancellationToken = default) - { - return Task.FromResult(this); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineBuilder.cs b/sdk/resourcemanager/Proto.Client/compute/VirtualMachineBuilder.cs deleted file mode 100644 index bc064f45f6a5..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineBuilder.cs +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Compute -{ - /// - /// A class representing a builder object used to create Azure resources. - /// - public class VirtualMachineBuilder - { - /// - /// Initializes a new instance of the class. - /// - /// The container object to create the resource in. - /// The resource to create. - public VirtualMachineBuilder(VirtualMachineContainer container, VirtualMachineData resource) - { - Resource = resource; - UnTypedContainer = container; - } - - /// - /// Gets the resource object to create. - /// - protected VirtualMachineData Resource { get; private set; } - - /// - /// Gets the resource name. - /// - protected string ResourceName { get; private set; } - - /// - /// Gets the container object to create the resource in. - /// - protected VirtualMachineContainer UnTypedContainer { get; private set; } - - /// - /// Creates the resource object to send to the Azure API. - /// - /// The resource to create. - public VirtualMachineData Build() - { - ThrowIfNotValid(); - OnBeforeBuild(); - InternalBuild(); - OnAfterBuild(); - - return Resource; - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - /// Name cannot be null or a whitespace. - public Response CreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return UnTypedContainer.CreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this resource. - /// Name cannot be null or a whitespace. - public async Task> CreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await UnTypedContainer.CreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public Operation StartCreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return UnTypedContainer.StartCreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public async Task> StartCreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await UnTypedContainer.StartCreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// Determines whether or not the resource is valid. - /// - /// The message indicating what is wrong with the resource. - /// Whether or not the resource is valid. - protected virtual bool IsValid(out string message) - { - message = string.Empty; - - return true; - } - - /// - /// Perform any tasks necessary after the resource is built - /// - protected virtual void OnAfterBuild() - { - } - - /// - /// Perform any tasks necessary before the resource is built - /// - protected virtual void OnBeforeBuild() - { - } - - private static void InternalBuild() - { - } - - private void ThrowIfNotValid() - { - if (!IsValid(out var message)) - { - throw new InvalidOperationException(message); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineContainer.cs b/sdk/resourcemanager/Proto.Client/compute/VirtualMachineContainer.cs deleted file mode 100644 index 7ce166544347..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineContainer.cs +++ /dev/null @@ -1,211 +0,0 @@ -using Azure; -using Azure.ResourceManager.Compute; -using Azure.ResourceManager.Compute.Models; -using Azure.ResourceManager.Core; -using Proto.Compute.Convenience; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Compute -{ - /// - /// A class representing collection of VirtualMachine and their operations over a ResourceGroup. - /// - public class VirtualMachineContainer : ResourceContainerBase - { - /// - /// Initializes a new instance of the class. - /// - /// The ResourceGroup that is the parent of the VirtualMachines. - internal VirtualMachineContainer(ResourceGroupOperations resourceGroup) - : base(resourceGroup) - { - } - - /// - /// Typed Resource Identifier for the container. - /// - public new ResourceGroupResourceIdentifier Id => base.Id as ResourceGroupResourceIdentifier; - - private VirtualMachinesOperations Operations => new ComputeManagementClient( - BaseUri, - Id.SubscriptionId, - Credential, - ClientOptions.Convert()).VirtualMachines; - - /// - /// Gets the valid resource type for this object - /// - protected override ResourceType ValidResourceType => ResourceGroupOperations.ResourceType; - - /// - /// The operation to create a virtual machine. - /// - /// The name of the virtual machine. - /// Parameters supplied to the Create Virtual Machine operation. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - public Response CreateOrUpdate(string name, VirtualMachineData resourceDetails, CancellationToken cancellationToken = default) - { - var response = Operations.StartCreateOrUpdate(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - return Response.FromValue(new VirtualMachine(Parent, new VirtualMachineData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to create a virtual machine. - /// - /// The name of the virtual machine. - /// Parameters supplied to the Create Virtual Machine operation. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this resource. - public async Task> CreateOrUpdateAsync(string name, VirtualMachineData resourceDetails, CancellationToken cancellationToken = default) - { - var operation = await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken).ConfigureAwait(false); - var response = await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return Response.FromValue(new VirtualMachine(Parent, new VirtualMachineData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to create a virtual machine. - /// - /// The name of the virtual machine. - /// Parameters supplied to the Create Virtual Machine operation. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// - /// Details on long running operation object. - /// - /// An that allows polling for completion of the operation. - public Operation StartCreateOrUpdate(string name, VirtualMachineData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - Operations.StartCreateOrUpdate(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken), - v => new VirtualMachine(Parent, new VirtualMachineData(v))); - } - - /// - /// The operation to create a virtual machine. - /// - /// The name of the virtual machine. - /// Parameters supplied to the Create Virtual Machine operation. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// - /// Details on long running operation object. - /// - /// A that on completion returns an that allows polling for completion of the operation. - public async Task> StartCreateOrUpdateAsync(string name, VirtualMachineData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken).ConfigureAwait(false), - v => new VirtualMachine(Parent, new VirtualMachineData(v))); - } - - /// - /// Construct an object used to create a VirtualMachine. - /// - /// The hostname for the virtual machine. - /// The admin username to use. - /// The admin password to use. - /// The network interface id to use. - /// The availability set id to use. - /// The location to create the Virtual Machine. - /// Object used to create a . - public VirtualMachineModelBuilder Construct(string hostName, string adminUser, string adminPassword, ResourceIdentifier networkInterfaceId, ResourceIdentifier availabilitySetId, LocationData location = null) - { - var parent = GetParentResource(); - var vm = new Azure.ResourceManager.Compute.Models.VirtualMachine(location ?? parent.Data.Location) - { - NetworkProfile = new NetworkProfile(), - OsProfile = new OSProfile - { - ComputerName = hostName, - AdminUsername = adminUser, - AdminPassword = adminPassword, - WindowsConfiguration = new WindowsConfiguration { TimeZone = "Pacific Standard Time", ProvisionVMAgent = true } - }, - StorageProfile = new StorageProfile() - { - ImageReference = new ImageReference() - { - Offer = "WindowsServer", - Publisher = "MicrosoftWindowsServer", - Sku = "2019-Datacenter", - Version = "latest" - }, - }, - HardwareProfile = new HardwareProfile() { VmSize = VirtualMachineSizeTypes.StandardB1Ms }, - AvailabilitySet = new Azure.ResourceManager.Compute.Models.SubResource() { Id = availabilitySetId } - }; - vm.NetworkProfile.NetworkInterfaces.Add(new NetworkInterfaceReference() { Id = networkInterfaceId }); - - return new VirtualMachineModelBuilder(this, new VirtualMachineData(vm)); - } - - /// - /// List the virtual machines for this resource group. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of that may take multiple service requests to iterate over. - public Pageable List(CancellationToken cancellationToken = default) - { - var result = Operations.List(Id.Name, cancellationToken); - return new PhWrappingPageable( - result, - s => new VirtualMachine(Parent, new VirtualMachineData(s))); - } - - /// - /// List the virtual machines for this resource group. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of that may take multiple service requests to iterate over. - public AsyncPageable ListAsync(CancellationToken cancellationToken = default) - { - var result = Operations.ListAsync(Id.Name, cancellationToken); - return new PhWrappingAsyncPageable( - result, - s => new VirtualMachine(Parent, new VirtualMachineData(s))); - } - - /// - /// Filters the list of virtual machines for this resource group represented as generic resources. - /// - /// The substring to filter by. - /// The number of items to truncate by. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of that may take multiple service requests to iterate over. - public Pageable ListAsGenericResource(string nameFilter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(VirtualMachineOperations.ResourceType); - filters.SubstringFilter = nameFilter; - return ResourceListOperations.ListAtContext(Parent as ResourceGroupOperations, filters, top, cancellationToken); - } - - /// - /// Filters the list of virtual machines for this resource group represented as generic resources. - /// - /// The substring to filter by. - /// The number of items to truncate by. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of that may take multiple service requests to iterate over. - public AsyncPageable ListAsGenericResourceAsync(string nameFilter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(VirtualMachineOperations.ResourceType); - filters.SubstringFilter = nameFilter; - return ResourceListOperations.ListAtContextAsync(Parent as ResourceGroupOperations, filters, top, cancellationToken); - } - - /// - public Response Get(string virtualMachineName, CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, virtualMachineName, cancellationToken); - return Response.FromValue(new VirtualMachine(Parent, new VirtualMachineData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> GetAsync(string virtualMachineName, CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, virtualMachineName, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new VirtualMachine(Parent, new VirtualMachineData(response.Value)), response.GetRawResponse()); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineExtensionImageContainer.cs b/sdk/resourcemanager/Proto.Client/compute/VirtualMachineExtensionImageContainer.cs deleted file mode 100644 index 3918092fb35e..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineExtensionImageContainer.cs +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.ResourceManager.Compute; -using Azure.ResourceManager.Compute.Models; -using Azure.ResourceManager.Core; - -namespace Proto.Compute -{ - /// - /// A class representing collection of VirtualMachine and their operations over a ResourceGroup. - /// - public class VirtualMachineExtensionImageContainer : ContainerBase - { - private string _subsriptionId; - - /// - /// Initializes a new instance of the class. - /// - /// The subscription that is the parent of the VirtualMachinesExtensionImage. - internal VirtualMachineExtensionImageContainer(SubscriptionOperations subscription) - : base(subscription) - { - _subsriptionId = subscription.Id.SubscriptionId; - } - - private VirtualMachineExtensionImagesOperations Operations => new ComputeManagementClient( - BaseUri, - _subsriptionId, - Credential, - ClientOptions.Convert()).VirtualMachineExtensionImages; - - /// - /// Gets the valid resource type for this object - /// - protected override ResourceType ValidResourceType => SubscriptionOperations.ResourceType; - - public Response Get( - string location, - string publisherName, - string type, - string version, - CancellationToken cancellationToken = default) - { - return Operations.Get(location, publisherName, type, version, cancellationToken); - } - - public async Task> GetAsync( - string location, - string publisherName, - string type, - string version, - CancellationToken cancellationToken = default) - { - return await Operations.GetAsync(location, publisherName, type, version, cancellationToken) - .ConfigureAwait(false); - } - - public IEnumerable ListTypes( - string location, - string publisherName, - CancellationToken cancellationToken = default) - { - return Operations.ListTypes(location, publisherName, cancellationToken).Value; - } - - public async Task> ListTypesAsync( - string location, - string publisherName, - CancellationToken cancellationToken = default) - { - return (await Operations.ListTypesAsync(location, publisherName, cancellationToken).ConfigureAwait(false)).Value; - } - - public IEnumerable ListVersions( - string location, - string publisherName, - string type, - string filter = null, - int? top = null, - string orderby = null, - CancellationToken cancellationToken = default) - { - return Operations.ListVersions(location, publisherName, type, filter: filter, top: top, orderby: orderby, cancellationToken: cancellationToken).Value; - } - - public async Task> ListVersionsAsync( - string location, - string publisherName, - string type, - string filter = null, - int? top = null, - string orderby = null, - CancellationToken cancellationToken = default) - { - return (await Operations.ListVersionsAsync(location, publisherName, type, filter: filter, top: top, orderby: orderby, cancellationToken: cancellationToken).ConfigureAwait(false)).Value; - } - - /// - /// Returns the resource from Azure if it exists. - /// - /// The location of the . - /// The publisherName of the . - /// The type of the . - /// The version of the . - /// A token to allow the caller to cancel the call to the service. - /// The default value is . - /// An instance of resource or null if not found. - public VirtualMachineExtensionImage TryGet( - string location, - string publisherName, - string type, - string version, - CancellationToken cancellationToken = default) - { - try - { - return Get(location:location, publisherName:publisherName, type:type, version:version, cancellationToken:cancellationToken).Value; - } - catch (RequestFailedException e) when (e.Status == 404) - { - return null; - } - } - - /// - /// Returns the resource from Azure if it exists. - /// - /// The location of the . - /// The publisherName of the . - /// The type of the . - /// The version of the . - /// A token to allow the caller to cancel the call to the service. - /// The default value is . - /// An instance of resource or null if not found. - public async Task TryGetAsync( - string location, - string publisherName, - string type, - string version, - CancellationToken cancellationToken = default) - { - try - { - return (await GetAsync(location: location, publisherName: publisherName, type: type, version: version, cancellationToken: cancellationToken).ConfigureAwait(false)).Value; - } - catch (RequestFailedException e) when (e.Status == 404) - { - return null; - } - } - - /// - /// Determines whether or not the azure resource exists in this container - /// - /// The location of the . - /// The publisherName of the . - /// The type of the . - /// The version of the . - /// A token to allow the caller to cancel the call to the service. - /// The default value is . - /// Whether or not the resource existed. - public bool DoesExist( - string location, - string publisherName, - string type, - string version, - CancellationToken cancellationToken = default) - { - return TryGet(location: location, publisherName: publisherName, type: type, version: version, cancellationToken: cancellationToken) != null; - } - - /// - /// Determines whether or not the azure resource exists in this container - /// - /// The location of the . - /// The publisherName of the . - /// The type of the . - /// The version of the . - /// A token to allow the caller to cancel the call to the service. - /// The default value is . - /// Whether or not the resource existed. - public async Task DoesExistAsync( - string location, - string publisherName, - string type, - string version, - CancellationToken cancellationToken = default) - { - return await TryGetAsync(location: location, publisherName: publisherName, type: type, version: version, cancellationToken: cancellationToken).ConfigureAwait(false) != null; - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineImageContainer.cs b/sdk/resourcemanager/Proto.Client/compute/VirtualMachineImageContainer.cs deleted file mode 100644 index 42f4657febc6..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineImageContainer.cs +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.ResourceManager.Compute; -using Azure.ResourceManager.Compute.Models; -using Azure.ResourceManager.Core; - -namespace Proto.Compute -{ - /// - /// A class representing collection of VirtualMachine and their operations over a ResourceGroup. - /// - public class VirtualMachineImageContainer : ContainerBase - { - private string _subscriptionId; - - /// - /// Initializes a new instance of the class. - /// - /// The parent subscription. - internal VirtualMachineImageContainer(SubscriptionOperations parent) - : base(parent) - { - _subscriptionId = parent.Id.SubscriptionId; - } - - private VirtualMachineImagesOperations Operations => new ComputeManagementClient( - BaseUri, - _subscriptionId, - Credential, - ClientOptions.Convert()).VirtualMachineImages; - - protected override ResourceType ValidResourceType => SubscriptionOperations.ResourceType; - - public Response Get( - string location, - string publisherName, - string offer, - string skus, - string version, - CancellationToken cancellationToken = default) - { - return Operations.Get(location, publisherName, offer, skus, version, cancellationToken); - } - - public async Task> GetAsync( - string location, - string publisherName, - string offer, - string skus, - string version, - CancellationToken cancellationToken = default) - { - return await Operations.GetAsync(location, publisherName, offer, skus, version, cancellationToken); - } - - public IEnumerable ListOffers( - string location, - string publisherName, - CancellationToken cancellationToken = default) - { - return Operations.ListOffers(location, publisherName, cancellationToken).Value; - } - - public async Task> ListOffersAsync( - string location, - string publisherName, - CancellationToken cancellationToken = default) - { - return (await Operations.ListOffersAsync(location, publisherName, cancellationToken).ConfigureAwait(false)).Value; - } - - public IEnumerable ListPublishers( - string location, - CancellationToken cancellationToken = default) - { - return Operations.ListPublishers(location, cancellationToken).Value; - } - - public async Task> ListPublishersAsync( - string location, - CancellationToken cancellationToken = default) - { - return (await Operations.ListPublishersAsync(location, cancellationToken).ConfigureAwait(false)).Value; - } - - public IEnumerable ListSkus( - string location, - string publisherName, - string offer, - CancellationToken cancellationToken = default) - { - return Operations.ListSkus(location, publisherName, offer, cancellationToken).Value; - } - - public async Task> ListSkusAsync( - string location, - string publisherName, - string offer, - CancellationToken cancellationToken = default) - { - return (await Operations.ListSkusAsync(location, publisherName, offer, cancellationToken).ConfigureAwait(false)).Value; - } - - public IEnumerable ListVersions( - string location, - string publisherName, - string offer, - string skus, - string expand = null, - int? top = null, - string orderby = null, - CancellationToken cancellationToken = default) - { - return Operations.List(location, - publisherName: publisherName, - offer: offer, - skus: skus, - expand: expand, - top: top, - orderby: orderby, - cancellationToken: cancellationToken).Value; - } - - public async Task> ListVersionsAsync( - string location, - string publisherName, - string offer, - string skus, - string expand = null, - int? top = null, - string orderby = null, - CancellationToken cancellationToken = default) - { - return (await Operations.ListAsync(location, - publisherName: publisherName, - offer: offer, - skus: skus, - expand: expand, - top: top, - orderby: orderby, - cancellationToken: cancellationToken).ConfigureAwait(false)).Value; - } - - /// - /// Returns the resource from Azure if it exists. - /// - /// The location of the . - /// The publisherName of the . - /// The offer of the . - /// The skus of the . - /// The version of the . - /// A token to allow the caller to cancel the call to the service. - /// The default value is . - /// An instance of resource or null if not found. - public VirtualMachineImage TryGet( - string location, - string publisherName, - string offer, - string skus, - string version, - CancellationToken cancellationToken = default) - { - try - { - return Get(location: location, publisherName: publisherName, offer: offer, skus: skus, version: version, cancellationToken: cancellationToken).Value; - } - catch (RequestFailedException e) when (e.Status == 404) - { - return null; - } - } - - /// - /// Returns the resource from Azure if it exists. - /// - /// The location of the . - /// The publisherName of the . - /// The offer of the . - /// The skus of the . - /// The version of the . - /// A token to allow the caller to cancel the call to the service. - /// The default value is . - /// An instance of resource or null if not found. - public async Task TryGetAsync( - string location, - string publisherName, - string offer, - string skus, - string version, - CancellationToken cancellationToken = default) - { - try - { - return (await GetAsync(location: location, publisherName: publisherName, offer: offer, skus: skus, version: version, cancellationToken: cancellationToken).ConfigureAwait(false)).Value; - } - catch (RequestFailedException e) when (e.Status == 404) - { - return null; - } - } - - /// - /// Determines whether or not the azure resource exists in this container - /// - /// The location of the . - /// The publisherName of the . - /// The offer of the . - /// The skus of the . - /// The version of the . - /// A token to allow the caller to cancel the call to the service. - /// The default value is . - /// Whether or not the resource existed. - public bool DoesExist( - string location, - string publisherName, - string offer, - string skus, - string version, - CancellationToken cancellationToken = default) - { - return TryGet(location: location, publisherName: publisherName, offer: offer, skus: skus, version: version, cancellationToken: cancellationToken) != null; - } - - /// - /// Determines whether or not the azure resource exists in this container - /// - /// The location of the . - /// The publisherName of the . - /// The offer of the . - /// The skus of the . - /// The version of the . - /// A token to allow the caller to cancel the call to the service. - /// The default value is . - /// Whether or not the resource existed. - public async Task DoesExistAsync( - string location, - string publisherName, - string offer, - string skus, - string version, - CancellationToken cancellationToken = default) - { - return await TryGetAsync(location: location, publisherName: publisherName, offer: offer, skus: skus, version: version, cancellationToken: cancellationToken).ConfigureAwait(false) != null; - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineOperations.cs b/sdk/resourcemanager/Proto.Client/compute/VirtualMachineOperations.cs deleted file mode 100644 index 71402ce7e029..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineOperations.cs +++ /dev/null @@ -1,389 +0,0 @@ -using Azure; -using Azure.ResourceManager.Compute; -using Azure.ResourceManager.Compute.Models; -using Azure.ResourceManager.Core; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Compute -{ - /// - /// A class representing the operations that can be performed over a specific VirtualMachine. - /// - public class VirtualMachineOperations : ResourceOperationsBase - { - /// - /// Initializes a new instance of the class. - /// - /// An instance of that has an id for a virtual machine. - internal VirtualMachineOperations(GenericResourceOperations genericOperations) - : base(genericOperations, genericOperations.Id) - { - } - - /// - /// 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 VirtualMachineOperations(ResourceGroupOperations resourceGroup, string vmName) - : base(resourceGroup, resourceGroup.Id.AppendProviderResource(ResourceType.Namespace, ResourceType.Type, vmName)) - { - } - - /// - /// 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. - protected VirtualMachineOperations(ResourceOperationsBase operation, ResourceGroupResourceIdentifier id) - : base(operation, id) - { - } - - /// - /// Gets the resource type definition for a virtual machine. - /// - public static readonly ResourceType ResourceType = "Microsoft.Compute/virtualMachines"; - - /// - /// Gets the valid resources for virtual machines. - /// - protected override ResourceType ValidResourceType => ResourceType; - - private VirtualMachinesOperations Operations => new ComputeManagementClient( - BaseUri, - Id.SubscriptionId, - Credential, - ClientOptions.Convert()).VirtualMachines; - - /// - /// Initializes a new instance of the class from a . - /// - /// An instance of that has an id for a virtual machine. - /// A new instance of the class. - public static VirtualMachineOperations FromGeneric(GenericResourceOperations genericOperations) - { - return new VirtualMachineOperations(genericOperations); - } - - /// - public Response Delete(CancellationToken cancellationToken = default) - { - return Operations.StartDelete(Id.ResourceGroupName, Id.Name, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - public async Task DeleteAsync(CancellationToken cancellationToken = default) - { - return (await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken)).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - public Operation StartDelete(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(Operations.StartDelete(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - public async Task StartDeleteAsync(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - #region PowerOn - /// - /// The operation to start a virtual machine. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - public Response PowerOn(CancellationToken cancellationToken = default) - { - var operation = Operations.StartStart(Id.ResourceGroupName, Id.Name, cancellationToken); - return operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - /// The operation to start a virtual machine. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this resource. - public async Task PowerOnAsync(CancellationToken cancellationToken = default) - { - var operation = await Operations.StartStartAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - } - - /// - /// The operation to start a virtual machine. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - public Operation StartPowerOn(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(Operations.StartStart(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - /// The operation to start a virtual machine. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - public async Task StartPowerOnAsync(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(await Operations.StartStartAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false)); - } - #endregion - - #region PowerOff - /// - /// The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine. - /// - /// The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - public Response PowerOff(bool? skipShutdown = null, CancellationToken cancellationToken = default) - { - var operation = Operations.StartPowerOff(Id.ResourceGroupName, Id.Name, skipShutdown, cancellationToken); - return operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - /// The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine. - /// - /// The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this resource. - public async Task PowerOffAsync(bool? skipShutdown = null, CancellationToken cancellationToken = default) - { - var operation = await Operations.StartPowerOffAsync(Id.ResourceGroupName, Id.Name, skipShutdown, cancellationToken).ConfigureAwait(false); - return await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - } - - /// - /// The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine. - /// - /// The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - public Operation StartPowerOff(bool? skipShutdown = null, CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(Operations.StartPowerOff(Id.ResourceGroupName, Id.Name, skipShutdown, cancellationToken)); - } - - /// - /// The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine. - /// - /// The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - public async Task StartPowerOffAsync(bool? skipShutdown = null, CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(await Operations.StartPowerOffAsync(Id.ResourceGroupName, Id.Name, skipShutdown, cancellationToken).ConfigureAwait(false)); - } - #endregion - - /// - public override Response Get(CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new VirtualMachine(this, new VirtualMachineData(response.Value)), response.GetRawResponse()); - } - - /// - public override async Task> GetAsync(CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new VirtualMachine(this, new VirtualMachineData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to update a virtual machine. Please note some properties can be set only during virtual machine creation. - /// - /// The parameters to update. - /// An that allows polling for completion of the operation. - public Operation StartUpdate(VirtualMachineUpdate patchable, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - Operations.StartUpdate(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - v => new VirtualMachine(this, new VirtualMachineData(v))); - } - - /// - /// The operation to update a virtual machine. Please note some properties can be set only during virtual machine creation. - /// - /// The parameters to update. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - public async Task> StartUpdateAsync(VirtualMachineUpdate patchable, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - await Operations.StartUpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - v => new VirtualMachine(this, new VirtualMachineData(v))); - } - - /// - public Response AddTag(string key, string value, CancellationToken cancellationToken = default) - { - var vm = GetResource(); - var patchable = new VirtualMachineUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags[key] = value; - - var response = Operations.StartUpdate(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - return Response.FromValue(new VirtualMachine(this, new VirtualMachineData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - var vm = await GetResourceAsync(cancellationToken); - var patchable = new VirtualMachineUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags[key] = value; - - var response = await Operations.StartUpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).Result.WaitForCompletionAsync(); - return Response.FromValue(new VirtualMachine(this, new VirtualMachineData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartAddTag(string key, string value, CancellationToken cancellationToken = default) - { - var vm = GetResource(); - var patchable = new VirtualMachineUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags[key] = value; - - return new PhArmOperation( - Operations.StartUpdate(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - v => new VirtualMachine(this, new VirtualMachineData(v))); - } - - /// - public async Task> StartAddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - var vm = await GetResourceAsync(cancellationToken); - var patchable = new VirtualMachineUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags[key] = value; - - return new PhArmOperation( - await Operations.StartUpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - v => new VirtualMachine(this, new VirtualMachineData(v))); - } - - /// - public Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new VirtualMachineUpdate(); - patchable.Tags.ReplaceWith(tags); - - var response = Operations.StartUpdate(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - return Response.FromValue(new VirtualMachine(this, new VirtualMachineData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new VirtualMachineUpdate(); - patchable.Tags.ReplaceWith(tags); - - var response = await Operations.StartUpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).Result.WaitForCompletionAsync(cancellationToken); - return Response.FromValue(new VirtualMachine(this, new VirtualMachineData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartSetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new VirtualMachineUpdate(); - patchable.Tags.ReplaceWith(tags); - - return new PhArmOperation( - Operations.StartUpdate(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(), - v => new VirtualMachine(this, new VirtualMachineData(v))); - } - - /// - public async Task> StartSetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new VirtualMachineUpdate(); - patchable.Tags.ReplaceWith(tags); - - return new PhArmOperation( - await Operations.StartUpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).Result.WaitForCompletionAsync(cancellationToken), - v => new VirtualMachine(this, new VirtualMachineData(v))); - } - - /// - public Response RemoveTag(string key, CancellationToken cancellationToken = default) - { - var vm = GetResource(); - var patchable = new VirtualMachineUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags.Remove(key); - - var response = Operations.StartUpdate(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - return Response.FromValue(new VirtualMachine(this, new VirtualMachineData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - var vm = await GetResourceAsync(cancellationToken); - var patchable = new VirtualMachineUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags.Remove(key); - - var response = await Operations.StartUpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).Result.WaitForCompletionAsync(cancellationToken); - return Response.FromValue(new VirtualMachine(this, new VirtualMachineData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartRemoveTag(string key, CancellationToken cancellationToken = default) - { - var vm = GetResource(); - var patchable = new VirtualMachineUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags.Remove(key); - - return new PhArmOperation( - Operations.StartUpdate(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(), - v => new VirtualMachine(this, new VirtualMachineData(v))); - } - - /// - public async Task> StartRemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - var vm = await GetResourceAsync(cancellationToken); - var patchable = new VirtualMachineUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags.Remove(key); - - return new PhArmOperation( - await Operations.StartUpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).Result.WaitForCompletionAsync(cancellationToken), - v => new VirtualMachine(this, new VirtualMachineData(v))); - } - - /// - /// Lists all available geo-locations. - /// - /// A collection of location that may take multiple service requests to iterate over. - public IEnumerable ListAvailableLocations(CancellationToken cancellationToken = default) - { - return ListAvailableLocations(ResourceType, cancellationToken); - } - - /// - /// Lists all available geo-locations. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of location that may take multiple service requests to iterate over. - /// The default subscription id is null. - public async Task> ListAvailableLocationsAsync(CancellationToken cancellationToken = default) - { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineScaleSet.cs b/sdk/resourcemanager/Proto.Client/compute/VirtualMachineScaleSet.cs deleted file mode 100644 index 1b1773b3959b..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineScaleSet.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using Azure.ResourceManager.Core; - -namespace Proto.Compute -{ - /// - /// Class representing a VirtualMachineScaleSet along with the instance operations that can be performed on it. - /// - public class VirtualMachineScaleSet : VirtualMachineScaleSetOperations - { - /// - /// Gets the data representing this VirtualMachineScaleSet. - /// - public VirtualMachineScaleSetData Data { get; private set; } - - /// - /// Initializes a new instance of the class. - /// - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal VirtualMachineScaleSet(ResourceOperationsBase operations, VirtualMachineScaleSetData resource) - : base(operations, resource.Id) - { - Data = resource; - } - - /// - protected override VirtualMachineScaleSet GetResource(CancellationToken cancellation = default) - { - return this; - } - - /// - protected override Task GetResourceAsync(CancellationToken cancellationToken = default) - { - return Task.FromResult(this); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineScaleSetBuilder.cs b/sdk/resourcemanager/Proto.Client/compute/VirtualMachineScaleSetBuilder.cs deleted file mode 100644 index 933e93312f04..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineScaleSetBuilder.cs +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Compute -{ - /// - /// A class representing a builder object used to create Azure resources. - /// - public partial class VirtualMachineScaleSetBuilder - { - private VirtualMachineScaleSetData _model; - - /// - /// Initializes a new instance of the class. - /// - /// The container object to create the resource in. - /// The resource to create. - public VirtualMachineScaleSetBuilder(VirtualMachineScaleSetContainer container, VirtualMachineScaleSetData resource) - { - Resource = resource; - VirtualMachineScaleSetContainer = container; - _model = resource; - } - - /// - /// Gets the resource object to create. - /// - protected VirtualMachineScaleSetData Resource { get; private set; } - - /// - /// Gets the resource name. - /// - protected string ResourceName { get; private set; } - - /// - /// Gets the container object to create the resource in. - /// - protected VirtualMachineScaleSetContainer VirtualMachineScaleSetContainer { get; private set; } - - /// - /// Creates the resource object to send to the Azure API. - /// - /// The resource to create. - public VirtualMachineScaleSetData Build() - { - ThrowIfNotValid(); - OnBeforeBuild(); - InternalBuild(); - OnAfterBuild(); - - return Resource; - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - /// Name cannot be null or a whitespace. - public Response CreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return VirtualMachineScaleSetContainer.CreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this resource. - /// Name cannot be null or a whitespace. - public async Task> CreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await VirtualMachineScaleSetContainer.CreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public Operation StartCreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return VirtualMachineScaleSetContainer.StartCreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public async Task> StartCreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await VirtualMachineScaleSetContainer.StartCreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// Determines whether or not the resource is valid. - /// - /// The message indicating what is wrong with the resource. - /// Whether or not the resource is valid. - protected virtual bool IsValid(out string message) - { - message = string.Empty; - - return true; - } - - /// - /// Perform any tasks necessary after the resource is built - /// - protected virtual void OnAfterBuild() - { - } - - /// - /// Perform any tasks necessary before the resource is built - /// - protected virtual void OnBeforeBuild() - { - } - - private static void InternalBuild() - { - } - - private void ThrowIfNotValid() - { - if (!IsValid(out var message)) - { - throw new InvalidOperationException(message); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineScaleSetContainer.cs b/sdk/resourcemanager/Proto.Client/compute/VirtualMachineScaleSetContainer.cs deleted file mode 100644 index db175f026646..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineScaleSetContainer.cs +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using Azure.ResourceManager.Compute; -using Azure.ResourceManager.Compute.Models; -using Azure.ResourceManager.Core; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Compute -{ - /// - /// A class representing collection of VirtualMachineScaleSet and their operations over a ResourceGroup. - /// - public class VirtualMachineScaleSetContainer : ResourceContainerBase - { - /// - /// Initializes a new instance of the class. - /// - /// The ResourceGroup that is the parent of the VirtualMachineScaleSets. - internal VirtualMachineScaleSetContainer(ResourceGroupOperations resourceGroup) - : base(resourceGroup) - { - } - - /// - /// Typed Resource Identifier for the container. - /// - public new ResourceGroupResourceIdentifier Id => base.Id as ResourceGroupResourceIdentifier; - - private VirtualMachineScaleSetsOperations Operations => new ComputeManagementClient( - BaseUri, - Id.SubscriptionId, - Credential, - ClientOptions.Convert()).VirtualMachineScaleSets; - - /// - /// Gets the valid resource type for this object - /// - protected override ResourceType ValidResourceType => ResourceGroupOperations.ResourceType; - - /// - /// The operation to create a virtual machine. - /// - /// The name of the virtual machine. - /// Parameters supplied to the Create Virtual Machine operation. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - public Response CreateOrUpdate(string name, VirtualMachineScaleSetData resourceDetails, CancellationToken cancellationToken = default) - { - var response = Operations.StartCreateOrUpdate(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken).WaitForCompletionAsync().ConfigureAwait(false).GetAwaiter().GetResult(); - return Response.FromValue(new VirtualMachineScaleSet(Parent, new VirtualMachineScaleSetData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to create a virtual machine. - /// - /// The name of the virtual machine. - /// Parameters supplied to the Create Virtual Machine operation. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this resource. - public async Task> CreateOrUpdateAsync(string name, VirtualMachineScaleSetData resourceDetails, CancellationToken cancellationToken = default) - { - var response = await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult().WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return Response.FromValue(new VirtualMachineScaleSet(Parent, new VirtualMachineScaleSetData(response.Value)), response.GetRawResponse()); - } - - /// - public Response Get(string virtualMachineScaleSetName, CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, virtualMachineScaleSetName, cancellationToken); - return Response.FromValue(new VirtualMachineScaleSet(Parent, new VirtualMachineScaleSetData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> GetAsync(string virtualMachineScaleSetName, CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, virtualMachineScaleSetName, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new VirtualMachineScaleSet(Parent, new VirtualMachineScaleSetData(response.Value)), response.GetRawResponse()); - } - - /// - /// List the virtual machines for this resource group. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of that may take multiple service requests to iterate over. - public Pageable List(CancellationToken cancellationToken = default) - { - var result = Operations.List(Id.Name, cancellationToken); - return new PhWrappingPageable( - result, - s => new VirtualMachineScaleSet(Parent, new VirtualMachineScaleSetData(s))); - } - - /// - /// Filters the list of virtual machines for this resource group represented as generic resources. - /// - /// The substring to filter by. - /// The number of items to truncate by. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of that may take multiple service requests to iterate over. - public Pageable ListAsGenericResource(string nameFilter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(VirtualMachineScaleSetOperations.ResourceType); - filters.SubstringFilter = nameFilter; - return ResourceListOperations.ListAtContext(Parent as ResourceGroupOperations, filters, top, cancellationToken); - } - - /// - /// Filters the list of virtual machines for this resource group represented as generic resources. - /// - /// The substring to filter by. - /// The number of items to truncate by. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of that may take multiple service requests to iterate over. - public AsyncPageable ListAsGenericResourceAsync(string nameFilter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(VirtualMachineScaleSetOperations.ResourceType); - filters.SubstringFilter = nameFilter; - return ResourceListOperations.ListAtContextAsync(Parent as ResourceGroupOperations, filters, top, cancellationToken); - } - - /// - /// List the virtual machines for this resource group. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of that may take multiple service requests to iterate over. - public AsyncPageable ListAsync(CancellationToken cancellationToken = default) - { - var result = Operations.ListAsync(Id.Name, cancellationToken); - return new PhWrappingAsyncPageable( - result, - s => new VirtualMachineScaleSet(Parent, new VirtualMachineScaleSetData(s))); - } - - /// - /// The operation to create a virtual machine. - /// - /// The name of the virtual machine. - /// Parameters supplied to the Create Virtual Machine operation. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// - /// Details on long running operation object. - /// - /// An that allows polling for completion of the operation. - public Operation StartCreateOrUpdate(string name, VirtualMachineScaleSetData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - Operations.StartCreateOrUpdate(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken), - v => new VirtualMachineScaleSet(Parent, new VirtualMachineScaleSetData(v))); - } - - /// - /// The operation to create a virtual machine. - /// - /// The name of the virtual machine. - /// Parameters supplied to the Create Virtual Machine operation. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// - /// Details on long running operation object. - /// - /// A that on completion returns an that allows polling for completion of the operation. - public async Task> StartCreateOrUpdateAsync(string name, VirtualMachineScaleSetData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken).ConfigureAwait(false), - v => new VirtualMachineScaleSet(Parent, new VirtualMachineScaleSetData(v))); - } - - /// - /// Construct an object used to create a VirtualMachine. - /// - /// The hostname for the virtual machine. - /// The location to create the Virtual Machine. - /// Object used to create a . - public VirtualMachineScaleSetBuilder Construct(string hostName, LocationData location = null) - { - var parent = GetParentResource(); - var vmss = new Azure.ResourceManager.Compute.Models.VirtualMachineScaleSet(location ?? parent.Data.Location) - { - // TODO SKU should not be hardcoded - Sku = new Azure.ResourceManager.Compute.Models.Sku() { Name = "Standard_DS1_v2", Capacity = 2 }, - Overprovision = false, - VirtualMachineProfile = new Azure.ResourceManager.Compute.Models.VirtualMachineScaleSetVMProfile() - { - NetworkProfile = new VirtualMachineScaleSetNetworkProfile(), - StorageProfile = new VirtualMachineScaleSetStorageProfile() - { - OsDisk = new VirtualMachineScaleSetOSDisk(DiskCreateOptionTypes.FromImage), - ImageReference = new ImageReference() - { - Offer = "WindowsServer", - Publisher = "MicrosoftWindowsServer", - Sku = "2019-Datacenter", - Version = "latest" - }, - } - }, - UpgradePolicy = new UpgradePolicy() { Mode = UpgradeMode.Automatic }, - }; - - var nicConfig = new VirtualMachineScaleSetNetworkConfiguration("scaleSetNic") - { - Primary = true, - }; - var ipconfig = new VirtualMachineScaleSetIPConfiguration("scaleSetIPConfig") - { - Subnet = new ApiEntityReference() { Id = "" }, - }; - ipconfig.LoadBalancerBackendAddressPools.Add(null); - ipconfig.LoadBalancerInboundNatPools.Add(null); - nicConfig.IpConfigurations.Add(ipconfig); - - vmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.Add(nicConfig); - - return new VirtualMachineScaleSetBuilder(this, new VirtualMachineScaleSetData(vmss)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineScaleSetOperations.cs b/sdk/resourcemanager/Proto.Client/compute/VirtualMachineScaleSetOperations.cs deleted file mode 100644 index 9b5aec1ce870..000000000000 --- a/sdk/resourcemanager/Proto.Client/compute/VirtualMachineScaleSetOperations.cs +++ /dev/null @@ -1,306 +0,0 @@ -using Azure; -using Azure.ResourceManager.Compute; -using Azure.ResourceManager.Compute.Models; -using Azure.ResourceManager.Core; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Compute -{ - /// - /// A class representing the operations that can be performed over a specific VirtualMachineScaleSet. - /// - public class VirtualMachineScaleSetOperations : ResourceOperationsBase - { - /// - /// Initializes a new instance of the class. - /// - /// An instance of that has an id for a virtual machine. - internal VirtualMachineScaleSetOperations(GenericResourceOperations genericOperations) - : base(genericOperations, genericOperations.Id) - { - } - - /// - /// 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 VirtualMachineScaleSetOperations(ResourceGroupOperations resourceGroup, string vmName) - : base(resourceGroup, resourceGroup.Id.AppendProviderResource(ResourceType.Namespace, ResourceType.Type, vmName)) - { - } - - /// - /// 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. - protected VirtualMachineScaleSetOperations(ResourceOperationsBase operation, ResourceGroupResourceIdentifier id) - : base(operation, id) - { - } - - /// - /// Gets the resource type definition for a virtual machine. - /// - public static readonly ResourceType ResourceType = "Microsoft.Compute/virtualMachineScaleSets"; - - /// - /// Gets the valid resources for virtual machines. - /// - protected override ResourceType ValidResourceType => ResourceType; - - private VirtualMachineScaleSetsOperations Operations => new ComputeManagementClient( - BaseUri, - Id.SubscriptionId, - Credential, - ClientOptions.Convert()).VirtualMachineScaleSets; - - /// - /// Initializes a new instance of the class from a . - /// - /// An instance of that has an id for a virtual machine. - /// A new instance of the class. - public static VirtualMachineScaleSetOperations FromGeneric(GenericResourceOperations genericOperations) - { - return new VirtualMachineScaleSetOperations(genericOperations); - } - - /// - public Response Delete(CancellationToken cancellationToken = default) - { - return Operations.StartDelete(Id.ResourceGroupName, Id.Name, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - public async Task DeleteAsync(CancellationToken cancellationToken = default) - { - return (await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken)).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - public Operation StartDelete(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(Operations.StartDelete(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - public async Task StartDeleteAsync(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - public override Response Get(CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(response.Value)), response.GetRawResponse()); - } - - /// - public override async Task> GetAsync(CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to update a virtual machine. Please note some properties can be set only during virtual machine creation. - /// - /// The parameters to update. - /// An that allows polling for completion of the operation. - public Operation StartUpdate(VirtualMachineScaleSetUpdate patchable, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - Operations.StartUpdate(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - v => new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(v))); - } - - /// - /// The operation to update a virtual machine. Please note some properties can be set only during virtual machine creation. - /// - /// The parameters to update. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - public async Task> StartUpdateAsync(VirtualMachineScaleSetUpdate patchable, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - await Operations.StartUpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - v => new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(v))); - } - - /// - public Response AddTag(string key, string value, CancellationToken cancellationToken = default) - { - var vm = GetResource(); - var patchable = new VirtualMachineScaleSetUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags[key] = value; - - var response = Operations.StartUpdate(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - return Response.FromValue(new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - var vm = await GetResourceAsync(cancellationToken); - var patchable = new VirtualMachineScaleSetUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags[key] = value; - - var response = await Operations.StartUpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).Result.WaitForCompletionAsync(); - return Response.FromValue(new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartAddTag(string key, string value, CancellationToken cancellationToken = default) - { - var vm = GetResource(); - var patchable = new VirtualMachineScaleSetUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags[key] = value; - - return new PhArmOperation( - Operations.StartUpdate(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - v => new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(v))); - } - - /// - public async Task> StartAddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - var vm = await GetResourceAsync(cancellationToken); - var patchable = new VirtualMachineScaleSetUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags[key] = value; - - return new PhArmOperation( - await Operations.StartUpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - v => new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(v))); - } - - /// - public Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new VirtualMachineScaleSetUpdate(); - patchable.Tags.ReplaceWith(tags); - - var response = Operations.StartUpdate(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - return Response.FromValue(new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new VirtualMachineScaleSetUpdate(); - patchable.Tags.ReplaceWith(tags); - - var response = await Operations.StartUpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).Result.WaitForCompletionAsync(cancellationToken); - return Response.FromValue(new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartSetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new VirtualMachineScaleSetUpdate(); - patchable.Tags.ReplaceWith(tags); - - return new PhArmOperation( - Operations.StartUpdate(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(), - v => new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(v))); - } - - /// - public async Task> StartSetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new VirtualMachineScaleSetUpdate(); - patchable.Tags.ReplaceWith(tags); - - return new PhArmOperation( - await Operations.StartUpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).Result.WaitForCompletionAsync(cancellationToken), - v => new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(v))); - } - - /// - public Response RemoveTag(string key, CancellationToken cancellationToken = default) - { - var vm = GetResource(); - var patchable = new VirtualMachineScaleSetUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags.Remove(key); - - var response = Operations.StartUpdate(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - return Response.FromValue(new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - var vm = await GetResourceAsync(cancellationToken); - var patchable = new VirtualMachineScaleSetUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags.Remove(key); - - var response = await Operations.StartUpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).Result.WaitForCompletionAsync(cancellationToken); - return Response.FromValue(new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartRemoveTag(string key, CancellationToken cancellationToken = default) - { - var vm = GetResource(); - var patchable = new VirtualMachineScaleSetUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags.Remove(key); - - return new PhArmOperation( - Operations.StartUpdate(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(), - v => new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(v))); - } - - /// - public async Task> StartRemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - var vm = await GetResourceAsync(cancellationToken); - var patchable = new VirtualMachineScaleSetUpdate(); - patchable.Tags.ReplaceWith(vm.Data.Tags); - patchable.Tags.Remove(key); - - return new PhArmOperation( - await Operations.StartUpdateAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).Result.WaitForCompletionAsync(cancellationToken), - v => new VirtualMachineScaleSet(this, new VirtualMachineScaleSetData(v))); - } - - /// - /// Lists all available geo-locations. - /// - /// A collection of location that may take multiple service requests to iterate over. - public IEnumerable ListAvailableLocations(CancellationToken cancellationToken = default) - { - return ListAvailableLocations(ResourceType, cancellationToken); - } - - /// - /// Lists all available geo-locations. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of location that may take multiple service requests to iterate over. - /// The default subscription id is null. - public async Task> ListAvailableLocationsAsync(CancellationToken cancellationToken = default) - { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken); - } - - /// - /// Gets a list of subnet in the virtual nerwork. - /// - /// An object representing collection of subnets and their operations over a virtual network. - public RollingUpgradeOperations GetRollingUpgrade() - { - return new RollingUpgradeOperations(this); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/Adapters/PhWrappingAsyncPageable.cs b/sdk/resourcemanager/Proto.Client/network/Adapters/PhWrappingAsyncPageable.cs deleted file mode 100644 index 43a76a766317..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Adapters/PhWrappingAsyncPageable.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Azure.ResourceManager.Core -{ - /// - /// Returns an AsyncPageable that transforms each page of contents after they are retrieved from the server - /// according to the profived transformation function - /// - /// The model returned by existing AsyncPageable methods. - /// The to convert TModel into. - public class PhWrappingAsyncPageable : AsyncPageable - where TOperations : class - where TModel : class - { - private readonly Func _converter; - private readonly IEnumerable> _wrapped; - - /// - /// Initializes a new instance of the class for mocking. - /// - protected PhWrappingAsyncPageable() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - public PhWrappingAsyncPageable(AsyncPageable wrapped, Func converter) - { - _wrapped = new[] { wrapped }; - _converter = converter; - } - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - public PhWrappingAsyncPageable(IEnumerable> wrapped, Func converter) - { - _wrapped = wrapped; - _converter = converter; - } - - /// - public override async IAsyncEnumerable> AsPages( - string continuationToken = null, - int? pageSizeHint = null) - { - foreach (var pageEnum in _wrapped) - { - await foreach (var page in pageEnum.AsPages().WithCancellation(CancellationToken)) - { - yield return new WrappingPage(page, _converter); - } - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/Adapters/PhWrappingPageable.cs b/sdk/resourcemanager/Proto.Client/network/Adapters/PhWrappingPageable.cs deleted file mode 100644 index c11077cb0107..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Adapters/PhWrappingPageable.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.Core -{ - /// - /// This class allows performing conversions on pages of data as they are accessed - used in the prototype to convett - /// between underlying model types and the new model types that extend Resource, - /// and also for returning Operations classes for those underlying objects. - /// - /// The type parameter of the Pageable we are wrapping. - /// The desired type parameter of the returned pageable. - public class PhWrappingPageable : Pageable - where TOperations : class - where TModel : class - { - private readonly Func _converter; - private readonly IEnumerable> _wrapped; - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - public PhWrappingPageable(Pageable wrapped, Func converter) - { - _wrapped = new[] { wrapped }; - _converter = converter; - } - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - public PhWrappingPageable(IEnumerable> wrapped, Func converter) - { - _wrapped = wrapped; - _converter = converter; - } - - /// - public override IEnumerable> AsPages(string continuationToken = null, int? pageSizeHint = null) - { - foreach (var pages in _wrapped) - { - foreach (var page in pages.AsPages()) - { - yield return new WrappingPage(page, _converter); - } - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/Adapters/WrappingPage.cs b/sdk/resourcemanager/Proto.Client/network/Adapters/WrappingPage.cs deleted file mode 100644 index df1faea2f915..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Adapters/WrappingPage.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.ResourceManager.Core -{ - /// - /// A class representing a wrapper over - /// - /// The type parameter we are wrapping. - /// The desired type parameter of the returned page. - internal class WrappingPage : Page - where TOperations : class - where TModel : class - { - private readonly Func _converter; - private readonly Page _wrapped; - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - internal WrappingPage(Page wrapped, Func converter) - { - _wrapped = wrapped; - _converter = converter; - } - - /// - public override IReadOnlyList Values => _wrapped.Values.Select(_converter).ToList(); - - /// - public override string ContinuationToken => _wrapped.ContinuationToken; - - /// - public override Response GetRawResponse() - { - return _wrapped.GetRawResponse(); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/CHANGELOG.md b/sdk/resourcemanager/Proto.Client/network/CHANGELOG.md deleted file mode 100644 index 5c312e4ea9be..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -# Release History - -## 1.0.0-beta.1 (Unreleased) - --Initial checkin diff --git a/sdk/resourcemanager/Proto.Client/network/Extensions/ArmClientExtensions.cs b/sdk/resourcemanager/Proto.Client/network/Extensions/ArmClientExtensions.cs deleted file mode 100644 index 876502ed8657..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Extensions/ArmClientExtensions.cs +++ /dev/null @@ -1,102 +0,0 @@ -using Azure.ResourceManager.Core; -using System; - -namespace Proto.Network -{ - /// - /// A class to add extension methods to an ArmClient. - /// - public static class ArmClientExtensions - { - - /// - /// Gets the NetworkInterfaceOperations. - /// - /// The instance the method will execute against. - /// The ResourceIdentifier of the resource that is the target of operations. - /// Returns an object representing the operations that can be performed over a specific . - /// ResourceIdentifier provided is not for a NetworkInterfaceOperations. - /// ResourceIdentifier cannot be null. - public static NetworkInterfaceOperations GetNetworkInterfaceOperations(this ArmClient client, ResourceGroupResourceIdentifier resourceId) - { - if (resourceId is null) - throw new ArgumentNullException(nameof(resourceId)); - if (resourceId.ResourceType != NetworkInterfaceOperations.ResourceType) - throw new ArgumentException($"{nameof(resourceId.ResourceType)} provided is not for a NetworkInterface.", nameof(resourceId.ResourceType)); - - return new NetworkInterfaceOperations(client.GetResourceGroupOperations(resourceId), resourceId.Name); - } - - /// - /// Gets the NetworkSecurityGroupOperations. - /// - /// The instance the method will execute against. - /// The ResourceIdentifier of the resource that is the target of operations. - /// Returns an object representing the operations that can be performed over a specific . - /// ResourceIdentifier provided is not for a NetworkSecurityGroup. - /// ResourceIdentifier cannot be null. - public static NetworkSecurityGroupOperations GetNetworkSecurityGroupOperations(this ArmClient client, ResourceGroupResourceIdentifier resourceId) - { - if (resourceId is null) - throw new ArgumentNullException(nameof(resourceId)); - if (resourceId.ResourceType != NetworkSecurityGroupOperations.ResourceType) - throw new ArgumentException($"{nameof(resourceId.ResourceType)} provided is not for a NetworkSecurityGroup.", nameof(resourceId.ResourceType)); - - return new NetworkSecurityGroupOperations(client.GetResourceGroupOperations(resourceId), resourceId.Name); - } - - /// - /// Gets the PublicIpAddressOperations. - /// - /// The instance the method will execute against. - /// The ResourceIdentifier of the resource that is the target of operations. - /// Returns an object representing the operations that can be performed over a specific . - /// ResourceIdentifier provided is not for a PublicIpAddress. - /// ResourceIdentifier cannot be null. - public static PublicIpAddressOperations GetPublicIpAddressOperations(this ArmClient client, ResourceGroupResourceIdentifier resourceId) - { - if (resourceId is null) - throw new ArgumentNullException(nameof(resourceId)); - if (resourceId.ResourceType != PublicIpAddressOperations.ResourceType) - throw new ArgumentException($"{nameof(resourceId.ResourceType)} provided is not for a PublicIpAddress.", nameof(resourceId.ResourceType)); - - return new PublicIpAddressOperations(client.GetResourceGroupOperations(resourceId), resourceId.Name); - } - - /// - /// Gets the SubnetOperations. - /// - /// The instance the method will execute against. - /// The ResourceIdentifier of the resource that is the target of operations. - /// Returns an object representing the operations that can be performed over a specific . - /// ResourceIdentifier provided is not for a Subnet. - /// ResourceIdentifier cannot be null. - public static SubnetOperations GetSubnetOperations(this ArmClient client, ResourceGroupResourceIdentifier resourceId) - { - if (resourceId is null) - throw new ArgumentNullException(nameof(resourceId)); - if (resourceId.ResourceType != SubnetOperations.ResourceType) - throw new ArgumentException($"{nameof(resourceId.ResourceType)} provided is not for a Subnet.", nameof(resourceId.ResourceType)); - - return new SubnetOperations(client.GetVirtualNetworkOperations(resourceId.Parent as ResourceGroupResourceIdentifier), resourceId.Name); - } - - /// - /// Gets the VirtualNetworkOperations. - /// - /// The instance the method will execute against. - /// The ResourceIdentifier of the resource that is the target of operations. - /// Returns an object representing the operations that can be performed over a specific . - /// ResourceIdentifier provided is not for a VirtualNetwork. - /// ResourceIdentifier cannot be null. - public static VirtualNetworkOperations GetVirtualNetworkOperations(this ArmClient client, ResourceGroupResourceIdentifier resourceId) - { - if (resourceId is null) - throw new ArgumentNullException(nameof(resourceId)); - if (resourceId.ResourceType != VirtualNetworkOperations.ResourceType) - throw new ArgumentException($"{nameof(resourceId.ResourceType)} provided is not for a VirtualNetwork.", nameof(resourceId.ResourceType)); - - return new VirtualNetworkOperations(client.GetResourceGroupOperations(resourceId), resourceId.Name); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/Extensions/ResourceGroupExtensions.cs b/sdk/resourcemanager/Proto.Client/network/Extensions/ResourceGroupExtensions.cs deleted file mode 100644 index 0975ca3446db..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Extensions/ResourceGroupExtensions.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.ResourceManager.Core; -using System; - -namespace Proto.Network -{ - /// - /// A class to add extension methods to resource group. - /// - public static class ResourceGroupExtensions - { - /// - /// Gets a under a . - /// - /// The instance the method will execute against. - /// An instance of . - public static VirtualNetworkContainer GetVirtualNetworks(this ResourceGroupOperations resourceGroup) - { - return new VirtualNetworkContainer(resourceGroup); - } - - /// - /// Gets a under a . - /// - /// The instance the method will execute against. - /// An instance of . - public static PublicIpAddressContainer GetPublicIpAddresss(this ResourceGroupOperations resourceGroup) - { - return new PublicIpAddressContainer(resourceGroup); - } - - /// - /// Gets the operations over the collection of contained in the resource group. - /// - /// The operations over a specific resource group. - /// A representing the collection of - public static NetworkInterfaceContainer GetNetworkInterfaces(this ResourceGroupOperations resourceGroup) - { - return new NetworkInterfaceContainer(resourceGroup); - } - - /// - /// Gets a under a . - /// - /// The instance the method will execute against. - /// An instance of . - public static NetworkSecurityGroupContainer GetNetworkSecurityGroups(this ResourceGroupOperations resourceGroup) - { - return new NetworkSecurityGroupContainer(resourceGroup); - } - - /// - /// Gets a under a . - /// - /// The instance the method will execute against. - /// An instance of . - public static LoadBalancerContainer GetLoadBalancers(this ResourceGroupOperations resourceGroup) - { - return new LoadBalancerContainer(resourceGroup); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/Extensions/SubscriptionExtensions.cs b/sdk/resourcemanager/Proto.Client/network/Extensions/SubscriptionExtensions.cs deleted file mode 100644 index 5bd6b84c7d38..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Extensions/SubscriptionExtensions.cs +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using Azure.Core; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Network; -using System; - -namespace Proto.Network -{ - /// - /// A class to add extension methods to Azure subscription. - /// - public static class SubscriptionExtensions - { - #region Virtual Network Operations - - private static NetworkManagementClient GetNetworkClient(Uri baseUri, string subscriptionGuid, TokenCredential credential, ArmClientOptions clientOptions) - { - return new NetworkManagementClient( - subscriptionGuid, - baseUri, - credential, - clientOptions.Convert()); - } - - /// - /// Lists the virtual networks for this subscription. - /// - /// The instance the method will execute against. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static Pageable ListVnets(this SubscriptionOperations subscription) - { - return subscription.UseClientContext( - (baseUri, credential, options, pipeline) => - { - NetworkManagementClient networkClient = GetNetworkClient(baseUri, subscription.Id.SubscriptionId, credential, options); - var vmOperations = networkClient.VirtualNetworks; - var result = vmOperations.ListAll(); - return new PhWrappingPageable( - result, - s => new VirtualNetwork(subscription, new VirtualNetworkData(s))); - } - ); - } - - /// - /// Lists the virtual networks for this subscription. - /// - /// The instance the method will execute against. - /// An async collection of resource operations that may take multiple service requests to iterate over. - public static AsyncPageable ListVnetsAsync(this SubscriptionOperations subscription) - { - return subscription.UseClientContext( - (baseUri, credential, options, pipeline) => - { - NetworkManagementClient networkClient = GetNetworkClient(baseUri, subscription.Id.SubscriptionId, credential, options); - var vmOperations = networkClient.VirtualNetworks; - var result = vmOperations.ListAllAsync(); - return new PhWrappingAsyncPageable( - result, - s => new VirtualNetwork(subscription, new VirtualNetworkData(s))); - } - ); - } - - #endregion - - #region Public IP Address Operations - - /// - /// Lists the public IPs for this subscription. - /// - /// The instance the method will execute against. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static Pageable ListPublicIps(this SubscriptionOperations subscription) - { - return subscription.UseClientContext( - (baseUri, credential, options, pipeline) => - { - NetworkManagementClient networkClient = GetNetworkClient(baseUri, subscription.Id.SubscriptionId, credential, options); - var publicIPAddressesOperations = networkClient.PublicIPAddresses; - var result = publicIPAddressesOperations.ListAll(); - return new PhWrappingPageable( - result, - s => new PublicIpAddress(subscription, new PublicIPAddressData(s))); - } - ); - } - - /// - /// Lists the public IP addresses for this subscription. - /// - /// The instance the method will execute against. - /// An async collection of resource operations that may take multiple service requests to iterate over. - public static AsyncPageable ListPublicIpsAsync(this SubscriptionOperations subscription) - { - return subscription.UseClientContext( - (baseUri, credential, options, pipeline) => - { - NetworkManagementClient networkClient = GetNetworkClient(baseUri, subscription.Id.SubscriptionId, credential, options); - var publicIPAddressesOperations = networkClient.PublicIPAddresses; - var result = publicIPAddressesOperations.ListAllAsync(); - return new PhWrappingAsyncPageable( - result, - s => new PublicIpAddress(subscription, new PublicIPAddressData(s))); - } - ); - } - - #endregion - - #region Network Interface (NIC) operations - - /// - /// Lists the for this . - /// - /// The to target for listing. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable ListNics(this SubscriptionOperations subscription) - { - return subscription.UseClientContext( - (baseUri, credential, options, pipeline) => - { - NetworkManagementClient networkClient = GetNetworkClient(baseUri, subscription.Id.SubscriptionId, credential, options); - var networkInterfacesOperations = networkClient.NetworkInterfaces; - var result = networkInterfacesOperations.ListAll(); - return new PhWrappingPageable( - result, - s => new NetworkInterface(subscription, new NetworkInterfaceData(s))); - } - ); - } - - /// - /// Lists the for this . - /// - /// The to target for listing. - /// An async collection of resource operations that may take multiple service requests to iterate over. - public static AsyncPageable ListNicsAsync(this SubscriptionOperations subscription) - { - return subscription.UseClientContext( - (baseUri, credential, options, pipeline) => - { - NetworkManagementClient networkClient = GetNetworkClient(baseUri, subscription.Id.SubscriptionId, credential, options); - var networkInterfacesOperations = networkClient.NetworkInterfaces; - var result = networkInterfacesOperations.ListAllAsync(); - return new PhWrappingAsyncPageable( - result, - s => new NetworkInterface(subscription, new NetworkInterfaceData(s))); - } - ); - } - - #endregion - - #region Network Security Group operations - - /// - /// Lists the network security groups for this subscription. - /// - /// The instance the method will execute against. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static Pageable ListNsgs(this SubscriptionOperations subscription) - { - return subscription.UseClientContext( - (baseUri, credential, options, pipeline) => - { - NetworkManagementClient networkClient = GetNetworkClient(baseUri, subscription.Id.SubscriptionId, credential, options); - var networkSecurityGroupsOperations = networkClient.NetworkSecurityGroups; - var result = networkSecurityGroupsOperations.ListAll(); - return new PhWrappingPageable( - result, - s => new NetworkSecurityGroup(subscription, new NetworkSecurityGroupData(s))); - } - ); - } - - /// - /// Lists the network security groups for this subscription. - /// - /// The instance the method will execute against. - /// An async collection of resource operations that may take multiple service requests to iterate over. - public static AsyncPageable ListNsgsAsync(this SubscriptionOperations subscription) - { - return subscription.UseClientContext( - (baseUri, credential, options, pipeline) => - { - NetworkManagementClient networkClient = GetNetworkClient(baseUri, subscription.Id.SubscriptionId, credential, options); - var networkSecurityGroupsOperations = networkClient.NetworkSecurityGroups; - var result = networkSecurityGroupsOperations.ListAllAsync(); - return new PhWrappingAsyncPageable( - result, - s => new NetworkSecurityGroup(subscription, new NetworkSecurityGroupData(s))); - } - ); - } - - #endregion - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/LoadBalancer.cs b/sdk/resourcemanager/Proto.Client/network/LoadBalancer.cs deleted file mode 100644 index db9bbf280a83..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/LoadBalancer.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using Azure.ResourceManager.Core; - -namespace Proto.Network -{ - /// - /// A class representing a LoadBalancer along with the instance operations that can be performed on it. - /// - public class LoadBalancer : LoadBalancerOperations - { - /// - /// Initializes a new instance of the class. - /// - internal LoadBalancer(ResourceOperationsBase options, LoadBalancerData resource) - : base(options, resource.Id) - { - Data = resource; - } - - /// - /// Gets the data representing the LoadBalancer - /// - public LoadBalancerData Data { get; private set; } - - /// - protected override LoadBalancer GetResource(CancellationToken cancellation = default) - { - return this; - } - - /// - protected override Task GetResourceAsync(CancellationToken cancellationToken = default) - { - return Task.FromResult(this); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/LoadBalancerContainer.cs b/sdk/resourcemanager/Proto.Client/network/LoadBalancerContainer.cs deleted file mode 100644 index d2232361635e..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/LoadBalancerContainer.cs +++ /dev/null @@ -1,112 +0,0 @@ -using Azure; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Network; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing collection of LoadBalancers and their operations over a VirtualNetwork. - /// - public class LoadBalancerContainer : ResourceContainerBase - { - /// - /// Initializes a new instance of the class. - /// - /// The parent resource group. - internal LoadBalancerContainer(ResourceGroupOperations resourceGroup) - : base(resourceGroup) - { - } - - /// - /// Typed Resource Identifier for the container. - /// - public new ResourceGroupResourceIdentifier Id => base.Id as ResourceGroupResourceIdentifier; - - /// - protected override ResourceType ValidResourceType => ResourceGroupOperations.ResourceType; - - private LoadBalancersOperations Operations => new NetworkManagementClient( - Id.SubscriptionId, - BaseUri, - Credential, - ClientOptions.Convert()).LoadBalancers; - - /// - public Response CreateOrUpdate(string name, LoadBalancerData resourceDetails, CancellationToken cancellationToken = default) - { - var response = Operations.StartCreateOrUpdate(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - return Response.FromValue(new LoadBalancer(Parent, new LoadBalancerData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> CreateOrUpdateAsync(string name, LoadBalancerData resourceDetails, CancellationToken cancellationToken = default) - { - var response = await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult().WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return Response.FromValue(new LoadBalancer(Parent, new LoadBalancerData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartCreateOrUpdate(string name, LoadBalancerData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - Operations.StartCreateOrUpdate(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken), - s => new LoadBalancer(Parent, new LoadBalancerData(s))); - } - - /// - public async Task> StartCreateOrUpdateAsync(string name, LoadBalancerData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken).ConfigureAwait(false), - s => new LoadBalancer(Parent, new LoadBalancerData(s))); - } - - /// - /// Lists the LoadBalancers for this LoadBalancer. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of resource operations that may take multiple service requests to iterate over. - public Pageable List(CancellationToken cancellationToken = default) - { - return new PhWrappingPageable( - Operations.List(Id.ResourceGroupName, cancellationToken), - convertor()); - } - - /// - /// Lists the LoadBalancers for this LoadBalancer. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of resource operations that may take multiple service requests to iterate over. - public AsyncPageable ListAsync(CancellationToken cancellationToken = default) - { - return new PhWrappingAsyncPageable( - Operations.ListAsync(Id.ResourceGroupName, cancellationToken), - convertor()); - } - - private Func convertor() - { - return s => new LoadBalancer(Parent, new LoadBalancerData(s)); - } - - /// - public Response Get(string loadBalancerName, CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, loadBalancerName, null, cancellationToken: cancellationToken); - return Response.FromValue(new LoadBalancer(Parent, new LoadBalancerData(response.Value)), response.GetRawResponse()); - - } - - /// - public async Task> GetAsync(string loadBalancerName, CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, loadBalancerName, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new LoadBalancer(Parent, new LoadBalancerData(response.Value)), response.GetRawResponse()); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/LoadBalancerOperations.cs b/sdk/resourcemanager/Proto.Client/network/LoadBalancerOperations.cs deleted file mode 100644 index ff0c6a8a2e34..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/LoadBalancerOperations.cs +++ /dev/null @@ -1,92 +0,0 @@ -using Azure; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Network; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing the operations that can be performed over a specific LoadBalancer. - /// - // TODO, ITaggable was not added. - public class LoadBalancerOperations : ResourceOperationsBase - { - /// - /// Initializes a new instance of the class. - /// - /// The client parameters to use in these operations. - /// The name of the LoadBalancer. - internal LoadBalancerOperations(VirtualNetworkOperations virtualNetwork, string loadBalancerName) - : base(virtualNetwork, virtualNetwork.Id.AppendChildResource( "loadBalancers", loadBalancerName)) - { - } - - /// - /// 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. - protected LoadBalancerOperations(ResourceOperationsBase options, ResourceIdentifier id) - : base(options, id) - { - } - - /// - /// Gets the resource type definition for a LoadBalancer. - /// - public static readonly ResourceType ResourceType = "Microsoft.Network/loadBalancers"; - - /// - /// Gets the valid resource type definition for a LoadBalancer. - /// - protected override ResourceType ValidResourceType => ResourceType; - - private LoadBalancersOperations Operations => new NetworkManagementClient( - Id.SubscriptionId, - BaseUri, - Credential, - ClientOptions.Convert()).LoadBalancers; - - /// - public Response Delete(CancellationToken cancellationToken = default) - { - return Operations.StartDelete(Id.ResourceGroupName, Id.Name, cancellationToken) - .WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - public async Task DeleteAsync(CancellationToken cancellationToken = default) - { - return (await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken)) - .WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - - /// - public Operation StartDelete(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(Operations.StartDelete(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - public async Task StartDeleteAsync(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - public override Response Get(CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Response.FromValue(new LoadBalancer(this, new LoadBalancerData(response.Value)), response.GetRawResponse()); - } - - /// - public override async Task> GetAsync(CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, Id.Name, null, cancellationToken); - return Response.FromValue(new LoadBalancer(this, new LoadBalancerData(response.Value)), response.GetRawResponse()); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/NetworkInterface.cs b/sdk/resourcemanager/Proto.Client/network/NetworkInterface.cs deleted file mode 100644 index 4492102277bc..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/NetworkInterface.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using Azure.ResourceManager.Core; - -namespace Proto.Network -{ - /// - /// A class that represents a network interface in a resource group and the operatiosn that can be performed on it. - /// - public class NetworkInterface : NetworkInterfaceOperations - { - internal NetworkInterface(ResourceOperationsBase options, NetworkInterfaceData resource) - : base(options, resource.Id) - { - Data = resource; - } - - /// - /// Gets the for this . - /// - public NetworkInterfaceData Data { get; private set; } - - /// - protected override NetworkInterface GetResource(CancellationToken cancellation = default) - { - return this; - } - - /// - protected override Task GetResourceAsync(CancellationToken cancellationToken = default) - { - return Task.FromResult(this); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/NetworkInterfaceBuilder.cs b/sdk/resourcemanager/Proto.Client/network/NetworkInterfaceBuilder.cs deleted file mode 100644 index a1cf6d405d96..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/NetworkInterfaceBuilder.cs +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing a builder object used to create Azure resources. - /// - public class NetworkInterfaceBuilder - { - /// - /// Initializes a new instance of the class. - /// - /// The container object to create the resource in. - /// The resource to create. - public NetworkInterfaceBuilder(NetworkInterfaceContainer container, NetworkInterfaceData resource) - { - Resource = resource; - UnTypedContainer = container; - } - - /// - /// Gets the resource object to create. - /// - protected NetworkInterfaceData Resource { get; private set; } - - /// - /// Gets the resource name. - /// - protected string ResourceName { get; private set; } - - /// - /// Gets the container object to create the resource in. - /// - protected NetworkInterfaceContainer UnTypedContainer { get; private set; } - - /// - /// Creates the resource object to send to the Azure API. - /// - /// The resource to create. - public NetworkInterfaceData Build() - { - ThrowIfNotValid(); - OnBeforeBuild(); - InternalBuild(); - OnAfterBuild(); - - return Resource; - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - /// Name cannot be null or a whitespace. - public Response CreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return UnTypedContainer.CreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this resource. - /// Name cannot be null or a whitespace. - public async Task> CreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await UnTypedContainer.CreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public Operation StartCreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return UnTypedContainer.StartCreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public async Task> StartCreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await UnTypedContainer.StartCreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// Determines whether or not the resource is valid. - /// - /// The message indicating what is wrong with the resource. - /// Whether or not the resource is valid. - protected virtual bool IsValid(out string message) - { - message = string.Empty; - - return true; - } - - /// - /// Perform any tasks necessary after the resource is built - /// - protected virtual void OnAfterBuild() - { - } - - /// - /// Perform any tasks necessary before the resource is built - /// - protected virtual void OnBeforeBuild() - { - } - - private static void InternalBuild() - { - } - - private void ThrowIfNotValid() - { - if (!IsValid(out var message)) - { - throw new InvalidOperationException(message); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/NetworkInterfaceContainer.cs b/sdk/resourcemanager/Proto.Client/network/NetworkInterfaceContainer.cs deleted file mode 100644 index 2af6b3c63822..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/NetworkInterfaceContainer.cs +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Network; -using Azure.ResourceManager.Network.Models; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing collection of and their operations over a . - /// - public class NetworkInterfaceContainer : ResourceContainerBase - { - internal NetworkInterfaceContainer(ResourceGroupOperations resourceGroup) - : base(resourceGroup) - { - } - - internal NetworkInterfacesOperations Operations => new NetworkManagementClient( - Id.SubscriptionId, - BaseUri, - Credential, - ClientOptions.Convert()).NetworkInterfaces; - - /// - /// - /// Typed Resource Identifier for the container. - /// - public new ResourceGroupResourceIdentifier Id => base.Id as ResourceGroupResourceIdentifier; - - /// - /// ResourceType for the container. - /// - protected override ResourceType ValidResourceType => ResourceGroupOperations.ResourceType; - - /// - /// The operation to create or update a network interface. Please note some properties can be set only during creation. - /// - /// The name of the network interface. - /// The desired network interface configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - /// Name of the network interface cannot be null or a whitespace. - /// resourceDetails cannot be null. - public Response CreateOrUpdate(string name, NetworkInterfaceData resourceDetails, CancellationToken cancellationToken = default) - { - var response = Operations.StartCreateOrUpdate(Id.ResourceGroupName, name, resourceDetails, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - return Response.FromValue(new NetworkInterface(Parent, new NetworkInterfaceData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to create or update a network interface. Please note some properties can be set only during creation. - /// - /// The name of the network interface. - /// The desired network interface configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this network interface. - /// Name of the network interface cannot be null or a whitespace. - /// resourceDetails cannot be null. - public async Task> CreateOrUpdateAsync(string name, NetworkInterfaceData resourceDetails, CancellationToken cancellationToken = default) - { - var response = await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails, cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult().WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetworkInterface(Parent, new NetworkInterfaceData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to create or update a network interface. Please note some properties can be set only during creation. - /// - /// The name of the network interface. - /// The desired network interface configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name of the network interface cannot be null or a whitespace. - /// resourceDetails cannot be null. - public Operation StartCreateOrUpdate(string name, NetworkInterfaceData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - Operations.StartCreateOrUpdate(Id.ResourceGroupName, name, resourceDetails, cancellationToken), - n => new NetworkInterface(Parent, new NetworkInterfaceData(n))); - } - - /// - /// The operation to create or update a network interface. Please note some properties can be set only during creation. - /// - /// The name of the network interface. - /// The desired network interface configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name of the network interface cannot be null or a whitespace. - /// resourceDetails cannot be null. - public async Task> StartCreateOrUpdateAsync(string name, NetworkInterfaceData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails, cancellationToken).ConfigureAwait(false), - n => new NetworkInterface(Parent, new NetworkInterfaceData(n))); - } - - /// - /// Constructs an object used to create a . - /// - /// The public IP address of the . - /// The resource identifier of the subnet attached to this . - /// The that will contain the . - /// An object used to create a . - public NetworkInterfaceBuilder Construct(string subnetId, PublicIPAddressData ip = default, LocationData location = null) - { - var parent = GetParentResource(); - var nic = new Azure.ResourceManager.Network.Models.NetworkInterface() - { - Location = location ?? parent.Data.Location, - }; - - nic.IpConfigurations.Add(new NetworkInterfaceIPConfiguration() - { - Name = "Primary", - Primary = true, - Subnet = new Azure.ResourceManager.Network.Models.Subnet() { Id = subnetId }, - PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - }); - - if (ip != null) - nic.IpConfigurations[0].PublicIPAddress = new PublicIPAddress() { Id = ip.Id }; - - return new NetworkInterfaceBuilder(this, new NetworkInterfaceData(nic)); - } - - /// - /// Lists the for this . - /// - /// A token to allow the caller to cancel the call to the service. - /// The default value is . - /// A collection of that may take multiple service requests to iterate over. - public Pageable List(CancellationToken cancellationToken = default) - { - return new PhWrappingPageable( - Operations.List(Id.Name, cancellationToken), - this.convertor()); - } - - /// - /// Lists the for this . - /// - /// A token to allow the caller to cancel the call to the service. - /// The default value is . - /// An async collection of that may take multiple service requests to iterate over. - public AsyncPageable ListAsync(CancellationToken cancellationToken = default) - { - var result = Operations.ListAsync(Id.Name, cancellationToken); - return new PhWrappingAsyncPageable( - result, - this.convertor()); - } - - /// - /// Filters the list of resources for this represented as generic resources. - /// - /// A string to filter the resources by name. - /// The number of results to return per page of data. - /// A token to allow the caller to cancel the call to the service. - /// The default value is . - /// A collection of resource operations that may take multiple service requests to iterate over. - public Pageable ListAsGenericResource(string nameFilter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(NetworkInterfaceData.ResourceType); - filters.SubstringFilter = nameFilter; - return ResourceListOperations.ListAtContext(Parent as ResourceGroupOperations, filters, top, cancellationToken); - } - - /// - /// Filters the list of resources for this represented as generic resources. - /// - /// A string to filter the resources by name. - /// The number of results to return per page of data. - /// A token to allow the caller to cancel the call to the service. - /// The default value is . - /// An async collection of resource operations that may take multiple service requests to iterate over. - public AsyncPageable ListAsGenericResourceAsync(string nameFilter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(NetworkInterfaceData.ResourceType); - filters.SubstringFilter = nameFilter; - return ResourceListOperations.ListAtContextAsync(Parent as ResourceGroupOperations, filters, top, cancellationToken); - } - - private Func convertor() - { - return s => new NetworkInterface(Parent, new NetworkInterfaceData(s)); - } - - /// - public Response Get(string networkInterfaceName, CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, networkInterfaceName, cancellationToken: cancellationToken); - return Response.FromValue(new NetworkInterface(Parent, new NetworkInterfaceData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> GetAsync(string networkInterfaceName, CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, networkInterfaceName, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetworkInterface(Parent, new NetworkInterfaceData(response.Value)), response.GetRawResponse()); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/NetworkInterfaceOperations.cs b/sdk/resourcemanager/Proto.Client/network/NetworkInterfaceOperations.cs deleted file mode 100644 index ed20ef5ac422..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/NetworkInterfaceOperations.cs +++ /dev/null @@ -1,240 +0,0 @@ -using Azure; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Network; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing the operations that can be pefroemd over a specific . - /// - public class NetworkInterfaceOperations : ResourceOperationsBase - { - internal NetworkInterfaceOperations(GenericResourceOperations genericOperations) - : base(genericOperations, genericOperations.Id) - { - } - - internal NetworkInterfaceOperations(ResourceGroupOperations resourceGroup, string nicName) - : base(resourceGroup, resourceGroup.Id.AppendProviderResource( ResourceType.Namespace, ResourceType.Type, nicName)) - { - } - - /// - /// 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. - protected NetworkInterfaceOperations(ResourceOperationsBase options, ResourceGroupResourceIdentifier id) - : base(options, id) - { - } - - /// - /// The resource type of a . - /// - public static readonly ResourceType ResourceType = "Microsoft.Network/networkInterfaces"; - - /// - protected override ResourceType ValidResourceType => ResourceType; - - internal NetworkInterfacesOperations Operations => new NetworkManagementClient( - Id.SubscriptionId, - BaseUri, - Credential, - ClientOptions.Convert()).NetworkInterfaces; - - /// - public Response Delete(CancellationToken cancellationToken = default) - { - return Operations.StartDelete(Id.ResourceGroupName, Id.Name, cancellationToken) - .WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - public async Task DeleteAsync(CancellationToken cancellationToken = default) - { - return (await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken)) - .WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - public Operation StartDelete(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(Operations.StartDelete(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - public async Task StartDeleteAsync(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - public override Response Get(CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Response.FromValue(new NetworkInterface(this, new NetworkInterfaceData(response.Value)), response.GetRawResponse()); - } - - /// - public async override Task> GetAsync(CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetworkInterface(this, new NetworkInterfaceData(response.Value)), response.GetRawResponse()); - } - - /// - public Response AddTag(string key, string value, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - var response = Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken); - return Response.FromValue(new NetworkInterface(this, new NetworkInterfaceData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - var response = await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetworkInterface(this, new NetworkInterfaceData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartAddTag(string key, string value, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - return new PhArmOperation( - Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new NetworkInterface(this, new NetworkInterfaceData(n))); - } - - /// - public async Task> StartAddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - return new PhArmOperation( - await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new NetworkInterface(this, new NetworkInterfaceData(n))); - } - - /// - public Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - var response = Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken); - return Response.FromValue(new NetworkInterface(this, new NetworkInterfaceData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - var response = await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetworkInterface(this, new NetworkInterfaceData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartSetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - return new PhArmOperation( - Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new NetworkInterface(this, new NetworkInterfaceData(n))); - } - - /// - public async Task> StartSetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - return new PhArmOperation( - await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new NetworkInterface(this, new NetworkInterfaceData(n))); - } - - /// - public Response RemoveTag(string key, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - var response = Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken); - return Response.FromValue(new NetworkInterface(this, new NetworkInterfaceData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - var response = await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetworkInterface(this, new NetworkInterfaceData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartRemoveTag(string key, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - return new PhArmOperation( - Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new NetworkInterface(this, new NetworkInterfaceData(n))); - } - - /// - public async Task> StartRemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - return new PhArmOperation( - await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new NetworkInterface(this, new NetworkInterfaceData(n))); - } - - /// - /// Lists all available geo-locations. - /// - /// A collection of location that may take multiple service requests to iterate over. - public IEnumerable ListAvailableLocations(CancellationToken cancellationToken = default) - { - return ListAvailableLocations(ResourceType, cancellationToken); - } - - /// - /// Lists all available geo-locations. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of location that may take multiple service requests to iterate over. - /// The default subscription id is null. - public async Task> ListAvailableLocationsAsync(CancellationToken cancellationToken = default) - { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/NetworkSecurityGroup.cs b/sdk/resourcemanager/Proto.Client/network/NetworkSecurityGroup.cs deleted file mode 100644 index b4684dadba26..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/NetworkSecurityGroup.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.ResourceManager.Core; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing the operations that can be performed over a specific network security group. - /// - public class NetworkSecurityGroup : NetworkSecurityGroupOperations - { - /// - /// Initializes a new instance of the class. - /// - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal NetworkSecurityGroup(ResourceOperationsBase operations, NetworkSecurityGroupData resource) - : base(operations, resource.Id) - { - Data = resource; - } - - /// - /// Gets the data representing this network security group. - /// - public NetworkSecurityGroupData Data { get; private set; } - - /// - protected override NetworkSecurityGroup GetResource(CancellationToken cancellation = default) - { - return this; - } - - /// - protected override Task GetResourceAsync(CancellationToken cancellationToken = default) - { - return Task.FromResult(this); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/NetworkSecurityGroupBuilder.cs b/sdk/resourcemanager/Proto.Client/network/NetworkSecurityGroupBuilder.cs deleted file mode 100644 index d4ad595089a6..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/NetworkSecurityGroupBuilder.cs +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing a builder object used to create Azure resources. - /// - public class NetworkSecurityGroupBuilder - { - /// - /// Initializes a new instance of the class. - /// - /// The container object to create the resource in. - /// The resource to create. - public NetworkSecurityGroupBuilder(NetworkSecurityGroupContainer container, NetworkSecurityGroupData resource) - { - Resource = resource; - UnTypedContainer = container; - } - - /// - /// Gets the resource object to create. - /// - protected NetworkSecurityGroupData Resource { get; private set; } - - /// - /// Gets the resource name. - /// - protected string ResourceName { get; private set; } - - /// - /// Gets the container object to create the resource in. - /// - protected NetworkSecurityGroupContainer UnTypedContainer { get; private set; } - - /// - /// Creates the resource object to send to the Azure API. - /// - /// The resource to create. - public NetworkSecurityGroupData Build() - { - ThrowIfNotValid(); - OnBeforeBuild(); - InternalBuild(); - OnAfterBuild(); - - return Resource; - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - /// Name cannot be null or a whitespace. - public Response CreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return UnTypedContainer.CreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this resource. - /// Name cannot be null or a whitespace. - public async Task> CreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await UnTypedContainer.CreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public Operation StartCreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return UnTypedContainer.StartCreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public async Task> StartCreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await UnTypedContainer.StartCreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// Determines whether or not the resource is valid. - /// - /// The message indicating what is wrong with the resource. - /// Whether or not the resource is valid. - protected virtual bool IsValid(out string message) - { - message = string.Empty; - - return true; - } - - /// - /// Perform any tasks necessary after the resource is built - /// - protected virtual void OnAfterBuild() - { - } - - /// - /// Perform any tasks necessary before the resource is built - /// - protected virtual void OnBeforeBuild() - { - } - - private static void InternalBuild() - { - } - - private void ThrowIfNotValid() - { - if (!IsValid(out var message)) - { - throw new InvalidOperationException(message); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/NetworkSecurityGroupContainer.cs b/sdk/resourcemanager/Proto.Client/network/NetworkSecurityGroupContainer.cs deleted file mode 100644 index f17d4e258dab..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/NetworkSecurityGroupContainer.cs +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Network; -using Azure.ResourceManager.Network.Models; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing collection of NetworkSecurityGroup and their operations over a resource group. - /// - public class NetworkSecurityGroupContainer : ResourceContainerBase - { - /// - /// Initializes a new instance of the class. - /// - /// An instance of that has an id for a [Resource]. - internal NetworkSecurityGroupContainer(GenericResourceOperations genericOperations) - : base(genericOperations) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The ResourceGroup that is the parent of the NetworkSecurityGroups. - internal NetworkSecurityGroupContainer(ResourceGroupOperations resourceGroup) - : base(resourceGroup) - { - } - - /// - /// Gets the valid resource type for network security groups. - /// - /// - /// Typed Resource Identifier for the container. - /// - public new ResourceGroupResourceIdentifier Id => base.Id as ResourceGroupResourceIdentifier; - - /// - /// ResourceType for the container. - /// - protected override ResourceType ValidResourceType => ResourceGroupOperations.ResourceType; - - private NetworkSecurityGroupsOperations Operations => new NetworkManagementClient( - Id.SubscriptionId, - BaseUri, - Credential, - ClientOptions.Convert()).NetworkSecurityGroups; - - /// - /// The operation to create or update a network security group. Please note some properties can be set only during creation. - /// - /// The name of the network security group. - /// The desired network security group configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - public Response CreateOrUpdate(string name, NetworkSecurityGroupData resourceDetails, CancellationToken cancellationToken = default) - { - var response = Operations.StartCreateOrUpdate(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - return Response.FromValue(new NetworkSecurityGroup(Parent, new NetworkSecurityGroupData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to create or update a network security group. Please note some properties can be set only during creation. - /// - /// The name of the network security group. - /// The desired network security group configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this network security group. - public async Task> CreateOrUpdateAsync(string name, NetworkSecurityGroupData resourceDetails, CancellationToken cancellationToken = default) - { - var response = await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult().WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetworkSecurityGroup(Parent, new NetworkSecurityGroupData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to create or update a network security group. Please note some properties can be set only during creation. - /// - /// The name of the network security group. - /// The desired network security group configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - public Operation StartCreateOrUpdate(string name, NetworkSecurityGroupData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - Operations.StartCreateOrUpdate(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken), - n => new NetworkSecurityGroup(Parent, new NetworkSecurityGroupData(n))); - } - - /// - /// The operation to create or update a network security group. Please note some properties can be set only during creation. - /// - /// The name of the network security group. - /// The desired network security group configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - public async Task> StartCreateOrUpdateAsync(string name, NetworkSecurityGroupData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails.Model, cancellationToken).ConfigureAwait(false), - n => new NetworkSecurityGroup(Parent, new NetworkSecurityGroupData(n))); - } - - /// - /// Construct an object used to create a network security group. - /// - /// The location to create the network security group. - /// The location to create the network security group. - /// Object used to create a . - public NetworkSecurityGroupBuilder Construct(LocationData locationData = null, params int[] openPorts) - { - var parent = GetParentResource(); - var nsg = new Azure.ResourceManager.Network.Models.NetworkSecurityGroup - { - Location = locationData ?? parent.Data.Location - }; - var index = 0; - foreach(int port in openPorts) - { - var securityRule = new SecurityRule - { - Name = $"Port{port}", - Priority = 1000 + (++index), - Protocol = SecurityRuleProtocol.Tcp, - Access = SecurityRuleAccess.Allow, - Direction = SecurityRuleDirection.Inbound, - SourcePortRange = "*", - SourceAddressPrefix = "*", - DestinationPortRange = $"{port}", - DestinationAddressPrefix = "*", - Description = $"Port_{port}" - }; - nsg.SecurityRules.Add(securityRule); - } - - return new NetworkSecurityGroupBuilder(this, new NetworkSecurityGroupData(nsg)); - } - - /// - /// Construct an object used to create a network security group. - /// - /// The location to create the network security group. - /// Object used to create a . - public NetworkSecurityGroupBuilder Construct(params int[] openPorts) - { - var parent = GetParentResource(); - var nsg = new Azure.ResourceManager.Network.Models.NetworkSecurityGroup - { - Location = parent.Data.Location, - }; - var index = 0; - foreach (int port in openPorts) - { - var securityRule = new SecurityRule - { - Name = $"Port{port}", - Priority = 1000 + (++index), - Protocol = SecurityRuleProtocol.Tcp, - Access = SecurityRuleAccess.Allow, - Direction = SecurityRuleDirection.Inbound, - SourcePortRange = "*", - SourceAddressPrefix = "*", - DestinationPortRange = $"{port}", - DestinationAddressPrefix = "*", - Description = $"Port_{port}" - }; - nsg.SecurityRules.Add(securityRule); - } - - return new NetworkSecurityGroupBuilder(this, new NetworkSecurityGroupData(nsg)); - } - - /// - /// List the network security groups for this network security group. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of that may take multiple service requests to iterate over. - public Pageable List(CancellationToken cancellationToken = default) - { - return new PhWrappingPageable( - Operations.List(Id.Name, cancellationToken), - r => new NetworkSecurityGroup(Parent, new NetworkSecurityGroupData(r))); - } - - /// - /// List the network security groups for this network security group. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of that may take multiple service requests to iterate over. - public AsyncPageable ListAsync(CancellationToken cancellationToken = default) - { - return new PhWrappingAsyncPageable( - Operations.ListAsync(Id.Name, cancellationToken), - r => new NetworkSecurityGroup(Parent, new NetworkSecurityGroupData(r))); - } - - /// - /// Filters the list of network security groups for this resource group represented as generic resources. - /// - /// The substring to filter by. - /// The number of items to truncate by. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of that may take multiple service requests to iterate over. - public Pageable ListAsGenericResource(string nameFilter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(NetworkSecurityGroupOperations.ResourceType); - filters.SubstringFilter = nameFilter; - return ResourceListOperations.ListAtContext(Parent as ResourceGroupOperations, filters, top, cancellationToken); - } - - /// - /// Filters the list of network security groups for this resource group represented as generic resources. - /// - /// The substring to filter by. - /// The number of items to truncate by. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of that may take multiple service requests to iterate over. - public AsyncPageable ListAsGenericResourceAsync(string nameFilter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(NetworkSecurityGroupOperations.ResourceType); - filters.SubstringFilter = nameFilter; - return ResourceListOperations.ListAtContextAsync(Parent as ResourceGroupOperations, filters, top, cancellationToken); - } - - /// - public Response Get(string networkSecurityGroup, CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, networkSecurityGroup, cancellationToken: cancellationToken); - return Response.FromValue(new NetworkSecurityGroup(Parent, new NetworkSecurityGroupData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> GetAsync(string networkSecurityGroup, CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, networkSecurityGroup, null, cancellationToken); - return Response.FromValue(new NetworkSecurityGroup(Parent, new NetworkSecurityGroupData(response.Value)), response.GetRawResponse()); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/NetworkSecurityGroupOperations.cs b/sdk/resourcemanager/Proto.Client/network/NetworkSecurityGroupOperations.cs deleted file mode 100644 index b72e8d4f0c6d..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/NetworkSecurityGroupOperations.cs +++ /dev/null @@ -1,300 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Network; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing the operations that can be performed over a specific NetworkSecurityGroup. - /// - public class NetworkSecurityGroupOperations : ResourceOperationsBase - { - /// - /// Initializes a new instance of the class. - /// - /// An instance of that has an id for a virtual machine. - internal NetworkSecurityGroupOperations(GenericResourceOperations genericOperations) - : base(genericOperations, genericOperations.Id) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The client parameters to use in these operations. - /// The network security group name. - internal NetworkSecurityGroupOperations(ResourceGroupOperations resourceGroup, string nsgName) - : base(resourceGroup, resourceGroup.Id.AppendProviderResource(ResourceType.Namespace, ResourceType.Type, nsgName)) - { - } - - /// - /// 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. - protected NetworkSecurityGroupOperations(ResourceOperationsBase operation, ResourceIdentifier id) - : base(operation, id) - { - } - - /// - protected override ResourceType ValidResourceType => ResourceType; - - /// - /// Gets the resource type definition for a network security group. - /// - public static readonly ResourceType ResourceType = "Microsoft.Network/networkSecurityGroups"; - - private NetworkSecurityGroupsOperations Operations => new NetworkManagementClient( - Id.SubscriptionId, - BaseUri, - Credential, - ClientOptions.Convert()).NetworkSecurityGroups; - - /// - /// Updates the network security group rules. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// The rules to be updated. - /// An that allows polling for completion of the operation. - public Operation UpdateRules(CancellationToken cancellationToken = default, params Azure.ResourceManager.Network.Models.SecurityRule[] rules) - { - var resource = GetResource(); - foreach (var rule in rules) - { - // Note that this makes use of the - var matchingRule = resource.Data.SecurityRules.FirstOrDefault(r => ResourceIdentifier.Equals(r.Id, rule.Id)); - if (matchingRule != null) - { - matchingRule.Access = rule.Access; - matchingRule.Description = rule.Description; - matchingRule.DestinationAddressPrefix = rule.DestinationAddressPrefix; - //matchingRule.DestinationAddressPrefixes = rule.DestinationAddressPrefixes; - matchingRule.DestinationPortRange = rule.DestinationPortRange; - //matchingRule.DestinationPortRanges = rule.DestinationPortRanges; - matchingRule.Direction = rule.Direction; - matchingRule.Priority = rule.Priority; - matchingRule.Protocol = rule.Protocol; - matchingRule.SourceAddressPrefix = rule.SourceAddressPrefix; - //matchingRule.SourceAddressPrefixes = rule.SourceAddressPrefixes; - matchingRule.SourcePortRange = rule.SourcePortRange; - //matchingRule.SourcePortRanges = rule.SourcePortRanges; - } - else - { - resource.Data.SecurityRules.Add(rule); - } - } - - return new PhArmOperation( - Operations.StartCreateOrUpdate(Id.ResourceGroupName, Id.Name, resource.Data), - n => new NetworkSecurityGroup(this, new NetworkSecurityGroupData(n))); - } - - /// - public override Response Get(CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Response.FromValue(new NetworkSecurityGroup(this, new NetworkSecurityGroupData(response.Value)), response.GetRawResponse()); - } - - /// - public override async Task> GetAsync(CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetworkSecurityGroup(this, new NetworkSecurityGroupData(response.Value)), response.GetRawResponse()); - } - - /// - public Response AddTag(string key, string value, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - var response = Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken); - return Response.FromValue(new NetworkSecurityGroup(this, new NetworkSecurityGroupData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - var response = await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetworkSecurityGroup(this, new NetworkSecurityGroupData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartAddTag(string key, string value, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - return new PhArmOperation( - Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new NetworkSecurityGroup(this, new NetworkSecurityGroupData(n))); - } - - /// - public async Task> StartAddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - return new PhArmOperation( - await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new NetworkSecurityGroup(this, new NetworkSecurityGroupData(n))); - } - - /// - public Response Delete(CancellationToken cancellationToken = default) - { - return Operations.StartDelete(Id.ResourceGroupName, Id.Name, cancellationToken) - .WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - public async Task DeleteAsync(CancellationToken cancellationToken = default) - { - return (await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken)) - .WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - public Operation StartDelete(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(Operations.StartDelete(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - public async Task StartDeleteAsync(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - protected override NetworkSecurityGroup GetResource(CancellationToken cancellationToken = default) - { - return Get().Value; - } - - /// - public Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - var response = Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken); - return Response.FromValue(new NetworkSecurityGroup(this, new NetworkSecurityGroupData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - var response = await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetworkSecurityGroup(this, new NetworkSecurityGroupData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartSetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - return new PhArmOperation( - Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new NetworkSecurityGroup(this, new NetworkSecurityGroupData(n))); - } - - /// - public async Task> StartSetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - return new PhArmOperation( - await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new NetworkSecurityGroup(this, new NetworkSecurityGroupData(n))); - } - - /// - public Response RemoveTag(string key, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - var response = Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken); - return Response.FromValue(new NetworkSecurityGroup(this, new NetworkSecurityGroupData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - var response = await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetworkSecurityGroup(this, new NetworkSecurityGroupData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartRemoveTag(string key, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - return new PhArmOperation( - Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new NetworkSecurityGroup(this, new NetworkSecurityGroupData(n))); - } - - /// - public async Task> StartRemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - return new PhArmOperation( - await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new NetworkSecurityGroup(this, new NetworkSecurityGroupData(n))); - } - - /// - /// Lists all available geo-locations. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of location that may take multiple service requests to iterate over. - public IEnumerable ListAvailableLocations(CancellationToken cancellationToken = default) - { - return ListAvailableLocations(ResourceType, cancellationToken); - } - - /// - /// Lists all available geo-locations. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of location that may take multiple service requests to iterate over. - /// The default subscription id is null. - public async Task> ListAvailableLocationsAsync(CancellationToken cancellationToken = default) - { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/Placeholder/LoadBalancerData.cs b/sdk/resourcemanager/Proto.Client/network/Placeholder/LoadBalancerData.cs deleted file mode 100644 index 8b0850825ffb..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Placeholder/LoadBalancerData.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Core; -using System.Collections.Generic; - -namespace Proto.Network -{ - /// - /// A class representing the LoadBalancer data model. - /// - public class LoadBalancerData : Resource - { - /// - /// Initializes a new instance of the class. - /// - public LoadBalancerData(Azure.ResourceManager.Network.Models.LoadBalancer loadBalancer) - : base(loadBalancer.Id, loadBalancer.Name, LoadBalancerOperations.ResourceType) - { - Model = loadBalancer; - } - - /// - /// Gets or sets the Model this resource is based of. - /// - public virtual Azure.ResourceManager.Network.Models.LoadBalancer Model { get; } - - /// - /// Gets the LoadBalancer id. - /// - public override string Name => Model.Name; - - /// - /// The provisioning state of the LoadBalancer resource. - /// - public ProvisioningState? ProvisioningState => Model.ProvisioningState; - - /// The load balancer SKU. - public LoadBalancerSku Sku - { - get => Model.Sku; - set => Model.Sku = value; - } - - /// A unique read-only string that changes whenever the resource is updated. - public string Etag => Model.Etag; - - /// Object representing the frontend IPs to be used for the load balancer. - public IList FrontendIPConfigurations => Model.FrontendIPConfigurations; - - /// Collection of backend address pools used by a load balancer. - public IList BackendAddressPools => Model.BackendAddressPools; - - /// Object collection representing the load balancing rules Gets the provisioning. - public IList LoadBalancingRules => Model.LoadBalancingRules; - - /// Collection of probe objects used in the load balancer. - public IList Probes => Model.Probes; - - /// Collection of inbound NAT Rules used by a load balancer. Defining inbound NAT rules on your load balancer is mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are referenced from virtual machine scale sets. NICs that are associated with individual virtual machines cannot reference an Inbound NAT pool. They have to reference individual inbound NAT rules. - public IList InboundNatRules => Model.InboundNatRules; - - /// Defines an external port range for inbound NAT to a single backend port on NICs associated with a load balancer. Inbound NAT rules are created automatically for each NIC associated with the Load Balancer using an external port from this range. Defining an Inbound NAT pool on your Load Balancer is mutually exclusive with defining inbound Nat rules. Inbound NAT pools are referenced from virtual machine scale sets. NICs that are associated with individual virtual machines cannot reference an inbound NAT pool. They have to reference individual inbound NAT rules. - public IList InboundNatPools => Model.InboundNatPools; - - /// The outbound rules. - public IList OutboundRules => Model.OutboundRules; - - /// The resource GUID property of the load balancer resource. - public string ResourceGuid => Model.ResourceGuid; - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/Placeholder/NetworkInterfaceData.cs b/sdk/resourcemanager/Proto.Client/network/Placeholder/NetworkInterfaceData.cs deleted file mode 100644 index ceb358880270..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Placeholder/NetworkInterfaceData.cs +++ /dev/null @@ -1,126 +0,0 @@ -using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Core; -using System; -using System.Collections.Generic; -using Azure.ResourceManager.Core.Adapters; - -namespace Proto.Network -{ - /// - /// A network interface in a resource group. - /// - public class NetworkInterfaceData : TrackedResource - { - /// - /// The ARM resource type for this . - /// - public static ResourceType ResourceType => "Microsoft.Network/networkInterfaces"; - - /// - /// Initializes a new instance of the class. - /// - /// The low level network interace model. - public NetworkInterfaceData(Azure.ResourceManager.Network.Models.NetworkInterface nic) : base(nic.Id, nic.Location, nic) - { - } - - /// - /// Gets the resource tags. - /// - public override IDictionary Tags => Model.Tags; - - /// - /// Gets the resource name. - /// - public override string Name => Model.Name; - - /// - /// Gets a unique read-only string that changes whenever the resource is updated. - /// - public string Etag => Model.Etag; - - /// - /// Gets the reference to a linked virtual machine. - /// - public Azure.ResourceManager.Network.Models.SubResource VirtualMachine => Model.VirtualMachine; - - /// - /// Gets the reference to the linked NetworkSecurityGroup resource. - /// - public Azure.ResourceManager.Network.Models.NetworkSecurityGroup NetworkSecurityGroup - { - get => Model.NetworkSecurityGroup; - set => Model.NetworkSecurityGroup = value; - } - - /// - /// Gets a reference to the private endpoint to which the network interface is linked. - /// - public PrivateEndpoint PrivateEndpoint => Model.PrivateEndpoint; - - /// - /// Gets or sets a list of IPConfigurations of the network interface. - /// - public IList IpConfigurations - { - get => Model.IpConfigurations; - } - - /// - /// Gets a list of TapConfigurations of the newtork interface. - /// - public IReadOnlyList TapConfigurations => Model.TapConfigurations; - - /// - /// Gets or sets the DNS settings in network interface. - /// - public NetworkInterfaceDnsSettings DnsSettings - { - get => Model.DnsSettings; - set => Model.DnsSettings = value; - } - - /// - /// Gets the MAC address of the network interface. - /// - public string MacAddress => Model.MacAddress; - - /// - /// Gets a value indicating whether this is a primary network interface on a virtual machine. - /// - public bool? Primary => Model.Primary; - - /// - /// Gets or sets a value determining if the network interface is accelerated networking enabled. - /// - public bool? EnableAcceleratedNetworking - { - get => Model.EnableAcceleratedNetworking; - set => Model.EnableAcceleratedNetworking = value; - } - - /// - /// Gets or sets a value Indicating whether IP forwarding is enabled on this network interface. - /// - public bool? EnableIPForwarding - { - get => Model.EnableIPForwarding; - set => Model.EnableIPForwarding = value; - } - - /// - /// Gets a list of references to linked BareMetal resources. - /// - public IReadOnlyList HostedWorkloads => Model.HostedWorkloads; - - /// - /// Gets the resource GUID property of the network interface resource. - /// - public string ResourceGuid => Model.ResourceGuid; - - /// - /// Gets the provisioning state of the network interface resource. - /// - public ProvisioningState? ProvisioningState => Model.ProvisioningState; - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/Placeholder/NetworkSecurityGroupData.cs b/sdk/resourcemanager/Proto.Client/network/Placeholder/NetworkSecurityGroupData.cs deleted file mode 100644 index 49a4e67436de..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Placeholder/NetworkSecurityGroupData.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Core.Adapters; -using Azure.ResourceManager.Network.Models; -using System.Collections.Generic; - -namespace Proto.Network -{ - /// - /// A class representing the NetworkSecurityGroup data model. - /// - public class NetworkSecurityGroupData : - TrackedResource - { - /// - /// Initializes a new instance of the class. - /// - /// The network security group to initialize. - public NetworkSecurityGroupData(Azure.ResourceManager.Network.Models.NetworkSecurityGroup nsg) - : base(nsg.Id, nsg.Location, nsg) - { - } - - /// Resource tags. - public override IDictionary Tags => Model.Tags; - - /// The name property of the network security group resource. - public override string Name => Model.Name; - - /// A unique read-only string that changes whenever the resource is updated. - public string Etag => Model.Etag; - - /// A collection of security rules of the network security group. - public IList SecurityRules - { - get => Model.SecurityRules; - } - - /// The default security rules of network security group. - public IReadOnlyList DefaultSecurityRules => Model.DefaultSecurityRules; - - /// A collection of references to network interfaces. - public IReadOnlyList NetworkInterfaces => Model.NetworkInterfaces; - - /// A collection of references to subnets. - public IReadOnlyList Subnets => Model.Subnets; - - /// A collection of references to flow log resources. - - public IReadOnlyList FlowLogs => Model.FlowLogs; - - /// The resource GUID property of the network security group resource. - public string ResourceGuid => Model.ResourceGuid; - - /// The provisioning state of the network security group resource. - public ProvisioningState? ProvisioningState => Model.ProvisioningState; - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/Placeholder/PhArmOperation.cs b/sdk/resourcemanager/Proto.Client/network/Placeholder/PhArmOperation.cs deleted file mode 100644 index 401d363632fa..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Placeholder/PhArmOperation.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.ResourceManager.Core; - -namespace Proto.Network -{ - /// - /// A class representing an arm operation wrapper object. - /// - /// The to convert TModel into. - /// The model returned by existing Operation methods. - public class PhArmOperation : Operation - where TOperations : class - where TModel : class - { - private readonly Func _converter; - private readonly Operation _wrappedOperation; - private readonly Operation _wrappedResponseOperation; - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - public PhArmOperation(Operation wrapped, Func converter) - { - if (wrapped is null) - { - throw new ArgumentNullException(nameof(wrapped)); - } - - if (converter is null) - { - throw new ArgumentNullException(nameof(converter)); - } - - _wrappedOperation = wrapped; - _converter = converter; - } - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - /// The function used to convert from existing type to new type. - public PhArmOperation(Response wrapped, Func converter) - { - if (wrapped is null) - { - throw new ArgumentNullException(nameof(wrapped)); - } - - if (converter is null) - { - throw new ArgumentNullException(nameof(converter)); - } - - _wrappedResponseOperation = new PhValueArmOperation(wrapped); - _converter = converter; - } - - /// - /// Initializes a new instance of the class for mocking. - /// - protected PhArmOperation() - { - } - - /// - public override string Id => _wrappedOperation?.Id; - - /// - public override TOperations Value => _converter(_doesWrapOperation ? _wrappedOperation.Value : _wrappedResponseOperation.Value); - - /// - public override bool HasCompleted => _doesWrapOperation ? _wrappedOperation.HasCompleted : _wrappedResponseOperation.HasCompleted; - - /// - public override bool HasValue => _doesWrapOperation ? _wrappedOperation.HasValue : _wrappedResponseOperation.HasValue; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "")] - private bool _doesWrapOperation => _wrappedResponseOperation is null; - - /// - public override Response GetRawResponse() - { - return _doesWrapOperation ? _wrappedOperation.GetRawResponse() : _wrappedResponseOperation.GetRawResponse(); - } - - /// - public override Response UpdateStatus(CancellationToken cancellationToken = default) - { - return _doesWrapOperation ? _wrappedOperation.UpdateStatus(cancellationToken) : _wrappedResponseOperation.UpdateStatus(cancellationToken); - } - - /// - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) - { - return _doesWrapOperation - ? _wrappedOperation.UpdateStatusAsync(cancellationToken) - : _wrappedResponseOperation.UpdateStatusAsync(cancellationToken); - } - - /// - public override async ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) - { - var task = WaitForCompletionAsync(OperationInternals.DefaultPollingInterval, cancellationToken); - return await task.ConfigureAwait(false); - } - - /// - public override async ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) - { - var value = _doesWrapOperation - ? await _wrappedOperation.WaitForCompletionAsync(pollingInterval, cancellationToken).ConfigureAwait(false) - : await _wrappedResponseOperation.WaitForCompletionAsync(pollingInterval, cancellationToken).ConfigureAwait(false); - return Response.FromValue(_converter(value.Value), GetRawResponse()); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/Placeholder/PhValueArmOperation.cs b/sdk/resourcemanager/Proto.Client/network/Placeholder/PhValueArmOperation.cs deleted file mode 100644 index 9919064b70b1..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Placeholder/PhValueArmOperation.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; - -namespace Proto.Network -{ - /// - /// A class representing an arm operation wrapper object. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1618:Generic type parameters should be documented", Justification = "")] - internal class PhValueArmOperation : Operation - where TOperations : class - { - private readonly Operation _wrappedOperation; - private readonly OperationOrResponseInternals _wrappedResponseOperation; - - /// - /// Initializes a new instance of the class for mocking. - /// - protected PhValueArmOperation() - { - } - - /// - /// Initializes a new instance of the . - /// - /// The operation object to wrap. - public PhValueArmOperation(Operation wrapped) - { - if (wrapped is null) - throw new ArgumentNullException(nameof(wrapped)); - - _wrappedOperation = wrapped; - } - - /// - /// Initializes a new instance of the . - /// - /// The response object to wrap. - public PhValueArmOperation(Response wrapped) - { - if (wrapped is null) - throw new ArgumentNullException(nameof(wrapped)); - - _wrappedResponseOperation = new OperationOrResponseInternals(wrapped); - } - - private bool _doesWrapOperation => _wrappedResponseOperation is null; - - public override TOperations Value => _doesWrapOperation ? _wrappedOperation.Value : _wrappedResponseOperation.Value; - - public override bool HasValue => _doesWrapOperation ? _wrappedOperation.HasValue : _wrappedResponseOperation.HasValue; - - public override string Id => _wrappedOperation?.Id; - - public override bool HasCompleted => _doesWrapOperation ? _wrappedOperation.HasCompleted : _wrappedResponseOperation.HasCompleted; - - public override Response GetRawResponse() => _doesWrapOperation? _wrappedOperation.GetRawResponse() : _wrappedResponseOperation.GetRawResponse(); - - public override Response UpdateStatus(CancellationToken cancellationToken = default) => _doesWrapOperation ? _wrappedOperation.UpdateStatus(cancellationToken) : _wrappedResponseOperation.UpdateStatus(cancellationToken); - - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _doesWrapOperation ? _wrappedOperation.UpdateStatusAsync(cancellationToken) : _wrappedResponseOperation.UpdateStatusAsync(cancellationToken); - - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _doesWrapOperation ? _wrappedOperation.WaitForCompletionAsync(cancellationToken) : _wrappedResponseOperation.WaitForCompletionAsync(cancellationToken); - - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) => _doesWrapOperation ? _wrappedOperation.WaitForCompletionAsync(pollingInterval, cancellationToken) : _wrappedResponseOperation.WaitForCompletionAsync(pollingInterval, cancellationToken); - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/Placeholder/PhVoidArmOperation.cs b/sdk/resourcemanager/Proto.Client/network/Placeholder/PhVoidArmOperation.cs deleted file mode 100644 index 039792bd298d..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Placeholder/PhVoidArmOperation.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; - -namespace Proto.Network -{ - /// - /// A class representing an arm operation wrapper object. - /// - public class PhVoidArmOperation : Operation - { - private readonly Operation _wrappedOperation; - private readonly OperationOrResponseInternals _wrappedResponseOperation; - - /// - /// Initializes a new instance of the class for mocking. - /// - protected PhVoidArmOperation() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - public PhVoidArmOperation(Operation wrapped) - { - if (wrapped is null) - throw new ArgumentNullException(nameof(wrapped)); - - _wrappedOperation = wrapped; - } - - /// - /// Initializes a new instance of the class. - /// - /// The results to wrap. - public PhVoidArmOperation(Response wrapped) - { - if (wrapped is null) - throw new ArgumentNullException(nameof(wrapped)); - - _wrappedResponseOperation = new OperationOrResponseInternals(wrapped); - } - - private bool _doesWrapOperation => _wrappedResponseOperation is null; - - /// - public override string Id => _wrappedOperation?.Id; - - /// - public override bool HasCompleted => _doesWrapOperation ? _wrappedOperation.HasCompleted : _wrappedResponseOperation.HasCompleted; - - /// - public override Response GetRawResponse() => _doesWrapOperation ? _wrappedOperation.GetRawResponse() : _wrappedResponseOperation.GetRawResponse(); - - /// - public override Response UpdateStatus(CancellationToken cancellationToken = default) => - _doesWrapOperation - ? _wrappedOperation.UpdateStatus(cancellationToken) - : _wrappedResponseOperation.UpdateStatus(cancellationToken); - - /// - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => - _doesWrapOperation - ? _wrappedOperation.UpdateStatusAsync(cancellationToken) - : _wrappedResponseOperation.UpdateStatusAsync(cancellationToken); - - /// - public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => - WaitForCompletionResponseAsync(OperationInternals.DefaultPollingInterval, cancellationToken); - - /// - public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) => - _doesWrapOperation - ? _wrappedOperation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken) - : _wrappedResponseOperation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/Placeholder/PublicIPAddressData.cs b/sdk/resourcemanager/Proto.Client/network/Placeholder/PublicIPAddressData.cs deleted file mode 100644 index 9e4fced6571d..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Placeholder/PublicIPAddressData.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Core; -using System; -using System.Collections.Generic; -using Azure.ResourceManager.Core.Adapters; - -namespace Proto.Network -{ - /// - /// A class representing the public IP address data model. - /// - public class PublicIPAddressData : TrackedResource - { - /// - /// Gets the resource type definition for a public IP address. - /// - public static ResourceType ResourceType => "Microsoft.Network/publicIpAddresses"; - - /// - /// Initializes a new instance of the class. - /// - /// The public IP address to initialize. - public PublicIPAddressData(PublicIPAddress ip) : base(ip.Id, ip.Location, ip) - { - } - - /// Resource tags. - public override IDictionary Tags => Model.Tags; - - /// The name property of the network security group resource. - public override string Name => Model.Name; - - /// The public IP address SKU. - public PublicIPAddressSku Sku - { - get => Model.Sku; - set => Model.Sku = value; - } - - /// A unique read-only string that changes whenever the resource is updated. - public string Etag => Model.Etag; - - /// A list of availability zones denoting the IP allocated for the resource needs to come from. - public IList Zones - { - get => Model.Zones; - } - - /// The public IP address allocation method. - public IPAllocationMethod? PublicIPAllocationMethod - { - get => Model.PublicIPAllocationMethod; - set => Model.PublicIPAllocationMethod = value; - } - - /// The public IP address version. - public IPVersion? PublicIPAddressVersion - { - get => Model.PublicIPAddressVersion; - set => Model.PublicIPAddressVersion = value; - } - - /// The IP configuration associated with the public IP address. - public IPConfiguration IpConfiguration => Model.IpConfiguration; - - /// The FQDN of the DNS record associated with the public IP address. - public PublicIPAddressDnsSettings DnsSettings - { - get => Model.DnsSettings; - set => Model.DnsSettings = value; - } - - /// The DDoS protection custom policy associated with the public IP address. - public DdosSettings DdosSettings - { - get => Model.DdosSettings; - set => Model.DdosSettings = value; - } - - /// The list of tags associated with the public IP address. - public IList IpTags - { - get => Model.IpTags; - } - - /// The IP address associated with the public IP address resource. - public string IpAddress - { - get => Model.IpAddress; - set => Model.IpAddress = value; - } - - /// The Public IP Prefix this Public IP Address should be allocated from. - public Azure.ResourceManager.Network.Models.SubResource PublicIPPrefix - { - get => Model.PublicIPPrefix; - set => Model.PublicIPPrefix = value; - } - - /// The idle timeout of the public IP address. - public int? IdleTimeoutInMinutes - { - get => Model.IdleTimeoutInMinutes; - set => Model.IdleTimeoutInMinutes = value; - } - - /// The resource GUID property of the public IP address resource. - public string ResourceGuid => Model.ResourceGuid; - - /// The provisioning state of the public IP address resource. - public ProvisioningState? ProvisioningState => Model.ProvisioningState; - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/Placeholder/SubnetData.cs b/sdk/resourcemanager/Proto.Client/network/Placeholder/SubnetData.cs deleted file mode 100644 index 48ef7dd88b3f..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Placeholder/SubnetData.cs +++ /dev/null @@ -1,131 +0,0 @@ -using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Core; -using System.Collections.Generic; - -namespace Proto.Network -{ - /// - /// A class representing the subnet data model. - /// - public class SubnetData : Resource - { - /// - /// Initializes a new instance of the class. - /// - public SubnetData(Azure.ResourceManager.Network.Models.Subnet sub) - : base(sub.Id, sub.Name, SubnetOperations.ResourceType) - { - Model = sub; - } - - /// - /// Gets or sets the Model this resource is based of. - /// - public virtual Azure.ResourceManager.Network.Models.Subnet Model { get; } - - /// - /// Gets the subnet id. - /// - public override string Name => Model.Name; - - /// - /// The provisioning state of the subnet resource. - /// - public ProvisioningState? ProvisioningState => Model.ProvisioningState; - - /// - /// A read-only string identifying the intention use for this subnet based on delegations and other user-defined properties. - /// - public string Purpose => Model.Purpose; - - /// An array of references to the delegations on the subnet. - public IList Delegations - { - get => Model.Delegations; - } - - /// An array of references to services injecting into this subnet. - public IReadOnlyList ServiceAssociationLinks => Model.ServiceAssociationLinks; - - /// An array of references to the external resources using subnet. - public IReadOnlyList ResourceNavigationLinks => Model.ResourceNavigationLinks; - - /// Array of IpAllocation which reference this subnet. - public IList IpAllocations - { - get => Model.IpAllocations; - } - - /// Array of IP configuration profiles which reference this subnet. - public IReadOnlyList IpConfigurationProfiles => Model.IpConfigurationProfiles; - - /// An array of references to the network interface IP configurations using subnet. - public IReadOnlyList IpConfigurations => Model.IpConfigurations; - - /// Enable or Disable apply network policies on private end point in the subnet. - public string PrivateEndpointNetworkPolicies - { - get => Model.PrivateEndpointNetworkPolicies; - set => Model.PrivateEndpointNetworkPolicies = value; - } - - /// An array of references to private endpoints. - public IReadOnlyList PrivateEndpoints => Model.PrivateEndpoints; - - /// An array of service endpoints. - public IList ServiceEndpoints - { - get => Model.ServiceEndpoints; - } - - /// Nat gateway associated with this subnet. - public Azure.ResourceManager.Network.Models.SubResource NatGateway - { - get => Model.NatGateway; - set => Model.NatGateway = value; - } - - /// The reference to the RouteTable resource. - public RouteTable RouteTable - { - get => Model.RouteTable; - set => Model.RouteTable = value; - } - - /// The reference to the NetworkSecurityGroup resource. - public Azure.ResourceManager.Network.Models.NetworkSecurityGroup NetworkSecurityGroup - { - get => Model.NetworkSecurityGroup; - set => Model.NetworkSecurityGroup = value; - } - - /// List of address prefixes for the subnet. - public IList AddressPrefixes - { - get => Model.AddressPrefixes; - } - - /// The address prefix for the subnet. - public string AddressPrefix - { - get => Model.AddressPrefix; - set => Model.AddressPrefix = value; - } - - /// A unique read-only string that changes whenever the resource is updated. - public string Etag => Model.Etag; - - /// An array of service endpoint policies. - public IList ServiceEndpointPolicies - { - get => Model.ServiceEndpointPolicies; - } - - /// Enable or Disable apply network policies on private link service in the subnet. - public string PrivateLinkServiceNetworkPolicies - { - get => Model.PrivateLinkServiceNetworkPolicies; - set => Model.PrivateLinkServiceNetworkPolicies = value; - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/Placeholder/VirtualNetworkData.cs b/sdk/resourcemanager/Proto.Client/network/Placeholder/VirtualNetworkData.cs deleted file mode 100644 index 20a724fb3dc3..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Placeholder/VirtualNetworkData.cs +++ /dev/null @@ -1,103 +0,0 @@ -using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Core; -using System; -using System.Collections.Generic; -using Azure.ResourceManager.Core.Adapters; - -namespace Proto.Network -{ - /// - /// A class representing the virtual nerwork data model. - /// - public class VirtualNetworkData : TrackedResource - { - /// - /// Gets the resource type definition for a virtual nerwork. - /// - public static ResourceType ResourceType => "Microsoft.Network/virtualNetworks"; - - /// - /// Initializes a new instance of the class. - /// - /// The virtual nerwork to initialize. - public VirtualNetworkData(Azure.ResourceManager.Network.Models.VirtualNetwork vnet) : base(vnet.Id, vnet.Location, vnet) - { - } - - /// - public override IDictionary Tags => Model.Tags; - - /// - public override string Name => Model.Name; - - /// A unique read-only string that changes whenever the resource is updated. - public string Etag => Model.Etag; - - /// The AddressSpace that contains an array of IP address ranges that can be used by subnets. - public AddressSpace AddressSpace - { - get => Model.AddressSpace; - set => Model.AddressSpace = value; - } - - /// The dhcpOptions that contains an array of DNS servers available to VMs deployed in the virtual network. - public DhcpOptions DhcpOptions - { - get => Model.DhcpOptions; - set => Model.DhcpOptions = value; - } - - /// A list of subnet in a Virtual Network. - public IList Subnets - { - get => Model.Subnets; - } - - /// A list of peering in a Virtual Network. - public IList VirtualNetworkPeerings - { - get => Model.VirtualNetworkPeerings; - } - - /// The resourceGuid property of the Virtual Network resource. - public string ResourceGuid => Model.ResourceGuid; - - /// The provisioning state of the virtual network resource. - public ProvisioningState? ProvisioningState => Model.ProvisioningState; - - /// Indicates if DDoS protection is enabled for all the protected resources in the virtual network. It requires a DDoS protection plan associated with the resource. - public bool? EnableDdosProtection - { - get => Model.EnableDdosProtection; - set => Model.EnableDdosProtection = value; - } - - /// Indicates if VM protection is enabled for all the subnets in the virtual network. - public bool? EnableVmProtection - { - get => Model.EnableVmProtection; - set => Model.EnableVmProtection = value; - } - - /// The DDoS protection plan associated with the virtual network. - public Azure.ResourceManager.Network.Models.SubResource DdosProtectionPlan - - { - get => Model.DdosProtectionPlan; - set => Model.DdosProtectionPlan = value; - } - - /// Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET. - public VirtualNetworkBgpCommunities BgpCommunities - { - get => Model.BgpCommunities; - set => Model.BgpCommunities = value; - } - - /// Array of IpAllocation which reference this VNET. - public IList IpAllocations - { - get => Model.IpAllocations; - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/Proto.Network.csproj b/sdk/resourcemanager/Proto.Client/network/Proto.Network.csproj deleted file mode 100644 index 626a81eed251..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Proto.Network.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - 1.0.0-beta.1 - netstandard2.0 - Proto.Network - latest - false - true - - - - C:\Git\azure-proto-sdk\azure-proto-network\obj\azure-proto-network.xml - - - - - - - - - - - - diff --git a/sdk/resourcemanager/Proto.Client/network/PublicIpAddress.cs b/sdk/resourcemanager/Proto.Client/network/PublicIpAddress.cs deleted file mode 100644 index 40bae46b8af1..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/PublicIpAddress.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using Azure.ResourceManager.Core; - -namespace Proto.Network -{ - /// - /// Class representing a PublicIpAddress resource along with the instance operations that can be performed on it. - /// - public class PublicIpAddress : PublicIpAddressOperations - { - /// - /// Initializes a new instance of the class. - /// - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal PublicIpAddress(ResourceOperationsBase options, PublicIPAddressData resource) - : base(options, resource.Id) - { - Data = resource; - } - - /// - /// Gets the data representing this PublicIPAddress. - /// - public PublicIPAddressData Data { get; private set; } - - /// - protected override PublicIpAddress GetResource(CancellationToken cancellation = default) - { - return this; - } - - /// - protected override Task GetResourceAsync(CancellationToken cancellationToken = default) - { - return Task.FromResult(this); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/PublicIpAddressBuilder.cs b/sdk/resourcemanager/Proto.Client/network/PublicIpAddressBuilder.cs deleted file mode 100644 index aa0871dd7e0a..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/PublicIpAddressBuilder.cs +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing a builder object used to create Azure resources. - /// - public class PublicIpAddressBuilder - { - /// - /// Initializes a new instance of the class. - /// - /// The container object to create the resource in. - /// The resource to create. - public PublicIpAddressBuilder(PublicIpAddressContainer container, PublicIPAddressData resource) - { - Resource = resource; - UnTypedContainer = container; - } - - /// - /// Gets the resource object to create. - /// - protected PublicIPAddressData Resource { get; private set; } - - /// - /// Gets the resource name. - /// - protected string ResourceName { get; private set; } - - /// - /// Gets the container object to create the resource in. - /// - protected PublicIpAddressContainer UnTypedContainer { get; private set; } - - /// - /// Creates the resource object to send to the Azure API. - /// - /// The resource to create. - public PublicIPAddressData Build() - { - ThrowIfNotValid(); - OnBeforeBuild(); - InternalBuild(); - OnAfterBuild(); - - return Resource; - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - /// Name cannot be null or a whitespace. - public Response CreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return UnTypedContainer.CreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this resource. - /// Name cannot be null or a whitespace. - public async Task> CreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await UnTypedContainer.CreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public Operation StartCreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return UnTypedContainer.StartCreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public async Task> StartCreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await UnTypedContainer.StartCreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// Determines whether or not the resource is valid. - /// - /// The message indicating what is wrong with the resource. - /// Whether or not the resource is valid. - protected virtual bool IsValid(out string message) - { - message = string.Empty; - - return true; - } - - /// - /// Perform any tasks necessary after the resource is built - /// - protected virtual void OnAfterBuild() - { - } - - /// - /// Perform any tasks necessary before the resource is built - /// - protected virtual void OnBeforeBuild() - { - } - - private static void InternalBuild() - { - } - - private void ThrowIfNotValid() - { - if (!IsValid(out var message)) - { - throw new InvalidOperationException(message); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/PublicIpAddressContainer.cs b/sdk/resourcemanager/Proto.Client/network/PublicIpAddressContainer.cs deleted file mode 100644 index 5879fcf05781..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/PublicIpAddressContainer.cs +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Network; -using Azure.ResourceManager.Network.Models; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing collection of PublicIpAddress and their operations over a resource group. - /// - public class PublicIpAddressContainer : ResourceContainerBase - { - /// - /// Initializes a new instance of the class. - /// - /// The client parameters to use in these operations. - internal PublicIpAddressContainer(ResourceGroupOperations resourceGroup) - : base(resourceGroup) - { - } - - /// - /// Typed Resource Identifier for the container. - /// - public new ResourceGroupResourceIdentifier Id => base.Id as ResourceGroupResourceIdentifier; - - /// - /// Gets the valid resource type for this resource. - /// - protected override ResourceType ValidResourceType => ResourceGroupOperations.ResourceType; - - private PublicIPAddressesOperations Operations => new NetworkManagementClient( - Id.SubscriptionId, - BaseUri, - Credential, - ClientOptions.Convert()).PublicIPAddresses; - - /// - /// The operation to create or update a public IP address. Please note some properties can be set only during creation. - /// - /// The name of the public IP address. - /// The desired public IP address configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - /// Name of the public IP address cannot be null or a whitespace. - /// resourceDetails cannot be null. - public Response CreateOrUpdate(string name, PublicIPAddressData resourceDetails, CancellationToken cancellationToken = default) - { - var response = Operations.StartCreateOrUpdate(Id.ResourceGroupName, name, resourceDetails, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - return Response.FromValue(new PublicIpAddress(Parent, new PublicIPAddressData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to create or update a public IP address. Please note some properties can be set only during creation. - /// - /// The name of the public IP address. - /// The desired public IP address configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this public IP address. - /// Name of the public IP address cannot be null or a whitespace. - /// resourceDetails cannot be null. - public async Task> CreateOrUpdateAsync(string name, PublicIPAddressData resourceDetails, CancellationToken cancellationToken = default) - { - var response = await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails, cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult().WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return Response.FromValue(new PublicIpAddress(Parent, new PublicIPAddressData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to create or update a public IP address. Please note some properties can be set only during creation. - /// - /// The name of the public IP address. - /// The desired public IP address configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name of the public IP address cannot be null or a whitespace. - /// resourceDetails cannot be null. - public Operation StartCreateOrUpdate(string name, PublicIPAddressData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - Operations.StartCreateOrUpdate(Id.ResourceGroupName, name, resourceDetails, cancellationToken), - n => new PublicIpAddress(Parent, new PublicIPAddressData(n))); - } - - /// - /// The operation to create or update a public IP address. Please note some properties can be set only during creation. - /// - /// The name of the public IP address. - /// The desired public IP address configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name of the public IP address cannot be null or a whitespace. - /// resourceDetails cannot be null. - public async Task> StartCreateOrUpdateAsync(string name, PublicIPAddressData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails, cancellationToken).ConfigureAwait(false), - n => new PublicIpAddress(Parent, new PublicIPAddressData(n))); - } - - /// - /// Construct an object used to create a public IP address. - /// - /// The location to create the network security group. - /// Object used to create a . - public PublicIpAddressBuilder Construct(LocationData location = null) - { - var parent = GetParentResource(); - var ipAddress = new PublicIPAddress() - { - PublicIPAddressVersion = IPVersion.IPv4.ToString(), - PublicIPAllocationMethod = IPAllocationMethod.Dynamic, - Location = location ?? parent.Data.Location, - }; - - return new PublicIpAddressBuilder(this, new PublicIPAddressData(ipAddress)); - } - - /// - /// List the public IP addresses for this resource group. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of that may take multiple service requests to iterate over. - public Pageable List(CancellationToken cancellationToken = default) - { - return new PhWrappingPageable( - Operations.List(Id.Name, cancellationToken), - Convertor()); - } - - /// - /// List the public IP addresses for this resource group. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of that may take multiple service requests to iterate over. - public AsyncPageable ListAsync(CancellationToken cancellationToken = default) - { - return new PhWrappingAsyncPageable( - Operations.ListAsync(Id.Name, cancellationToken), - Convertor()); - } - - /// - /// Filters the list of public IP addresses for this resource group represented as generic resources. - /// - /// The substring to filter by. - /// The number of items to truncate by. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of that may take multiple service requests to iterate over. - public Pageable ListAsGenericResource(string nameFilter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(PublicIPAddressData.ResourceType); - filters.SubstringFilter = nameFilter; - return ResourceListOperations.ListAtContext(Parent as ResourceGroupOperations, filters, top, cancellationToken); - } - - /// - /// Filters the list of public IP addresses for this resource group represented as generic resources. - /// - /// The substring to filter by. - /// The number of items to truncate by. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of that may take multiple service requests to iterate over. - public AsyncPageable ListAsGenericResourceAsync(string nameFilter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(PublicIPAddressData.ResourceType); - filters.SubstringFilter = nameFilter; - return ResourceListOperations.ListAtContextAsync(Parent as ResourceGroupOperations, filters, top, cancellationToken); - } - - private Func Convertor() - { - return s => new PublicIpAddress(Parent, new PublicIPAddressData(s)); - } - /// - public Response Get(string publicIpAddressesName, CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, publicIpAddressesName, cancellationToken: cancellationToken); - return Response.FromValue(new PublicIpAddress(Parent, new PublicIPAddressData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> GetAsync(string publicIpAddressesName, CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, publicIpAddressesName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(new PublicIpAddress(Parent, new PublicIPAddressData(response.Value)), response.GetRawResponse()); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/PublicIpAddressOperations.cs b/sdk/resourcemanager/Proto.Client/network/PublicIpAddressOperations.cs deleted file mode 100644 index ed3a8e4aebbe..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/PublicIpAddressOperations.cs +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Network; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing the operations that can be performed over a specific NetworkSecurityGroup. - /// - public class PublicIpAddressOperations : ResourceOperationsBase - { - /// - /// Initializes a new instance of the class. - /// - /// An instance of that has an id for a virtual machine. - internal PublicIpAddressOperations(GenericResourceOperations genericOperations) - : base(genericOperations, genericOperations.Id) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The client parameters to use in these operations. - /// The public ip address name. - internal PublicIpAddressOperations(ResourceGroupOperations resourceGroup, string publicIpName) - : base(resourceGroup, resourceGroup.Id.AppendProviderResource(ResourceType.Namespace, ResourceType.Type, publicIpName)) - { - } - - /// - /// 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. - protected PublicIpAddressOperations(ResourceOperationsBase options, ResourceIdentifier id) - : base(options, id) - { - } - - /// - /// Gets the resource type definition for a public IP address. - /// - public static readonly ResourceType ResourceType = "Microsoft.Network/publicIPAddresses"; - - /// - protected override ResourceType ValidResourceType => ResourceType; - - private PublicIPAddressesOperations Operations => new NetworkManagementClient( - Id.SubscriptionId, - BaseUri, - Credential, - ClientOptions.Convert()).PublicIPAddresses; - - /// - public Response Delete(CancellationToken cancellationToken = default) - { - return Operations.StartDelete(Id.ResourceGroupName, Id.Name, cancellationToken) - .WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - public async Task DeleteAsync(CancellationToken cancellationToken = default) - { - return (await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken)) - .WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - public Operation StartDelete(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(Operations.StartDelete(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - public async Task StartDeleteAsync(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - public override Response Get(CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Response.FromValue(new PublicIpAddress(this, new PublicIPAddressData(response.Value)), response.GetRawResponse()); - } - - /// - public override async Task> GetAsync(CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new PublicIpAddress(this, new PublicIPAddressData(response.Value)), response.GetRawResponse()); - } - - /// - public Response AddTag(string key, string value, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - var response = Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken); - return Response.FromValue(new PublicIpAddress(this, new PublicIPAddressData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - var response = await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new PublicIpAddress(this, new PublicIPAddressData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartAddTag(string key, string value, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - return new PhArmOperation(Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new PublicIpAddress(this, new PublicIPAddressData(n))); - } - - /// - public async Task> StartAddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - return new PhArmOperation(await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new PublicIpAddress(this, new PublicIPAddressData(n))); - } - - /// - public Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - var response = Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken); - return Response.FromValue(new PublicIpAddress(this, new PublicIPAddressData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - var response = await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new PublicIpAddress(this, new PublicIPAddressData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartSetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - return new PhArmOperation(Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new PublicIpAddress(this, new PublicIPAddressData(n))); - } - - /// - public async Task> StartSetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - return new PhArmOperation(await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new PublicIpAddress(this, new PublicIPAddressData(n))); - } - - /// - public Response RemoveTag(string key, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - var response = Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken); - return Response.FromValue(new PublicIpAddress(this, new PublicIPAddressData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - var response = await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new PublicIpAddress(this, new PublicIPAddressData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartRemoveTag(string key, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - return new PhArmOperation(Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new PublicIpAddress(this, new PublicIPAddressData(n))); - } - - /// - public async Task> StartRemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - return new PhArmOperation(await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new PublicIpAddress(this, new PublicIPAddressData(n))); - } - - /// - /// Lists all available geo-locations. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of location that may take multiple service requests to iterate over. - public IEnumerable ListAvailableLocations(CancellationToken cancellationToken = default) - { - return ListAvailableLocations(ResourceType, cancellationToken); - } - - /// - /// Lists all available geo-locations. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of location that may take multiple service requests to iterate over. - /// The default subscription id is null. - public async Task> ListAvailableLocationsAsync(CancellationToken cancellationToken = default) - { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/README.MD b/sdk/resourcemanager/Proto.Client/network/README.MD deleted file mode 100644 index 71ceaad3b35c..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/README.MD +++ /dev/null @@ -1,3 +0,0 @@ -# Proto Network - -Prototype version of Azure.ResourceManager.Network used to showcase and test the new prototype track 2 management plane SDK \ No newline at end of file diff --git a/sdk/resourcemanager/Proto.Client/network/Subnet.cs b/sdk/resourcemanager/Proto.Client/network/Subnet.cs deleted file mode 100644 index ac60e1b85a5a..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/Subnet.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using Azure.ResourceManager.Core; - -namespace Proto.Network -{ - /// - /// A class representing a subnet along with the instance operations that can be performed on it. - /// - public class Subnet : SubnetOperations - { - /// - /// Initializes a new instance of the class. - /// - internal Subnet(ResourceOperationsBase options, SubnetData resource) - : base(options, resource.Id) - { - Data = resource; - } - - /// - /// Gets the data representing the subnet - /// - public SubnetData Data { get; private set; } - - /// - protected override Subnet GetResource(CancellationToken cancellation = default) - { - return this; - } - - /// - protected override Task GetResourceAsync(CancellationToken cancellationToken = default) - { - return Task.FromResult(this); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/SubnetBuilder.cs b/sdk/resourcemanager/Proto.Client/network/SubnetBuilder.cs deleted file mode 100644 index 7fcdb5206eb9..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/SubnetBuilder.cs +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing a builder object used to create Azure resources. - /// - public class SubnetBuilder - { - /// - /// Initializes a new instance of the class. - /// - /// The container object to create the resource in. - /// The resource to create. - public SubnetBuilder(SubnetContainer container, SubnetData resource) - { - Resource = resource; - UnTypedContainer = container; - } - - /// - /// Gets the resource object to create. - /// - protected SubnetData Resource { get; private set; } - - /// - /// Gets the resource name. - /// - protected string ResourceName { get; private set; } - - /// - /// Gets the container object to create the resource in. - /// - protected SubnetContainer UnTypedContainer { get; private set; } - - /// - /// Creates the resource object to send to the Azure API. - /// - /// The resource to create. - public SubnetData Build() - { - ThrowIfNotValid(); - OnBeforeBuild(); - InternalBuild(); - OnAfterBuild(); - - return Resource; - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - /// Name cannot be null or a whitespace. - public Response CreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return UnTypedContainer.CreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this resource. - /// Name cannot be null or a whitespace. - public async Task> CreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await UnTypedContainer.CreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public Operation StartCreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return UnTypedContainer.StartCreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public async Task> StartCreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await UnTypedContainer.StartCreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// Determines whether or not the resource is valid. - /// - /// The message indicating what is wrong with the resource. - /// Whether or not the resource is valid. - protected virtual bool IsValid(out string message) - { - message = string.Empty; - - return true; - } - - /// - /// Perform any tasks necessary after the resource is built - /// - protected virtual void OnAfterBuild() - { - } - - /// - /// Perform any tasks necessary before the resource is built - /// - protected virtual void OnBeforeBuild() - { - Resource.Model.Name = ResourceName; - } - - private static void InternalBuild() - { - } - - private void ThrowIfNotValid() - { - if (!IsValid(out var message)) - { - throw new InvalidOperationException(message); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/SubnetContainer.cs b/sdk/resourcemanager/Proto.Client/network/SubnetContainer.cs deleted file mode 100644 index e1112b2468f1..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/SubnetContainer.cs +++ /dev/null @@ -1,170 +0,0 @@ -using Azure; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Network; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing collection of Subnets and their operations over a VirtualNetwork. - /// - public class SubnetContainer : ResourceContainerBase - { - /// - /// Initializes a new instance of the class. - /// - /// The virtual network associate with this subnet - internal SubnetContainer(VirtualNetworkOperations virtualNetwork) - : base(virtualNetwork) - { - } - - /// - /// Typed Resource Identifier for the container. - /// - public new ResourceGroupResourceIdentifier Id => base.Id as ResourceGroupResourceIdentifier; - - /// - protected override ResourceType ValidResourceType => VirtualNetworkOperations.ResourceType; - - private SubnetsOperations Operations => new NetworkManagementClient( - Id.SubscriptionId, - BaseUri, - Credential, - ClientOptions.Convert()).Subnets; - - /// - /// The operation to create or update a subnet. Please note some properties can be set only during creation. - /// - /// The name of the subnet. - /// The desired subnet configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - /// Name of the subnet cannot be null or a whitespace. - /// resourceDetails cannot be null. - public Response CreateOrUpdate(string name, SubnetData resourceDetails, CancellationToken cancellationToken = default) - { - var response = Operations.StartCreateOrUpdate(Id.ResourceGroupName, Id.Name, name, resourceDetails.Model, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - return Response.FromValue(new Subnet(Parent, new SubnetData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to create or update a subnet. Please note some properties can be set only during creation. - /// - /// The name of the subnet. - /// The desired subnet configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this subnet. - /// Name of the subnet cannot be null or a whitespace. - /// resourceDetails cannot be null. - public async Task> CreateOrUpdateAsync(string name, SubnetData resourceDetails, CancellationToken cancellationToken = default) - { - var response = await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, name, resourceDetails.Model, cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult().WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return Response.FromValue(new Subnet(Parent, new SubnetData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to create or update a subnet. Please note some properties can be set only during creation. - /// - /// The name of the subnet. - /// The desired subnet configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name of the subnet cannot be null or a whitespace. - /// resourceDetails cannot be null. - public Operation StartCreateOrUpdate(string name, SubnetData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - Operations.StartCreateOrUpdate(Id.ResourceGroupName, Id.Name, name, resourceDetails.Model, cancellationToken), - s => new Subnet(Parent, new SubnetData(s))); - } - - /// - /// The operation to create or update a subnet. Please note some properties can be set only during creation. - /// - /// The name of the subnet. - /// The desired subnet configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name of the subnet cannot be null or a whitespace. - /// resourceDetails cannot be null. - public async Task> StartCreateOrUpdateAsync(string name, SubnetData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, name, resourceDetails.Model, cancellationToken).ConfigureAwait(false), - s => new Subnet(Parent, new SubnetData(s))); - } - - /// - /// Constructs an object used to create a subnet. - /// - /// The CIDR of the resource. - /// The network security group of the resource. - /// A builder with and . - public SubnetBuilder Construct(string subnetCidr, NetworkSecurityGroupData group = null) - { - var subnet = new Azure.ResourceManager.Network.Models.Subnet() - { - AddressPrefix = subnetCidr, - }; - - if (null != group) - { - subnet.NetworkSecurityGroup = group.Model; - } - - return new SubnetBuilder(this, new SubnetData(subnet)); - } - - /// - /// Lists the subnets for this virtual network. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of resource operations that may take multiple service requests to iterate over. - public Pageable List(CancellationToken cancellationToken = default) - { - return new PhWrappingPageable( - Operations.List(Id.ResourceGroupName, Id.Name, cancellationToken), - convertor()); - } - - /// - /// Lists the subnets for this virtual network. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of resource operations that may take multiple service requests to iterate over. - public AsyncPageable ListAsync(CancellationToken cancellationToken = default) - { - return new PhWrappingAsyncPageable( - Operations.ListAsync(Id.ResourceGroupName, Id.Name, cancellationToken), - convertor()); - } - - private Func convertor() - { - return s => new Subnet(Parent, new SubnetData(s)); - } - - /// - public Response Get(string subnetName, CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, Id.Name, subnetName, cancellationToken: cancellationToken); - return Response.FromValue(new Subnet(Parent, new SubnetData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> GetAsync(string subnetName, CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, Id.Name, subnetName, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new Subnet(Parent, new SubnetData(response.Value)), response.GetRawResponse()); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/SubnetOperations.cs b/sdk/resourcemanager/Proto.Client/network/SubnetOperations.cs deleted file mode 100644 index f100ac546152..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/SubnetOperations.cs +++ /dev/null @@ -1,91 +0,0 @@ -using Azure; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Network; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing the operations that can be performed over a specific subnet. - /// - public class SubnetOperations : ResourceOperationsBase - { - /// - /// Initializes a new instance of the class. - /// - /// The client parameters to use in these operations. - /// The name of the subnet. - internal SubnetOperations(VirtualNetworkOperations virtualNetwork, string subnetName) - : base(virtualNetwork, virtualNetwork.Id.AppendChildResource( "subnets", subnetName)) - { - } - - /// - /// 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. - protected SubnetOperations(ResourceOperationsBase options, ResourceIdentifier id) - : base(options, id) - { - } - - /// - /// Gets the resource type definition for a subnet. - /// - public static readonly ResourceType ResourceType = "Microsoft.Network/virtualNetworks/subnets"; - - /// - /// Gets the valid resource type definition for a subnet. - /// - protected override ResourceType ValidResourceType => ResourceType; - - private SubnetsOperations Operations => new NetworkManagementClient( - Id.SubscriptionId, - BaseUri, - Credential, - ClientOptions.Convert()).Subnets; - - /// - public Response Delete(CancellationToken cancellationToken = default) - { - return Operations.StartDelete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken) - .WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - public async Task DeleteAsync(CancellationToken cancellationToken = default) - { - return (await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken)) - .WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - - /// - public Operation StartDelete(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(Operations.StartDelete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken)); - } - - /// - public async Task StartDeleteAsync(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken)); - } - - /// - public override Response Get(CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Response.FromValue(new Subnet(this, new SubnetData(response.Value)), response.GetRawResponse()); - } - - /// - public override async Task> GetAsync(CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new Subnet(this, new SubnetData(response.Value)), response.GetRawResponse()); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/TrackedResource.cs b/sdk/resourcemanager/Proto.Client/network/TrackedResource.cs deleted file mode 100644 index 0d44251e00d7..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/TrackedResource.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.ResourceManager.Core.Adapters -{ - /// - /// A class representing a generic tracked resource in Azure. - /// - /// The type of the underlying resource id - /// The type of the underlying model this class wraps - public abstract class TrackedResource : TrackedResource - where TIdentifier : TenantResourceIdentifier - where TModel : class - { - /// - /// Initializes a new instance of the class. - /// - /// The identifier of the resource that is the target of operations. - /// The location of the resource. - /// The model to copy from. - protected TrackedResource(TIdentifier id, LocationData location, TModel data) - : base(id, id?.Name, id?.ResourceType, location, null) - { - Model = data; - } - - /// - /// Gets or sets the Model this resource is based off. - /// - public virtual TModel Model { get; set; } - - /// - /// Converts from a into the TModel. - /// - /// The tracked resource convert from. - public static implicit operator TModel(TrackedResource other) - { - return other.Model; - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/VirtualNetwork.cs b/sdk/resourcemanager/Proto.Client/network/VirtualNetwork.cs deleted file mode 100644 index f9f92225b201..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/VirtualNetwork.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using Azure.ResourceManager.Core; - -namespace Proto.Network -{ - /// - /// A class representing a virtual nerwork along with the instance operations that can be performed on it. - /// - public class VirtualNetwork : VirtualNetworkOperations - { - /// - /// Initializes a new instance of the class. - /// - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal VirtualNetwork(ResourceOperationsBase options, VirtualNetworkData resource) - : base(options, resource.Id) - { - Data = resource; - } - - /// - /// Gets or sets the virtual nerwork data. - /// - public VirtualNetworkData Data { get; private set; } - - /// - protected override VirtualNetwork GetResource(CancellationToken cancellation = default) - { - return this; - } - - /// - protected override Task GetResourceAsync(CancellationToken cancellationToken = default) - { - return Task.FromResult(this); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/VirtualNetworkBuilder.cs b/sdk/resourcemanager/Proto.Client/network/VirtualNetworkBuilder.cs deleted file mode 100644 index 458c1060230b..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/VirtualNetworkBuilder.cs +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing a builder object used to create Azure resources. - /// - public class VirtualNetworkBuilder - { - /// - /// Initializes a new instance of the class. - /// - /// The container object to create the resource in. - /// The resource to create. - public VirtualNetworkBuilder(VirtualNetworkContainer container, VirtualNetworkData resource) - { - Resource = resource; - UnTypedContainer = container; - } - - /// - /// Gets the resource object to create. - /// - protected VirtualNetworkData Resource { get; private set; } - - /// - /// Gets the resource name. - /// - protected string ResourceName { get; private set; } - - /// - /// Gets the container object to create the resource in. - /// - protected VirtualNetworkContainer UnTypedContainer { get; private set; } - - /// - /// Creates the resource object to send to the Azure API. - /// - /// The resource to create. - public VirtualNetworkData Build() - { - ThrowIfNotValid(); - OnBeforeBuild(); - InternalBuild(); - OnAfterBuild(); - - return Resource; - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - /// Name cannot be null or a whitespace. - public Response CreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return UnTypedContainer.CreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this resource. - /// Name cannot be null or a whitespace. - public async Task> CreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await UnTypedContainer.CreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public Operation StartCreateOrUpdate(string name, CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return UnTypedContainer.StartCreateOrUpdate(name, Resource, cancellationToken); - } - - /// - /// The operation to create or update a resource. Please note some properties can be set only during creation. - /// - /// The name of the new resource to create. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name cannot be null or a whitespace. - public async Task> StartCreateOrUpdateAsync( - string name, - CancellationToken cancellationToken = default) - { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); - - ResourceName = name; - Resource = Build(); - - return await UnTypedContainer.StartCreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false); - } - - /// - /// Determines whether or not the resource is valid. - /// - /// The message indicating what is wrong with the resource. - /// Whether or not the resource is valid. - protected virtual bool IsValid(out string message) - { - message = string.Empty; - - return true; - } - - /// - /// Perform any tasks necessary after the resource is built - /// - protected virtual void OnAfterBuild() - { - } - - /// - /// Perform any tasks necessary before the resource is built - /// - protected virtual void OnBeforeBuild() - { - } - - private static void InternalBuild() - { - } - - private void ThrowIfNotValid() - { - if (!IsValid(out var message)) - { - throw new InvalidOperationException(message); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/VirtualNetworkContainer.cs b/sdk/resourcemanager/Proto.Client/network/VirtualNetworkContainer.cs deleted file mode 100644 index 6f9ed7464f94..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/VirtualNetworkContainer.cs +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Network; -using Azure.ResourceManager.Network.Models; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing collection of virtual network and their operations over a resource group. - /// - public class VirtualNetworkContainer : ResourceContainerBase - { - /// - /// Initializes a new instance of the class. - /// - /// The parent resource group. - internal VirtualNetworkContainer(ResourceGroupOperations resourceGroup) - : base(resourceGroup) - { - } - - /// - /// Typed Resource Identifier for the container. - /// - public new ResourceGroupResourceIdentifier Id => base.Id as ResourceGroupResourceIdentifier; - - /// - protected override ResourceType ValidResourceType => ResourceGroupOperations.ResourceType; - - private VirtualNetworksOperations Operations => new NetworkManagementClient( - Id.SubscriptionId, - BaseUri, - Credential, - ClientOptions.Convert()).VirtualNetworks; - - /// - /// The operation to create or update a virtual network. Please note some properties can be set only during creation. - /// - /// The name of the virtual network. - /// The desired virtual network configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A response with the operation for this resource. - /// Name of the virtual network cannot be null or a whitespace. - /// resourceDetails cannot be null. - public Response CreateOrUpdate(string name, VirtualNetworkData resourceDetails, CancellationToken cancellationToken = default) - { - var response = Operations.StartCreateOrUpdate(Id.ResourceGroupName, name, resourceDetails, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - return Response.FromValue(new VirtualNetwork(Parent, new VirtualNetworkData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to create or update a virtual network. Please note some properties can be set only during creation. - /// - /// The name of the virtual network. - /// The desired virtual network configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns a response with the operation for this virtual network. - /// Name of the virtual network cannot be null or a whitespace. - /// resourceDetails cannot be null. - public async Task> CreateOrUpdateAsync(string name, VirtualNetworkData resourceDetails, CancellationToken cancellationToken = default) - { - var response = await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails, cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult().WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return Response.FromValue(new VirtualNetwork(Parent, new VirtualNetworkData(response.Value)), response.GetRawResponse()); - } - - /// - /// The operation to create or update a virtual network. Please note some properties can be set only during creation. - /// - /// The name of the virtual network. - /// The desired virtual network configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name of the virtual network cannot be null or a whitespace. - /// resourceDetails cannot be null. - public Operation StartCreateOrUpdate(string name, VirtualNetworkData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - Operations.StartCreateOrUpdate(Id.ResourceGroupName, name, resourceDetails, cancellationToken), - n => new VirtualNetwork(Parent, new VirtualNetworkData(n))); - } - - /// - /// The operation to create or update a virtual network. Please note some properties can be set only during creation. - /// - /// The name of the virtual network. - /// The desired virtual network configuration. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A that on completion returns an that allows polling for completion of the operation. - /// - /// Details on long running operation object. - /// - /// Name of the virtual network cannot be null or a whitespace. - /// resourceDetails cannot be null. - public async Task> StartCreateOrUpdateAsync(string name, VirtualNetworkData resourceDetails, CancellationToken cancellationToken = default) - { - return new PhArmOperation( - await Operations.StartCreateOrUpdateAsync(Id.ResourceGroupName, name, resourceDetails, cancellationToken).ConfigureAwait(false), - n => new VirtualNetwork(Parent, new VirtualNetworkData(n))); - } - - /// - /// Constructs an object used to create a virtual network. - /// - /// The CIDR of the resource. - /// The location of the resource. - /// A builder with and . - public VirtualNetworkBuilder Construct(string vnetCidr, LocationData location = null) - { - var parent = GetParentResource(); - var vnet = new Azure.ResourceManager.Network.Models.VirtualNetwork() - { - Location = location ?? parent.Data.Location, - AddressSpace = new AddressSpace(), - }; - vnet.AddressSpace.AddressPrefixes.Add(vnetCidr); - - return new VirtualNetworkBuilder(this, new VirtualNetworkData(vnet)); - } - - /// - /// Lists the virtual network for this resource group. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of resource operations that may take multiple service requests to iterate over. - public Pageable List(CancellationToken cancellationToken = default) - { - return new PhWrappingPageable( - Operations.List(Id.Name, cancellationToken), - Convertor()); - } - - /// - /// Lists the virtual network for this resource group. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of resource operations that may take multiple service requests to iterate over. - public AsyncPageable ListAsync(CancellationToken cancellationToken = default) - { - return new PhWrappingAsyncPageable( - Operations.ListAsync(Id.Name, cancellationToken), - Convertor()); - } - - /// - /// Filters the list of virtual network for this resource group represented as generic resources. - /// - /// The filter used in this operation. - /// The number of results to return. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of resource that may take multiple service requests to iterate over. - public Pageable ListAsGenericResource(string nameFilter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(VirtualNetworkData.ResourceType); - filters.SubstringFilter = nameFilter; - return ResourceListOperations.ListAtContext(Parent as ResourceGroupOperations, filters, top, cancellationToken); - } - - /// - /// Filters the list of virtual network for this resource group represented as generic resources. - /// - /// The filter used in this operation. - /// The number of results to return. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of resource that may take multiple service requests to iterate over. - public AsyncPageable ListAsGenericResourceAsync(string nameFilter, int? top = null, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new ResourceFilterCollection(VirtualNetworkData.ResourceType); - filters.SubstringFilter = nameFilter; - return ResourceListOperations.ListAtContextAsync(Parent as ResourceGroupOperations, filters, top, cancellationToken); - } - - private Func Convertor() - { - return s => new VirtualNetwork(Parent, new VirtualNetworkData(s)); - } - - /// - public Response Get(string virtualNetworkName, CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, virtualNetworkName, cancellationToken: cancellationToken); - return Response.FromValue(new VirtualNetwork(Parent, new VirtualNetworkData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> GetAsync(string virtualNetworkName, CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, virtualNetworkName, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new VirtualNetwork(Parent, new VirtualNetworkData(response.Value)), response.GetRawResponse()); - } - - } -} diff --git a/sdk/resourcemanager/Proto.Client/network/VirtualNetworkOperations.cs b/sdk/resourcemanager/Proto.Client/network/VirtualNetworkOperations.cs deleted file mode 100644 index 3a2de8a6f0ef..000000000000 --- a/sdk/resourcemanager/Proto.Client/network/VirtualNetworkOperations.cs +++ /dev/null @@ -1,258 +0,0 @@ -using Azure; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Network; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace Proto.Network -{ - /// - /// A class representing the operations that can be performed over a specific virtual nerwork. - /// - public class VirtualNetworkOperations : ResourceOperationsBase - { - /// - /// Initializes a new instance of the class. - /// - /// An instance of that has an id for a virtual nerwork. - internal VirtualNetworkOperations(GenericResourceOperations genericOperations) - : base(genericOperations, genericOperations.Id) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The client parameters to use in these operations. - /// The name of the virtual network to use. - internal VirtualNetworkOperations(ResourceGroupOperations resourceGroup, string vnetName) - : base(resourceGroup, resourceGroup.Id.AppendProviderResource(ResourceType.Namespace, ResourceType.Type, vnetName)) - { - } - - /// - /// 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. - protected VirtualNetworkOperations(ResourceOperationsBase options, ResourceIdentifier id) - : base(options, id) - { - } - - /// - /// Gets the resource type definition for a virtual nerwork. - /// - public static readonly ResourceType ResourceType = "Microsoft.Network/virtualNetworks"; - - /// - /// Gets the valid resource type definition for a virtual nerwork. - /// - protected override ResourceType ValidResourceType => ResourceType; - - private VirtualNetworksOperations Operations => new NetworkManagementClient( - Id.SubscriptionId, - BaseUri, - Credential, - ClientOptions.Convert()).VirtualNetworks; - - /// - public Response Delete(CancellationToken cancellationToken = default) - { - return Operations.StartDelete(Id.ResourceGroupName, Id.Name, cancellationToken).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - public async Task DeleteAsync(CancellationToken cancellationToken = default) - { - return (await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken)).WaitForCompletionAsync(cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - /// - public Operation StartDelete(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(Operations.StartDelete(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - public async Task StartDeleteAsync(CancellationToken cancellationToken = default) - { - return new PhVoidArmOperation(await Operations.StartDeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken)); - } - - /// - public override Response Get(CancellationToken cancellationToken = default) - { - var response = Operations.Get(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Response.FromValue(new VirtualNetwork(this, new VirtualNetworkData(response.Value)), response.GetRawResponse()); - } - - /// - public async override Task> GetAsync(CancellationToken cancellationToken = default) - { - var response = await Operations.GetAsync(Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new VirtualNetwork(this, new VirtualNetworkData(response.Value)), response.GetRawResponse()); - } - - /// - public Response AddTag(string key, string value, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - var response = Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken); - return Response.FromValue(new VirtualNetwork(this, new VirtualNetworkData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - var response = await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new VirtualNetwork(this, new VirtualNetworkData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartAddTag(string key, string value, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - return new PhArmOperation( - Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new VirtualNetwork(this, new VirtualNetworkData(n))); - } - - /// - public async Task> StartAddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags[key] = value; - return new PhArmOperation( - await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new VirtualNetwork(this, new VirtualNetworkData(n))); - } - - /// - /// Gets a list of subnet in the virtual nerwork. - /// - /// An object representing collection of subnets and their operations over a virtual network. - public SubnetContainer GetSubnets() - { - return new SubnetContainer(this); - } - - /// - public Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - var response = Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken); - return Response.FromValue(new VirtualNetwork(this, new VirtualNetworkData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - var response = await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new VirtualNetwork(this, new VirtualNetworkData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartSetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - return new PhArmOperation( - Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new VirtualNetwork(this, new VirtualNetworkData(n))); - } - - /// - public async Task> StartSetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(tags); - return new PhArmOperation( - await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new VirtualNetwork(this, new VirtualNetworkData(n))); - } - - /// - public Response RemoveTag(string key, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - var response = Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken); - return Response.FromValue(new VirtualNetwork(this, new VirtualNetworkData(response.Value)), response.GetRawResponse()); - } - - /// - public async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - var response = await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new VirtualNetwork(this, new VirtualNetworkData(response.Value)), response.GetRawResponse()); - } - - /// - public Operation StartRemoveTag(string key, CancellationToken cancellationToken = default) - { - var resource = GetResource(); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - return new PhArmOperation( - Operations.UpdateTags(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new VirtualNetwork(this, new VirtualNetworkData(n))); - } - - /// - public async Task> StartRemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - var resource = await GetResourceAsync(cancellationToken); - var patchable = new Azure.ResourceManager.Network.Models.TagsObject(); - patchable.Tags.ReplaceWith(resource.Data.Tags); - patchable.Tags.Remove(key); - return new PhArmOperation( - await Operations.UpdateTagsAsync(Id.ResourceGroupName, Id.Name, patchable, cancellationToken), - n => new VirtualNetwork(this, new VirtualNetworkData(n))); - } - - /// - /// Lists all available geo-locations. - /// - /// A collection of location that may take multiple service requests to iterate over. - public IEnumerable ListAvailableLocations(CancellationToken cancellationToken = default) - { - return ListAvailableLocations(ResourceType); - } - - /// - /// Lists all available geo-locations. - /// - /// A token to allow the caller to cancel the call to the service. The default value is . - /// An async collection of location that may take multiple service requests to iterate over. - /// The default subscription id is null. - public async Task> ListAvailableLocationsAsync(CancellationToken cancellationToken = default) - { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/CHANGELOG.md b/sdk/resourcemanager/Proto.Client/src/CHANGELOG.md deleted file mode 100644 index 5c312e4ea9be..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -# Release History - -## 1.0.0-beta.1 (Unreleased) - --Initial checkin diff --git a/sdk/resourcemanager/Proto.Client/src/Common/ScenarioHelper.cs b/sdk/resourcemanager/Proto.Client/src/Common/ScenarioHelper.cs deleted file mode 100644 index a440264bb390..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Common/ScenarioHelper.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Proto.Client.Common -{ - internal class ScenarioHelper - { - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Program.cs b/sdk/resourcemanager/Proto.Client/src/Program.cs deleted file mode 100644 index 3c860cfb6c59..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Program.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Azure.Identity; -using Azure.ResourceManager.Core; -using System; - -namespace Proto.Client -{ - class Program - { - static void Main(string[] args) - { - Scenario scenario = null; - try - { - scenario = ScenarioFactory.GetScenario(Scenarios.ShutdownVmsByLINQ); - scenario.Execute(); - } - finally - { - foreach (var rgId in Scenario.CleanUp) - { - var id = new ResourceGroupResourceIdentifier(rgId); - var rg = new ArmClient(new DefaultAzureCredential()).GetSubscriptions().TryGet(id.SubscriptionId).GetResourceGroups().Get(id.ResourceGroupName).Value; - Console.WriteLine($"--------Deleting {rg.Id.Name}--------"); - try - { - _ = rg.DeleteAsync(); - } - catch - { - //ignore exceptions in case the rg doesn't exist - } - } - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Proto.Client.csproj b/sdk/resourcemanager/Proto.Client/src/Proto.Client.csproj deleted file mode 100644 index ad98c5b409b5..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Proto.Client.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - 1.0.0-beta.1 - Exe - netcoreapp3.1 - false - - - - DEBUG;TRACE - - - - - - - - - - - - $(NoWarn);AZC0001;CA1303 - - - - - - - diff --git a/sdk/resourcemanager/Proto.Client/src/Scenario.cs b/sdk/resourcemanager/Proto.Client/src/Scenario.cs deleted file mode 100644 index a6929c4c622b..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenario.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Proto.Client -{ - abstract class Scenario - { - public ScenarioContext Context { get; private set; } - - public readonly static HashSet CleanUp = new HashSet(); - - public abstract void Execute(); - - public Scenario() : this(new ScenarioContext()) { } - - public Scenario(ScenarioContext context) - { - Context = context; - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/ScenarioContext.cs b/sdk/resourcemanager/Proto.Client/src/ScenarioContext.cs deleted file mode 100644 index 966196ef6c2a..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/ScenarioContext.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Azure.ResourceManager.Core; -using System; - -namespace Proto.Client -{ - class ScenarioContext - { - public static readonly string AzureSdkSandboxId = "db1ab6f0-4769-4b27-930e-01e2ef9c123c"; - - public string Hostname => $"{Environment.UserName}"; - public string VmName => $"{Environment.UserName}"; - public string RgName { get; private set; } - public string NsgName => $"{Environment.UserName}-test-nsg"; - public string SubscriptionId { get; private set; } - public string Loc => LocationData.WestUS2; - public string SubnetName => $"{Environment.UserName}-subnet"; - - public string PrincipalId => "4c5ce728-7350-4ae5-bcf1-42e8e33b00fe"; - - public string RoleId => "acdd72a7-3385-48ef-bd42-f606fba81ae7"; - - public ScenarioContext() : this(AzureSdkSandboxId) { } - - public ScenarioContext(string subscriptionId) - { - RgName = $"{Environment.UserName}-{Environment.TickCount}-rg"; - SubscriptionId = subscriptionId; - } - } -} \ No newline at end of file diff --git a/sdk/resourcemanager/Proto.Client/src/ScenarioFactory.cs b/sdk/resourcemanager/Proto.Client/src/ScenarioFactory.cs deleted file mode 100644 index 2d769ee9d9ea..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/ScenarioFactory.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Linq; -using System.Reflection; - -namespace Proto.Client -{ - enum Scenarios - { - All, - GetVMTaskExamples, - CreateSingleVmExample, - CreateSingleVMCheckLocation, - ShutdownVmsByName, - StartStopVm, - StartFromVm, - SetTagsOnVm, - ShutdownVmsByTag, - CreateMultipleVms, - GenericEntityLoop, - ShutdownVmsByLINQ, - ShutdownVmsByNameAcrossResourceGroups, - //ShutdownVmsByNameAcrossSubscriptions, - List, - ClientOptionsOverride, - GetSubscription, - NullDataValues, - //RoleAssignment, - //DeleteGeneric, - //AddTagToGeneric, - CheckResourceExists, - GetFromOperations, - CreateSingleVmExampleAsync, - StartCreateSingleVmExampleAsync, - StartCreateSingleVmExample, - DefaultSubscription, - SubscriptionExists, - UseParentLocation, - GetByContainers, - GetByContainersAsync, - CheckResourceGroupOpsAsync, - TenantResource, - CheckResourceGroupContainerAsync, - GenericResourceOperationsExample, - SingletonVmssUpgrade, - VmImageTests, - } - - class ScenarioFactory - { - public static Scenario GetScenario(Scenarios scenario) - { - switch(scenario) - { - default: - var type = Assembly.GetExecutingAssembly() - .GetTypes() - .Where(t => t.Name == scenario.ToString()) - .First(); - return Activator.CreateInstance(type) as Scenario; - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/AddTagToGeneric.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/AddTagToGeneric.cs deleted file mode 100644 index c957d6b18b49..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/AddTagToGeneric.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Azure.ResourceManager.Core; -using Proto.Compute; -using System; -using Azure.Identity; - -namespace Proto.Client -{ - class AddTagToGeneric : Scenario - { - public override void Execute() - { - var createVm = new CreateSingleVmExample(Context); - createVm.Execute(); - - var client = new ArmClient(new DefaultAzureCredential()); - var sub = client.GetSubscriptions().TryGet(Context.SubscriptionId); - var rgOp = sub.GetResourceGroups().Get(Context.RgName).Value; - foreach (var genericOp in rgOp.GetVirtualMachines().ListAsGenericResource(Context.VmName)) - { - Console.WriteLine($"Adding tag to {genericOp.Id}"); - genericOp.StartAddTag("tagKey", "tagVaue"); - } - - var vmOp = rgOp.GetVirtualMachines().Get(Context.VmName).Value; - Console.WriteLine($"Getting {vmOp.Id}"); - var vm = vmOp.Get().Value; - - if(!vm.Data.Tags.ContainsKey("tagKey")) - throw new InvalidOperationException("Failed"); - - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/All.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/All.cs deleted file mode 100644 index a45fbaf07e02..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/All.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Azure.ResourceManager.Core; -using System; -using System.Linq; -using System.Threading.Tasks; -using Azure.Identity; - -namespace Proto.Client -{ - class All : Scenario - { - public override void Execute() - { - var list = Enum.GetValues(typeof(Scenarios)).Cast().ToList(); - try - { - foreach(var scenario in list) - { - if (scenario != Scenarios.All) - { - Console.WriteLine($"########## Starting Scenario {scenario} ##########"); - var executable = ScenarioFactory.GetScenario(scenario); - executable.Execute(); - Console.WriteLine($"########## Finished Scenario {scenario} ##########"); - } - } - } - finally - { - var client = new ArmClient(new DefaultAzureCredential()); - foreach (var rgId in CleanUp) - { - var id = new ResourceGroupResourceIdentifier(rgId); - var rg = client.GetResourceGroupOperations(id); - Console.WriteLine($"--------Deleting {rg.Id.Name}--------"); - try - { - _ = rg.DeleteAsync(); - } - catch - { - //ignore exceptions in case rg doesn't exist - } - } - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceExists.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceExists.cs deleted file mode 100644 index 06d26dddf4fa..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceExists.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Azure.ResourceManager.Core; -using Proto.Compute; -using System; -using Azure.Identity; - -namespace Proto.Client -{ - class CheckResourceExists : Scenario - { - public override void Execute() - { - var client = new ArmClient(new DefaultAzureCredential()); - var subOp = client.DefaultSubscription; - var rgContainer = subOp.GetResourceGroups(); - - Console.WriteLine($"Making sure {Context.RgName} doesn't exist yet."); - if (rgContainer.DoesExist(Context.RgName)) - throw new Exception($"The resource group {Context.RgName} should not have existed."); - - Console.WriteLine($"Creating {Context.RgName}"); - _ = rgContainer.Construct(LocationData.Default).CreateOrUpdate(Context.RgName).Value; - - Console.WriteLine($"Making sure {Context.RgName} exists now."); - if (!rgContainer.DoesExist(Context.RgName)) - throw new Exception($"The resource group {Context.RgName} should have existed."); - - Console.WriteLine($"Using try get value to retrieve {Context.RgName}"); - ResourceGroup rgOutput = rgContainer.TryGet(Context.RgName); - if(rgOutput == null) - throw new Exception($"The resource group {Context.RgName} should have existed."); - - var asetContainer = rgOutput.GetAvailabilitySets(); - var asetName = Context.VmName + "_aSet"; - - Console.WriteLine($"Making sure {asetName} doesn't exist yet."); - if (asetContainer.DoesExist(asetName)) - throw new Exception($"The availability set {asetName} should not have existed."); - - Console.WriteLine($"Creating {asetName}"); - var aset = asetContainer.Construct("Aligned").CreateOrUpdate(asetName).Value; - - Console.WriteLine($"Making sure {asetName} exists now."); - if (!asetContainer.DoesExist(asetName)) - throw new Exception($"The availability set {asetName} should have existed."); - - Console.WriteLine("Using try get value to retrieve the rg"); - AvailabilitySet asetOutput = asetContainer.TryGet(asetName); - if (asetOutput == null) - throw new Exception($"The availability set {asetName} should have existed."); - - - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceGroupContainerAsync.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceGroupContainerAsync.cs deleted file mode 100644 index 2b08cbc2a2f7..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceGroupContainerAsync.cs +++ /dev/null @@ -1,96 +0,0 @@ -using Azure.Identity; -using Azure.ResourceManager.Core; -using System; -using System.Threading.Tasks; - -namespace Proto.Client -{ - class CheckResourceGroupContainerAsync : Scenario - { - public CheckResourceGroupContainerAsync() : base() { } - - public CheckResourceGroupContainerAsync(ScenarioContext context) : base(context) { } - - public override void Execute() - { - ExecuteAsync().ConfigureAwait(false).GetAwaiter().GetResult(); - } - - private async System.Threading.Tasks.Task ExecuteAsync() - { - var client = new ArmClient(new DefaultAzureCredential()); - var subscription = client.GetSubscriptions().TryGet(Context.SubscriptionId); - - // Create Resource Group - Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; - CleanUp.Add(resourceGroup.Id); - var rgOps = subscription.GetResourceGroups().Get(Context.RgName); - var resourceGroupContainer = subscription.GetResourceGroups(); - var resourceGroupData = new ResourceGroupData("East US"); - - ShouldThrow( - () => resourceGroupContainer.Construct(null), - "Construct with null loc didn't throw", - "Construct"); - - ShouldThrow( - () => resourceGroupContainer.CreateOrUpdate("test", null), - "CreateOrUpdate with null resourceGroupData didn't throw", - "CreateOrUpdate"); - - await ShouldThrowAsync( - async () => await resourceGroupContainer.CreateOrUpdateAsync(" ", resourceGroupData), - "CreateOrUpdateAsync with whitespaces only string didn't throw", - "CreateOrUpdateAsync"); - - ShouldThrow( - () => resourceGroupContainer.StartCreateOrUpdate("test", null), - "StartCreateOrUpdate with null ResourceGroupData didn't throw", - "StartCreateOrUpdate"); - - await ShouldThrowAsync( - async () => await resourceGroupContainer.StartCreateOrUpdateAsync(" ", resourceGroupData), - "StartCreateOrUpdateAsync with whitespaces only string didn't throw", - "StartCreateOrUpdateAsync"); - - ShouldThrow( - () => resourceGroupContainer.Get(null), - "Get with null string didn't throw", - "Get"); - - await ShouldThrowAsync( - async () => await resourceGroupContainer.GetAsync(" "), - "GetAsync with whitespaces only string didn't throw", - "GetAsync"); - - Console.WriteLine("--------Done--------"); - } - - private static void ShouldThrow(Action lambda, string failMessage, string method) - { - try - { - lambda(); - throw new Exception(failMessage); - } - catch (Exception e) when (e.GetType() == typeof(T)) - { - Console.WriteLine($"{method} Exception was thrown as expected."); - } - } - - private static async Task ShouldThrowAsync(Func lambda, string failMessage, string method) - { - try - { - await lambda(); - throw new Exception(failMessage); - } - catch (Exception e) when (e.GetType() == typeof(T)) - { - Console.WriteLine($"{method} Exception was thrown as expected."); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceGroupOpsAsync.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceGroupOpsAsync.cs deleted file mode 100644 index 3711112759b0..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceGroupOpsAsync.cs +++ /dev/null @@ -1,145 +0,0 @@ -using Azure.ResourceManager.Core; -using Proto.Compute; -using System; -using System.Threading.Tasks; -using Azure.Identity; - -namespace Proto.Client -{ - class CheckResourceGroupOpsAsync : Scenario - { - public CheckResourceGroupOpsAsync() : base() { } - - public CheckResourceGroupOpsAsync(ScenarioContext context) : base(context) { } - - public override void Execute() - { - ExecuteAsync().ConfigureAwait(false).GetAwaiter().GetResult(); - } - - private async System.Threading.Tasks.Task ExecuteAsync() - { - var client = new ArmClient(new DefaultAzureCredential()); - var subscription = client.GetSubscriptions().TryGet(Context.SubscriptionId); - - // Create Resource Group - Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; - CleanUp.Add(resourceGroup.Id); - var rgOps = subscription.GetResourceGroups().Get(Context.RgName).Value; - - ShouldThrow( - () => rgOps.AddTag("", ""), - "AddTag with empty string didn't throw", - "AddTag"); - - await ShouldThrowAsync( - async () => await rgOps.AddTagAsync(null, null), - "AddTagAsync with null string didn't throw", - "AddTagAsync"); - - ShouldThrow( - () => rgOps.StartAddTag("", null), - "StartAddTag with empty string didn't throw", - "StartAddTag"); - - await ShouldThrowAsync( - async () => await rgOps.StartAddTagAsync(" ", "test"), - "StartAddTagAsync with whitespaces only string didn't throw", - "StartAddTagAsync"); - - // Create AvailabilitySet - Console.WriteLine("--------Create AvailabilitySet async--------"); - var aset = (await (await resourceGroup.GetAvailabilitySets().Construct("Aligned").StartCreateOrUpdateAsync(Context.VmName + "_aSet")).WaitForCompletionAsync()).Value; - var data = aset.Get().Value.Data; - - ShouldThrow( - () => rgOps.CreateResource("", data), - "CreateResource with empty string didn't throw", - "CreateResource"); - - await ShouldThrowAsync( - async () => await rgOps.CreateResourceAsync(" ", data), - "CreateResourceAsync with whitespaces string didn't throw", - "CreateResourceAsync"); - - ShouldThrow( - () => rgOps.SetTags(null), - "SetTags with null didn't throw", - "SetTags"); - - await ShouldThrowAsync( - async () => await rgOps.SetTagsAsync(null), - "SetTagsAsync with null didn't throw", - "SetTagsAsync"); - - ShouldThrow( - () => rgOps.StartSetTags(null), - "StartSetTags with null didn't throw", - "StartSetTags"); - - await ShouldThrowAsync( - async () => await rgOps.StartSetTagsAsync(null), - "StartSetTagsAsync with null didn't throw", - "StartSetTagsAsync"); - - ShouldThrow( - () => rgOps.RemoveTag(""), - "RemoveTag with empty string didn't throw", - "RemoveTag"); - - await ShouldThrowAsync( - async () => await rgOps.RemoveTagAsync(null), - "RemoveTagAsync with null didn't throw", - "RemoveTagAsync"); - - ShouldThrow( - () => rgOps.StartRemoveTag(" "), - "StartRemoveTag with whitespace string didn't throw", - "StartRemoveTag"); - - await ShouldThrowAsync( - async () => await rgOps.StartRemoveTagAsync(null), - "StartRemoveTagAsync with null didn't throw", - "StartRemoveTagAsync"); - - ShouldThrow( - () => rgOps.CreateResource("tester", null), - "CreateResource model exception not thrown", - "CreateResource"); - - await ShouldThrowAsync( - async () => await rgOps.CreateResourceAsync("tester", null), - "CreateResourceAsync model exception not thrown", - "CreateResourceAsync"); - - Console.WriteLine("--------Done--------"); - } - - private static void ShouldThrow(Action lambda, string failMessage, string method) - { - try - { - lambda(); - throw new Exception(failMessage); - } - catch (Exception e) when (e.GetType() == typeof(T)) - { - Console.WriteLine($"{method} Exception was thrown as expected."); - } - } - - private static async Task ShouldThrowAsync(Func lambda, string failMessage, string method) - { - try - { - await lambda(); - throw new Exception(failMessage); - } - catch (Exception e) when (e.GetType() == typeof(T)) - { - Console.WriteLine($"{method} Exception was thrown as expected."); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/ClientOverrides.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/ClientOverrides.cs deleted file mode 100644 index d67889290876..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/ClientOverrides.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Azure.ResourceManager.Core; -using System; -using Azure.Core; -using Azure.Core.Pipeline; -using System.Threading; -using System.Diagnostics; -using Azure.Identity; - -namespace Proto.Client -{ - class ClientOptionsOverride : Scenario - { - public override void Execute() - { - - ArmClientOptions options1 = new ArmClientOptions(); - ArmClientOptions options2 = new ArmClientOptions(); - var dummyPolicy1 = new dummyPolicy(); - var dummyPolicy2 = new dummyPolicy2(); - options1.AddPolicy(dummyPolicy1, HttpPipelinePosition.PerCall); - options2.AddPolicy(dummyPolicy2, HttpPipelinePosition.PerCall); - var client1 = new ArmClient(new DefaultAzureCredential(), options1); - var client2 = new ArmClient(new DefaultAzureCredential(), options2); - - Console.WriteLine("-----Client 1-----"); - foreach (var sub in client1.GetSubscriptions().List()) - { - Console.WriteLine($"Found {sub.Data.DisplayName}"); - } - - Console.WriteLine("-----Client 2-----"); - foreach (var sub in client2.GetSubscriptions().List()) - { - Console.WriteLine($"Found {sub.Data.DisplayName}"); - } - - Debug.Assert(dummyPolicy1.numMsgGot * 2 == dummyPolicy2.numMsgGot); - Console.WriteLine("\nPASSED\n"); - - } - - private class dummyPolicy : HttpPipelineSynchronousPolicy - { - public int numMsgGot = 0; - - public override void OnReceivedResponse(HttpMessage message) - { - Interlocked.Increment(ref numMsgGot); - } - } - - private class dummyPolicy2 : HttpPipelineSynchronousPolicy - { - public int numMsgGot = 0; - - public override void OnReceivedResponse(HttpMessage message) - { - Interlocked.Add(ref numMsgGot, 2); - } - } - - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateMultipleVms.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateMultipleVms.cs deleted file mode 100644 index 074906dd7351..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateMultipleVms.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Azure; -using Azure.Identity; -using Azure.ResourceManager.Core; -using Proto.Compute; -using Proto.Network; -using System; -using System.Collections.Generic; - -namespace Proto.Client -{ - class CreateMultipleVms : Scenario - { - public CreateMultipleVms() : base() { } - - public CreateMultipleVms(ScenarioContext context) : base(context) { } - - public override void Execute() - { - var client = new ArmClient(new DefaultAzureCredential()); - var subscription = client.GetSubscriptions().TryGet(Context.SubscriptionId); - - // Create Resource Group - Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; - CleanUp.Add(resourceGroup.Id); - - // Create AvailabilitySet - Console.WriteLine("--------Start create AvailabilitySet--------"); - var aset = resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; - - // Create VNet - Console.WriteLine("--------Start create VNet--------"); - string vnetName = Context.VmName + "_vnet"; - var vnet = resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; - - //create subnet - Console.WriteLine("--------Start create Subnet--------"); - var subnet = vnet.GetSubnets().Construct("10.0.0.0/24").CreateOrUpdate(Context.SubnetName).Value; - - //create network security group - Console.WriteLine("--------Start create NetworkSecurityGroup--------"); - _ = resourceGroup.GetNetworkSecurityGroups().Construct(80).CreateOrUpdate(Context.NsgName).Value; - - CreateVms(resourceGroup, aset, subnet); - - } - - private void CreateVms(ResourceGroup resourceGroup, AvailabilitySet aset, SubnetOperations subnet) - { - List> operations = new List>(); - for (int i = 0; i < 10; i++) - { - // Create Network Interface - Console.WriteLine("--------Start create Network Interface--------"); - var nic = resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_{i}_nic").Value; - - // Create VM - string num = i % 2 == 0 ? "-e" : "-o"; - string name = $"{Context.VmName}{i}{num}"; - Console.WriteLine("--------Start create VM {0}--------", i); - var vmOp = resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).StartCreateOrUpdate(name); - operations.Add(vmOp); - } - - foreach (var operation in operations) - { - var vm = operation.WaitForCompletionAsync().ConfigureAwait(false).GetAwaiter().GetResult().Value; - Console.WriteLine($"--------Finished creating VM {vm.Id.Name}"); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVMCheckLocation.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVMCheckLocation.cs deleted file mode 100644 index cbb4811ca22f..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVMCheckLocation.cs +++ /dev/null @@ -1,91 +0,0 @@ -using Azure.ResourceManager.Core; -using Proto.Compute; -using Proto.Network; -using System; -using System.Linq; -using Azure.Identity; - -namespace Proto.Client -{ - class CreateSingleVMCheckLocation : Scenario - { - public CreateSingleVMCheckLocation() : base() { } - - public CreateSingleVMCheckLocation(ScenarioContext context) : base(context) { } - - public override void Execute() - { - var client = new ArmClient(new DefaultAzureCredential()); - var subscription = client.GetSubscriptions().TryGet(Context.SubscriptionId); - - // Create Resource Group - Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; - CleanUp.Add(resourceGroup.Id); - Console.WriteLine("\nResource Group List Available Locations: "); - var loc = resourceGroup.ListAvailableLocations(); - foreach(var l in loc) - { - Console.WriteLine(l.DisplayName); - } - - // Create AvailabilitySet - Console.WriteLine("--------Start create AvailabilitySet--------"); - var aset = resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; - Console.WriteLine("\nAvailability Set List Available Locations: "); - loc = aset.ListAvailableLocations(); - foreach (var l in loc) - { - Console.WriteLine(l.DisplayName); - } - - // Create VNet - Console.WriteLine("--------Start create VNet--------"); - string vnetName = Context.VmName + "_vnet"; - var vnet = resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; - Console.WriteLine("\nVirtual Network List Available Locations: "); - loc = vnet.ListAvailableLocations(); - foreach (var l in loc) - { - Console.WriteLine(l.DisplayName); - } - - //create subnet - Console.WriteLine("--------Start create Subnet--------"); - var subnet = vnet.GetSubnets().Construct("10.0.0.0/24").CreateOrUpdate(Context.SubnetName).Value; - - //create network security group - Console.WriteLine("--------Start create NetworkSecurityGroup--------"); - var nsg = resourceGroup.GetNetworkSecurityGroups().Construct(80).CreateOrUpdate(Context.NsgName).Value; - Console.WriteLine("\nNetwork Security Group List Available Locations: "); - loc = nsg.ListAvailableLocations(); - foreach (var l in loc) - { - Console.WriteLine(l.DisplayName); - } - - // Create Network Interface - Console.WriteLine("--------Start create Network Interface--------"); - var nic = resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; - Console.WriteLine("\nNetwork Interface Container List Available Locations: "); - loc = nic.ListAvailableLocations(); - foreach (var l in loc) - { - Console.WriteLine(l.DisplayName); - } - - // Create VM - Console.WriteLine("--------Start create VM--------"); - var vm = resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).CreateOrUpdate(Context.VmName).Value; - Console.WriteLine("\nVirtual Machine List Available Locations: "); - loc = vm.ListAvailableLocations(); - foreach (var l in loc) - { - Console.WriteLine(l.DisplayName); - } - - Console.WriteLine("VM ID: " + vm.Id); - Console.WriteLine("--------Done create VM--------"); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVmExample.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVmExample.cs deleted file mode 100644 index 66daa0080f76..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVmExample.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Azure.ResourceManager.Core; -using Proto.Compute; -using Proto.Network; -using System; -using Azure.Identity; - -namespace Proto.Client -{ - class CreateSingleVmExample : Scenario - { - public CreateSingleVmExample() : base() { } - - public CreateSingleVmExample(ScenarioContext context) : base(context) { } - - public override void Execute() - { - var client = new ArmClient(new DefaultAzureCredential()); - var subscription = client.DefaultSubscription; - - // Create Resource Group - Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; - CleanUp.Add(resourceGroup.Id); - - // Create AvailabilitySet - Console.WriteLine("--------Start create AvailabilitySet--------"); - var aset = resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; - - // Create VNet - Console.WriteLine("--------Start create VNet--------"); - string vnetName = Context.VmName + "_vnet"; - var vnet = resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; - - //create subnet - Console.WriteLine("--------Start create Subnet async--------"); - var subnet = vnet.GetSubnets().Construct("10.0.0.0/24").CreateOrUpdate(Context.SubnetName).Value; - - //create network security group - Console.WriteLine("--------Start create NetworkSecurityGroup--------"); - _ = resourceGroup.GetNetworkSecurityGroups().Construct(80).CreateOrUpdate(Context.NsgName).Value; - - // Create Network Interface - Console.WriteLine("--------Start create Network Interface--------"); - var nic = resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; - - // Create VM - Console.WriteLine("--------Start create VM--------"); - var vm = resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).CreateOrUpdate(Context.VmName).Value; - - Console.WriteLine("VM ID: " + vm.Id); - Console.WriteLine("--------Done create VM--------"); - - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVmExampleAsync.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVmExampleAsync.cs deleted file mode 100644 index bcc7236a4738..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVmExampleAsync.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Azure.ResourceManager.Core; -using Proto.Compute; -using Proto.Network; -using System; -using Azure.Identity; - -namespace Proto.Client -{ - class CreateSingleVmExampleAsync : Scenario - { - public CreateSingleVmExampleAsync() : base() { } - - public CreateSingleVmExampleAsync(ScenarioContext context) : base(context) { } - - public override void Execute() - { - ExcuteAsync().ConfigureAwait(false).GetAwaiter().GetResult(); - } - - private async System.Threading.Tasks.Task ExcuteAsync() - { - var client = new ArmClient(new DefaultAzureCredential()); - var subscription = client.GetSubscriptions().TryGet(Context.SubscriptionId); - - // Create Resource Group - Console.WriteLine($"--------Start create group async {Context.RgName}--------"); - var resourceGroup = (await subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdateAsync(Context.RgName)).Value; - CleanUp.Add(resourceGroup.Id); - - // Create AvailabilitySet - Console.WriteLine("--------Start create AvailabilitySet async--------"); - var aset = (await resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdateAsync(Context.VmName + "_aSet")).Value; - - // Create VNet - Console.WriteLine("--------Start create VNet async--------"); - string vnetName = Context.VmName + "_vnet"; - var vnet = (await resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdateAsync(vnetName)).Value; - - //create subnet - Console.WriteLine("--------Start create Subnet async--------"); - var subnet = (await vnet.GetSubnets().Construct("10.0.0.0/24").CreateOrUpdateAsync(Context.SubnetName)).Value; - - //create network security group - Console.WriteLine("--------Start create NetworkSecurityGroup async--------"); - _ = (await resourceGroup.GetNetworkSecurityGroups().Construct(80).CreateOrUpdateAsync(Context.NsgName)).Value; - - // Create Network Interface - Console.WriteLine("--------Start create Network Interface async--------"); - var nic = (await resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).CreateOrUpdateAsync($"{Context.VmName}_nic")).Value; - - // Create VM - Console.WriteLine("--------Start create VM async--------"); - var vm = (await resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).CreateOrUpdateAsync(Context.VmName)).Value; - - Console.WriteLine("VM ID: " + vm.Id); - Console.WriteLine("--------Done create VM--------"); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateVMSS.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateVMSS.cs deleted file mode 100644 index 7043318d55df..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateVMSS.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Threading.Tasks; -using Azure.Identity; -using Azure.ResourceManager.Core; -using Proto.Compute; -using Proto.Network; - -namespace Proto.Client -{ - class CreateVMSS : Scenario - { - public override void Execute() - { - // TODO Not fully debugged yet around LoadBalancer - // ExecuteAsync().ConfigureAwait(false).GetAwaiter().GetResult(); - } - - private async Task ExecuteAsync() - { - var client = new ArmClient(ScenarioContext.AzureSdkSandboxId, new DefaultAzureCredential()); - - // Create Resource Group - Console.WriteLine($"--------Start StartCreate group {Context.RgName}--------"); - ResourceGroup resourceGroup = await client - .DefaultSubscription - .GetResourceGroups() - .Construct(Context.Loc) - .StartCreateOrUpdate(Context.RgName) - .WaitForCompletionAsync() - ; - CleanUp.Add(resourceGroup.Id); - - // Create VNet - Console.WriteLine("--------Start create VNet--------"); - string vnetName = Context.VmName + "_vnet"; - var vnet = resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; - - //create subnet - Console.WriteLine("--------Start create Subnet async--------"); - var subnet = vnet.GetSubnets().Construct("10.0.0.0/24").CreateOrUpdate(Context.SubnetName).Value; - - //create network security group - Console.WriteLine("--------Start create NetworkSecurityGroup--------"); - _ = resourceGroup.GetNetworkSecurityGroups().Construct(80).CreateOrUpdate(Context.NsgName).Value; - - // Create Network Interface - Console.WriteLine("--------Start create Network Interface--------"); - var nic = resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; - - - // Create Network Interface - Console.WriteLine("--------Start create Public IP--------"); - var publicIP = resourceGroup.GetPublicIpAddresss().Construct(resourceGroup.Data.Location).CreateOrUpdate($"{Context.VmName}_publicip").Value; - - // Create Network Interface - Console.WriteLine("--------Start create Load Balancer--------"); - var lbData = new LoadBalancerData(new Azure.ResourceManager.Network.Models.LoadBalancer() - { - Location = resourceGroup.Data.Location, - }); - var lb = resourceGroup.GetLoadBalancers().CreateOrUpdate($"{Context.VmName}_lb", lbData).Value; - - // Create VMSS - VirtualMachineScaleSet vmss = resourceGroup - .GetVirtualMachineScaleSet() - .Construct($"{Context.VmName}ScaleSet") - .WithRequiredLoadBalancer(lb.Id) - .WithRequiredPrimaryNetworkInterface("default", nic.Id, null, null) - //.WithUseLinuxImage("testvmss", "azureuser", "") - .WithUseWindowsImage($"{Context.VmName}Prefix", "azureuser", "") - .CreateOrUpdate($"{Context.VmName}ScaleSet"); - CleanUp.Add(vmss.Id); - - Console.WriteLine("\nDone all asserts passed ..."); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/DefaultSubscription.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/DefaultSubscription.cs deleted file mode 100644 index 4552153e39ed..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/DefaultSubscription.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Azure.Identity; -using Azure.ResourceManager.Core; -using System; - -namespace Proto.Client -{ - class DefaultSubscription : Scenario - { - public override void Execute() - { - var client = new ArmClient(Context.SubscriptionId, new DefaultAzureCredential()); - - var sub = client.DefaultSubscription; - - if (sub.Data.SubscriptionGuid != Context.SubscriptionId) - throw new Exception($"Didn't get back expected subscription. Got {sub.Data.SubscriptionGuid} expected {Context.SubscriptionId}"); - - Console.WriteLine("Found correct subscription"); - - // Note: check of default subscription without specifying subscription is dependent on the credentials - // used in constructuing the client. Removed this test as its outcome is unpredictable unless you - // always use the same credentials. - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/DeleteGeneric.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/DeleteGeneric.cs deleted file mode 100644 index d1ac0f0c5d78..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/DeleteGeneric.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Azure; -using Azure.ResourceManager.Core; -using Proto.Compute; -using System; -using Azure.Identity; - -namespace Proto.Client -{ - class DeleteGeneric : Scenario - { - public override void Execute() - { - var createVm = new CreateSingleVmExample(Context); - createVm.Execute(); - var client = new ArmClient(new DefaultAzureCredential()); - var sub = client.GetSubscriptions().TryGet(Context.SubscriptionId); - var rgOp = sub.GetResourceGroups().Get(Context.RgName).Value; - foreach(var genericOp in rgOp.GetVirtualMachines().ListAsGenericResource(Context.VmName)) - { - Console.WriteLine($"Deleting {genericOp.Id}"); - genericOp.Delete(); - } - - try - { - var vmOp = rgOp.GetVirtualMachines().Get(Context.VmName).Value; - Console.WriteLine($"Trying to get {vmOp.Id}"); - var response = vmOp.Get(); - } - catch(RequestFailedException e) when (e.Status == 404) - { - Console.WriteLine("Got 404 returned as expected"); - - } - - throw new InvalidOperationException("Failed"); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/GenericEntityLoop.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/GenericEntityLoop.cs deleted file mode 100644 index 3a8a5e644853..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/GenericEntityLoop.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Proto.Compute; -using Azure.ResourceManager.Core; -using System; -using Azure.Identity; - -namespace Proto.Client -{ - class GenericEntityLoop : Scenario - { - public override void Execute() - { - var createVm = new CreateSingleVmExample(Context); - createVm.Execute(); - - var client = new ArmClient(new DefaultAzureCredential()); - var sub = client.GetSubscriptions().TryGet(Context.SubscriptionId); - var rgOp = sub.GetResourceGroups().Get(Context.RgName).Value; - foreach(var entity in rgOp.GetVirtualMachines().List()) - { - Console.WriteLine($"{entity.Id.Name}"); - entity.StartAddTag("name", "Value"); - } - - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/GenericResourcesOperationsExample.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/GenericResourcesOperationsExample.cs deleted file mode 100644 index 9dbdf060888a..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/GenericResourcesOperationsExample.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Azure.ResourceManager.Core; -using Proto.Compute; -using Proto.Network; -using System; -using Azure.Identity; -using Azure.Core; - -namespace Proto.Client -{ - class GenericResourceOperationsExample : Scenario - { - public override void Execute() - { - ArmClientOptions clientOptions = new ArmClientOptions(); - var client = new ArmClient(new DefaultAzureCredential(), clientOptions); - var subscription = client.GetSubscriptions().TryGet(Context.SubscriptionId); - var rgOp = subscription.GetResourceGroups().Get(Context.RgName).Value; - var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; - var aset = resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; - string vnetName = Context.VmName + "_vnet"; - var vnet = resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; - foreach (var genericOp in rgOp.GetAvailabilitySets().ListAsGenericResource(Context.VmName)) - { - genericOp.Get(); - } - - foreach (var genericOp in rgOp.GetVirtualNetworks().ListAsGenericResource(Context.VmName)) - { - genericOp.Get(); - } - Console.WriteLine(clientOptions.ApiVersions.TryGetApiVersion(VirtualNetwork.ResourceType)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetByContainerAsync.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/GetByContainerAsync.cs deleted file mode 100644 index 610cddd86205..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetByContainerAsync.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Azure.ResourceManager.Core; -using Proto.Compute; -using Proto.Network; -using System; -using System.Diagnostics; -using System.Threading.Tasks; -using Azure.Identity; - -namespace Proto.Client -{ - class GetByContainersAsync: Scenario - { - public override void Execute() - { - ExecuteAsync().ConfigureAwait(false).GetAwaiter().GetResult(); - } - private async Task ExecuteAsync() - { - var createMultipleVms = new CreateMultipleVms(Context); - createMultipleVms.Execute(); - - var sub = new ArmClient(new DefaultAzureCredential()).GetSubscriptions().TryGet(Context.SubscriptionId); - var rg = sub.GetResourceGroups().Get(Context.RgName).Value; - var virtualMachineContainer = rg.GetVirtualMachines(); - await foreach (var response in virtualMachineContainer.ListAsync()) - { - var virtualMachine = await virtualMachineContainer.GetAsync(response.Data.Id.Name); - Debug.Assert(virtualMachine.Value.Data.Name.Equals(response.Data.Id.Name)); - } - var virtualNetworkContainer = rg.GetVirtualNetworks(); - await foreach (var response in virtualNetworkContainer.ListAsync()) - { - var virtualNetwork = await virtualNetworkContainer.GetAsync(response.Data.Id.Name); - Debug.Assert(virtualNetwork.Value.Data.Name.Equals(response.Data.Id.Name)); - await foreach (var subnetResponse in response.GetSubnets().ListAsync()) - { - var subnets = await response.GetSubnets().GetAsync(subnetResponse.Data.Name); - Debug.Assert(subnets.Value.Data.Name.Equals(subnetResponse.Data.Name)); - } - } - Console.WriteLine("\nDone all asserts passed ..."); - - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetByContainers.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/GetByContainers.cs deleted file mode 100644 index 430fbda8455b..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetByContainers.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Azure.ResourceManager.Core; -using Proto.Compute; -using Proto.Network; -using System; -using System.Diagnostics; -using Azure.Identity; - -namespace Proto.Client -{ - class GetByContainers: Scenario - { - public override void Execute() - { - var createMultipleVms = new CreateMultipleVms(Context); - createMultipleVms.Execute(); - - var sub = new ArmClient(new DefaultAzureCredential()).GetSubscriptions().TryGet(Context.SubscriptionId); - var rg = sub.GetResourceGroups().Get(Context.RgName).Value; - var virtualMachineContainer = rg.GetVirtualMachines(); - foreach (var response in virtualMachineContainer.List()) - { - var virtualMachine = virtualMachineContainer.Get(response.Data.Id.Name); - Debug.Assert(virtualMachine.Value.Data.Name.Equals(response.Data.Id.Name)); - } - var virtualNetworkContainer = rg.GetVirtualNetworks(); - foreach (var response in virtualNetworkContainer.List()) - { - var virtualNetwork = virtualNetworkContainer.Get(response.Data.Id.Name); - Debug.Assert(virtualNetwork.Value.Data.Name.Equals(response.Data.Id.Name)); - foreach (var subnetResponse in response.GetSubnets().List()) - { - var subnets = response.GetSubnets().Get(subnetResponse.Data.Name); - Debug.Assert(subnets.Value.Data.Name.Equals(subnetResponse.Data.Name)); - } - } - Console.WriteLine("\nDone all asserts passed ..."); - - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetFromOperations.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/GetFromOperations.cs deleted file mode 100644 index bcbecd7c1ca4..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetFromOperations.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Azure.Identity; -using Azure.ResourceManager.Core; -using Proto.Compute; -using Proto.Network; - -namespace Proto.Client -{ - class GetFromOperations : Scenario - { - public override void Execute() - { - var createVm = new CreateSingleVmExample(Context); - createVm.Execute(); - - var client = new ArmClient(new DefaultAzureCredential()); - var subscription = client.GetSubscriptions().TryGet(Context.SubscriptionId); - - var resourceGroup = subscription.GetResourceGroups().Get(Context.RgName).Value; - _ = resourceGroup.GetAvailabilitySets().Get(Context.VmName + "_aSet").Value; - var vnet = resourceGroup.GetVirtualNetworks().Get(Context.VmName + "_vnet").Value; - _ = vnet.GetSubnets().Get(Context.SubnetName).Value; - _ = resourceGroup.GetNetworkSecurityGroups().Get(Context.NsgName).Value; - _ = resourceGroup.GetNetworkInterfaces().Get($"{Context.VmName}_nic").Value; - _ = resourceGroup.GetVirtualMachines().Get(Context.VmName).Value; - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetSubscription.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/GetSubscription.cs deleted file mode 100644 index dca02e127202..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetSubscription.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Azure.ResourceManager.Core; -using System; -using System.Diagnostics; -using Azure.Identity; - -namespace Proto.Client -{ - class GetSubscription : Scenario - { - public override void Execute() - { - var sandboxId = "db1ab6f0-4769-4b27-930e-01e2ef9c123c"; - var expectDisplayName = "Azure SDK sandbox"; - var subOp = new ArmClient(new DefaultAzureCredential()).GetSubscriptions().TryGet(sandboxId); - Debug.Assert(expectDisplayName == subOp.Data.DisplayName); - Console.WriteLine("Passed, got " + subOp.Data.DisplayName); - - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetVMTaskExamples.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/GetVMTaskExamples.cs deleted file mode 100644 index 4212d7a7db5a..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetVMTaskExamples.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Network; -using Proto.Compute; -using Proto.Network; -using System; -using System.Linq; -using Azure.Identity; - -namespace Proto.Client -{ - class GetVMTaskExamples : Scenario - { - public GetVMTaskExamples() : base() { } - - public GetVMTaskExamples(ScenarioContext context) : base(context) { } - - public override void Execute() - { - var createVm = new CreateSingleVmExample(Context); - createVm.Execute(); - - var client = new ArmClient(new DefaultAzureCredential()); - var subscription = client.GetSubscriptions().TryGet(Context.SubscriptionId); - var resourceGroup = subscription.GetResourceGroups().Get(Context.RgName).Value; - var vmId = resourceGroup.GetVirtualMachines().Get(Context.VmName).Value.Id; - var vnId = resourceGroup.GetVirtualNetworks().Get(Context.VmName + "_vnet").Value.Id; - var subnetId = resourceGroup.GetVirtualNetworks().Get(Context.VmName + "_vnet").Value.GetSubnets().Get(Context.SubnetName).Value.Id; - var asId = resourceGroup.GetAvailabilitySets().Get(Context.VmName + "_aSet").Value.Id; - var nsgId = resourceGroup.GetNetworkSecurityGroups().Get(Context.NsgName).Value.Id; - var niId = resourceGroup.GetNetworkInterfaces().Get(Context.VmName + "_nic").Value.Id; - - var vmOps = client.GetVirtualMachineOperations(vmId); - Console.WriteLine("\nclient.GetVirtualMachineOperations(vmResourceId)"); - vmOps.PowerOff(); - Console.WriteLine("Option 1 vm is " + vmOps.Get().Value.Data.InstanceView.Statuses.Last().Code); - vmOps.PowerOn(); - Console.WriteLine("Option 1 vm is " + vmOps.Get().Value.Data.InstanceView.Statuses.Last().Code); - - var subnetOps = client.GetSubnetOperations(subnetId); - Console.WriteLine("Option 1 subnet is " + subnetOps.Id); - - var vnOps = client.GetVirtualNetworkOperations(vnId); - var nsgOps = client.GetNetworkSecurityGroupOperations(nsgId); - var niOps = client.GetNetworkInterfaceOperations(niId); - var asOps = client.GetAvailabilitySetOperations(asId); - - Console.WriteLine(vnOps.Id); - Console.WriteLine(nsgOps.Id); - Console.WriteLine(niOps.Id); - Console.WriteLine(asOps.Id); - - Console.WriteLine("Demo complete"); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/ListByNameExpanded.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/ListByNameExpanded.cs deleted file mode 100644 index 5d7388818c94..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/ListByNameExpanded.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Proto.Compute; -using Azure.ResourceManager.Core; -using Proto.Network; -using System; -using System.Threading.Tasks; -using Azure.Identity; - -namespace Proto.Client -{ - class List : Scenario - { - public override void Execute() - { - var createMultipleVms = new CreateMultipleVms(Context); - createMultipleVms.Execute(); - - var client = new ArmClient(new DefaultAzureCredential()); - var sub = client.GetSubscriptions().TryGet(Context.SubscriptionId); - var rg = sub.GetResourceGroups().Get(Context.RgName).Value; - foreach (var availabilitySet in rg.GetAvailabilitySets().ListAsGenericResource(Environment.UserName)) - { - Console.WriteLine($"--------AvailabilitySet operation id--------: {availabilitySet.Id}"); - } - - foreach (var vm in rg.GetVirtualMachines().ListAsGenericResource(Environment.UserName)) - { - Console.WriteLine($"--------VM operation id--------: {vm.Id}"); - } - - foreach (var networkInterface in rg.GetNetworkInterfaces().ListAsGenericResource(Environment.UserName)) - { - Console.WriteLine($"--------NetworkInterface operation id--------: {networkInterface.Id}"); - } - - foreach (var networkSecurityGroup in rg.GetNetworkSecurityGroups().ListAsGenericResource(Environment.UserName)) - { - Console.WriteLine($"--------NetworkSecurityGroup operation id--------: {networkSecurityGroup.Id}"); - } - - foreach (var VNet in rg.GetVirtualNetworks().ListAsGenericResource(Environment.UserName)) - { - Console.WriteLine($"--------VNet operation id--------: {VNet.Id}"); - } - - ExecuteAsync(rg).GetAwaiter().GetResult(); - - } - - private async Task ExecuteAsync(ResourceGroup rg) - { - await foreach (var availabilitySet in rg.GetAvailabilitySets().ListAsGenericResourceAsync(Environment.UserName)) - { - Console.WriteLine($"--------AvailabilitySet operation id--------: {availabilitySet.Id}"); - } - - await foreach (var vm in rg.GetVirtualMachines().ListAsGenericResourceAsync(Environment.UserName)) - { - Console.WriteLine($"--------VM operation id--------: {vm.Id}"); - } - - await foreach (var networkInterface in rg.GetNetworkInterfaces().ListAsGenericResourceAsync(Environment.UserName)) - { - Console.WriteLine($"--------NetworkInterface operation id--------: {networkInterface.Id}"); - } - - await foreach (var networkSecurityGroup in rg.GetNetworkSecurityGroups().ListAsGenericResourceAsync(Environment.UserName)) - { - Console.WriteLine($"--------NetworkSecurityGroup operation id--------: {networkSecurityGroup.Id}"); - } - - await foreach (var VNet in rg.GetVirtualNetworks().ListAsGenericResourceAsync(Environment.UserName)) - { - Console.WriteLine($"--------VNet operation id--------: {VNet.Id}"); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/NullDataValues.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/NullDataValues.cs deleted file mode 100644 index f9f567e0025f..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/NullDataValues.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Azure.ResourceManager.Core; -using Proto.Compute; -using Proto.Network; - -namespace Proto.Client -{ - class NullDataValues : Scenario - { - public override void Execute() - { - var resourceGroupData = new ResourceGroupData("East US"); - var nic = new Azure.ResourceManager.Network.Models.NetworkInterface(); - var networkInterfaceData = new NetworkInterfaceData(nic); - var aset = new Azure.ResourceManager.Compute.Models.AvailabilitySet("East US"); - var availabilitySet = new AvailabilitySetData(aset); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/RoleAssignment.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/RoleAssignment.cs deleted file mode 100644 index 18cd73a02a58..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/RoleAssignment.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Azure.ResourceManager.Core; -using Proto.Authorization; -using Proto.Compute; -using Proto.Network; -using System; -using Azure.Identity; - -namespace Proto.Client -{ - class RoleAssignment : Scenario - { - public override void Execute() - { - var client = new ArmClient(new DefaultAzureCredential()); - var subscription = client.GetSubscriptions().TryGet(Context.SubscriptionId); - - // Create Resource Group - Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; - CleanUp.Add(resourceGroup.Id); - - Console.WriteLine("--------Start create Assignment--------"); - var input = new RoleAssignmentCreateParameters($"/subscriptions/{Context.SubscriptionId}/resourceGroups/{Context.RgName}/providers/Microsoft.Authorization/roleDefinitions/{Context.RoleId}", Context.PrincipalId); - var assign = resourceGroup.GetRoleAssignments().Create(Guid.NewGuid().ToString(), input).Value; - Console.WriteLine("--------Done create Assignment--------"); - - assign = assign.Get().Value; - - // Create AvailabilitySet - Console.WriteLine("--------Start create AvailabilitySet--------"); - var aset = resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; - - // Create VNet - Console.WriteLine("--------Start create VNet--------"); - string vnetName = Context.VmName + "_vnet"; - var vnet = resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; - - //create subnet - Console.WriteLine("--------Start create Subnet--------"); - var subnet = vnet.GetSubnets().Construct("10.0.0.0/24").CreateOrUpdate(Context.SubnetName).Value; - - //create network security group - Console.WriteLine("--------Start create NetworkSecurityGroup--------"); - _ = resourceGroup.GetNetworkSecurityGroups().Construct(80).CreateOrUpdate(Context.NsgName).Value; - - // Create Network Interface - Console.WriteLine("--------Start create Network Interface--------"); - var nic = resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; - - // Create VM - Console.WriteLine("--------Start create VM--------"); - var vm = resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).CreateOrUpdate(Context.VmName).Value; - - Console.WriteLine("VM ID: " + vm.Id); - Console.WriteLine("--------Done create VM--------"); - - - Console.WriteLine("--------Start create Assignment--------"); - var input2 = new RoleAssignmentCreateParameters($"{vm.Id}/providers/Microsoft.Authorization/roleDefinitions/{Context.RoleId}", Context.PrincipalId); - var assign2 = vm.GetRoleAssignments().Create(Guid.NewGuid().ToString(), input2).Value; - Console.WriteLine("--------Done create Assignment--------"); - - assign2 = assign2.Get().Value; - Console.WriteLine($"Created assignment: '{assign.Data.Id}'"); - - - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/SetTagsOnVm.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/SetTagsOnVm.cs deleted file mode 100644 index 95dbb33ebc5f..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/SetTagsOnVm.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading.Tasks; -using Azure.Identity; -using Azure.ResourceManager.Core; -using Proto.Compute; - -namespace Proto.Client -{ - class SetTagsOnVm : Scenario - { - public override void Execute() - { - var createVm = new CreateSingleVmExample(Context); - createVm.Execute(); - - ExecuteAsync().ConfigureAwait(false).GetAwaiter().GetResult(); - } - - private void DumpDictionary(IDictionary dic) - { - Console.WriteLine(string.Join( - ", ", - dic.Select(kvp => kvp.Key + ":" + kvp.Value))); - } - - private async Task ExecuteAsync() - { - // Update Tag for a known resource - var client = new ArmClient(new DefaultAzureCredential()); - var sub = client.GetSubscriptions().TryGet(Context.SubscriptionId); - var rgOp = sub.GetResourceGroups().Get(Context.RgName).Value; - var vmOp = rgOp.GetVirtualMachines().Get(Context.VmName).Value; - - Console.WriteLine($"Adding tags to {vmOp.Id.Name}"); - - var vm = (await vmOp.StartAddTag("key1", "value1").WaitForCompletionAsync()).Value; - Debug.Assert(vm.Data.Tags.Where(x => x.Key.StartsWith("key")).Count() == 1); - DumpDictionary(vm.Data.Tags); - - vm = (await vm.StartAddTag("key2", "value2").WaitForCompletionAsync()).Value; - Debug.Assert(vm.Data.Tags.Where(x => x.Key.StartsWith("key")).Count() == 2); - DumpDictionary(vm.Data.Tags); - - vm = (await (await vmOp.StartAddTagAsync("key3", "value3")).WaitForCompletionAsync()).Value; - Debug.Assert(vm.Data.Tags.Where(x => x.Key.StartsWith("key")).Count() == 3); - DumpDictionary(vm.Data.Tags); - - vm = (await vm.StartAddTagAsync("key4", "value4")).WaitForCompletionAsync().Result.Value; - Debug.Assert(vm.Data.Tags.Where(x => x.Key.StartsWith("key")).Count() == 4); - DumpDictionary(vm.Data.Tags); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByLINQ.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByLINQ.cs deleted file mode 100644 index ad731911c42e..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByLINQ.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Proto.Compute; -using Azure.ResourceManager.Core; -using System; -using System.Linq; -using Azure.Identity; - -namespace Proto.Client -{ - class ShutdownVmsByLINQ : Scenario - { - public override void Execute() - { - var createMultipleVms = new CreateMultipleVms(Context); - createMultipleVms.Execute(); - - var client = new ArmClient(new DefaultAzureCredential()); - foreach (var subscription in client.GetSubscriptions().List()) - { - var vmList = subscription.ListVirtualMachines(); - foreach (var vm in vmList.Where(armResource => armResource.Data.Name.Contains("-o"))) - { - Console.WriteLine($"In subscription list: Stopping {vm.Id}"); - vm.PowerOff(); - Console.WriteLine($"In subscription list: Starting {vm.Id}"); - vm.PowerOn(); - } - } - - var sub = client.GetSubscriptions().TryGet(Context.SubscriptionId); - var resourceGroup = sub.GetResourceGroups().Get(Context.RgName).Value; - - resourceGroup.GetVirtualMachines().List().Select(vm => - { - var parts = vm.Id.Name.Split('-'); - var n = Convert.ToInt32(parts[0].Last()); - return (vm, n); - }) - .Where(tuple => tuple.n % 2 == 0) - .ToList() - .ForEach(tuple => - { - Console.WriteLine($"In resource group list: Stopping {tuple.vm.Id.Name}"); - tuple.vm.PowerOff(); - Console.WriteLine($"In resource group list: Starting {tuple.vm.Id.Name}"); - tuple.vm.PowerOn(); - }); - - - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByName.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByName.cs deleted file mode 100644 index d00b322af90f..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByName.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Proto.Compute; -using Azure.ResourceManager.Core; -using System; -using Azure.Identity; - -namespace Proto.Client -{ - class ShutdownVmsByName: Scenario - { - public override void Execute() - { - var createMultipleVms = new CreateMultipleVms(Context); - createMultipleVms.Execute(); - - var sub = new ArmClient(new DefaultAzureCredential()).GetSubscriptions().TryGet(Context.SubscriptionId); - - foreach(var armResource in sub.ListVirtualMachinesByName("-e")) - { - var vmOperations = VirtualMachineOperations.FromGeneric(armResource); - Console.WriteLine($"Stopping {vmOperations.Id.ResourceGroupName} : {armResource.Id.Name}"); - vmOperations.PowerOff(); - Console.WriteLine($"Starting {vmOperations.Id.ResourceGroupName} : {armResource.Id.Name}"); - vmOperations.PowerOn(); - } - - - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByNameAcrossResourceGroups.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByNameAcrossResourceGroups.cs deleted file mode 100644 index fa2adab87ec9..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByNameAcrossResourceGroups.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Proto.Compute; -using Azure.ResourceManager.Core; -using System; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using Azure.Identity; - -namespace Proto.Client -{ - class ShutdownVmsByNameAcrossResourceGroups : Scenario - { - public override void Execute() - { - int numberOfRgs = 2; - var context = Context; - for (int i = 0; i < numberOfRgs; i++) - { - var createMultipleVms = new CreateMultipleVms(context); - createMultipleVms.Execute(); - context = new ScenarioContext(); - } - - var subscription = new ArmClient(new DefaultAzureCredential()).GetSubscriptions().TryGet(Context.SubscriptionId); - - Regex reg = new Regex($"{Context.VmName}.*-e"); - Parallel.ForEach(subscription.ListVirtualMachines(), vm => - { - if (reg.IsMatch(vm.Id.Name)) - { - Console.WriteLine($"Stopping {vm.Id.ResourceGroupName} {vm.Id.Name}"); - vm.PowerOff(); - Console.WriteLine($"Starting {vm.Id.ResourceGroupName} {vm.Id.Name}"); - vm.PowerOn(); - } - }); - - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByNameAcrossSubscriptions.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByNameAcrossSubscriptions.cs deleted file mode 100644 index b2f53d363c80..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByNameAcrossSubscriptions.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Azure.ResourceManager.Compute; -using Proto.Compute; -using Azure.ResourceManager.Core; -using System; -using System.Threading.Tasks; -using Azure.Identity; - -namespace Proto.Client -{ - class ShutdownVmsByNameAcrossSubscriptions : Scenario - { - public async void ShutdownAsync() - { - var client = new ArmClient(new DefaultAzureCredential()); - - await foreach (var subscription in client.GetSubscriptions().ListAsync()) - { - await foreach (var armResource in subscription.ListVirtualMachinesByNameAsync("-e")) - { - var vmOperations = VirtualMachineOperations.FromGeneric(armResource); - await vmOperations.PowerOffAsync(); - await vmOperations.PowerOnAsync(); - } - } - } - - public async override void Execute() - { - #region SETUP - ScenarioContext[] contexts = new ScenarioContext[] { new ScenarioContext(), new ScenarioContext("c9cbd920-c00c-427c-852b-8aaf38badaeb") }; - ParallelOptions options = new ParallelOptions - { - MaxDegreeOfParallelism = 1 - }; - - Parallel.ForEach(contexts, options, context => - { - var createMultipleVms = new CreateMultipleVms(context); - createMultipleVms.Execute(); - }); - #endregion - - - var client = new ArmClient(new DefaultAzureCredential()); - foreach (var sub in client.GetSubscriptions().List()) - { - await foreach (var armResource in sub.ListVirtualMachinesByNameAsync("-e")) - { - var vmOperations = VirtualMachineOperations.FromGeneric(armResource); - Console.WriteLine($"Stopping {vmOperations.Id.SubscriptionId} {vmOperations.Id.ResourceGroupName} {vmOperations.Id.Name}"); - vmOperations.PowerOff(); - Console.WriteLine($"Starting {vmOperations.Id.SubscriptionId} {vmOperations.Id.ResourceGroupName} {vmOperations.Id.Name}"); - vmOperations.PowerOn(); - } - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByTag.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByTag.cs deleted file mode 100644 index 2dc398df5a43..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByTag.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Proto.Compute; -using Azure.ResourceManager.Core; -using System; -using System.Linq; -using Azure.Identity; - -namespace Proto.Client -{ - class ShutdownVmsByTag : Scenario - { - public override void Execute() - { - var createMultipleVms = new CreateMultipleVms(Context); - createMultipleVms.Execute(); - - var client = new ArmClient(new DefaultAzureCredential()); - var sub = client.GetSubscriptions().TryGet(Context.SubscriptionId); - var rg = sub.GetResourceGroups().Get(Context.RgName).Value; - - //set tags on random vms - Random rand = new Random(Environment.TickCount); - foreach (var generic in rg.GetVirtualMachines().ListAsGenericResource(Environment.UserName)) - { - var vm = VirtualMachineOperations.FromGeneric(generic); - if (rand.NextDouble() > 0.5) - { - Console.WriteLine("adding tag to {0}", vm.Id.Name); - vm.StartAddTag("tagkey", "tagvalue"); - } - } - - var filteredList = rg.GetVirtualMachines().List().Where(vm => - { - string value; - return (vm.Data.Tags.TryGetValue("tagkey", out value) && value == "tagvalue"); - }); - - foreach (var vm in filteredList) - { - Console.WriteLine("--------Stopping VM {0}--------", vm.Id.Name); - vm.PowerOff(); - Console.WriteLine("--------Starting VM {0}--------", vm.Id.Name); - vm.PowerOn(); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/SingletonVmssUpgrade.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/SingletonVmssUpgrade.cs deleted file mode 100644 index 00fd9c7c981a..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/SingletonVmssUpgrade.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Diagnostics; -using System.Threading.Tasks; -using Azure; -using Azure.Identity; -using Azure.ResourceManager.Core; -using Proto.Compute; -using Proto.Network; - -namespace Proto.Client -{ - class SingletonVmssUpgrade : Scenario - { - public override void Execute() - { - ExecuteAsync().ConfigureAwait(false).GetAwaiter().GetResult(); - } - - private async Task ExecuteAsync() - { - var client = new ArmClient(ScenarioContext.AzureSdkSandboxId, new DefaultAzureCredential()); - - // NOTE: due to full test involves creating LB which have another 3-5 resources needs to be in - // proto, this test relies on pre-created VMSS. - // 1. Follow instruction here (CLI), https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/quick-create-cli - // az group create --name azhang-test --location eastus - // az vmss create --resource-group azhang-test --name myScaleSet --image UbuntuLTS --upgrade-policy-mode automatic --admin-username azureuser --generate-ssh-keys - // 2. Initiate a rolling upgrade az vmss rolling-upgrade start -g azhang-test -n myScaleSet --debug - VirtualMachineScaleSet vmss1 = await client.DefaultSubscription - .GetResourceGroups().Get("azhang-test").Value - .GetVirtualMachineScaleSet().GetAsync("myScaleSet"); - - var ru = vmss1.GetRollingUpgrade().Get().Value; - Debug.Assert(ru.Data.Model != null); - - ru = ru.Get().Value; - Debug.Assert(ru.Data.Model != null); - - try - { - vmss1.GetRollingUpgrade().Cancel(); - } - catch (RequestFailedException e) when (e.Status == 409) - { - } - catch - { - throw; - } - - Console.WriteLine("Test case SingletonVmssUpgrade passed."); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartCreateSingleVmExample.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/StartCreateSingleVmExample.cs deleted file mode 100644 index 019481f5f341..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartCreateSingleVmExample.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Azure.ResourceManager.Core; -using Proto.Compute; -using Proto.Network; -using System; -using Azure.Identity; - -namespace Proto.Client -{ - class StartCreateSingleVmExample : Scenario - { - public StartCreateSingleVmExample() : base() { } - - public StartCreateSingleVmExample(ScenarioContext context) : base(context) { } - - public override void Execute() - { - ExcuteAsync().ConfigureAwait(false).GetAwaiter().GetResult(); - } - - private async System.Threading.Tasks.Task ExcuteAsync() - { - var client = new ArmClient(new DefaultAzureCredential()); - var subscription = client.GetSubscriptions().TryGet(Context.SubscriptionId); - - // Create Resource Group - Console.WriteLine($"--------Start StartCreate group {Context.RgName}--------"); - var resourceGroup = (await(subscription.GetResourceGroups().Construct(Context.Loc).StartCreateOrUpdate(Context.RgName)).WaitForCompletionAsync()).Value; - CleanUp.Add(resourceGroup.Id); - - // Create AvailabilitySet - Console.WriteLine("--------Start StartCreate AvailabilitySet async--------"); - var aset = (await(resourceGroup.GetAvailabilitySets().Construct("Aligned").StartCreateOrUpdate(Context.VmName + "_aSet")).WaitForCompletionAsync()).Value; - - // Create VNet - Console.WriteLine("--------Start StartCreate VNet--------"); - string vnetName = Context.VmName + "_vnet"; - var vnet = (await(resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").StartCreateOrUpdate(vnetName)).WaitForCompletionAsync()).Value; - - //create subnet - Console.WriteLine("--------Start StartCreate Subnet--------"); - var subnet = (await(vnet.GetSubnets().Construct("10.0.0.0/24").StartCreateOrUpdate(Context.SubnetName)).WaitForCompletionAsync()).Value; - - //create network security group - Console.WriteLine("--------Start StartCreate NetworkSecurityGroup--------"); - _ = (await(resourceGroup.GetNetworkSecurityGroups().Construct(80).StartCreateOrUpdate(Context.NsgName)).WaitForCompletionAsync()).Value; - - // Create Network Interface - Console.WriteLine("--------Start StartCreate Network Interface--------"); - var nic = (await(resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).StartCreateOrUpdate($"{Context.VmName}_nic")).WaitForCompletionAsync()).Value; - - // Create VM - Console.WriteLine("--------Start StartCreate VM --------"); - var vm = (await(resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).StartCreateOrUpdate(Context.VmName)).WaitForCompletionAsync()).Value; - - Console.WriteLine("VM ID: " + vm.Id); - Console.WriteLine("--------Done StartCreate VM--------"); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartCreateSingleVmExampleAsync.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/StartCreateSingleVmExampleAsync.cs deleted file mode 100644 index 872061332264..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartCreateSingleVmExampleAsync.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Azure.ResourceManager.Core; -using Proto.Compute; -using Proto.Network; -using System; -using Azure.Identity; - -namespace Proto.Client -{ - class StartCreateSingleVmExampleAsync : Scenario - { - public StartCreateSingleVmExampleAsync() : base() { } - - public StartCreateSingleVmExampleAsync(ScenarioContext context) : base(context) { } - - public override void Execute() - { - ExecuteAsync().ConfigureAwait(false).GetAwaiter().GetResult(); - } - private async System.Threading.Tasks.Task ExecuteAsync() - { - var client = new ArmClient(new DefaultAzureCredential()); - var subscription = client.GetSubscriptions().TryGet(Context.SubscriptionId); - - // Create Resource Group - Console.WriteLine($"--------Start StartCreate group async {Context.RgName}--------"); - var resourceGroup = (await (await subscription.GetResourceGroups().Construct(Context.Loc).StartCreateOrUpdateAsync(Context.RgName)).WaitForCompletionAsync()).Value; - CleanUp.Add(resourceGroup.Id); - - // Create AvailabilitySet - Console.WriteLine("--------Start StartCreate AvailabilitySet async--------"); - var aset = (await (await resourceGroup.GetAvailabilitySets().Construct("Aligned").StartCreateOrUpdateAsync(Context.VmName + "_aSet")).WaitForCompletionAsync()).Value; - - // Create VNet - Console.WriteLine("--------Start StartCreate VNet async--------"); - string vnetName = Context.VmName + "_vnet"; - var vnet = (await (await resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").StartCreateOrUpdateAsync(vnetName)).WaitForCompletionAsync()).Value; - - //create subnet - Console.WriteLine("--------Start StartCreate Subnet async--------"); - var subnet = (await (await vnet.GetSubnets().Construct("10.0.0.0/24").StartCreateOrUpdateAsync(Context.SubnetName)).WaitForCompletionAsync()).Value; - - //create network security group - Console.WriteLine("--------Start StartCreate NetworkSecurityGroup async--------"); - _ = (await (await resourceGroup.GetNetworkSecurityGroups().Construct(80).StartCreateOrUpdateAsync(Context.NsgName)).WaitForCompletionAsync()).Value; - - // Create Network Interface - Console.WriteLine("--------Start StartCreate Network Interface async--------"); - var nic = (await (await resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).StartCreateOrUpdateAsync($"{Context.VmName}_nic")).WaitForCompletionAsync()).Value; - - // Create VM - Console.WriteLine("--------Start StartCreate VM async--------"); - var vm = (await (await resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).StartCreateOrUpdateAsync(Context.VmName)).WaitForCompletionAsync()).Value; - - Console.WriteLine("VM ID: " + vm.Id); - Console.WriteLine("--------Done StartCreate VM--------"); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartFromVm.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/StartFromVm.cs deleted file mode 100644 index a88b279d5408..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartFromVm.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Azure.Identity; -using Azure.ResourceManager.Core; -using Proto.Compute; -using System; - -namespace Proto.Client -{ - class StartFromVm : Scenario - { - public override void Execute() - { - var createVm = new CreateSingleVmExample(Context); - createVm.Execute(); - var client = new ArmClient(new DefaultAzureCredential()); - - var id = $"/subscriptions/{Context.SubscriptionId}/resourceGroups/{Context.RgName}/providers/Microsoft.Compute/virtualMachines/{Context.VmName}"; - - //retrieve from lowest level, doesn't give ability to walk up and down the container structure - var vmOp = client.GetVirtualMachineOperations(id); - var vm = vmOp.Get().Value.Data; - Console.WriteLine($"Found VM {vm.Id}"); - - var sub = client.GetSubscriptions().TryGet(Context.SubscriptionId); - //retrieve from lowest level inside management package gives ability to walk up and down - var rg = sub.GetResourceGroups().Get(Context.RgName).Value; - var vm2 = rg.GetVirtualMachines().Get(Context.VmName).Value.Data; - Console.WriteLine($"Found VM {vm2.Id}"); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartStopVm.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/StartStopVm.cs deleted file mode 100644 index b3e93e52c8fe..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartStopVm.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Proto.Compute; -using Azure.ResourceManager.Core; -using System; -using Azure.Identity; - -namespace Proto.Client -{ - class StartStopVm : Scenario - { - public override void Execute() - { - var createVm = new CreateSingleVmExample(Context); - createVm.Execute(); - - var client = new ArmClient(new DefaultAzureCredential()); - var subscription = client.GetSubscriptions().TryGet(Context.SubscriptionId); - var resourceGroup = subscription.GetResourceGroups().Get(Context.RgName).Value; - var vm = resourceGroup.GetVirtualMachines().Get(Context.VmName).Value; - Console.WriteLine($"Found VM {Context.VmName}"); - Console.WriteLine("--------Stopping VM--------"); - vm.PowerOff(); - Console.WriteLine("--------Starting VM--------"); - vm.PowerOn(); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/SubscriptionExists.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/SubscriptionExists.cs deleted file mode 100644 index 6eea5bdca9fd..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/SubscriptionExists.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Azure.ResourceManager.Core; -using System; -using Azure.Identity; - -namespace Proto.Client -{ - class SubscriptionExists : Scenario - { - public override void Execute() - { - var client = new ArmClient(new DefaultAzureCredential()); - if(client.GetSubscriptions().DoesExist(Context.SubscriptionId)) - { - Console.WriteLine($"Found {Context.SubscriptionId}"); - } - else - { - throw new Exception($"Did not find {Context.SubscriptionId}"); - } - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/TenantResource.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/TenantResource.cs deleted file mode 100644 index f5f8c43237d6..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/TenantResource.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Azure.ResourceManager.Core; -using System; -using Proto.Billing; -using System.Diagnostics; -using Azure.Identity; - -namespace Proto.Client -{ - class TenantResource : Scenario - { - public override void Execute() - { - var client = new ArmClient(new DefaultAzureCredential()); - TenantOperations tenant = client.Tenant; - string testAccount = "9b84fb4c-c79a-4819-bd24-1e58f88885bd"; - // old value: "3984c6f4-2d2a-4b04-93ce-43cf4824b698:e2f1492a-a492-468d-909f-bf7fe6662c01_2019-05-31"; - // Note that the account may or may not be accessible, depending on your credentials - BillingAccountOperations billingAccountOperations = tenant.GetBillingAccountsOperations(testAccount); - var account = billingAccountOperations.Get(); - Debug.Assert(account.Value.Data.Name.Equals(testAccount)); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/UseParentLocation.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/UseParentLocation.cs deleted file mode 100644 index e28f3b1ce419..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/UseParentLocation.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Azure.ResourceManager.Core; -using Proto.Compute; -using Proto.Network; -using System; -using Azure.Identity; - -namespace Proto.Client -{ - class UseParentLocation : Scenario - { - public override void Execute() - { - var client = new ArmClient(new DefaultAzureCredential()); - var subscription = client.GetSubscriptions().TryGet(Context.SubscriptionId); - - // Create Resource Group - Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; - CleanUp.Add(resourceGroup.Id); - - // Create AvailabilitySet - Console.WriteLine("--------Start create AvailabilitySet--------"); - var aset = resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; - if (aset.Data.Location != Context.Loc) - throw new Exception($"aset was on the wrong location expected {Context.Loc} actual {aset.Data.Location}"); - - // Create VNet - Console.WriteLine("--------Start create VNet--------"); - string vnetName = Context.VmName + "_vnet"; - var vnet = resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; - if (vnet.Data.Location != Context.Loc) - throw new Exception($"vnet was on the wrong location expected {Context.Loc} actual {vnet.Data.Location}"); - - //create subnet - Console.WriteLine("--------Start create Subnet async--------"); - var subnet = vnet.GetSubnets().Construct("10.0.0.0/24").CreateOrUpdateAsync(Context.SubnetName).ConfigureAwait(false).GetAwaiter().GetResult().Value; - - //create network security group - Console.WriteLine("--------Start create NetworkSecurityGroup--------"); - var nsg = resourceGroup.GetNetworkSecurityGroups().Construct(80).CreateOrUpdate(Context.NsgName).Value; - if (nsg.Data.Location != Context.Loc) - throw new Exception($"nsg was on the wrong location expected {Context.Loc} actual {nsg.Data.Location}"); - - // Create Network Interface - Console.WriteLine("--------Start create Network Interface--------"); - var nic = resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; - if (nic.Data.Location != Context.Loc) - throw new Exception($"nic was on the wrong location expected {Context.Loc} actual {nic.Data.Location}"); - - // Create VM - Console.WriteLine("--------Start create VM--------"); - var vm = resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).CreateOrUpdate(Context.VmName).Value; - if (vm.Data.Location != Context.Loc) - throw new Exception($"vm was on the wrong location expected {Context.Loc} actual {vm.Data.Location}"); - - Console.WriteLine("VM ID: " + vm.Id); - Console.WriteLine("--------Done create VM--------"); - - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/VMImageTests.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/VMImageTests.cs deleted file mode 100644 index fbf0377e6bba..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/VMImageTests.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Linq; -using System.Threading.Tasks; -using Azure.Identity; -using Azure.ResourceManager.Core; -using Proto.Compute; - -namespace Proto.Client -{ - class VmImageTests : Scenario - { - public override void Execute() - { - var client = new ArmClient(new DefaultAzureCredential()); - Execute(client); - ExecuteAsync(client).ConfigureAwait(false).GetAwaiter().GetResult(); - } - - private void Execute(ArmClient client) - { - var subscription = client.DefaultSubscription; - - var defaultLocation = ((LocationData)Context.Loc).Name; - var defaultPublisher = "redhat"; - - Console.WriteLine($"--------Start listing all VMImage publishers at {defaultLocation}--------"); - foreach (var p in subscription.GetVmImages().ListPublishers(defaultLocation).Take(50)) - { - Console.WriteLine(p.Name); - } - - Console.WriteLine($"--------Start listing all VMImage offers for Publisher {defaultPublisher}--------"); - foreach (var o in subscription.GetVmImages().ListOffers(defaultLocation, defaultPublisher).Take(3)) - { - Console.WriteLine($"offer:\t{o.Name}"); - - foreach (var s in subscription.GetVmImages().ListSkus(defaultLocation, defaultPublisher, o.Name).Take(3)) - { - Console.WriteLine($"\tsku:\t{s.Name}"); - - foreach (var v in subscription.GetVmImages().ListVersions(defaultLocation, defaultPublisher, o.Name, s.Name).Take(2)) - { - Console.WriteLine($"\t\tversion:\t{v.Name}"); - - var vmImage = subscription.GetVmImages().Get( - defaultLocation, - defaultPublisher, - o.Name, - s.Name, - v.Name); - Console.WriteLine($"vmImage:\t\t\tVM Image:\t{vmImage.Value.Id}"); - } - } - } - - Console.WriteLine($"--------Start listing all VMExtensionImage offers for Publisher {defaultPublisher}--------"); - foreach (var t in subscription.GetVmExtensionImages().ListTypes(defaultLocation, defaultPublisher).Take(5)) - { - Console.WriteLine($"\tType:\t{t.Name}"); - - foreach (var v in subscription.GetVmExtensionImages().ListVersions(defaultLocation, defaultPublisher, t.Name).Take(5)) - { - Console.WriteLine($"\t\tOffer:\t{v.Name}"); - } - } - - if (!subscription.GetVmExtensionImages().DoesExist(defaultLocation, "Microsoft.Azure.Extensions", "DockerExtension", "1.2.0") - || subscription.GetVmExtensionImages().DoesExist(defaultLocation, "Microsoft.Azure.Extensions", "DockerExtension", "0.0.0")) - { - Console.WriteLine("!!!!!!! DoesExist check failed!"); - } - - if (subscription.GetVmExtensionImages().TryGet(defaultLocation, "Microsoft.Azure.Extensions", "DockerExtension", "1.2.0") == null - || subscription.GetVmExtensionImages().TryGet(defaultLocation, "Microsoft.Azure.Extensions", "DockerExtension", "0.0.0") != null) - { - Console.WriteLine("!!!!!!! DoesExist check failed!"); - } - - Console.WriteLine($"-------- All Sync VM image API test passed.--------"); - } - - private async Task ExecuteAsync (ArmClient client) - { - var subscription = client.DefaultSubscription; - - var defaultLocation = ((LocationData)Context.Loc).Name; - var defaultPublisher = "redhat"; - - Console.WriteLine($"--------Start listing all VMImage publishers at {defaultLocation}--------"); - foreach (var p in (await subscription.GetVmImages().ListPublishersAsync(defaultLocation)).Take(50)) - { - Console.WriteLine(p.Name); - } - - Console.WriteLine($"--------Start listing all VMImage offers for Publisher {defaultPublisher}--------"); - foreach (var o in (await subscription.GetVmImages().ListOffersAsync(defaultLocation, defaultPublisher)).Take(3)) - { - Console.WriteLine($"offer:\t{o.Name}"); - - foreach (var s in (await subscription.GetVmImages().ListSkusAsync(defaultLocation, defaultPublisher, o.Name)).Take(3)) - { - Console.WriteLine($"\tsku:\t{s.Name}"); - - foreach (var v in (await subscription.GetVmImages().ListVersionsAsync(defaultLocation, defaultPublisher, o.Name, s.Name)).Take(2)) - { - Console.WriteLine($"\t\tversion:\t{v.Name}"); - - var vmImage = await subscription.GetVmImages().GetAsync( - defaultLocation, - defaultPublisher, - o.Name, - s.Name, - v.Name); - Console.WriteLine($"vmImage:\t\t\tVM Image:\t{vmImage.Value.Id}"); - } - } - } - - Console.WriteLine($"--------Start listing all VMExtensionImage offers for Publisher {defaultPublisher}--------"); - foreach (var t in (await subscription.GetVmExtensionImages().ListTypesAsync(defaultLocation, defaultPublisher)).Take(5)) - { - Console.WriteLine($"\tType:\t{t.Name}"); - - foreach (var v in (await subscription.GetVmExtensionImages().ListVersionsAsync(defaultLocation, defaultPublisher, t.Name)).Take(5)) - { - Console.WriteLine($"\t\tOffer:\t{v.Name}"); - } - } - - if (!await subscription.GetVmExtensionImages().DoesExistAsync(defaultLocation, "Microsoft.Azure.Extensions", "DockerExtension", "1.2.0") - || await subscription.GetVmExtensionImages().DoesExistAsync(defaultLocation, "Microsoft.Azure.Extensions", "DockerExtension", "0.0.0")) - { - Console.WriteLine("!!!!!!! DoesExist check failed!"); - } - - if (await subscription.GetVmExtensionImages().TryGetAsync(defaultLocation, "Microsoft.Azure.Extensions", "DockerExtension", "1.2.0") == null - || await subscription.GetVmExtensionImages().TryGetAsync(defaultLocation, "Microsoft.Azure.Extensions", "DockerExtension", "0.0.0") != null) - { - Console.WriteLine("!!!!!!! DoesExist check failed!"); - } - - Console.WriteLine($"-------- All Async VM image API test passed.--------"); - } - } -} diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/VmModelBuilder.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/VmModelBuilder.cs deleted file mode 100644 index 96c3dfeec646..000000000000 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/VmModelBuilder.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Threading.Tasks; -using Azure.Identity; -using Proto.Compute; -using Azure.ResourceManager.Core; -using Proto.Network; -using Proto.Compute.Convenience; - -namespace Proto.Client -{ - class VmModelBuilder : Scenario - { - public override void Execute() - { - throw new NotImplementedException(); - } - - private Task CreateVmWithBuilderAsync() - { - var client = new ArmClient(new DefaultAzureCredential()); - var subscription = client.GetSubscriptions().TryGet(Context.SubscriptionId); - - // Create Resource Group - Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; - - // Create AvailabilitySet - Console.WriteLine("--------Start create AvailabilitySet--------"); - var aset = resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; - - // Create VNet - Console.WriteLine("--------Start create VNet--------"); - string vnetName = Context.VmName + "_vnet"; - var vnet = resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; - - //create subnet - Console.WriteLine("--------Start create Subnet--------"); - var nsg = resourceGroup.GetNetworkSecurityGroups().Construct(80).CreateOrUpdate(Context.NsgName).Value; - var subnet = vnet.GetSubnets().Construct("10.0.0.0/24").CreateOrUpdate(Context.SubnetName).Value; - - // Create Network Interface - Console.WriteLine("--------Start create Network Interface--------"); - var nic = resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; - - // Options: required parameters on in the constructor - VirtualMachineModelBuilder vmBuilder = new VirtualMachineModelBuilder( - resourceGroup.GetVirtualMachines(), - new VirtualMachineData(new Azure.ResourceManager.Compute.Models.VirtualMachine(Context.Loc))); ; - var vm = vmBuilder.UseWindowsImage("admin-user", "!@#$%asdfA") - .RequiredNetworkInterface(nic.Id) - .RequiredAvalabilitySet(aset.Id) - .CreateOrUpdate(Context.VmName).Value; - - return Task.FromResult(vm); - } - } -}