From cb819352fe4797a66c30c4c6f6b2eb6bab671179 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Fri, 13 Sep 2024 08:02:11 +0800 Subject: [PATCH] [Blueprint] Remove Blueprint 0.20.7-preview dependencies on released track 1 SDK and add Microsoft.Azure.PowerShell.Blueprint.Management.Sdk (#26036) * blueprint management sdk generated by autorest.csharp * blueprint management sdk generated by autorest.powershell * Update Assembly * Blueprint changelog * Update ChangeLog.md --------- Co-authored-by: Jin Lei <54836179+msJinLei@users.noreply.github.com> --- .../Blueprint.Management.Sdk.csproj | 13 + .../Customizations/Constants.cs | 56 + .../ManagementGroupArtifactsExtensions.cs | 206 +++ ...mentGroupAssignmentOperationsExtensions.cs | 104 ++ .../ManagementGroupAssignmentsExtentions.cs | 189 +++ .../ManagementGroupBlueprintsExtensions.cs | 185 +++ ...gementGroupPublishedArtifactsExtensions.cs | 116 ++ ...ementGroupPublishedBlueprintsExtensions.cs | 205 +++ .../SubscriptionArtifactsExtensions.cs | 206 +++ ...scriptionAssignmentOperationsExtensions.cs | 104 ++ .../SubscriptionAssignmentsExtensions.cs | 190 +++ .../SubscriptionBlueprintsExtensions.cs | 185 +++ ...ubscriptionPublishedArtifactsExtensions.cs | 116 ++ ...bscriptionPublishedBlueprintsExtensions.cs | 205 +++ .../Customizations/Models/Artifact.cs | 8 + .../Customizations/Models/Assignment.cs | 19 + .../Models/AzureResourceBase.cs | 11 + .../Models/OrdinalStringDictionary.cs | 16 + .../Generated/ArtifactsOperations.cs | 1105 ++++++++++++++ .../ArtifactsOperationsExtensions.cs | 239 +++ .../Generated/AssignmentOperations.cs | 654 +++++++++ .../AssignmentOperationsExtensions.cs | 145 ++ .../Generated/AssignmentsOperations.cs | 1287 +++++++++++++++++ .../AssignmentsOperationsExtensions.cs | 266 ++++ .../Generated/BlueprintManagementClient.cs | 362 +++++ .../Generated/BlueprintsOperations.cs | 1068 ++++++++++++++ .../BlueprintsOperationsExtensions.cs | 215 +++ .../Generated/IArtifactsOperations.cs | 164 +++ .../Generated/IAssignmentOperations.cs | 103 ++ .../Generated/IAssignmentsOperations.cs | 184 +++ .../Generated/IBlueprintManagementClient.cs | 97 ++ .../Generated/IBlueprintsOperations.cs | 152 ++ .../IPublishedArtifactsOperations.cs | 105 ++ .../IPublishedBlueprintsOperations.cs | 166 +++ .../Generated/Models/Artifact.cs | 49 + .../Generated/Models/ArtifactKind.cs | 20 + .../Generated/Models/Assignment.cs | 223 +++ .../Models/AssignmentDeleteBehavior.cs | 19 + .../Models/AssignmentDeploymentJob.cs | 108 ++ .../Models/AssignmentDeploymentJobResult.cs | 58 + .../Models/AssignmentJobCreatedResource.cs | 58 + .../Generated/Models/AssignmentLockMode.cs | 20 + .../Models/AssignmentLockSettings.cs | 87 ++ .../Generated/Models/AssignmentOperation.cs | 112 ++ .../Models/AssignmentOperationProperties.cs | 100 ++ .../Generated/Models/AssignmentProperties.cs | 164 +++ .../Models/AssignmentProvisioningState.cs | 27 + .../Generated/Models/AssignmentStatus.cs | 55 + .../Generated/Models/AzureResourceBase.cs | 68 + .../Models/AzureResourceManagerError.cs | 58 + .../Generated/Models/BlueprintModel.cs | 177 +++ ...rintResourcePropertiesBaseAutoGenerated.cs | 81 ++ .../Models/BlueprintResourceStatusBase.cs | 58 + .../Generated/Models/BlueprintStatus.cs | 45 + .../Generated/Models/BlueprintTargetScope.cs | 26 + .../Generated/Models/KeyVaultReference.cs | 62 + .../Models/ManagedServiceIdentity.cs | 98 ++ .../Models/ManagedServiceIdentityType.cs | 20 + .../Generated/Models/Page.cs | 43 + .../Generated/Models/ParameterDefinition.cs | 140 ++ .../Models/ParameterDefinitionMetadata.cs | 101 ++ .../Generated/Models/ParameterValue.cs | 75 + .../Models/PolicyAssignmentArtifact.cs | 157 ++ .../PolicyAssignmentArtifactProperties.cs | 145 ++ .../Generated/Models/PublishedBlueprint.cs | 183 +++ .../Models/ResourceGroupDefinition.cs | 151 ++ .../Generated/Models/ResourceGroupValue.cs | 79 + .../Models/ResourceProviderOperation.cs | 58 + .../ResourceProviderOperationDisplay.cs | 78 + .../Models/ResourceProviderOperationList.cs | 48 + .../Models/RoleAssignmentArtifact.cs | 150 ++ .../RoleAssignmentArtifactProperties.cs | 138 ++ .../Generated/Models/SecretValueReference.cs | 93 ++ .../Generated/Models/TemplateArtifact.cs | 157 ++ .../Models/TemplateArtifactProperties.cs | 145 ++ .../Generated/Models/TemplateParameterType.cs | 24 + .../Generated/Models/TrackedResource.cs | 72 + .../Generated/Models/UserAssignedIdentity.cs | 59 + .../Models/WhoIsBlueprintContract.cs | 50 + .../Generated/PublishedArtifactsOperations.cs | 672 +++++++++ .../PublishedArtifactsOperationsExtensions.cs | 153 ++ .../PublishedBlueprintsOperations.cs | 1105 ++++++++++++++ ...PublishedBlueprintsOperationsExtensions.cs | 241 +++ .../Properties/AssemblyInfo.cs | 26 + .../Blueprint.Management.Sdk/README.md | 97 ++ .../Blueprint.Test/Blueprint.Test.csproj | 4 +- src/Blueprint/Blueprint.sln | 65 +- src/Blueprint/Blueprint/Az.Blueprint.psd1 | 2 +- src/Blueprint/Blueprint/Blueprint.csproj | 2 +- src/Blueprint/Blueprint/ChangeLog.md | 2 + 90 files changed, 14717 insertions(+), 37 deletions(-) create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Blueprint.Management.Sdk.csproj create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Constants.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupArtifactsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupAssignmentOperationsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupAssignmentsExtentions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupBlueprintsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupPublishedArtifactsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupPublishedBlueprintsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionArtifactsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionAssignmentOperationsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionAssignmentsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionBlueprintsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionPublishedArtifactsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionPublishedBlueprintsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/Artifact.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/Assignment.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/AzureResourceBase.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/OrdinalStringDictionary.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/ArtifactsOperations.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentOperations.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentOperationsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentsOperations.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentsOperationsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/BlueprintManagementClient.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/BlueprintsOperations.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/BlueprintsOperationsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/IArtifactsOperations.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/IAssignmentOperations.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/IAssignmentsOperations.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/IBlueprintManagementClient.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/IBlueprintsOperations.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/IPublishedArtifactsOperations.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/IPublishedBlueprintsOperations.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/Artifact.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ArtifactKind.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/Assignment.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentDeleteBehavior.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentDeploymentJob.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentDeploymentJobResult.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentJobCreatedResource.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentLockMode.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentLockSettings.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentOperation.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentOperationProperties.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentProperties.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentProvisioningState.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentStatus.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AzureResourceBase.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AzureResourceManagerError.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintModel.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintResourcePropertiesBaseAutoGenerated.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintResourceStatusBase.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintStatus.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintTargetScope.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/KeyVaultReference.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ManagedServiceIdentity.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ManagedServiceIdentityType.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/Page.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ParameterDefinition.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ParameterDefinitionMetadata.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ParameterValue.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/PolicyAssignmentArtifact.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/PolicyAssignmentArtifactProperties.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/PublishedBlueprint.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceGroupDefinition.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceGroupValue.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceProviderOperation.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceProviderOperationDisplay.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceProviderOperationList.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/RoleAssignmentArtifact.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/RoleAssignmentArtifactProperties.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/SecretValueReference.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TemplateArtifact.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TemplateArtifactProperties.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TemplateParameterType.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TrackedResource.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/UserAssignedIdentity.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/Models/WhoIsBlueprintContract.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedArtifactsOperations.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedArtifactsOperationsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedBlueprintsOperations.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedBlueprintsOperationsExtensions.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/Properties/AssemblyInfo.cs create mode 100644 src/Blueprint/Blueprint.Management.Sdk/README.md diff --git a/src/Blueprint/Blueprint.Management.Sdk/Blueprint.Management.Sdk.csproj b/src/Blueprint/Blueprint.Management.Sdk/Blueprint.Management.Sdk.csproj new file mode 100644 index 000000000000..bf6a2e40eb14 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Blueprint.Management.Sdk.csproj @@ -0,0 +1,13 @@ + + + Blueprint + + + + netstandard2.0 + Microsoft.Azure.PowerShell.Blueprint.Management.Sdk + Microsoft.Azure.Management.Blueprint + $(NoWarn);CS0108;CS1573 + + + \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Constants.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Constants.cs new file mode 100644 index 000000000000..dab2ecfa7249 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Constants.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +namespace Microsoft.Azure.Management.Blueprint +{ + public static class Constants + { + public static class ResourceScopes + { + public const string SubscriptionScope = "/subscriptions/{0}"; + public const string ManagementGroupScope = "/providers/Microsoft.Management/managementGroups/{0}"; + + } + + /// + /// Allowed target scope of blueprint. + /// + public static class BlueprintTargetScopes + { + public const string Subscription = "subscription"; + } + + /// + /// allowed parameter types, align with Azure Resource Template + /// + public static class ParameterDefinitionTypes + { + public const string String = "string"; + public const string Int = "int"; + public const string Array = "array"; + public const string Bool = "bool"; + public const string Object = "object"; + public const string SecureString = "secureString"; + public const string SecureObject = "secureObject"; + } + + public static class ManagedServiceIdentityType + { + public const string SystemAssigned = "SystemAssigned"; + } + + public static class AssignmentProvisioningState + { + public const string Creating = "Creating"; + public const string Validating = "Validating"; + public const string Waiting = "Waiting"; + public const string Deploying = "Deploying"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + public const string Locking = "Locking"; + public const string Deleting = "Deleting"; + + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupArtifactsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupArtifactsExtensions.cs new file mode 100644 index 000000000000..0dcccf5e8424 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupArtifactsExtensions.cs @@ -0,0 +1,206 @@ +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ArtifactsOperations. + /// + public static partial class ManagementGroupArtifactsExtensions + { + /// + /// Create or update Blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// name of the artifact. + /// + /// + /// Blueprint artifact to save. + /// + public static Artifact CreateOrUpdateInManagementGroup(this IArtifactsOperations operations, string managementGroupName, string blueprintName, string artifactName, Artifact artifact) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.CreateOrUpdateAsync(scope, blueprintName, artifactName, artifact).GetAwaiter().GetResult(); + } + + /// + /// Create or update Blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// name of the artifact. + /// + /// + /// Blueprint artifact to save. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateInManagementGroupAsync(this IArtifactsOperations operations, string managementGroupName, string blueprintName, string artifactName, Artifact artifact, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, blueprintName, artifactName, artifact, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a Blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// name of the artifact. + /// + public static Artifact GetInManagementGroup(this IArtifactsOperations operations, string managementGroupName, string blueprintName, string artifactName) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.GetAsync(scope, blueprintName, artifactName).GetAwaiter().GetResult(); + } + + /// + /// Get a Blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// name of the artifact. + /// + /// + /// The cancellation token. + /// + public static async Task GetInManagementGroupAsync(this IArtifactsOperations operations, string managementGroupName, string blueprintName, string artifactName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.GetWithHttpMessagesAsync(scope, blueprintName, artifactName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a Blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// name of the artifact. + /// + public static Artifact DeleteInManagementGroup(this IArtifactsOperations operations, string managementGroupName, string blueprintName, string artifactName) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.DeleteAsync(scope, blueprintName, artifactName).GetAwaiter().GetResult(); + } + + /// + /// Delete a Blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// name of the artifact. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteInManagementGroupAsync(this IArtifactsOperations operations, string managementGroupName, string blueprintName, string artifactName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.DeleteWithHttpMessagesAsync(scope, blueprintName, artifactName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List artifacts for a given Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + public static IPage ListInManagementGroup(this IArtifactsOperations operations, string managementGroupName, string blueprintName) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.ListAsync(scope, blueprintName).GetAwaiter().GetResult(); + } + + /// + /// List artifacts for a given Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInManagementGroupAsync(this IArtifactsOperations operations, string managementGroupName, string blueprintName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.ListWithHttpMessagesAsync(scope, blueprintName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupAssignmentOperationsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupAssignmentOperationsExtensions.cs new file mode 100644 index 000000000000..e0fc5c5312b9 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupAssignmentOperationsExtensions.cs @@ -0,0 +1,104 @@ +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AssignmentOperations. + /// + public static partial class ManagementGroupAssignmentOperationsExtensions + { + /// + /// Lists Operations for given blueprint assignment within a management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group where the assignment is saved. + /// + /// + /// The name of the assignment. + /// + public static IPage ListInManagementGroup(this IAssignmentOperations operations, string managementGroupName, string assignmentName) + { + var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.ListAsync(resourceScope, assignmentName).GetAwaiter().GetResult(); + } + + /// + /// Lists Operations for given blueprint assignment within a management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group where the assignment is saved. + /// + /// + /// The name of the assignment. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInManagementGroupAsync(this IAssignmentOperations operations, string managementGroupName, string assignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.ListWithHttpMessagesAsync(resourceScope, assignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a Blueprint assignment operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group where the assignment is saved. + /// + /// + /// The name of the assignment. + /// + /// + /// The name of the assignment operation. + /// + public static AssignmentOperation GetInManagementGroup(this IAssignmentOperations operations, string managementGroupName, string assignmentName, string assignmentOperationName) + { + var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.GetAsync(resourceScope, assignmentName, assignmentOperationName).GetAwaiter().GetResult(); + } + + /// + /// Gets a Blueprint assignment operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group where the assignment is saved. + /// + /// + /// The name of the assignment. + /// + /// + /// The name of the assignment operation. + /// + /// + /// The cancellation token. + /// + public static async Task GetInManagementGroupAsync(this IAssignmentOperations operations, string managementGroupName, string assignmentName, string assignmentOperationName, CancellationToken cancellationToken = default(CancellationToken)) + { + var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.GetWithHttpMessagesAsync(resourceScope, assignmentName, assignmentOperationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} + diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupAssignmentsExtentions.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupAssignmentsExtentions.cs new file mode 100644 index 000000000000..60cca15e93e1 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupAssignmentsExtentions.cs @@ -0,0 +1,189 @@ +namespace Microsoft.Azure.Management.Blueprint.Customizations.Extensions +{ + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Azure.Management.Blueprint.Models; + using Microsoft.Rest.Azure; + + public static partial class ManagementGroupAssignmentsExtentions + { + /// + /// Creates or updates a Blueprint assignment in a management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group where the assignment will be saved. + /// + /// + /// The name of the assignment. + /// + /// + /// The assignment object to save. + /// + + public static Assignment CreateOrUpdateInManagementGroup(this IAssignmentsOperations operations, string managementGroupName, string assignmentName, Assignment assignment) + { + var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.CreateOrUpdateAsync(resourceScope, assignmentName, assignment).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Blueprint assignment in a management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group where the assignment will be saved. + /// + /// + /// The name of the assignment. + /// + /// + /// The assignment object to save. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateInManagementGroupAsync(this IAssignmentsOperations operations, string managementGroupName, string assignmentName, Assignment assignment, CancellationToken cancellationToken = default(CancellationToken)) + { + var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceScope, assignmentName, assignment, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a Blueprint assignment in a management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group where the assignment is saved. + /// + /// + /// The name of the assignment. + /// + public static Assignment GetInSubscription(this IAssignmentsOperations operations, string managementGroupName, string assignmentName) + { + var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.GetInSubscriptionAsync(resourceScope, assignmentName).GetAwaiter().GetResult(); + } + + /// + /// Gets a Blueprint assignment in a management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group where the assignment is saved. + /// + /// + /// The name of the assignment. + /// + /// + /// The cancellation token. + /// + public static async Task GetInManagementGroupAsync(this IAssignmentsOperations operations, string managementGroupName, string assignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.GetWithHttpMessagesAsync(resourceScope, assignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Blueprint assignment in a management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group where the assignment is saved. + /// + /// + /// The name of the assignment. + /// + /// + /// If set to , this will delete all of the resources created by the assignment. + /// The default is to preserve resources with . + /// + public static Assignment DeleteInManagementGroup(this IAssignmentsOperations operations, string managementGroupName, string assignmentName, string assignmentDeleteBehavior = default(string)) + { + var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.DeleteAsync(resourceScope, assignmentName, assignmentDeleteBehavior).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Blueprint assignment in a management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group where the assignment is saved. + /// + /// + /// The name of the assignment. + /// + /// + /// If set to , this will delete all of the resources created by the assignment. + /// This functionality is disabled by default. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteInManagementGroupAsync(this IAssignmentsOperations operations, string managementGroupName, string assignmentName, string assignmentDeleteBehavior = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceScope, assignmentName, assignmentDeleteBehavior, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists Blueprint assignments within a management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group where the assignments are saved. + /// + public static IPage ListInManagementGroup(this IAssignmentsOperations operations, string managementGroupName) + { + var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.ListAsync(resourceScope).GetAwaiter().GetResult(); + } + + /// + /// Lists Blueprint assignments within a management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group where the assignments are saved. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInManagementGroupAsync(this IAssignmentsOperations operations, string managementGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.ListWithHttpMessagesAsync(resourceScope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} + diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupBlueprintsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupBlueprintsExtensions.cs new file mode 100644 index 000000000000..ba92c328c5dc --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupBlueprintsExtensions.cs @@ -0,0 +1,185 @@ +using Microsoft.Azure.Management.Blueprint.Models; +using Microsoft.Rest.Azure; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Management.Blueprint +{ + /// + /// Extension methods for BlueprintsOperations. + /// + public static partial class ManagementGroupBlueprintsExtensions + { + /// + /// Create or update Blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// Blueprint definition. + /// + public static BlueprintModel CreateOrUpdateInManagementGroup(this IBlueprintsOperations operations, string managementGroupName, string blueprintName, BlueprintModel blueprint) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.CreateOrUpdateAsync(scope, blueprintName, blueprint).GetAwaiter().GetResult(); + } + + /// + /// Create or update Blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// Blueprint definition. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateInManagementGroupAsync(this IBlueprintsOperations operations, string managementGroupName, string blueprintName, BlueprintModel blueprint, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, blueprintName, blueprint, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + public static BlueprintModel GetInManagementGroup(this IBlueprintsOperations operations, string managementGroupName, string blueprintName) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.GetAsync(scope, blueprintName).GetAwaiter().GetResult(); + } + + /// + /// Get a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// The cancellation token. + /// + public static async Task GetInManagementGroupAsync(this IBlueprintsOperations operations, string managementGroupName, string blueprintName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.GetWithHttpMessagesAsync(scope, blueprintName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + public static BlueprintModel DeleteInManagementGroup(this IBlueprintsOperations operations, string managementGroupName, string blueprintName) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.DeleteAsync(scope, blueprintName).GetAwaiter().GetResult(); + } + + /// + /// Delete a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteInManagementGroupAsync(this IBlueprintsOperations operations, string managementGroupName, string blueprintName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.DeleteWithHttpMessagesAsync(scope, blueprintName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + public static IPage ListInManagementGroup(this IBlueprintsOperations operations, string managementGroupName) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.ListAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// Create or update blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInManagementGroupAsync(this IBlueprintsOperations operations, string managementGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupPublishedArtifactsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupPublishedArtifactsExtensions.cs new file mode 100644 index 000000000000..7a6e96423d3f --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupPublishedArtifactsExtensions.cs @@ -0,0 +1,116 @@ +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PublishedArtifactsOperations. + /// + public static partial class ManagementGroupPublishedArtifactsExtensions + { + /// + /// Get an artifact for a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + /// + /// name of the artifact. + /// + public static Artifact GetInManagementGroup(this IPublishedArtifactsOperations operations, string managementGroupName, string blueprintName, string versionId, string artifactName) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.GetAsync(scope, blueprintName, versionId, artifactName).GetAwaiter().GetResult(); + } + + /// + /// Get an artifact for a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + /// + /// name of the artifact. + /// + /// + /// The cancellation token. + /// + public static async Task GetInManagementGroupAsync(this IPublishedArtifactsOperations operations, string managementGroupName, string blueprintName, string versionId, string artifactName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.GetWithHttpMessagesAsync(scope, blueprintName, versionId, artifactName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List artifacts for a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + public static IPage ListInManagementGroup(this IPublishedArtifactsOperations operations, string managementGroupName, string blueprintName, string versionId) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.ListAsync(scope, blueprintName, versionId).GetAwaiter().GetResult(); + } + + /// + /// List artifacts for a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInManagementGroupAsync(this IPublishedArtifactsOperations operations, string managementGroupName, string blueprintName, string versionId, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.ListWithHttpMessagesAsync(scope, blueprintName, versionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupPublishedBlueprintsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupPublishedBlueprintsExtensions.cs new file mode 100644 index 000000000000..89ee55aacb40 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/ManagementGroupPublishedBlueprintsExtensions.cs @@ -0,0 +1,205 @@ +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PublishedBlueprintsOperations. + /// + public static partial class ManagementGroupPublishedBlueprintsExtensions + { + /// + /// Publish a new version of the Blueprint with the latest artifacts. Published + /// Blueprints are immutable. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + public static PublishedBlueprint CreateInManagementGroup(this IPublishedBlueprintsOperations operations, string managementGroupName, string blueprintName, string versionId) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.CreateAsync(scope, blueprintName, versionId).GetAwaiter().GetResult(); + } + + /// + /// Publish a new version of the Blueprint with the latest artifacts. Published + /// Blueprints are immutable. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + /// + /// published blueprint object + /// + /// + /// The cancellation token. + /// + public static async Task CreateInManagementGroupAsync(this IPublishedBlueprintsOperations operations, string managementGroupName, string blueprintName, string versionId, PublishedBlueprint publishedBlueprint = default(PublishedBlueprint), CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.CreateWithHttpMessagesAsync(scope, blueprintName, versionId, publishedBlueprint, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + public static PublishedBlueprint GetInManagementGroup(this IPublishedBlueprintsOperations operations, string managementGroupName, string blueprintName, string versionId) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.GetAsync(scope, blueprintName, versionId).GetAwaiter().GetResult(); + } + + /// + /// Get a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + /// + /// The cancellation token. + /// + public static async Task GetInManagementGroupAsync(this IPublishedBlueprintsOperations operations, string managementGroupName, string blueprintName, string versionId, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.GetWithHttpMessagesAsync(scope, blueprintName, versionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + public static PublishedBlueprint DeleteInManagementGroup(this IPublishedBlueprintsOperations operations, string managementGroupName, string blueprintName, string versionId) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.DeleteAsync(scope, blueprintName, versionId).GetAwaiter().GetResult(); + } + + /// + /// Delete a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteInManagementGroupAsync(this IPublishedBlueprintsOperations operations, string managementGroupName, string blueprintName, string versionId, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.DeleteWithHttpMessagesAsync(scope, blueprintName, versionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List published versions of given Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + public static IPage ListInManagementGroup(this IPublishedBlueprintsOperations operations, string managementGroupName, string blueprintName) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + return operations.ListAsync(scope, blueprintName).GetAwaiter().GetResult(); + } + + /// + /// List published versions of given Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure managementGroup name, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInManagementGroupAsync(this IPublishedBlueprintsOperations operations, string managementGroupName, string blueprintName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName); + using (var _result = await operations.ListWithHttpMessagesAsync(scope, blueprintName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionArtifactsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionArtifactsExtensions.cs new file mode 100644 index 000000000000..85774455d4b7 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionArtifactsExtensions.cs @@ -0,0 +1,206 @@ +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ArtifactsOperations. + /// + public static partial class SubscriptionArtifactsExtensions + { + /// + /// Create or update Blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// name of the artifact. + /// + /// + /// Blueprint artifact to save. + /// + public static Artifact CreateOrUpdateInSubscription(this IArtifactsOperations operations, string subscriptionId, string blueprintName, string artifactName, Artifact artifact) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.CreateOrUpdateAsync(scope, blueprintName, artifactName, artifact).GetAwaiter().GetResult(); + } + + /// + /// Create or update Blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// name of the artifact. + /// + /// + /// Blueprint artifact to save. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateInSubscriptionAsync(this IArtifactsOperations operations, string subscriptionId, string blueprintName, string artifactName, Artifact artifact, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, blueprintName, artifactName, artifact, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a Blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// name of the artifact. + /// + public static Artifact GetInSubscription(this IArtifactsOperations operations, string subscriptionId, string blueprintName, string artifactName) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.GetAsync(scope, blueprintName, artifactName).GetAwaiter().GetResult(); + } + + /// + /// Get a Blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// name of the artifact. + /// + /// + /// The cancellation token. + /// + public static async Task GetInSubscriptionAsync(this IArtifactsOperations operations, string subscriptionId, string blueprintName, string artifactName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.GetWithHttpMessagesAsync(scope, blueprintName, artifactName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a Blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// name of the artifact. + /// + public static Artifact DeleteInSubscription(this IArtifactsOperations operations, string subscriptionId, string blueprintName, string artifactName) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.DeleteAsync(scope, blueprintName, artifactName).GetAwaiter().GetResult(); + } + + /// + /// Delete a Blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// name of the artifact. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteInSubscriptionAsync(this IArtifactsOperations operations, string subscriptionId, string blueprintName, string artifactName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.DeleteWithHttpMessagesAsync(scope, blueprintName, artifactName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List artifacts for a given Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + public static IPage ListInSubscription(this IArtifactsOperations operations, string subscriptionId, string blueprintName) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.ListAsync(scope, blueprintName).GetAwaiter().GetResult(); + } + + /// + /// List artifacts for a given Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInSubscriptionAsync(this IArtifactsOperations operations, string subscriptionId, string blueprintName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.ListWithHttpMessagesAsync(scope, blueprintName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionAssignmentOperationsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionAssignmentOperationsExtensions.cs new file mode 100644 index 000000000000..91defe071cec --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionAssignmentOperationsExtensions.cs @@ -0,0 +1,104 @@ +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AssignmentOperations. + /// + public static partial class SubscriptionAssignmentOperationsExtensions + { + /// + /// List Operations for given blueprint assignment within a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we assign the blueprint to. + /// + /// + /// name of the assignment. + /// + public static IPage ListInSubscription(this IAssignmentOperations operations, string subscriptionId, string assignmentName) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.ListAsync(scope, assignmentName).GetAwaiter().GetResult(); + } + + /// + /// List Operations for given blueprint assignment within a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we assign the blueprint to. + /// + /// + /// name of the assignment. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInSubscriptionAsync(this IAssignmentOperations operations, string subscriptionId, string assignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.ListWithHttpMessagesAsync(scope, assignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a Blueprint assignment operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we assign the blueprint to. + /// + /// + /// name of the assignment. + /// + /// + /// name of the assignment operation. + /// + public static AssignmentOperation GetInSubscription(this IAssignmentOperations operations, string subscriptionId, string assignmentName, string assignmentOperationName) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.GetAsync(scope, assignmentName, assignmentOperationName).GetAwaiter().GetResult(); + } + + /// + /// Get a Blueprint assignment operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we assign the blueprint to. + /// + /// + /// name of the assignment. + /// + /// + /// name of the assignment operation. + /// + /// + /// The cancellation token. + /// + public static async Task GetInSubscriptionAsync(this IAssignmentOperations operations, string subscriptionId, string assignmentName, string assignmentOperationName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.GetWithHttpMessagesAsync(scope, assignmentName, assignmentOperationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionAssignmentsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionAssignmentsExtensions.cs new file mode 100644 index 000000000000..b132a62be780 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionAssignmentsExtensions.cs @@ -0,0 +1,190 @@ +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AssignmentsOperations. + /// + public static partial class SubscriptionAssignmentsExtensions + { + /// + /// Create or update a Blueprint assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we assign the blueprint to. + /// + /// + /// name of the assignment. + /// + /// + /// assignment object to save. + /// + public static Assignment CreateOrUpdateInSubscription(this IAssignmentsOperations operations, string subscriptionId, string assignmentName, Assignment assignment) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.CreateOrUpdateAsync(scope, assignmentName, assignment).GetAwaiter().GetResult(); + } + + /// + /// Create or update a Blueprint assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we assign the blueprint to. + /// + /// + /// name of the assignment. + /// + /// + /// assignment object to save. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateInSubscriptionAsync(this IAssignmentsOperations operations, string subscriptionId, string assignmentName, Assignment assignment, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, assignmentName, assignment, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a Blueprint assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we assign the blueprint to. + /// + /// + /// name of the assignment. + /// + public static Assignment GetInSubscription(this IAssignmentsOperations operations, string subscriptionId, string assignmentName) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.GetInSubscriptionAsync(scope, assignmentName).GetAwaiter().GetResult(); + } + + /// + /// Get a Blueprint assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we assign the blueprint to. + /// + /// + /// name of the assignment. + /// + /// + /// The cancellation token. + /// + public static async Task GetInSubscriptionAsync(this IAssignmentsOperations operations, string subscriptionId, string assignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.GetWithHttpMessagesAsync(scope, assignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a Blueprint assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we assign the blueprint to. + /// + /// + /// name of the assignment. + /// + /// + /// If set to , this will delete all of the resources created by the assignment. + /// This functionality is disabled by default. + /// + public static Assignment DeleteInSubscription(this IAssignmentsOperations operations, string subscriptionId, string assignmentName, string assignmentDeleteBehavior = default(string)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.DeleteAsync(scope, assignmentName, assignmentDeleteBehavior).GetAwaiter().GetResult(); + } + + /// + /// Delete a Blueprint assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we assign the blueprint to. + /// + /// + /// name of the assignment. + /// + /// + /// If set to , this will delete all of the resources created by the assignment. + /// This functionality is disabled by default. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteInSubscriptionAsync(this IAssignmentsOperations operations, string subscriptionId, string assignmentName, string assignmentDeleteBehavior = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.DeleteWithHttpMessagesAsync(scope, assignmentName, assignmentDeleteBehavior, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List Blueprint assignments within a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we assign the blueprint to. + /// + public static IPage ListInSubscription(this IAssignmentsOperations operations, string subscriptionId) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.ListAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// List Blueprint assignments within a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we assign the blueprint to. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInSubscriptionAsync(this IAssignmentsOperations operations, string subscriptionId, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionBlueprintsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionBlueprintsExtensions.cs new file mode 100644 index 000000000000..5d816fc4254b --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionBlueprintsExtensions.cs @@ -0,0 +1,185 @@ +using Microsoft.Azure.Management.Blueprint.Models; +using Microsoft.Rest.Azure; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Management.Blueprint +{ + /// + /// Extension methods for BlueprintsOperations. + /// + public static partial class SubscriptionBlueprintsExtensions + { + /// + /// Create or update Blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// Blueprint definition. + /// + public static BlueprintModel CreateOrUpdateInSubscription(this IBlueprintsOperations operations, string subscriptionId, string blueprintName, BlueprintModel blueprint) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.CreateOrUpdateAsync(scope, blueprintName, blueprint).GetAwaiter().GetResult(); + } + + /// + /// Create or update Blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// Blueprint definition. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateInSubscriptionAsync(this IBlueprintsOperations operations, string subscriptionId, string blueprintName, BlueprintModel blueprint, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, blueprintName, blueprint, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + public static BlueprintModel GetInSubscription(this IBlueprintsOperations operations, string subscriptionId, string blueprintName) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.GetAsync(scope, blueprintName).GetAwaiter().GetResult(); + } + + /// + /// Get a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// The cancellation token. + /// + public static async Task GetInSubscriptionAsync(this IBlueprintsOperations operations, string subscriptionId, string blueprintName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.GetWithHttpMessagesAsync(scope, blueprintName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + public static BlueprintModel DeleteInSubscription(this IBlueprintsOperations operations, string subscriptionId, string blueprintName) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.DeleteAsync(scope, blueprintName).GetAwaiter().GetResult(); + } + + /// + /// Delete a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteInSubscriptionAsync(this IBlueprintsOperations operations, string subscriptionId, string blueprintName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.DeleteWithHttpMessagesAsync(scope, blueprintName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + public static IPage ListInSubscription(this IBlueprintsOperations operations, string subscriptionId) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.ListAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// Create or update blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInSubscriptionAsync(this IBlueprintsOperations operations, string subscriptionId, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionPublishedArtifactsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionPublishedArtifactsExtensions.cs new file mode 100644 index 000000000000..1d4fb9e83463 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionPublishedArtifactsExtensions.cs @@ -0,0 +1,116 @@ +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PublishedArtifactsOperations. + /// + public static partial class SubscriptionPublishedArtifactsExtensions + { + /// + /// Get an artifact for a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + /// + /// name of the artifact. + /// + public static Artifact GetInSubscription(this IPublishedArtifactsOperations operations, string subscriptionId, string blueprintName, string versionId, string artifactName) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.GetAsync(scope, blueprintName, versionId, artifactName).GetAwaiter().GetResult(); + } + + /// + /// Get an artifact for a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + /// + /// name of the artifact. + /// + /// + /// The cancellation token. + /// + public static async Task GetInSubscriptionAsync(this IPublishedArtifactsOperations operations, string subscriptionId, string blueprintName, string versionId, string artifactName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.GetWithHttpMessagesAsync(scope, blueprintName, versionId, artifactName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List artifacts for a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + public static IPage ListInSubscription(this IPublishedArtifactsOperations operations, string subscriptionId, string blueprintName, string versionId) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.ListAsync(scope, blueprintName, versionId).GetAwaiter().GetResult(); + } + + /// + /// List artifacts for a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInSubscriptionAsync(this IPublishedArtifactsOperations operations, string subscriptionId, string blueprintName, string versionId, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.ListWithHttpMessagesAsync(scope, blueprintName, versionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionPublishedBlueprintsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionPublishedBlueprintsExtensions.cs new file mode 100644 index 000000000000..7f0d58a73b9c --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Extensions/SubscriptionPublishedBlueprintsExtensions.cs @@ -0,0 +1,205 @@ +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PublishedBlueprintsOperations. + /// + public static partial class SubscriptionPublishedBlueprintsExtensions + { + /// + /// Publish a new version of the Blueprint with the latest artifacts. Published + /// Blueprints are immutable. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + public static PublishedBlueprint CreateInSubscription(this IPublishedBlueprintsOperations operations, string subscriptionId, string blueprintName, string versionId) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.CreateAsync(scope, blueprintName, versionId).GetAwaiter().GetResult(); + } + + /// + /// Publish a new version of the Blueprint with the latest artifacts. Published + /// Blueprints are immutable. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + /// + /// published blueprint object + /// + /// + /// The cancellation token. + /// + public static async Task CreateInSubscriptionAsync(this IPublishedBlueprintsOperations operations, string subscriptionId, string blueprintName, string versionId, PublishedBlueprint publishedBlueprint = default(PublishedBlueprint), CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.CreateWithHttpMessagesAsync(scope, blueprintName, versionId, publishedBlueprint, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + public static PublishedBlueprint GetInSubscription(this IPublishedBlueprintsOperations operations, string subscriptionId, string blueprintName, string versionId) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.GetAsync(scope, blueprintName, versionId).GetAwaiter().GetResult(); + } + + /// + /// Get a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + /// + /// The cancellation token. + /// + public static async Task GetInSubscriptionAsync(this IPublishedBlueprintsOperations operations, string subscriptionId, string blueprintName, string versionId, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.GetWithHttpMessagesAsync(scope, blueprintName, versionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + public static PublishedBlueprint DeleteInSubscription(this IPublishedBlueprintsOperations operations, string subscriptionId, string blueprintName, string versionId) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.DeleteAsync(scope, blueprintName, versionId).GetAwaiter().GetResult(); + } + + /// + /// Delete a published Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// version of the published blueprint. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteInSubscriptionAsync(this IPublishedBlueprintsOperations operations, string subscriptionId, string blueprintName, string versionId, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.DeleteWithHttpMessagesAsync(scope, blueprintName, versionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List published versions of given Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + public static IPage ListInSubscription(this IPublishedBlueprintsOperations operations, string subscriptionId, string blueprintName) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + return operations.ListAsync(scope, blueprintName).GetAwaiter().GetResult(); + } + + /// + /// List published versions of given Blueprint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// azure subscriptionId, which we save the blueprint to. + /// + /// + /// name of the blueprint. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInSubscriptionAsync(this IPublishedBlueprintsOperations operations, string subscriptionId, string blueprintName, CancellationToken cancellationToken = default(CancellationToken)) + { + var scope = string.Format(Constants.ResourceScopes.SubscriptionScope, subscriptionId); + using (var _result = await operations.ListWithHttpMessagesAsync(scope, blueprintName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/Artifact.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/Artifact.cs new file mode 100644 index 000000000000..02a80469b684 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/Artifact.cs @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +namespace Microsoft.Azure.Management.Blueprint.Models +{ + public abstract partial class Artifact : AzureResourceBase + { + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/Assignment.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/Assignment.cs new file mode 100644 index 000000000000..d8c4fb3897cf --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/Assignment.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +namespace Microsoft.Azure.Management.Blueprint.Models +{ + public partial class Assignment : TrackedResource + { + public bool IsTerminalState() + { + if (this.ProvisioningState == AssignmentProvisioningState.Succeeded || + this.ProvisioningState == AssignmentProvisioningState.Failed || + this.ProvisioningState == AssignmentProvisioningState.Canceled) + { + return true; + } + + return false; + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/AzureResourceBase.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/AzureResourceBase.cs new file mode 100644 index 000000000000..d50134cf2900 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/AzureResourceBase.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using Microsoft.Rest.Azure; + + public abstract partial class AzureResourceBase : IResource + { + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/OrdinalStringDictionary.cs b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/OrdinalStringDictionary.cs new file mode 100644 index 000000000000..70325ca09ca1 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Customizations/Models/OrdinalStringDictionary.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System; + using System.Collections.Generic; + + public class OrdinalStringDictionary : Dictionary + { + public OrdinalStringDictionary() + : base(StringComparer.OrdinalIgnoreCase) + { + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/ArtifactsOperations.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/ArtifactsOperations.cs new file mode 100644 index 000000000000..96af186823ae --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/ArtifactsOperations.cs @@ -0,0 +1,1105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// ArtifactsOperations operations. + /// + internal partial class ArtifactsOperations : Microsoft.Rest.IServiceOperations, IArtifactsOperations + { + /// + /// Initializes a new instance of the ArtifactsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ArtifactsOperations (BlueprintManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BlueprintManagementClient + /// + public BlueprintManagementClient Client { get; private set; } + + /// + /// Create or update blueprint artifact. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + /// + /// Blueprint artifact to create or update. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceScope, string blueprintName, string artifactName, Artifact artifact, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (artifact == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifact"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (blueprintName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "blueprintName"); + } + + if (artifactName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactName"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("blueprintName", blueprintName); + tracingParameters.Add("artifactName", artifactName); + + tracingParameters.Add("artifact", artifact); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts/{artifactName}").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{blueprintName}", System.Uri.EscapeDataString(blueprintName)); + _url = _url.Replace("{artifactName}", System.Uri.EscapeDataString(artifactName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(artifact != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(artifact, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get a blueprint artifact. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceScope, string blueprintName, string artifactName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (blueprintName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "blueprintName"); + } + + if (artifactName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactName"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("blueprintName", blueprintName); + tracingParameters.Add("artifactName", artifactName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts/{artifactName}").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{blueprintName}", System.Uri.EscapeDataString(blueprintName)); + _url = _url.Replace("{artifactName}", System.Uri.EscapeDataString(artifactName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete a blueprint artifact. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceScope, string blueprintName, string artifactName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (blueprintName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "blueprintName"); + } + + if (artifactName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactName"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("blueprintName", blueprintName); + tracingParameters.Add("artifactName", artifactName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts/{artifactName}").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{blueprintName}", System.Uri.EscapeDataString(blueprintName)); + _url = _url.Replace("{artifactName}", System.Uri.EscapeDataString(artifactName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List artifacts for a given blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceScope, string blueprintName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (blueprintName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "blueprintName"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("blueprintName", blueprintName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{blueprintName}", System.Uri.EscapeDataString(blueprintName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List artifacts for a given blueprint definition. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs new file mode 100644 index 000000000000..4bd317e9ee3d --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for ArtifactsOperations + /// + public static partial class ArtifactsOperationsExtensions + { + /// + /// Create or update blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + public static Artifact CreateOrUpdate(this IArtifactsOperations operations, string resourceScope, string blueprintName, string artifactName, Artifact artifact) + { + return ((IArtifactsOperations)operations).CreateOrUpdateAsync(resourceScope, blueprintName, artifactName, artifact).GetAwaiter().GetResult(); + } + + /// + /// Create or update blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IArtifactsOperations operations, string resourceScope, string blueprintName, string artifactName, Artifact artifact, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceScope, blueprintName, artifactName, artifact, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get a blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + public static Artifact Get(this IArtifactsOperations operations, string resourceScope, string blueprintName, string artifactName) + { + return ((IArtifactsOperations)operations).GetAsync(resourceScope, blueprintName, artifactName).GetAwaiter().GetResult(); + } + + /// + /// Get a blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IArtifactsOperations operations, string resourceScope, string blueprintName, string artifactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceScope, blueprintName, artifactName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete a blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + public static Artifact Delete(this IArtifactsOperations operations, string resourceScope, string blueprintName, string artifactName) + { + return ((IArtifactsOperations)operations).DeleteAsync(resourceScope, blueprintName, artifactName).GetAwaiter().GetResult(); + } + + /// + /// Delete a blueprint artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IArtifactsOperations operations, string resourceScope, string blueprintName, string artifactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceScope, blueprintName, artifactName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List artifacts for a given blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + public static Microsoft.Rest.Azure.IPage List(this IArtifactsOperations operations, string resourceScope, string blueprintName) + { + return ((IArtifactsOperations)operations).ListAsync(resourceScope, blueprintName).GetAwaiter().GetResult(); + } + + /// + /// List artifacts for a given blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IArtifactsOperations operations, string resourceScope, string blueprintName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceScope, blueprintName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List artifacts for a given blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IArtifactsOperations operations, string nextPageLink) + { + return ((IArtifactsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List artifacts for a given blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IArtifactsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentOperations.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentOperations.cs new file mode 100644 index 000000000000..baa981d38c75 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentOperations.cs @@ -0,0 +1,654 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// AssignmentOperations operations. + /// + internal partial class AssignmentOperations : Microsoft.Rest.IServiceOperations, IAssignmentOperations + { + /// + /// Initializes a new instance of the AssignmentOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AssignmentOperations (BlueprintManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BlueprintManagementClient + /// + public BlueprintManagementClient Client { get; private set; } + + /// + /// List operations for given blueprint assignment within a subscription or a + /// management group. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceScope, string assignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (assignmentName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "assignmentName"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("assignmentName", assignmentName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}/assignmentOperations").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{assignmentName}", System.Uri.EscapeDataString(assignmentName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get a blueprint assignment operation. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// Name of the blueprint assignment operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceScope, string assignmentName, string assignmentOperationName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (assignmentName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "assignmentName"); + } + + if (assignmentOperationName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "assignmentOperationName"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("assignmentName", assignmentName); + tracingParameters.Add("assignmentOperationName", assignmentOperationName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}/assignmentOperations/{assignmentOperationName}").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{assignmentName}", System.Uri.EscapeDataString(assignmentName)); + _url = _url.Replace("{assignmentOperationName}", System.Uri.EscapeDataString(assignmentOperationName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List operations for given blueprint assignment within a subscription or a + /// management group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentOperationsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentOperationsExtensions.cs new file mode 100644 index 000000000000..82a16e9acd74 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentOperationsExtensions.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for AssignmentOperations + /// + public static partial class AssignmentOperationsExtensions + { + /// + /// List operations for given blueprint assignment within a subscription or a + /// management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + public static Microsoft.Rest.Azure.IPage List(this IAssignmentOperations operations, string resourceScope, string assignmentName) + { + return ((IAssignmentOperations)operations).ListAsync(resourceScope, assignmentName).GetAwaiter().GetResult(); + } + + /// + /// List operations for given blueprint assignment within a subscription or a + /// management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IAssignmentOperations operations, string resourceScope, string assignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceScope, assignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get a blueprint assignment operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// Name of the blueprint assignment operation. + /// + public static AssignmentOperation Get(this IAssignmentOperations operations, string resourceScope, string assignmentName, string assignmentOperationName) + { + return ((IAssignmentOperations)operations).GetAsync(resourceScope, assignmentName, assignmentOperationName).GetAwaiter().GetResult(); + } + + /// + /// Get a blueprint assignment operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// Name of the blueprint assignment operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IAssignmentOperations operations, string resourceScope, string assignmentName, string assignmentOperationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceScope, assignmentName, assignmentOperationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List operations for given blueprint assignment within a subscription or a + /// management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IAssignmentOperations operations, string nextPageLink) + { + return ((IAssignmentOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List operations for given blueprint assignment within a subscription or a + /// management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IAssignmentOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentsOperations.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentsOperations.cs new file mode 100644 index 000000000000..0e5530945f39 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentsOperations.cs @@ -0,0 +1,1287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// AssignmentsOperations operations. + /// + internal partial class AssignmentsOperations : Microsoft.Rest.IServiceOperations, IAssignmentsOperations + { + /// + /// Initializes a new instance of the AssignmentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AssignmentsOperations (BlueprintManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BlueprintManagementClient + /// + public BlueprintManagementClient Client { get; private set; } + + /// + /// Create or update a blueprint assignment. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// Blueprint assignment object to save. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceScope, string assignmentName, Assignment assignment, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (assignment == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "assignment"); + } + if (assignment != null) + { + assignment.Validate(); + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (assignmentName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "assignmentName"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("assignmentName", assignmentName); + + tracingParameters.Add("assignment", assignment); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{assignmentName}", System.Uri.EscapeDataString(assignmentName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(assignment != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(assignment, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get a blueprint assignment. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceScope, string assignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (assignmentName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "assignmentName"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("assignmentName", assignmentName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{assignmentName}", System.Uri.EscapeDataString(assignmentName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete a blueprint assignment. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// When deleteBehavior=all, the resources that were created by the blueprint + /// assignment will be deleted. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceScope, string assignmentName, string deleteBehavior = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (assignmentName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "assignmentName"); + } + + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("assignmentName", assignmentName); + tracingParameters.Add("deleteBehavior", deleteBehavior); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{assignmentName}", System.Uri.EscapeDataString(assignmentName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (deleteBehavior != null) + { + _queryParameters.Add(string.Format("deleteBehavior={0}", System.Uri.EscapeDataString(deleteBehavior))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get Blueprints service SPN objectId + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> WhoIsBlueprintWithHttpMessagesAsync(string resourceScope, string assignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (assignmentName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "assignmentName"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("assignmentName", assignmentName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "WhoIsBlueprint", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}/WhoIsBlueprint").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{assignmentName}", System.Uri.EscapeDataString(assignmentName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List blueprint assignments within a subscription or a management group. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceScope, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List blueprint assignments within a subscription or a management group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentsOperationsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentsOperationsExtensions.cs new file mode 100644 index 000000000000..511c951d13c3 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/AssignmentsOperationsExtensions.cs @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for AssignmentsOperations + /// + public static partial class AssignmentsOperationsExtensions + { + /// + /// Create or update a blueprint assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + public static Assignment CreateOrUpdate(this IAssignmentsOperations operations, string resourceScope, string assignmentName, Assignment assignment) + { + return ((IAssignmentsOperations)operations).CreateOrUpdateAsync(resourceScope, assignmentName, assignment).GetAwaiter().GetResult(); + } + + /// + /// Create or update a blueprint assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IAssignmentsOperations operations, string resourceScope, string assignmentName, Assignment assignment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceScope, assignmentName, assignment, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get a blueprint assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + public static Assignment Get(this IAssignmentsOperations operations, string resourceScope, string assignmentName) + { + return ((IAssignmentsOperations)operations).GetAsync(resourceScope, assignmentName).GetAwaiter().GetResult(); + } + + /// + /// Get a blueprint assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IAssignmentsOperations operations, string resourceScope, string assignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceScope, assignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete a blueprint assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// When deleteBehavior=all, the resources that were created by the blueprint + /// assignment will be deleted. + /// + public static Assignment Delete(this IAssignmentsOperations operations, string resourceScope, string assignmentName, string deleteBehavior = default(string)) + { + return ((IAssignmentsOperations)operations).DeleteAsync(resourceScope, assignmentName, deleteBehavior).GetAwaiter().GetResult(); + } + + /// + /// Delete a blueprint assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// When deleteBehavior=all, the resources that were created by the blueprint + /// assignment will be deleted. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IAssignmentsOperations operations, string resourceScope, string assignmentName, string deleteBehavior = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceScope, assignmentName, deleteBehavior, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get Blueprints service SPN objectId + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + public static WhoIsBlueprintContract WhoIsBlueprint(this IAssignmentsOperations operations, string resourceScope, string assignmentName) + { + return ((IAssignmentsOperations)operations).WhoIsBlueprintAsync(resourceScope, assignmentName).GetAwaiter().GetResult(); + } + + /// + /// Get Blueprints service SPN objectId + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task WhoIsBlueprintAsync(this IAssignmentsOperations operations, string resourceScope, string assignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.WhoIsBlueprintWithHttpMessagesAsync(resourceScope, assignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List blueprint assignments within a subscription or a management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + public static Microsoft.Rest.Azure.IPage List(this IAssignmentsOperations operations, string resourceScope) + { + return ((IAssignmentsOperations)operations).ListAsync(resourceScope).GetAwaiter().GetResult(); + } + + /// + /// List blueprint assignments within a subscription or a management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IAssignmentsOperations operations, string resourceScope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceScope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List blueprint assignments within a subscription or a management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IAssignmentsOperations operations, string nextPageLink) + { + return ((IAssignmentsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List blueprint assignments within a subscription or a management group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IAssignmentsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/BlueprintManagementClient.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/BlueprintManagementClient.cs new file mode 100644 index 000000000000..28c86d5dcf6a --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/BlueprintManagementClient.cs @@ -0,0 +1,362 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// Azure Blueprints Client provides access to blueprint definitions, + /// assignments, and artifacts, and related blueprint operations. + /// + public partial class BlueprintManagementClient : Microsoft.Rest.ServiceClient, IBlueprintManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + /// + /// Gets or sets json serialization settings. + /// + public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; } + /// + /// Gets or sets json deserialization settings. + /// + public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; } + /// + /// Credentials needed for the client to connect to Azure. + /// + public Microsoft.Rest.ServiceClientCredentials Credentials { get; private set; } + + /// + /// The API version to use for this operation. + /// + public string ApiVersion { get; private set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set;} + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// /// value is 30. + /// + public int? LongRunningOperationRetryTimeout { get; set;} + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// /// set to true a unique x-ms-client-request-id value is generated and + /// /// included in each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set;} + + /// + /// Gets the IBlueprintsOperations + /// + public virtual IBlueprintsOperations Blueprints { get; private set; } + /// + /// Gets the IArtifactsOperations + /// + public virtual IArtifactsOperations Artifacts { get; private set; } + /// + /// Gets the IPublishedBlueprintsOperations + /// + public virtual IPublishedBlueprintsOperations PublishedBlueprints { get; private set; } + /// + /// Gets the IPublishedArtifactsOperations + /// + public virtual IPublishedArtifactsOperations PublishedArtifacts { get; private set; } + /// + /// Gets the IAssignmentsOperations + /// + public virtual IAssignmentsOperations Assignments { get; private set; } + /// + /// Gets the IAssignmentOperations + /// + public virtual IAssignmentOperations AssignmentOperations { get; private set; } + /// + /// Initializes a new instance of the BlueprintManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling BlueprintManagementClient.Dispose(). False: will not dispose provided httpClient + protected BlueprintManagementClient(System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the BlueprintManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected BlueprintManagementClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the BlueprintManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected BlueprintManagementClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the BlueprintManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected BlueprintManagementClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + this.BaseUri = baseUri; + } + /// + /// Initializes a new instance of the BlueprintManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected BlueprintManagementClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + + this.BaseUri = baseUri; + } + /// + /// Initializes a new instance of the BlueprintManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public BlueprintManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the BlueprintManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling BlueprintManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public BlueprintManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the BlueprintManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public BlueprintManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the BlueprintManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public BlueprintManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the BlueprintManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Thrown when a required parameter is null + /// + public BlueprintManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + + /// + /// Initializes client properties. + /// + private void Initialize() + { + this.Blueprints = new BlueprintsOperations(this); + this.Artifacts = new ArtifactsOperations(this); + this.PublishedBlueprints = new PublishedBlueprintsOperations(this); + this.PublishedArtifacts = new PublishedArtifactsOperations(this); + this.Assignments = new AssignmentsOperations(this); + this.AssignmentOperations = new AssignmentOperations(this); + this.BaseUri = new System.Uri("https://management.azure.com"); + this.ApiVersion = "2018-11-01-preview"; + this.AcceptLanguage = "en-US"; + this.LongRunningOperationRetryTimeout = 30; + this.GenerateClientRequestId = true; + SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List + { + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List + { + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicDeserializeJsonConverter("kind")); + CustomInitialize(); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter()); + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/BlueprintsOperations.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/BlueprintsOperations.cs new file mode 100644 index 000000000000..24fe1a9bf5cb --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/BlueprintsOperations.cs @@ -0,0 +1,1068 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// BlueprintsOperations operations. + /// + internal partial class BlueprintsOperations : Microsoft.Rest.IServiceOperations, IBlueprintsOperations + { + /// + /// Initializes a new instance of the BlueprintsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BlueprintsOperations (BlueprintManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BlueprintManagementClient + /// + public BlueprintManagementClient Client { get; private set; } + + /// + /// Create or update a blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Blueprint definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceScope, string blueprintName, BlueprintModel blueprint, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (blueprint == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "blueprint"); + } + if (blueprint != null) + { + blueprint.Validate(); + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (blueprintName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "blueprintName"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("blueprintName", blueprintName); + + tracingParameters.Add("blueprint", blueprint); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{blueprintName}", System.Uri.EscapeDataString(blueprintName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(blueprint != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(blueprint, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get a blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceScope, string blueprintName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (blueprintName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "blueprintName"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("blueprintName", blueprintName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{blueprintName}", System.Uri.EscapeDataString(blueprintName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete a blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceScope, string blueprintName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (blueprintName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "blueprintName"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("blueprintName", blueprintName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{blueprintName}", System.Uri.EscapeDataString(blueprintName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List blueprint definitions. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceScope, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprints").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List blueprint definitions. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/BlueprintsOperationsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/BlueprintsOperationsExtensions.cs new file mode 100644 index 000000000000..e37650e2cc0d --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/BlueprintsOperationsExtensions.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for BlueprintsOperations + /// + public static partial class BlueprintsOperationsExtensions + { + /// + /// Create or update a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + public static BlueprintModel CreateOrUpdate(this IBlueprintsOperations operations, string resourceScope, string blueprintName, BlueprintModel blueprint) + { + return ((IBlueprintsOperations)operations).CreateOrUpdateAsync(resourceScope, blueprintName, blueprint).GetAwaiter().GetResult(); + } + + /// + /// Create or update a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IBlueprintsOperations operations, string resourceScope, string blueprintName, BlueprintModel blueprint, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceScope, blueprintName, blueprint, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + public static BlueprintModel Get(this IBlueprintsOperations operations, string resourceScope, string blueprintName) + { + return ((IBlueprintsOperations)operations).GetAsync(resourceScope, blueprintName).GetAwaiter().GetResult(); + } + + /// + /// Get a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IBlueprintsOperations operations, string resourceScope, string blueprintName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceScope, blueprintName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + public static BlueprintModel Delete(this IBlueprintsOperations operations, string resourceScope, string blueprintName) + { + return ((IBlueprintsOperations)operations).DeleteAsync(resourceScope, blueprintName).GetAwaiter().GetResult(); + } + + /// + /// Delete a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IBlueprintsOperations operations, string resourceScope, string blueprintName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceScope, blueprintName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List blueprint definitions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + public static Microsoft.Rest.Azure.IPage List(this IBlueprintsOperations operations, string resourceScope) + { + return ((IBlueprintsOperations)operations).ListAsync(resourceScope).GetAwaiter().GetResult(); + } + + /// + /// List blueprint definitions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IBlueprintsOperations operations, string resourceScope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceScope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List blueprint definitions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IBlueprintsOperations operations, string nextPageLink) + { + return ((IBlueprintsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List blueprint definitions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IBlueprintsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/IArtifactsOperations.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/IArtifactsOperations.cs new file mode 100644 index 000000000000..6689df3d1d32 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/IArtifactsOperations.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// ArtifactsOperations operations. + /// + public partial interface IArtifactsOperations + { + /// + /// Create or update blueprint artifact. + /// + /// + /// Create or update blueprint artifact. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + /// + /// Blueprint artifact to create or update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceScope, string blueprintName, string artifactName, Artifact artifact, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a blueprint artifact. + /// + /// + /// Get a blueprint artifact. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceScope, string blueprintName, string artifactName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a blueprint artifact. + /// + /// + /// Delete a blueprint artifact. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceScope, string blueprintName, string artifactName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List artifacts for a given blueprint definition. + /// + /// + /// List artifacts for a given blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceScope, string blueprintName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List artifacts for a given blueprint definition. + /// + /// + /// List artifacts for a given blueprint definition. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/IAssignmentOperations.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/IAssignmentOperations.cs new file mode 100644 index 000000000000..ba6bbbe46176 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/IAssignmentOperations.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// AssignmentOperations operations. + /// + public partial interface IAssignmentOperations + { + /// + /// List operations for given blueprint assignment within a subscription or a + /// management group. + /// + /// + /// List operations for given blueprint assignment within a subscription or a + /// management group. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceScope, string assignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a blueprint assignment operation. + /// + /// + /// Get a blueprint assignment operation. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// Name of the blueprint assignment operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceScope, string assignmentName, string assignmentOperationName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List operations for given blueprint assignment within a subscription or a + /// management group. + /// + /// + /// List operations for given blueprint assignment within a subscription or a + /// management group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/IAssignmentsOperations.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/IAssignmentsOperations.cs new file mode 100644 index 000000000000..e0d2f814f78a --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/IAssignmentsOperations.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// AssignmentsOperations operations. + /// + public partial interface IAssignmentsOperations + { + /// + /// Create or update a blueprint assignment. + /// + /// + /// Create or update a blueprint assignment. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// Blueprint assignment object to save. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceScope, string assignmentName, Assignment assignment, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a blueprint assignment. + /// + /// + /// Get a blueprint assignment. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceScope, string assignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a blueprint assignment. + /// + /// + /// Delete a blueprint assignment. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// When deleteBehavior=all, the resources that were created by the blueprint + /// assignment will be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceScope, string assignmentName, string deleteBehavior = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get Blueprints service SPN objectId + /// + /// + /// Get Blueprints service SPN objectId + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> WhoIsBlueprintWithHttpMessagesAsync(string resourceScope, string assignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List blueprint assignments within a subscription or a management group. + /// + /// + /// List blueprint assignments within a subscription or a management group. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceScope, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List blueprint assignments within a subscription or a management group. + /// + /// + /// List blueprint assignments within a subscription or a management group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/IBlueprintManagementClient.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/IBlueprintManagementClient.cs new file mode 100644 index 000000000000..5dbccfa8b75a --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/IBlueprintManagementClient.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// Azure Blueprints Client provides access to blueprint definitions, + /// assignments, and artifacts, and related blueprint operations. + /// + public partial interface IBlueprintManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + Microsoft.Rest.ServiceClientCredentials Credentials { get;} + + + /// + /// The API version to use for this operation. + /// + string ApiVersion { get;} + + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set;} + + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set;} + + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// /// set to true a unique x-ms-client-request-id value is generated and + /// /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set;} + + + /// + /// Gets the IBlueprintsOperations + /// + IBlueprintsOperations Blueprints { get; } + + /// + /// Gets the IArtifactsOperations + /// + IArtifactsOperations Artifacts { get; } + + /// + /// Gets the IPublishedBlueprintsOperations + /// + IPublishedBlueprintsOperations PublishedBlueprints { get; } + + /// + /// Gets the IPublishedArtifactsOperations + /// + IPublishedArtifactsOperations PublishedArtifacts { get; } + + /// + /// Gets the IAssignmentsOperations + /// + IAssignmentsOperations Assignments { get; } + + /// + /// Gets the IAssignmentOperations + /// + IAssignmentOperations AssignmentOperations { get; } + + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/IBlueprintsOperations.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/IBlueprintsOperations.cs new file mode 100644 index 000000000000..5c7d367d44ff --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/IBlueprintsOperations.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// BlueprintsOperations operations. + /// + public partial interface IBlueprintsOperations + { + /// + /// Create or update a blueprint definition. + /// + /// + /// Create or update a blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Blueprint definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceScope, string blueprintName, BlueprintModel blueprint, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a blueprint definition. + /// + /// + /// Get a blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceScope, string blueprintName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a blueprint definition. + /// + /// + /// Delete a blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceScope, string blueprintName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List blueprint definitions. + /// + /// + /// List blueprint definitions. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceScope, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List blueprint definitions. + /// + /// + /// List blueprint definitions. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/IPublishedArtifactsOperations.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/IPublishedArtifactsOperations.cs new file mode 100644 index 000000000000..ead89ef859a0 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/IPublishedArtifactsOperations.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// PublishedArtifactsOperations operations. + /// + public partial interface IPublishedArtifactsOperations + { + /// + /// Get an artifact for a published blueprint definition. + /// + /// + /// Get an artifact for a published blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceScope, string blueprintName, string versionId, string artifactName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List artifacts for a version of a published blueprint definition. + /// + /// + /// List artifacts for a version of a published blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceScope, string blueprintName, string versionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List artifacts for a version of a published blueprint definition. + /// + /// + /// List artifacts for a version of a published blueprint definition. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/IPublishedBlueprintsOperations.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/IPublishedBlueprintsOperations.cs new file mode 100644 index 000000000000..fe815d880a76 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/IPublishedBlueprintsOperations.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// PublishedBlueprintsOperations operations. + /// + public partial interface IPublishedBlueprintsOperations + { + /// + /// Publish a new version of the blueprint definition with the latest + /// artifacts. Published blueprint definitions are immutable. + /// + /// + /// Publish a new version of the blueprint definition with the latest + /// artifacts. Published blueprint definitions are immutable. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// Published Blueprint to create or update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceScope, string blueprintName, string versionId, PublishedBlueprint publishedBlueprint = default(PublishedBlueprint), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a published version of a blueprint definition. + /// + /// + /// Get a published version of a blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceScope, string blueprintName, string versionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a published version of a blueprint definition. + /// + /// + /// Delete a published version of a blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceScope, string blueprintName, string versionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List published versions of given blueprint definition. + /// + /// + /// List published versions of given blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceScope, string blueprintName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List published versions of given blueprint definition. + /// + /// + /// List published versions of given blueprint definition. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/Artifact.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/Artifact.cs new file mode 100644 index 000000000000..3910921424b6 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/Artifact.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Represents a blueprint artifact. + /// + [Newtonsoft.Json.JsonObject("Artifact")] + public partial class Artifact : AzureResourceBase + { + /// + /// Initializes a new instance of the Artifact class. + /// + public Artifact() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Artifact class. + /// + + /// String Id used to locate any resource on Azure. + /// + + /// Type of this resource. + /// + + /// Name of this resource. + /// + public Artifact(string id = default(string), string type = default(string), string name = default(string)) + + : base(id, type, name) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ArtifactKind.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ArtifactKind.cs new file mode 100644 index 000000000000..cb8432980fd8 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ArtifactKind.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + + /// + /// Defines values for ArtifactKind. + /// + + + public static class ArtifactKind + { + public const string Template = "template"; + public const string RoleAssignment = "roleAssignment"; + public const string PolicyAssignment = "policyAssignment"; + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/Assignment.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/Assignment.cs new file mode 100644 index 000000000000..87850649c969 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/Assignment.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Represents a blueprint assignment. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Assignment : TrackedResource + { + /// + /// Initializes a new instance of the Assignment class. + /// + public Assignment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Assignment class. + /// + + /// String Id used to locate any resource on Azure. + /// + + /// Type of this resource. + /// + + /// Name of this resource. + /// + + /// The location of this blueprint assignment. + /// + + /// Managed identity for this blueprint assignment. + /// + + /// One-liner string explain this resource. + /// + + /// Multi-line explain this resource. + /// + + /// ID of the published version of a blueprint definition. + /// + + /// The target subscription scope of the blueprint assignment (format: + /// '/subscriptions/{subscriptionId}'). For management group level assignments, + /// the property is required. + /// + + /// Blueprint assignment parameter values. + /// + + /// Names and locations of resource group placeholders. + /// + + /// Status of blueprint assignment. This field is readonly. + /// + + /// Defines how resources deployed by a blueprint assignment are locked. + /// + + /// State of the blueprint assignment. + /// Possible values include: 'creating', 'validating', 'waiting', 'deploying', + /// 'cancelling', 'locking', 'succeeded', 'failed', 'canceled', 'deleting' + public Assignment(string location, ManagedServiceIdentity identity, System.Collections.Generic.IDictionary parameters, System.Collections.Generic.IDictionary resourceGroups, string id = default(string), string type = default(string), string name = default(string), string displayName = default(string), string description = default(string), string blueprintId = default(string), string scope = default(string), AssignmentStatus status = default(AssignmentStatus), AssignmentLockSettings locks = default(AssignmentLockSettings), string provisioningState = default(string)) + + : base(location, id, type, name) + { + this.Identity = identity; + this.DisplayName = displayName; + this.Description = description; + this.BlueprintId = blueprintId; + this.Scope = scope; + this.Parameters = parameters; + this.ResourceGroups = resourceGroups; + this.Status = status; + this.Locks = locks; + this.ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets managed identity for this blueprint assignment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identity")] + public ManagedServiceIdentity Identity {get; set; } + + /// + /// Gets or sets one-liner string explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets multi-line explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } + + /// + /// Gets or sets iD of the published version of a blueprint definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.blueprintId")] + public string BlueprintId {get; set; } + + /// + /// Gets or sets the target subscription scope of the blueprint assignment + /// (format: '/subscriptions/{subscriptionId}'). For management group level + /// assignments, the property is required. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.scope")] + public string Scope {get; set; } + + /// + /// Gets or sets blueprint assignment parameter values. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.parameters")] + public System.Collections.Generic.IDictionary Parameters {get; set; } + + /// + /// Gets or sets names and locations of resource group placeholders. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.resourceGroups")] + public System.Collections.Generic.IDictionary ResourceGroups {get; set; } + + /// + /// Gets status of blueprint assignment. This field is readonly. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public AssignmentStatus Status {get; private set; } + + /// + /// Gets or sets defines how resources deployed by a blueprint assignment are + /// locked. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.locks")] + public AssignmentLockSettings Locks {get; set; } + + /// + /// Gets state of the blueprint assignment. Possible values include: 'creating', 'validating', 'waiting', 'deploying', 'cancelling', 'locking', 'succeeded', 'failed', 'canceled', 'deleting' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (this.Identity == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Identity"); + } + if (this.Parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Parameters"); + } + if (this.ResourceGroups == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ResourceGroups"); + } + if (this.Identity != null) + { + this.Identity.Validate(); + } + if (this.DisplayName != null) + { + if (this.DisplayName.Length > 256) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "DisplayName", 256); + } + } + if (this.Description != null) + { + if (this.Description.Length > 500) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Description", 500); + } + } + + + if (this.Parameters != null) + { + foreach (var valueElement in this.Parameters.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + if (this.ResourceGroups != null) + { + foreach (var valueElement in this.ResourceGroups.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + + + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentDeleteBehavior.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentDeleteBehavior.cs new file mode 100644 index 000000000000..453db8b1da5c --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentDeleteBehavior.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + + /// + /// Defines values for AssignmentDeleteBehavior. + /// + + + public static class AssignmentDeleteBehavior + { + public const string None = "none"; + public const string All = "all"; + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentDeploymentJob.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentDeploymentJob.cs new file mode 100644 index 000000000000..a04ead9fd8dc --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentDeploymentJob.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Represents individual job in given blueprint assignment operation. + /// + public partial class AssignmentDeploymentJob + { + /// + /// Initializes a new instance of the AssignmentDeploymentJob class. + /// + public AssignmentDeploymentJob() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AssignmentDeploymentJob class. + /// + + /// Kind of job. + /// + + /// Name of the action performed in this job. + /// + + /// Id of this job. + /// + + /// State of this job. + /// + + /// Deployment job result. + /// + + /// Result of this deployment job for each retry. + /// + + /// Reference to deployment job resource id. + /// + public AssignmentDeploymentJob(string kind = default(string), string action = default(string), string jobId = default(string), string jobState = default(string), AssignmentDeploymentJobResult result = default(AssignmentDeploymentJobResult), System.Collections.Generic.IList history = default(System.Collections.Generic.IList), string requestUri = default(string)) + + { + this.Kind = kind; + this.Action = action; + this.JobId = jobId; + this.JobState = jobState; + this.Result = result; + this.History = history; + this.RequestUri = requestUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets kind of job. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "kind")] + public string Kind {get; set; } + + /// + /// Gets or sets name of the action performed in this job. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "action")] + public string Action {get; set; } + + /// + /// Gets or sets id of this job. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "jobId")] + public string JobId {get; set; } + + /// + /// Gets or sets state of this job. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "jobState")] + public string JobState {get; set; } + + /// + /// Gets or sets deployment job result. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "result")] + public AssignmentDeploymentJobResult Result {get; set; } + + /// + /// Gets or sets result of this deployment job for each retry. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "history")] + public System.Collections.Generic.IList History {get; set; } + + /// + /// Gets or sets reference to deployment job resource id. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "requestUri")] + public string RequestUri {get; set; } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentDeploymentJobResult.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentDeploymentJobResult.cs new file mode 100644 index 000000000000..a969148674e4 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentDeploymentJobResult.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Result of each individual deployment in a blueprint assignment. + /// + public partial class AssignmentDeploymentJobResult + { + /// + /// Initializes a new instance of the AssignmentDeploymentJobResult class. + /// + public AssignmentDeploymentJobResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AssignmentDeploymentJobResult class. + /// + + /// Contains error details if deployment job failed. + /// + + /// Resources created as result of the deployment job. + /// + public AssignmentDeploymentJobResult(AzureResourceManagerError error = default(AzureResourceManagerError), System.Collections.Generic.IList resources = default(System.Collections.Generic.IList)) + + { + this.Error = error; + this.Resources = resources; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets contains error details if deployment job failed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "error")] + public AzureResourceManagerError Error {get; set; } + + /// + /// Gets or sets resources created as result of the deployment job. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resources")] + public System.Collections.Generic.IList Resources {get; set; } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentJobCreatedResource.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentJobCreatedResource.cs new file mode 100644 index 000000000000..1dd3fcee0bc4 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentJobCreatedResource.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Azure resource created from deployment job. + /// + public partial class AssignmentJobCreatedResource : AzureResourceBase + { + /// + /// Initializes a new instance of the AssignmentJobCreatedResource class. + /// + public AssignmentJobCreatedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AssignmentJobCreatedResource class. + /// + + /// String Id used to locate any resource on Azure. + /// + + /// Type of this resource. + /// + + /// Name of this resource. + /// + + /// Additional properties in a dictionary. + /// + public AssignmentJobCreatedResource(string id = default(string), string type = default(string), string name = default(string), System.Collections.Generic.IDictionary properties = default(System.Collections.Generic.IDictionary)) + + : base(id, type, name) + { + this.Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets additional properties in a dictionary. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + public System.Collections.Generic.IDictionary Properties {get; set; } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentLockMode.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentLockMode.cs new file mode 100644 index 000000000000..f3332afee954 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentLockMode.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + + /// + /// Defines values for AssignmentLockMode. + /// + + + public static class AssignmentLockMode + { + public const string None = "None"; + public const string AllResourcesReadOnly = "AllResourcesReadOnly"; + public const string AllResourcesDoNotDelete = "AllResourcesDoNotDelete"; + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentLockSettings.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentLockSettings.cs new file mode 100644 index 000000000000..652b2cf4552f --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentLockSettings.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Defines how resources deployed by a blueprint assignment are locked. + /// + public partial class AssignmentLockSettings + { + /// + /// Initializes a new instance of the AssignmentLockSettings class. + /// + public AssignmentLockSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AssignmentLockSettings class. + /// + + /// Lock mode. + /// Possible values include: 'None', 'AllResourcesReadOnly', + /// 'AllResourcesDoNotDelete' + + /// List of AAD principals excluded from blueprint locks. Up to 5 principals + /// are permitted. + /// + + /// List of management operations that are excluded from blueprint locks. Up to + /// 200 actions are permitted. If the lock mode is set to + /// 'AllResourcesReadOnly', then the following actions are automatically + /// appended to 'excludedActions': '*/read', + /// 'Microsoft.Network/virtualNetworks/subnets/join/action' and + /// 'Microsoft.Authorization/locks/delete'. If the lock mode is set to + /// 'AllResourcesDoNotDelete', then the following actions are automatically + /// appended to 'excludedActions': 'Microsoft.Authorization/locks/delete'. + /// Duplicate actions will get removed. + /// + public AssignmentLockSettings(string mode = default(string), System.Collections.Generic.IList excludedPrincipals = default(System.Collections.Generic.IList), System.Collections.Generic.IList excludedActions = default(System.Collections.Generic.IList)) + + { + this.Mode = mode; + this.ExcludedPrincipals = excludedPrincipals; + this.ExcludedActions = excludedActions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets lock mode. Possible values include: 'None', 'AllResourcesReadOnly', 'AllResourcesDoNotDelete' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "mode")] + public string Mode {get; set; } + + /// + /// Gets or sets list of AAD principals excluded from blueprint locks. Up to 5 + /// principals are permitted. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "excludedPrincipals")] + public System.Collections.Generic.IList ExcludedPrincipals {get; set; } + + /// + /// Gets or sets list of management operations that are excluded from blueprint + /// locks. Up to 200 actions are permitted. If the lock mode is set to + /// 'AllResourcesReadOnly', then the following actions are automatically + /// appended to 'excludedActions': '*/read', + /// 'Microsoft.Network/virtualNetworks/subnets/join/action' and + /// 'Microsoft.Authorization/locks/delete'. If the lock mode is set to + /// 'AllResourcesDoNotDelete', then the following actions are automatically + /// appended to 'excludedActions': 'Microsoft.Authorization/locks/delete'. + /// Duplicate actions will get removed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "excludedActions")] + public System.Collections.Generic.IList ExcludedActions {get; set; } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentOperation.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentOperation.cs new file mode 100644 index 000000000000..5a1bd9875053 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentOperation.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Represents underlying deployment detail for each update to the blueprint + /// assignment. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class AssignmentOperation : AzureResourceBase + { + /// + /// Initializes a new instance of the AssignmentOperation class. + /// + public AssignmentOperation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AssignmentOperation class. + /// + + /// String Id used to locate any resource on Azure. + /// + + /// Type of this resource. + /// + + /// Name of this resource. + /// + + /// The published version of the blueprint definition used for the blueprint + /// assignment operation. + /// + + /// State of this blueprint assignment operation. + /// + + /// Create time of this blueprint assignment operation. + /// + + /// Start time of the underlying deployment. + /// + + /// Finish time of the overall underlying deployments. + /// + + /// List of jobs in this blueprint assignment operation. + /// + public AssignmentOperation(string id = default(string), string type = default(string), string name = default(string), string blueprintVersion = default(string), string assignmentState = default(string), string timeCreated = default(string), string timeStarted = default(string), string timeFinished = default(string), System.Collections.Generic.IList deployments = default(System.Collections.Generic.IList)) + + : base(id, type, name) + { + this.BlueprintVersion = blueprintVersion; + this.AssignmentState = assignmentState; + this.TimeCreated = timeCreated; + this.TimeStarted = timeStarted; + this.TimeFinished = timeFinished; + this.Deployments = deployments; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the published version of the blueprint definition used for the + /// blueprint assignment operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.blueprintVersion")] + public string BlueprintVersion {get; set; } + + /// + /// Gets or sets state of this blueprint assignment operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.assignmentState")] + public string AssignmentState {get; set; } + + /// + /// Gets or sets create time of this blueprint assignment operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.timeCreated")] + public string TimeCreated {get; set; } + + /// + /// Gets or sets start time of the underlying deployment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.timeStarted")] + public string TimeStarted {get; set; } + + /// + /// Gets or sets finish time of the overall underlying deployments. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.timeFinished")] + public string TimeFinished {get; set; } + + /// + /// Gets or sets list of jobs in this blueprint assignment operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.deployments")] + public System.Collections.Generic.IList Deployments {get; set; } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentOperationProperties.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentOperationProperties.cs new file mode 100644 index 000000000000..1d3ef12836ee --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentOperationProperties.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Properties of AssignmentOperation. + /// + public partial class AssignmentOperationProperties + { + /// + /// Initializes a new instance of the AssignmentOperationProperties class. + /// + public AssignmentOperationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AssignmentOperationProperties class. + /// + + /// The published version of the blueprint definition used for the blueprint + /// assignment operation. + /// + + /// State of this blueprint assignment operation. + /// + + /// Create time of this blueprint assignment operation. + /// + + /// Start time of the underlying deployment. + /// + + /// Finish time of the overall underlying deployments. + /// + + /// List of jobs in this blueprint assignment operation. + /// + public AssignmentOperationProperties(string blueprintVersion = default(string), string assignmentState = default(string), string timeCreated = default(string), string timeStarted = default(string), string timeFinished = default(string), System.Collections.Generic.IList deployments = default(System.Collections.Generic.IList)) + + { + this.BlueprintVersion = blueprintVersion; + this.AssignmentState = assignmentState; + this.TimeCreated = timeCreated; + this.TimeStarted = timeStarted; + this.TimeFinished = timeFinished; + this.Deployments = deployments; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the published version of the blueprint definition used for the + /// blueprint assignment operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "blueprintVersion")] + public string BlueprintVersion {get; set; } + + /// + /// Gets or sets state of this blueprint assignment operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "assignmentState")] + public string AssignmentState {get; set; } + + /// + /// Gets or sets create time of this blueprint assignment operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "timeCreated")] + public string TimeCreated {get; set; } + + /// + /// Gets or sets start time of the underlying deployment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "timeStarted")] + public string TimeStarted {get; set; } + + /// + /// Gets or sets finish time of the overall underlying deployments. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "timeFinished")] + public string TimeFinished {get; set; } + + /// + /// Gets or sets list of jobs in this blueprint assignment operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deployments")] + public System.Collections.Generic.IList Deployments {get; set; } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentProperties.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentProperties.cs new file mode 100644 index 000000000000..d5e7e395cbbb --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentProperties.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Detailed properties for a blueprint assignment. + /// + public partial class AssignmentProperties : BlueprintResourcePropertiesBaseAutoGenerated + { + /// + /// Initializes a new instance of the AssignmentProperties class. + /// + public AssignmentProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AssignmentProperties class. + /// + + /// One-liner string explain this resource. + /// + + /// Multi-line explain this resource. + /// + + /// ID of the published version of a blueprint definition. + /// + + /// The target subscription scope of the blueprint assignment (format: + /// '/subscriptions/{subscriptionId}'). For management group level assignments, + /// the property is required. + /// + + /// Blueprint assignment parameter values. + /// + + /// Names and locations of resource group placeholders. + /// + + /// Status of blueprint assignment. This field is readonly. + /// + + /// Defines how resources deployed by a blueprint assignment are locked. + /// + + /// State of the blueprint assignment. + /// Possible values include: 'creating', 'validating', 'waiting', 'deploying', + /// 'cancelling', 'locking', 'succeeded', 'failed', 'canceled', 'deleting' + public AssignmentProperties(System.Collections.Generic.IDictionary parameters, System.Collections.Generic.IDictionary resourceGroups, string displayName = default(string), string description = default(string), string blueprintId = default(string), string scope = default(string), AssignmentStatus status = default(AssignmentStatus), AssignmentLockSettings locks = default(AssignmentLockSettings), string provisioningState = default(string)) + + : base(displayName, description) + { + this.BlueprintId = blueprintId; + this.Scope = scope; + this.Parameters = parameters; + this.ResourceGroups = resourceGroups; + this.Status = status; + this.Locks = locks; + this.ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets iD of the published version of a blueprint definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "blueprintId")] + public string BlueprintId {get; set; } + + /// + /// Gets or sets the target subscription scope of the blueprint assignment + /// (format: '/subscriptions/{subscriptionId}'). For management group level + /// assignments, the property is required. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "scope")] + public string Scope {get; set; } + + /// + /// Gets or sets blueprint assignment parameter values. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public System.Collections.Generic.IDictionary Parameters {get; set; } + + /// + /// Gets or sets names and locations of resource group placeholders. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceGroups")] + public System.Collections.Generic.IDictionary ResourceGroups {get; set; } + + /// + /// Gets status of blueprint assignment. This field is readonly. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public AssignmentStatus Status {get; private set; } + + /// + /// Gets or sets defines how resources deployed by a blueprint assignment are + /// locked. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "locks")] + public AssignmentLockSettings Locks {get; set; } + + /// + /// Gets state of the blueprint assignment. Possible values include: 'creating', 'validating', 'waiting', 'deploying', 'cancelling', 'locking', 'succeeded', 'failed', 'canceled', 'deleting' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (this.Parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Parameters"); + } + if (this.ResourceGroups == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ResourceGroups"); + } + + + if (this.Parameters != null) + { + foreach (var valueElement in this.Parameters.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + if (this.ResourceGroups != null) + { + foreach (var valueElement in this.ResourceGroups.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + + + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentProvisioningState.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentProvisioningState.cs new file mode 100644 index 000000000000..04da0ada43ce --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentProvisioningState.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + + /// + /// Defines values for AssignmentProvisioningState. + /// + + + public static class AssignmentProvisioningState + { + public const string Creating = "creating"; + public const string Validating = "validating"; + public const string Waiting = "waiting"; + public const string Deploying = "deploying"; + public const string Cancelling = "cancelling"; + public const string Locking = "locking"; + public const string Succeeded = "succeeded"; + public const string Failed = "failed"; + public const string Canceled = "canceled"; + public const string Deleting = "deleting"; + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentStatus.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentStatus.cs new file mode 100644 index 000000000000..6838cc063d1f --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AssignmentStatus.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// The status of a blueprint assignment. This field is readonly. + /// + public partial class AssignmentStatus : BlueprintResourceStatusBase + { + /// + /// Initializes a new instance of the AssignmentStatus class. + /// + public AssignmentStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AssignmentStatus class. + /// + + /// Creation time of this blueprint definition. + /// + + /// Last modified time of this blueprint definition. + /// + + /// List of resources that were created by the blueprint assignment. + /// + public AssignmentStatus(System.DateTime? timeCreated = default(System.DateTime?), System.DateTime? lastModified = default(System.DateTime?), System.Collections.Generic.IList managedResources = default(System.Collections.Generic.IList)) + + : base(timeCreated, lastModified) + { + this.ManagedResources = managedResources; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets list of resources that were created by the blueprint assignment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "managedResources")] + public System.Collections.Generic.IList ManagedResources {get; private set; } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AzureResourceBase.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AzureResourceBase.cs new file mode 100644 index 000000000000..7c8e449aa3e9 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AzureResourceBase.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Common properties for all Azure resources. + /// + public partial class AzureResourceBase : Microsoft.Rest.Azure.IResource + { + /// + /// Initializes a new instance of the AzureResourceBase class. + /// + public AzureResourceBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureResourceBase class. + /// + + /// String Id used to locate any resource on Azure. + /// + + /// Type of this resource. + /// + + /// Name of this resource. + /// + public AzureResourceBase(string id = default(string), string type = default(string), string name = default(string)) + + { + this.Id = id; + this.Type = type; + this.Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets string Id used to locate any resource on Azure. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } + + /// + /// Gets type of this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } + + /// + /// Gets name of this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AzureResourceManagerError.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AzureResourceManagerError.cs new file mode 100644 index 000000000000..a2c83b9b55df --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/AzureResourceManagerError.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Error code and message + /// + public partial class AzureResourceManagerError + { + /// + /// Initializes a new instance of the AzureResourceManagerError class. + /// + public AzureResourceManagerError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureResourceManagerError class. + /// + + /// Error code. + /// + + /// Error message. + /// + public AzureResourceManagerError(string code = default(string), string message = default(string)) + + { + this.Code = code; + this.Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets error code. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } + + /// + /// Gets or sets error message. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintModel.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintModel.cs new file mode 100644 index 000000000000..500b4b65cad9 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintModel.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Represents a Blueprint definition. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class BlueprintModel : AzureResourceBase + { + /// + /// Initializes a new instance of the BlueprintModel class. + /// + public BlueprintModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BlueprintModel class. + /// + + /// String Id used to locate any resource on Azure. + /// + + /// Type of this resource. + /// + + /// Name of this resource. + /// + + /// One-liner string explain this resource. + /// + + /// Multi-line explain this resource. + /// + + /// Status of the blueprint. This field is readonly. + /// + + /// The scope where this blueprint definition can be assigned. + /// Possible values include: 'subscription', 'managementGroup' + + /// Parameters required by this blueprint definition. + /// + + /// Resource group placeholders defined by this blueprint definition. + /// + + /// Published versions of this blueprint definition. + /// + + /// Layout view of the blueprint definition for UI reference. + /// + public BlueprintModel(string id = default(string), string type = default(string), string name = default(string), string displayName = default(string), string description = default(string), BlueprintStatus status = default(BlueprintStatus), string targetScope = default(string), System.Collections.Generic.IDictionary parameters = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IDictionary resourceGroups = default(System.Collections.Generic.IDictionary), object versions = default(object), object layout = default(object)) + + : base(id, type, name) + { + this.DisplayName = displayName; + this.Description = description; + this.Status = status; + this.TargetScope = targetScope; + this.Parameters = parameters; + this.ResourceGroups = resourceGroups; + this.Versions = versions; + this.Layout = layout; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets one-liner string explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets multi-line explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } + + /// + /// Gets status of the blueprint. This field is readonly. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public BlueprintStatus Status {get; private set; } + + /// + /// Gets or sets the scope where this blueprint definition can be assigned. Possible values include: 'subscription', 'managementGroup' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetScope")] + public string TargetScope {get; set; } + + /// + /// Gets or sets parameters required by this blueprint definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.parameters")] + public System.Collections.Generic.IDictionary Parameters {get; set; } + + /// + /// Gets or sets resource group placeholders defined by this blueprint + /// definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.resourceGroups")] + public System.Collections.Generic.IDictionary ResourceGroups {get; set; } + + /// + /// Gets or sets published versions of this blueprint definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.versions")] + public object Versions {get; set; } + + /// + /// Gets or sets layout view of the blueprint definition for UI reference. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.layout")] + public object Layout {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.DisplayName != null) + { + if (this.DisplayName.Length > 256) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "DisplayName", 256); + } + } + if (this.Description != null) + { + if (this.Description.Length > 500) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Description", 500); + } + } + + + if (this.Parameters != null) + { + foreach (var valueElement in this.Parameters.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + if (this.ResourceGroups != null) + { + foreach (var valueElement in this.ResourceGroups.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintResourcePropertiesBaseAutoGenerated.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintResourcePropertiesBaseAutoGenerated.cs new file mode 100644 index 000000000000..04d26ac4999d --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintResourcePropertiesBaseAutoGenerated.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Shared properties between all blueprint resources. + /// + public partial class BlueprintResourcePropertiesBaseAutoGenerated + { + /// + /// Initializes a new instance of the BlueprintResourcePropertiesBaseAutoGenerated class. + /// + public BlueprintResourcePropertiesBaseAutoGenerated() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BlueprintResourcePropertiesBaseAutoGenerated class. + /// + + /// One-liner string explain this resource. + /// + + /// Multi-line explain this resource. + /// + public BlueprintResourcePropertiesBaseAutoGenerated(string displayName = default(string), string description = default(string)) + + { + this.DisplayName = displayName; + this.Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets one-liner string explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets multi-line explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.DisplayName != null) + { + if (this.DisplayName.Length > 256) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "DisplayName", 256); + } + } + if (this.Description != null) + { + if (this.Description.Length > 500) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Description", 500); + } + } + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintResourceStatusBase.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintResourceStatusBase.cs new file mode 100644 index 000000000000..e27213defa23 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintResourceStatusBase.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Shared status properties between all blueprint resources. + /// + public partial class BlueprintResourceStatusBase + { + /// + /// Initializes a new instance of the BlueprintResourceStatusBase class. + /// + public BlueprintResourceStatusBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BlueprintResourceStatusBase class. + /// + + /// Creation time of this blueprint definition. + /// + + /// Last modified time of this blueprint definition. + /// + public BlueprintResourceStatusBase(System.DateTime? timeCreated = default(System.DateTime?), System.DateTime? lastModified = default(System.DateTime?)) + + { + this.TimeCreated = timeCreated; + this.LastModified = lastModified; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets creation time of this blueprint definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "timeCreated")] + public System.DateTime? TimeCreated {get; private set; } + + /// + /// Gets last modified time of this blueprint definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lastModified")] + public System.DateTime? LastModified {get; private set; } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintStatus.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintStatus.cs new file mode 100644 index 000000000000..e497ffdc5725 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintStatus.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// The status of the blueprint. This field is readonly. + /// + public partial class BlueprintStatus : BlueprintResourceStatusBase + { + /// + /// Initializes a new instance of the BlueprintStatus class. + /// + public BlueprintStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BlueprintStatus class. + /// + + /// Creation time of this blueprint definition. + /// + + /// Last modified time of this blueprint definition. + /// + public BlueprintStatus(System.DateTime? timeCreated = default(System.DateTime?), System.DateTime? lastModified = default(System.DateTime?)) + + : base(timeCreated, lastModified) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintTargetScope.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintTargetScope.cs new file mode 100644 index 000000000000..ef455e39eedf --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/BlueprintTargetScope.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + + /// + /// Defines values for BlueprintTargetScope. + /// + + + public static class BlueprintTargetScope + { + /// + /// The blueprint targets a subscription during blueprint assignment. + /// + public const string Subscription = "subscription"; + /// + /// The blueprint targets a management group during blueprint assignment. This + /// is reserved for future use. + /// + public const string ManagementGroup = "managementGroup"; + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/KeyVaultReference.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/KeyVaultReference.cs new file mode 100644 index 000000000000..ca7b8c91a07a --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/KeyVaultReference.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Specifies the link to a Key Vault. + /// + public partial class KeyVaultReference + { + /// + /// Initializes a new instance of the KeyVaultReference class. + /// + public KeyVaultReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultReference class. + /// + + /// Azure resource ID of the Key Vault. + /// + public KeyVaultReference(string id) + + { + this.Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets azure resource ID of the Key Vault. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Id == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Id"); + } + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ManagedServiceIdentity.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ManagedServiceIdentity.cs new file mode 100644 index 000000000000..7e12d9c0bd80 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ManagedServiceIdentity.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Managed identity generic object. + /// + public partial class ManagedServiceIdentity + { + /// + /// Initializes a new instance of the ManagedServiceIdentity class. + /// + public ManagedServiceIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedServiceIdentity class. + /// + + /// Type of the managed identity. + /// Possible values include: 'None', 'SystemAssigned', 'UserAssigned' + + /// Azure Active Directory principal ID associated with this Identity. + /// + + /// ID of the Azure Active Directory. + /// + + /// The list of user-assigned managed identities associated with the resource. + /// Key is the Azure resource Id of the managed identity. + /// + public ManagedServiceIdentity(string type, string principalId = default(string), string tenantId = default(string), System.Collections.Generic.IDictionary userAssignedIdentities = default(System.Collections.Generic.IDictionary)) + + { + this.Type = type; + this.PrincipalId = principalId; + this.TenantId = tenantId; + this.UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets type of the managed identity. Possible values include: 'None', 'SystemAssigned', 'UserAssigned' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; set; } + + /// + /// Gets or sets azure Active Directory principal ID associated with this + /// Identity. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalId")] + public string PrincipalId {get; set; } + + /// + /// Gets or sets iD of the Azure Active Directory. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tenantId")] + public string TenantId {get; set; } + + /// + /// Gets or sets the list of user-assigned managed identities associated with + /// the resource. Key is the Azure resource Id of the managed identity. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userAssignedIdentities")] + public System.Collections.Generic.IDictionary UserAssignedIdentities {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Type == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Type"); + } + + + + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ManagedServiceIdentityType.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ManagedServiceIdentityType.cs new file mode 100644 index 000000000000..2b9d2561afe2 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ManagedServiceIdentityType.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + + /// + /// Defines values for ManagedServiceIdentityType. + /// + + + public static class ManagedServiceIdentityType + { + public const string None = "None"; + public const string SystemAssigned = "SystemAssigned"; + public const string UserAssigned = "UserAssigned"; + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/Page.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/Page.cs new file mode 100644 index 000000000000..497854bbbc7b --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/Page.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [Newtonsoft.Json.JsonObject] + public class Page : Microsoft.Rest.Azure.IPage + { + /// + /// Gets the link to the next page. + /// + [Newtonsoft.Json.JsonProperty("nextLink")] + public System.String NextPageLink { get; private set; } + + [Newtonsoft.Json.JsonProperty("value")] + private System.Collections.Generic.IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public System.Collections.Generic.IEnumerator GetEnumerator() + { + return (Items == null) ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ParameterDefinition.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ParameterDefinition.cs new file mode 100644 index 000000000000..a36b0f436cad --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ParameterDefinition.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Represent a parameter with constrains and metadata. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class ParameterDefinition + { + /// + /// Initializes a new instance of the ParameterDefinition class. + /// + public ParameterDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ParameterDefinition class. + /// + + /// Allowed data types for Resource Manager template parameters. + /// Possible values include: 'string', 'array', 'bool', 'int', 'object', + /// 'secureObject', 'secureString' + + /// Default Value for this parameter. + /// + + /// Array of allowed values for this parameter. + /// + + /// DisplayName of this parameter/resourceGroup. + /// + + /// Description of this parameter/resourceGroup. + /// + + /// StrongType for UI to render rich experience during blueprint assignment. + /// Supported strong types are resourceType, principalId and location. + /// + public ParameterDefinition(string type, object defaultValue = default(object), System.Collections.Generic.IList allowedValues = default(System.Collections.Generic.IList), string displayName = default(string), string description = default(string), string strongType = default(string)) + + { + this.Type = type; + this.DefaultValue = defaultValue; + this.AllowedValues = allowedValues; + this.DisplayName = displayName; + this.Description = description; + this.StrongType = strongType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets allowed data types for Resource Manager template parameters. Possible values include: 'string', 'array', 'bool', 'int', 'object', 'secureObject', 'secureString' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; set; } + + /// + /// Gets or sets default Value for this parameter. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "defaultValue")] + public object DefaultValue {get; set; } + + /// + /// Gets or sets array of allowed values for this parameter. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowedValues")] + public System.Collections.Generic.IList AllowedValues {get; set; } + + /// + /// Gets or sets displayName of this parameter/resourceGroup. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "metadata.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets description of this parameter/resourceGroup. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "metadata.description")] + public string Description {get; set; } + + /// + /// Gets or sets strongType for UI to render rich experience during blueprint + /// assignment. Supported strong types are resourceType, principalId and + /// location. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "metadata.strongType")] + public string StrongType {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Type == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Type"); + } + + + + if (this.DisplayName != null) + { + if (this.DisplayName.Length > 256) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "DisplayName", 256); + } + } + if (this.Description != null) + { + if (this.Description.Length > 500) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Description", 500); + } + } + if (this.StrongType != null) + { + if (this.StrongType.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "StrongType", 64); + } + } + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ParameterDefinitionMetadata.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ParameterDefinitionMetadata.cs new file mode 100644 index 000000000000..8f40537001ef --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ParameterDefinitionMetadata.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// User-friendly properties for this parameter. + /// + public partial class ParameterDefinitionMetadata + { + /// + /// Initializes a new instance of the ParameterDefinitionMetadata class. + /// + public ParameterDefinitionMetadata() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ParameterDefinitionMetadata class. + /// + + /// DisplayName of this parameter/resourceGroup. + /// + + /// Description of this parameter/resourceGroup. + /// + + /// StrongType for UI to render rich experience during blueprint assignment. + /// Supported strong types are resourceType, principalId and location. + /// + public ParameterDefinitionMetadata(string displayName = default(string), string description = default(string), string strongType = default(string)) + + { + this.DisplayName = displayName; + this.Description = description; + this.StrongType = strongType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets displayName of this parameter/resourceGroup. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets description of this parameter/resourceGroup. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets strongType for UI to render rich experience during blueprint + /// assignment. Supported strong types are resourceType, principalId and + /// location. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "strongType")] + public string StrongType {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.DisplayName != null) + { + if (this.DisplayName.Length > 256) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "DisplayName", 256); + } + } + if (this.Description != null) + { + if (this.Description.Length > 500) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Description", 500); + } + } + if (this.StrongType != null) + { + if (this.StrongType.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "StrongType", 64); + } + } + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ParameterValue.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ParameterValue.cs new file mode 100644 index 000000000000..84d8a82bf04f --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ParameterValue.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Value for the specified parameter. Can be either 'value' or 'reference' but + /// not both. + /// + public partial class ParameterValue + { + /// + /// Initializes a new instance of the ParameterValue class. + /// + public ParameterValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ParameterValue class. + /// + + /// Parameter value. Any valid JSON value is allowed including objects, arrays, + /// strings, numbers and booleans. + /// + + /// Parameter value as reference type. + /// + public ParameterValue(object value = default(object), SecretValueReference reference = default(SecretValueReference)) + + { + this.Value = value; + this.Reference = reference; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets parameter value. Any valid JSON value is allowed including + /// objects, arrays, strings, numbers and booleans. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public object Value {get; set; } + + /// + /// Gets or sets parameter value as reference type. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "reference")] + public SecretValueReference Reference {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + if (this.Reference != null) + { + this.Reference.Validate(); + } + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/PolicyAssignmentArtifact.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/PolicyAssignmentArtifact.cs new file mode 100644 index 000000000000..77de197fc786 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/PolicyAssignmentArtifact.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Blueprint artifact that applies a Policy assignment. + /// + [Newtonsoft.Json.JsonObject("policyAssignment")] + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class PolicyAssignmentArtifact : Artifact + { + /// + /// Initializes a new instance of the PolicyAssignmentArtifact class. + /// + public PolicyAssignmentArtifact() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyAssignmentArtifact class. + /// + + /// String Id used to locate any resource on Azure. + /// + + /// Type of this resource. + /// + + /// Name of this resource. + /// + + /// One-liner string explain this resource. + /// + + /// Multi-line explain this resource. + /// + + /// Artifacts which need to be deployed before the specified artifact. + /// + + /// Azure resource ID of the policy definition. + /// + + /// Parameter values for the policy definition. + /// + + /// Name of the resource group placeholder to which the policy will be + /// assigned. + /// + public PolicyAssignmentArtifact(string policyDefinitionId, System.Collections.Generic.IDictionary parameters, string id = default(string), string type = default(string), string name = default(string), string displayName = default(string), string description = default(string), System.Collections.Generic.IList dependsOn = default(System.Collections.Generic.IList), string resourceGroup = default(string)) + + : base(id, type, name) + { + this.DisplayName = displayName; + this.Description = description; + this.DependsOn = dependsOn; + this.PolicyDefinitionId = policyDefinitionId; + this.Parameters = parameters; + this.ResourceGroup = resourceGroup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets one-liner string explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets multi-line explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } + + /// + /// Gets or sets artifacts which need to be deployed before the specified + /// artifact. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.dependsOn")] + public System.Collections.Generic.IList DependsOn {get; set; } + + /// + /// Gets or sets azure resource ID of the policy definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.policyDefinitionId")] + public string PolicyDefinitionId {get; set; } + + /// + /// Gets or sets parameter values for the policy definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.parameters")] + public System.Collections.Generic.IDictionary Parameters {get; set; } + + /// + /// Gets or sets name of the resource group placeholder to which the policy + /// will be assigned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.resourceGroup")] + public string ResourceGroup {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.PolicyDefinitionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "PolicyDefinitionId"); + } + if (this.Parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Parameters"); + } + if (this.DisplayName != null) + { + if (this.DisplayName.Length > 256) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "DisplayName", 256); + } + } + if (this.Description != null) + { + if (this.Description.Length > 500) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Description", 500); + } + } + + + if (this.Parameters != null) + { + foreach (var valueElement in this.Parameters.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/PolicyAssignmentArtifactProperties.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/PolicyAssignmentArtifactProperties.cs new file mode 100644 index 000000000000..81f5839da4bb --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/PolicyAssignmentArtifactProperties.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Properties of a Policy assignment blueprint artifact. + /// + public partial class PolicyAssignmentArtifactProperties + { + /// + /// Initializes a new instance of the PolicyAssignmentArtifactProperties class. + /// + public PolicyAssignmentArtifactProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyAssignmentArtifactProperties class. + /// + + /// One-liner string explain this resource. + /// + + /// Multi-line explain this resource. + /// + + /// Artifacts which need to be deployed before the specified artifact. + /// + + /// Azure resource ID of the policy definition. + /// + + /// Parameter values for the policy definition. + /// + + /// Name of the resource group placeholder to which the policy will be + /// assigned. + /// + public PolicyAssignmentArtifactProperties(string policyDefinitionId, System.Collections.Generic.IDictionary parameters, string displayName = default(string), string description = default(string), System.Collections.Generic.IList dependsOn = default(System.Collections.Generic.IList), string resourceGroup = default(string)) + + { + this.DisplayName = displayName; + this.Description = description; + this.DependsOn = dependsOn; + this.PolicyDefinitionId = policyDefinitionId; + this.Parameters = parameters; + this.ResourceGroup = resourceGroup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets one-liner string explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets multi-line explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets artifacts which need to be deployed before the specified + /// artifact. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dependsOn")] + public System.Collections.Generic.IList DependsOn {get; set; } + + /// + /// Gets or sets azure resource ID of the policy definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "policyDefinitionId")] + public string PolicyDefinitionId {get; set; } + + /// + /// Gets or sets parameter values for the policy definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public System.Collections.Generic.IDictionary Parameters {get; set; } + + /// + /// Gets or sets name of the resource group placeholder to which the policy + /// will be assigned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceGroup")] + public string ResourceGroup {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.PolicyDefinitionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "PolicyDefinitionId"); + } + if (this.Parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Parameters"); + } + if (this.DisplayName != null) + { + if (this.DisplayName.Length > 256) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "DisplayName", 256); + } + } + if (this.Description != null) + { + if (this.Description.Length > 500) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Description", 500); + } + } + + + if (this.Parameters != null) + { + foreach (var valueElement in this.Parameters.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/PublishedBlueprint.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/PublishedBlueprint.cs new file mode 100644 index 000000000000..161d22739839 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/PublishedBlueprint.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Represents a published blueprint. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class PublishedBlueprint : AzureResourceBase + { + /// + /// Initializes a new instance of the PublishedBlueprint class. + /// + public PublishedBlueprint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PublishedBlueprint class. + /// + + /// String Id used to locate any resource on Azure. + /// + + /// Type of this resource. + /// + + /// Name of this resource. + /// + + /// One-liner string explain this resource. + /// + + /// Multi-line explain this resource. + /// + + /// Status of the blueprint. This field is readonly. + /// + + /// The scope where this blueprint definition can be assigned. + /// Possible values include: 'subscription', 'managementGroup' + + /// Parameters required by this blueprint definition. + /// + + /// Resource group placeholders defined by this blueprint definition. + /// + + /// Name of the published blueprint definition. + /// + + /// Version-specific change notes. + /// + public PublishedBlueprint(string id = default(string), string type = default(string), string name = default(string), string displayName = default(string), string description = default(string), BlueprintStatus status = default(BlueprintStatus), string targetScope = default(string), System.Collections.Generic.IDictionary parameters = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IDictionary resourceGroups = default(System.Collections.Generic.IDictionary), string blueprintName = default(string), string changeNotes = default(string)) + + : base(id, type, name) + { + this.DisplayName = displayName; + this.Description = description; + this.Status = status; + this.TargetScope = targetScope; + this.Parameters = parameters; + this.ResourceGroups = resourceGroups; + this.BlueprintName = blueprintName; + this.ChangeNotes = changeNotes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets one-liner string explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets multi-line explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } + + /// + /// Gets status of the blueprint. This field is readonly. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public BlueprintStatus Status {get; private set; } + + /// + /// Gets or sets the scope where this blueprint definition can be assigned. Possible values include: 'subscription', 'managementGroup' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetScope")] + public string TargetScope {get; set; } + + /// + /// Gets or sets parameters required by this blueprint definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.parameters")] + public System.Collections.Generic.IDictionary Parameters {get; set; } + + /// + /// Gets or sets resource group placeholders defined by this blueprint + /// definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.resourceGroups")] + public System.Collections.Generic.IDictionary ResourceGroups {get; set; } + + /// + /// Gets or sets name of the published blueprint definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.blueprintName")] + public string BlueprintName {get; set; } + + /// + /// Gets or sets version-specific change notes. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.changeNotes")] + public string ChangeNotes {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.DisplayName != null) + { + if (this.DisplayName.Length > 256) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "DisplayName", 256); + } + } + if (this.Description != null) + { + if (this.Description.Length > 500) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Description", 500); + } + } + + + if (this.Parameters != null) + { + foreach (var valueElement in this.Parameters.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + if (this.ResourceGroups != null) + { + foreach (var valueElement in this.ResourceGroups.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + + if (this.ChangeNotes != null) + { + if (this.ChangeNotes.Length > 500) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "ChangeNotes", 500); + } + } + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceGroupDefinition.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceGroupDefinition.cs new file mode 100644 index 000000000000..0d8c43507e64 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceGroupDefinition.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Represents an Azure resource group in a blueprint definition. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class ResourceGroupDefinition + { + /// + /// Initializes a new instance of the ResourceGroupDefinition class. + /// + public ResourceGroupDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceGroupDefinition class. + /// + + /// Name of this resourceGroup. Leave empty if the resource group name will be + /// specified during the blueprint assignment. + /// + + /// Location of this resourceGroup. Leave empty if the resource group location + /// will be specified during the blueprint assignment. + /// + + /// Artifacts which need to be deployed before this resource group. + /// + + /// Tags to be assigned to this resource group. + /// + + /// DisplayName of this parameter/resourceGroup. + /// + + /// Description of this parameter/resourceGroup. + /// + + /// StrongType for UI to render rich experience during blueprint assignment. + /// Supported strong types are resourceType, principalId and location. + /// + public ResourceGroupDefinition(string name = default(string), string location = default(string), System.Collections.Generic.IList dependsOn = default(System.Collections.Generic.IList), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string displayName = default(string), string description = default(string), string strongType = default(string)) + + { + this.Name = name; + this.Location = location; + this.DependsOn = dependsOn; + this.Tags = tags; + this.DisplayName = displayName; + this.Description = description; + this.StrongType = strongType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets name of this resourceGroup. Leave empty if the resource group + /// name will be specified during the blueprint assignment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets location of this resourceGroup. Leave empty if the resource + /// group location will be specified during the blueprint assignment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } + + /// + /// Gets or sets artifacts which need to be deployed before this resource + /// group. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dependsOn")] + public System.Collections.Generic.IList DependsOn {get; set; } + + /// + /// Gets or sets tags to be assigned to this resource group. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } + + /// + /// Gets or sets displayName of this parameter/resourceGroup. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "metadata.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets description of this parameter/resourceGroup. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "metadata.description")] + public string Description {get; set; } + + /// + /// Gets or sets strongType for UI to render rich experience during blueprint + /// assignment. Supported strong types are resourceType, principalId and + /// location. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "metadata.strongType")] + public string StrongType {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + + + if (this.DisplayName != null) + { + if (this.DisplayName.Length > 256) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "DisplayName", 256); + } + } + if (this.Description != null) + { + if (this.Description.Length > 500) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Description", 500); + } + } + if (this.StrongType != null) + { + if (this.StrongType.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "StrongType", 64); + } + } + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceGroupValue.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceGroupValue.cs new file mode 100644 index 000000000000..ada84851f17f --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceGroupValue.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Represents an Azure resource group. + /// + public partial class ResourceGroupValue + { + /// + /// Initializes a new instance of the ResourceGroupValue class. + /// + public ResourceGroupValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceGroupValue class. + /// + + /// Name of the resource group. + /// + + /// Location of the resource group. + /// + public ResourceGroupValue(string name = default(string), string location = default(string)) + + { + this.Name = name; + this.Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets name of the resource group. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets location of the resource group. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Name != null) + { + if (this.Name.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Name", 90); + } + if (this.Name.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Name", 1); + } + } + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceProviderOperation.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceProviderOperation.cs new file mode 100644 index 000000000000..75d17a88d32c --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceProviderOperation.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Supported operations of this resource provider. + /// + public partial class ResourceProviderOperation + { + /// + /// Initializes a new instance of the ResourceProviderOperation class. + /// + public ResourceProviderOperation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceProviderOperation class. + /// + + /// Operation name, in format of {provider}/{resource}/{operation} + /// + + /// Display metadata associated with the operation. + /// + public ResourceProviderOperation(string name = default(string), ResourceProviderOperationDisplay display = default(ResourceProviderOperationDisplay)) + + { + this.Name = name; + this.Display = display; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets operation name, in format of {provider}/{resource}/{operation} + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets display metadata associated with the operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "display")] + public ResourceProviderOperationDisplay Display {get; set; } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceProviderOperationDisplay.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceProviderOperationDisplay.cs new file mode 100644 index 000000000000..9b8f0e2ff242 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceProviderOperationDisplay.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Display metadata associated with the operation. + /// + public partial class ResourceProviderOperationDisplay + { + /// + /// Initializes a new instance of the ResourceProviderOperationDisplay class. + /// + public ResourceProviderOperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceProviderOperationDisplay class. + /// + + /// Resource provider: Microsoft Blueprint. + /// + + /// Resource on which the operation is performed. + /// + + /// Type of operation: get, read, delete, etc. + /// + + /// Description of this operation. + /// + public ResourceProviderOperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + + { + this.Provider = provider; + this.Resource = resource; + this.Operation = operation; + this.Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets resource provider: Microsoft Blueprint. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provider")] + public string Provider {get; set; } + + /// + /// Gets or sets resource on which the operation is performed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resource")] + public string Resource {get; set; } + + /// + /// Gets or sets type of operation: get, read, delete, etc. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "operation")] + public string Operation {get; set; } + + /// + /// Gets or sets description of this operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceProviderOperationList.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceProviderOperationList.cs new file mode 100644 index 000000000000..46abd5ee84d8 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/ResourceProviderOperationList.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Results of the request to list operations. + /// + public partial class ResourceProviderOperationList + { + /// + /// Initializes a new instance of the ResourceProviderOperationList class. + /// + public ResourceProviderOperationList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceProviderOperationList class. + /// + + /// List of operations supported by this resource provider. + /// + public ResourceProviderOperationList(System.Collections.Generic.IList value = default(System.Collections.Generic.IList)) + + { + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets list of operations supported by this resource provider. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public System.Collections.Generic.IList Value {get; set; } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/RoleAssignmentArtifact.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/RoleAssignmentArtifact.cs new file mode 100644 index 000000000000..d34e28d29c54 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/RoleAssignmentArtifact.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Blueprint artifact that applies a Role assignment. + /// + [Newtonsoft.Json.JsonObject("roleAssignment")] + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class RoleAssignmentArtifact : Artifact + { + /// + /// Initializes a new instance of the RoleAssignmentArtifact class. + /// + public RoleAssignmentArtifact() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleAssignmentArtifact class. + /// + + /// String Id used to locate any resource on Azure. + /// + + /// Type of this resource. + /// + + /// Name of this resource. + /// + + /// One-liner string explain this resource. + /// + + /// Multi-line explain this resource. + /// + + /// Artifacts which need to be deployed before the specified artifact. + /// + + /// Azure resource ID of the RoleDefinition. + /// + + /// Array of user or group identities in Azure Active Directory. The + /// roleDefinition will apply to each identity. + /// + + /// RoleAssignment will be scope to this resourceGroup. If empty, it scopes to + /// the subscription. + /// + public RoleAssignmentArtifact(string roleDefinitionId, object principalIds, string id = default(string), string type = default(string), string name = default(string), string displayName = default(string), string description = default(string), System.Collections.Generic.IList dependsOn = default(System.Collections.Generic.IList), string resourceGroup = default(string)) + + : base(id, type, name) + { + this.DisplayName = displayName; + this.Description = description; + this.DependsOn = dependsOn; + this.RoleDefinitionId = roleDefinitionId; + this.PrincipalIds = principalIds; + this.ResourceGroup = resourceGroup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets one-liner string explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets multi-line explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } + + /// + /// Gets or sets artifacts which need to be deployed before the specified + /// artifact. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.dependsOn")] + public System.Collections.Generic.IList DependsOn {get; set; } + + /// + /// Gets or sets azure resource ID of the RoleDefinition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.roleDefinitionId")] + public string RoleDefinitionId {get; set; } + + /// + /// Gets or sets array of user or group identities in Azure Active Directory. + /// The roleDefinition will apply to each identity. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.principalIds")] + public object PrincipalIds {get; set; } + + /// + /// Gets or sets roleAssignment will be scope to this resourceGroup. If empty, + /// it scopes to the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.resourceGroup")] + public string ResourceGroup {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.RoleDefinitionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "RoleDefinitionId"); + } + if (this.PrincipalIds == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "PrincipalIds"); + } + if (this.DisplayName != null) + { + if (this.DisplayName.Length > 256) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "DisplayName", 256); + } + } + if (this.Description != null) + { + if (this.Description.Length > 500) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Description", 500); + } + } + + + + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/RoleAssignmentArtifactProperties.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/RoleAssignmentArtifactProperties.cs new file mode 100644 index 000000000000..a3dcb532dd88 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/RoleAssignmentArtifactProperties.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Properties of a Role assignment blueprint artifact. + /// + public partial class RoleAssignmentArtifactProperties + { + /// + /// Initializes a new instance of the RoleAssignmentArtifactProperties class. + /// + public RoleAssignmentArtifactProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleAssignmentArtifactProperties class. + /// + + /// One-liner string explain this resource. + /// + + /// Multi-line explain this resource. + /// + + /// Artifacts which need to be deployed before the specified artifact. + /// + + /// Azure resource ID of the RoleDefinition. + /// + + /// Array of user or group identities in Azure Active Directory. The + /// roleDefinition will apply to each identity. + /// + + /// RoleAssignment will be scope to this resourceGroup. If empty, it scopes to + /// the subscription. + /// + public RoleAssignmentArtifactProperties(string roleDefinitionId, object principalIds, string displayName = default(string), string description = default(string), System.Collections.Generic.IList dependsOn = default(System.Collections.Generic.IList), string resourceGroup = default(string)) + + { + this.DisplayName = displayName; + this.Description = description; + this.DependsOn = dependsOn; + this.RoleDefinitionId = roleDefinitionId; + this.PrincipalIds = principalIds; + this.ResourceGroup = resourceGroup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets one-liner string explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets multi-line explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets artifacts which need to be deployed before the specified + /// artifact. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dependsOn")] + public System.Collections.Generic.IList DependsOn {get; set; } + + /// + /// Gets or sets azure resource ID of the RoleDefinition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "roleDefinitionId")] + public string RoleDefinitionId {get; set; } + + /// + /// Gets or sets array of user or group identities in Azure Active Directory. + /// The roleDefinition will apply to each identity. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalIds")] + public object PrincipalIds {get; set; } + + /// + /// Gets or sets roleAssignment will be scope to this resourceGroup. If empty, + /// it scopes to the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceGroup")] + public string ResourceGroup {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.RoleDefinitionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "RoleDefinitionId"); + } + if (this.PrincipalIds == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "PrincipalIds"); + } + if (this.DisplayName != null) + { + if (this.DisplayName.Length > 256) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "DisplayName", 256); + } + } + if (this.Description != null) + { + if (this.Description.Length > 500) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Description", 500); + } + } + + + + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/SecretValueReference.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/SecretValueReference.cs new file mode 100644 index 000000000000..b3abc4cfab7c --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/SecretValueReference.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Reference to a Key Vault secret. + /// + public partial class SecretValueReference + { + /// + /// Initializes a new instance of the SecretValueReference class. + /// + public SecretValueReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecretValueReference class. + /// + + /// Specifies the reference to a given Azure Key Vault. + /// + + /// Name of the secret. + /// + + /// The version of the secret to use. If left blank, the latest version of the + /// secret is used. + /// + public SecretValueReference(KeyVaultReference keyVault, string secretName, string secretVersion = default(string)) + + { + this.KeyVault = keyVault; + this.SecretName = secretName; + this.SecretVersion = secretVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets specifies the reference to a given Azure Key Vault. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "keyVault")] + public KeyVaultReference KeyVault {get; set; } + + /// + /// Gets or sets name of the secret. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "secretName")] + public string SecretName {get; set; } + + /// + /// Gets or sets the version of the secret to use. If left blank, the latest + /// version of the secret is used. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "secretVersion")] + public string SecretVersion {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.KeyVault == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "KeyVault"); + } + if (this.SecretName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "SecretName"); + } + if (this.KeyVault != null) + { + this.KeyVault.Validate(); + } + + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TemplateArtifact.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TemplateArtifact.cs new file mode 100644 index 000000000000..2272cd5749d4 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TemplateArtifact.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Blueprint artifact that deploys a Resource Manager template. + /// + [Newtonsoft.Json.JsonObject("template")] + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class TemplateArtifact : Artifact + { + /// + /// Initializes a new instance of the TemplateArtifact class. + /// + public TemplateArtifact() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TemplateArtifact class. + /// + + /// String Id used to locate any resource on Azure. + /// + + /// Type of this resource. + /// + + /// Name of this resource. + /// + + /// One-liner string explain this resource. + /// + + /// Multi-line explain this resource. + /// + + /// Artifacts which need to be deployed before the specified artifact. + /// + + /// The Resource Manager template blueprint artifact body. + /// + + /// If applicable, the name of the resource group placeholder to which the + /// Resource Manager template blueprint artifact will be deployed. + /// + + /// Resource Manager template blueprint artifact parameter values. + /// + public TemplateArtifact(object template, System.Collections.Generic.IDictionary parameters, string id = default(string), string type = default(string), string name = default(string), string displayName = default(string), string description = default(string), System.Collections.Generic.IList dependsOn = default(System.Collections.Generic.IList), string resourceGroup = default(string)) + + : base(id, type, name) + { + this.DisplayName = displayName; + this.Description = description; + this.DependsOn = dependsOn; + this.Template = template; + this.ResourceGroup = resourceGroup; + this.Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets one-liner string explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets multi-line explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } + + /// + /// Gets or sets artifacts which need to be deployed before the specified + /// artifact. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.dependsOn")] + public System.Collections.Generic.IList DependsOn {get; set; } + + /// + /// Gets or sets the Resource Manager template blueprint artifact body. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.template")] + public object Template {get; set; } + + /// + /// Gets or sets if applicable, the name of the resource group placeholder to + /// which the Resource Manager template blueprint artifact will be deployed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.resourceGroup")] + public string ResourceGroup {get; set; } + + /// + /// Gets or sets resource Manager template blueprint artifact parameter values. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.parameters")] + public System.Collections.Generic.IDictionary Parameters {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Template == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Template"); + } + if (this.Parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Parameters"); + } + if (this.DisplayName != null) + { + if (this.DisplayName.Length > 256) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "DisplayName", 256); + } + } + if (this.Description != null) + { + if (this.Description.Length > 500) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Description", 500); + } + } + + + + if (this.Parameters != null) + { + foreach (var valueElement in this.Parameters.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TemplateArtifactProperties.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TemplateArtifactProperties.cs new file mode 100644 index 000000000000..c8fbd9930a1b --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TemplateArtifactProperties.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Properties of a Resource Manager template blueprint artifact. + /// + public partial class TemplateArtifactProperties + { + /// + /// Initializes a new instance of the TemplateArtifactProperties class. + /// + public TemplateArtifactProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TemplateArtifactProperties class. + /// + + /// One-liner string explain this resource. + /// + + /// Multi-line explain this resource. + /// + + /// Artifacts which need to be deployed before the specified artifact. + /// + + /// The Resource Manager template blueprint artifact body. + /// + + /// If applicable, the name of the resource group placeholder to which the + /// Resource Manager template blueprint artifact will be deployed. + /// + + /// Resource Manager template blueprint artifact parameter values. + /// + public TemplateArtifactProperties(object template, System.Collections.Generic.IDictionary parameters, string displayName = default(string), string description = default(string), System.Collections.Generic.IList dependsOn = default(System.Collections.Generic.IList), string resourceGroup = default(string)) + + { + this.DisplayName = displayName; + this.Description = description; + this.DependsOn = dependsOn; + this.Template = template; + this.ResourceGroup = resourceGroup; + this.Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets one-liner string explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets multi-line explain this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets artifacts which need to be deployed before the specified + /// artifact. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dependsOn")] + public System.Collections.Generic.IList DependsOn {get; set; } + + /// + /// Gets or sets the Resource Manager template blueprint artifact body. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "template")] + public object Template {get; set; } + + /// + /// Gets or sets if applicable, the name of the resource group placeholder to + /// which the Resource Manager template blueprint artifact will be deployed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceGroup")] + public string ResourceGroup {get; set; } + + /// + /// Gets or sets resource Manager template blueprint artifact parameter values. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public System.Collections.Generic.IDictionary Parameters {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Template == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Template"); + } + if (this.Parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Parameters"); + } + if (this.DisplayName != null) + { + if (this.DisplayName.Length > 256) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "DisplayName", 256); + } + } + if (this.Description != null) + { + if (this.Description.Length > 500) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Description", 500); + } + } + + + + if (this.Parameters != null) + { + foreach (var valueElement in this.Parameters.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TemplateParameterType.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TemplateParameterType.cs new file mode 100644 index 000000000000..150b7dc6ef60 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TemplateParameterType.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + + /// + /// Defines values for TemplateParameterType. + /// + + + public static class TemplateParameterType + { + public const string String = "string"; + public const string Array = "array"; + public const string Bool = "bool"; + public const string Int = "int"; + public const string Object = "object"; + public const string SecureObject = "secureObject"; + public const string SecureString = "secureString"; + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TrackedResource.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TrackedResource.cs new file mode 100644 index 000000000000..e3699136b280 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/TrackedResource.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Common properties for all Azure tracked resources. + /// + public partial class TrackedResource : AzureResourceBase + { + /// + /// Initializes a new instance of the TrackedResource class. + /// + public TrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrackedResource class. + /// + + /// String Id used to locate any resource on Azure. + /// + + /// Type of this resource. + /// + + /// Name of this resource. + /// + + /// The location of this blueprint assignment. + /// + public TrackedResource(string location, string id = default(string), string type = default(string), string name = default(string)) + + : base(id, type, name) + { + this.Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the location of this blueprint assignment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Location == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Location"); + } + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/UserAssignedIdentity.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/UserAssignedIdentity.cs new file mode 100644 index 000000000000..3f68b48ef1ff --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/UserAssignedIdentity.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// User-assigned managed identity. + /// + public partial class UserAssignedIdentity + { + /// + /// Initializes a new instance of the UserAssignedIdentity class. + /// + public UserAssignedIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserAssignedIdentity class. + /// + + /// Azure Active Directory principal ID associated with this Identity. + /// + + /// Client App Id associated with this identity. + /// + public UserAssignedIdentity(string principalId = default(string), string clientId = default(string)) + + { + this.PrincipalId = principalId; + this.ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets azure Active Directory principal ID associated with this + /// Identity. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalId")] + public string PrincipalId {get; set; } + + /// + /// Gets or sets client App Id associated with this identity. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "clientId")] + public string ClientId {get; set; } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/WhoIsBlueprintContract.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/WhoIsBlueprintContract.cs new file mode 100644 index 000000000000..d41a72cec197 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/Models/WhoIsBlueprintContract.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint.Models +{ + using System.Linq; + + /// + /// Response schema for querying the Azure Blueprints service principal in the + /// tenant. + /// + public partial class WhoIsBlueprintContract + { + /// + /// Initializes a new instance of the WhoIsBlueprintContract class. + /// + public WhoIsBlueprintContract() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WhoIsBlueprintContract class. + /// + + /// AAD object Id of the Azure Blueprints service principal in the tenant. + /// + public WhoIsBlueprintContract(string objectId = default(string)) + + { + this.ObjectId = objectId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets aAD object Id of the Azure Blueprints service principal in the + /// tenant. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "objectId")] + public string ObjectId {get; set; } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedArtifactsOperations.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedArtifactsOperations.cs new file mode 100644 index 000000000000..b16b3087cd3a --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedArtifactsOperations.cs @@ -0,0 +1,672 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// PublishedArtifactsOperations operations. + /// + internal partial class PublishedArtifactsOperations : Microsoft.Rest.IServiceOperations, IPublishedArtifactsOperations + { + /// + /// Initializes a new instance of the PublishedArtifactsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PublishedArtifactsOperations (BlueprintManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BlueprintManagementClient + /// + public BlueprintManagementClient Client { get; private set; } + + /// + /// Get an artifact for a published blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceScope, string blueprintName, string versionId, string artifactName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (blueprintName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "blueprintName"); + } + + if (versionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "versionId"); + } + + if (artifactName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactName"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("blueprintName", blueprintName); + tracingParameters.Add("versionId", versionId); + tracingParameters.Add("artifactName", artifactName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}/artifacts/{artifactName}").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{blueprintName}", System.Uri.EscapeDataString(blueprintName)); + _url = _url.Replace("{versionId}", System.Uri.EscapeDataString(versionId)); + _url = _url.Replace("{artifactName}", System.Uri.EscapeDataString(artifactName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List artifacts for a version of a published blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceScope, string blueprintName, string versionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (blueprintName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "blueprintName"); + } + + if (versionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "versionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("blueprintName", blueprintName); + tracingParameters.Add("versionId", versionId); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}/artifacts").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{blueprintName}", System.Uri.EscapeDataString(blueprintName)); + _url = _url.Replace("{versionId}", System.Uri.EscapeDataString(versionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List artifacts for a version of a published blueprint definition. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedArtifactsOperationsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedArtifactsOperationsExtensions.cs new file mode 100644 index 000000000000..0118b3bced99 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedArtifactsOperationsExtensions.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for PublishedArtifactsOperations + /// + public static partial class PublishedArtifactsOperationsExtensions + { + /// + /// Get an artifact for a published blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + public static Artifact Get(this IPublishedArtifactsOperations operations, string resourceScope, string blueprintName, string versionId, string artifactName) + { + return ((IPublishedArtifactsOperations)operations).GetAsync(resourceScope, blueprintName, versionId, artifactName).GetAwaiter().GetResult(); + } + + /// + /// Get an artifact for a published blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// Name of the blueprint artifact. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IPublishedArtifactsOperations operations, string resourceScope, string blueprintName, string versionId, string artifactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceScope, blueprintName, versionId, artifactName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List artifacts for a version of a published blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + public static Microsoft.Rest.Azure.IPage List(this IPublishedArtifactsOperations operations, string resourceScope, string blueprintName, string versionId) + { + return ((IPublishedArtifactsOperations)operations).ListAsync(resourceScope, blueprintName, versionId).GetAwaiter().GetResult(); + } + + /// + /// List artifacts for a version of a published blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IPublishedArtifactsOperations operations, string resourceScope, string blueprintName, string versionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceScope, blueprintName, versionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List artifacts for a version of a published blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IPublishedArtifactsOperations operations, string nextPageLink) + { + return ((IPublishedArtifactsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List artifacts for a version of a published blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IPublishedArtifactsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedBlueprintsOperations.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedBlueprintsOperations.cs new file mode 100644 index 000000000000..73446812131e --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedBlueprintsOperations.cs @@ -0,0 +1,1105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Blueprint +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// PublishedBlueprintsOperations operations. + /// + internal partial class PublishedBlueprintsOperations : Microsoft.Rest.IServiceOperations, IPublishedBlueprintsOperations + { + /// + /// Initializes a new instance of the PublishedBlueprintsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PublishedBlueprintsOperations (BlueprintManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BlueprintManagementClient + /// + public BlueprintManagementClient Client { get; private set; } + + /// + /// Publish a new version of the blueprint definition with the latest + /// artifacts. Published blueprint definitions are immutable. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// Published Blueprint to create or update. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceScope, string blueprintName, string versionId, PublishedBlueprint publishedBlueprint = default(PublishedBlueprint), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (publishedBlueprint != null) + { + publishedBlueprint.Validate(); + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (blueprintName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "blueprintName"); + } + + if (versionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "versionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("blueprintName", blueprintName); + tracingParameters.Add("versionId", versionId); + + tracingParameters.Add("publishedBlueprint", publishedBlueprint); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{blueprintName}", System.Uri.EscapeDataString(blueprintName)); + _url = _url.Replace("{versionId}", System.Uri.EscapeDataString(versionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(publishedBlueprint != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(publishedBlueprint, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get a published version of a blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceScope, string blueprintName, string versionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (blueprintName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "blueprintName"); + } + + if (versionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "versionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("blueprintName", blueprintName); + tracingParameters.Add("versionId", versionId); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{blueprintName}", System.Uri.EscapeDataString(blueprintName)); + _url = _url.Replace("{versionId}", System.Uri.EscapeDataString(versionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete a published version of a blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceScope, string blueprintName, string versionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (blueprintName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "blueprintName"); + } + + if (versionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "versionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("blueprintName", blueprintName); + tracingParameters.Add("versionId", versionId); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{blueprintName}", System.Uri.EscapeDataString(blueprintName)); + _url = _url.Replace("{versionId}", System.Uri.EscapeDataString(versionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List published versions of given blueprint definition. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceScope, string blueprintName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (resourceScope == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceScope"); + } + + if (blueprintName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "blueprintName"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceScope", resourceScope); + tracingParameters.Add("blueprintName", blueprintName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions").ToString(); + _url = _url.Replace("{resourceScope}", resourceScope); + _url = _url.Replace("{blueprintName}", System.Uri.EscapeDataString(blueprintName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List published versions of given blueprint definition. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedBlueprintsOperationsExtensions.cs b/src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedBlueprintsOperationsExtensions.cs new file mode 100644 index 000000000000..4c1ecfca9ece --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Generated/PublishedBlueprintsOperationsExtensions.cs @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Blueprint +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for PublishedBlueprintsOperations + /// + public static partial class PublishedBlueprintsOperationsExtensions + { + /// + /// Publish a new version of the blueprint definition with the latest + /// artifacts. Published blueprint definitions are immutable. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + public static PublishedBlueprint Create(this IPublishedBlueprintsOperations operations, string resourceScope, string blueprintName, string versionId, PublishedBlueprint publishedBlueprint = default(PublishedBlueprint)) + { + return ((IPublishedBlueprintsOperations)operations).CreateAsync(resourceScope, blueprintName, versionId, publishedBlueprint).GetAwaiter().GetResult(); + } + + /// + /// Publish a new version of the blueprint definition with the latest + /// artifacts. Published blueprint definitions are immutable. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateAsync(this IPublishedBlueprintsOperations operations, string resourceScope, string blueprintName, string versionId, PublishedBlueprint publishedBlueprint = default(PublishedBlueprint), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceScope, blueprintName, versionId, publishedBlueprint, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get a published version of a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + public static PublishedBlueprint Get(this IPublishedBlueprintsOperations operations, string resourceScope, string blueprintName, string versionId) + { + return ((IPublishedBlueprintsOperations)operations).GetAsync(resourceScope, blueprintName, versionId).GetAwaiter().GetResult(); + } + + /// + /// Get a published version of a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IPublishedBlueprintsOperations operations, string resourceScope, string blueprintName, string versionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceScope, blueprintName, versionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete a published version of a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + public static PublishedBlueprint Delete(this IPublishedBlueprintsOperations operations, string resourceScope, string blueprintName, string versionId) + { + return ((IPublishedBlueprintsOperations)operations).DeleteAsync(resourceScope, blueprintName, versionId).GetAwaiter().GetResult(); + } + + /// + /// Delete a published version of a blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// Version of the published blueprint definition. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IPublishedBlueprintsOperations operations, string resourceScope, string blueprintName, string versionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceScope, blueprintName, versionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List published versions of given blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + public static Microsoft.Rest.Azure.IPage List(this IPublishedBlueprintsOperations operations, string resourceScope, string blueprintName) + { + return ((IPublishedBlueprintsOperations)operations).ListAsync(resourceScope, blueprintName).GetAwaiter().GetResult(); + } + + /// + /// List published versions of given blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the resource. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + /// subscription (format: '/subscriptions/{subscriptionId}'). + /// + /// + /// Name of the blueprint definition. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IPublishedBlueprintsOperations operations, string resourceScope, string blueprintName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceScope, blueprintName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List published versions of given blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IPublishedBlueprintsOperations operations, string nextPageLink) + { + return ((IPublishedBlueprintsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List published versions of given blueprint definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IPublishedBlueprintsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Blueprint/Blueprint.Management.Sdk/Properties/AssemblyInfo.cs b/src/Blueprint/Blueprint.Management.Sdk/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..a09f61da65f2 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/Properties/AssemblyInfo.cs @@ -0,0 +1,26 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - Blueprint Management SDK")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: AssemblyVersion("0.20.0.0")] +[assembly: AssemblyFileVersion("0.20.8.0")] \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Management.Sdk/README.md b/src/Blueprint/Blueprint.Management.Sdk/README.md new file mode 100644 index 000000000000..6076aec1b361 --- /dev/null +++ b/src/Blueprint/Blueprint.Management.Sdk/README.md @@ -0,0 +1,97 @@ +# Overall +This directory contains management plane service clients of Az.Storage module. + +## Run Generation +In this directory, run AutoRest: +``` +autorest --reset +autorest --use:@autorest/powershell@4.x +``` + +### AutoRest Configuration +> see https://aka.ms/autorest +``` yaml +isSdkGenerator: true +powershell: true +# csharp: true +title: BlueprintManagementClient +reflect-api-versions: true +openapi-type: arm +azure-arm: true +payload-flattening-threshold: 1 +license-header: MICROSOFT_MIT_NO_VERSION +clear-output-folder: true +``` + + + +### +``` yaml +commit: 94e82241deb262a5bd60added152f5c9175fdd82 +input-file: + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/blueprintDefinition.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/blueprintAssignment.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/assignmentOperation.json + +output-folder: Generated + +namespace: Microsoft.Azure.Management.Blueprint + +directive: + - from: blueprintAssignment.json + suppress: TrackedResourcePatchOperation + reason: Assignment is proxy resource. + - from: blueprintDefinition.json + suppress: UniqueResourcePaths + where: $.paths + reason: Microsoft.Management is a proxy resource provider + - from: blueprintAssignment.json + suppress: OperationsAPIImplementation + where: $.paths + reason: OperationsAPI for Microsoft.Management is out of scope. + - from: blueprintDefinition.json + suppress: OperationsAPIImplementation + where: $.paths + reason: OperationsAPI for Microsoft.Management is out of scope. + - from: assignmentOperation.json + suppress: OperationsAPIImplementation + where: $.paths + reason: OperationsAPI for Microsoft.Management is out of scope. + - from: blueprintAssignment.json + where: $.paths["/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}"].delete.parameters + transform: >- + return [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ScopeParameter" + }, + { + "$ref": "#/parameters/AssignmentNameParameter" + }, + { + "name": "deleteBehavior", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "none", + "all" + ], + "x-ms-enum": { + "name": "AssignmentDeleteBehavior", + "modelAsString": true + }, + "description": "When deleteBehavior=all, the resources that were created by the blueprint assignment will be deleted." + } + ] + - from: blueprintAssignment.json + where: $.definitions.BlueprintResourcePropertiesBase.x-ms-external + transform: >- + return false + - where: + model-name: Blueprint + set: + model-name: BlueprintModel +``` \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Test/Blueprint.Test.csproj b/src/Blueprint/Blueprint.Test/Blueprint.Test.csproj index faf4f5c59104..a2b8f4f276ff 100644 --- a/src/Blueprint/Blueprint.Test/Blueprint.Test.csproj +++ b/src/Blueprint/Blueprint.Test/Blueprint.Test.csproj @@ -15,9 +15,7 @@ - - - + diff --git a/src/Blueprint/Blueprint.sln b/src/Blueprint/Blueprint.sln index 655fad793da3..af85a9f3221c 100644 --- a/src/Blueprint/Blueprint.sln +++ b/src/Blueprint/Blueprint.sln @@ -5,52 +5,51 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Accounts", "Accounts", "{8E7C6C0C-BFD1-4E1A-B042-79FB992B3558}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{3E40F9C5-9E33-423F-952A-605DC7990281}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{3E40F9C5-9E33-423F-952A-605DC7990281}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{5CA3299D-1709-4776-9A04-FF16380198DE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{5CA3299D-1709-4776-9A04-FF16380198DE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{BC6DE799-8CEC-4E08-B118-1C8FF7C8BDA2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{BC6DE799-8CEC-4E08-B118-1C8FF7C8BDA2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{FBC258F0-AED5-4F1B-A357-86ADB99E2121}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{FBC258F0-AED5-4F1B-A357-86ADB99E2121}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{D89E857E-E7C2-490B-BD6B-3ED50BE8B007}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{D89E857E-E7C2-490B-BD6B-3ED50BE8B007}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{3DD6D4E8-9021-459A-BDD8-B4533CB8F1A6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{3DD6D4E8-9021-459A-BDD8-B4533CB8F1A6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{E09BB005-D744-4D6A-B74B-04DE90074A32}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blueprint.Test", "Blueprint.Test\Blueprint.Test.csproj", "{64E319D3-7268-4052-B02E-F5E9319E2158}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blueprint.Test", "Blueprint.Test\Blueprint.Test.csproj", "{64E319D3-7268-4052-B02E-F5E9319E2158}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blueprint", "Blueprint\Blueprint.csproj", "{2E6A7EAC-01F0-4188-A32C-441847577F8C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blueprint", "Blueprint\Blueprint.csproj", "{2E6A7EAC-01F0-4188-A32C-441847577F8C}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DependentModules", "DependentModules", "{77D2C987-7CEB-4CFA-AA47-5171BD5B7C0A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceManager", "..\Resources\ResourceManager\ResourceManager.csproj", "{12A89145-B44B-420B-8BF4-A0B0856D1110}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.Authorization", "..\Resources\Authorization.Autorest\Az.Authorization.csproj", "{29A8760B-A0DB-480C-8270-83038355969B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Resources", "..\Resources\Resources\Resources.csproj", "{79F05C6B-D6CB-4CE7-AC49-516D22822B86}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.MSGraph", "..\Resources\MSGraph.Autorest\Az.MSGraph.csproj", "{44787BCE-CD80-4726-B9C5-8C7FBC2982B6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tags", "..\Resources\Tags\Tags.csproj", "{38A4D9FA-7D11-4014-ACED-5AC28C74CCF3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ResourceManager", "..\Resources\ResourceManager\ResourceManager.csproj", "{12A89145-B44B-420B-8BF4-A0B0856D1110}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{7E48CE83-9B77-4544-A4BF-9E850D6C2AD5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Resources", "..\Resources\Resources\Resources.csproj", "{79F05C6B-D6CB-4CE7-AC49-516D22822B86}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authorization.Management.Sdk", "..\Resources\Authorization.Management.Sdk\Authorization.Management.Sdk.csproj", "{6C83208C-9E59-4EBA-86AB-E850FC13BD68}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tags", "..\Resources\Tags\Tags.csproj", "{38A4D9FA-7D11-4014-ACED-5AC28C74CCF3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Resources.Management.Sdk", "..\Resources\Resources.Management.Sdk\Resources.Management.Sdk.csproj", "{9A74916D-E00D-4CC5-ADA2-FA563F5F9505}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{7E48CE83-9B77-4544-A4BF-9E850D6C2AD5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Authorization", "..\..\generated\Resources\Authorization.Autorest\Az.Authorization.csproj", "{F4F6BB5E-14A9-4510-9420-05977BAA7977}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authorization.Management.Sdk", "..\Resources\Authorization.Management.Sdk\Authorization.Management.Sdk.csproj", "{6C83208C-9E59-4EBA-86AB-E850FC13BD68}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.MSGraph", "..\..\generated\Resources\MSGraph.Autorest\Az.MSGraph.csproj", "{23589F07-AB5F-4548-A2F9-11E8BCE94CCA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Resources.Management.Sdk", "..\Resources\Resources.Management.Sdk\Resources.Management.Sdk.csproj", "{9A74916D-E00D-4CC5-ADA2-FA563F5F9505}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Policy", "..\..\generated\Resources\Policy.Autorest\Az.Policy.csproj", "{F438E115-EFA5-4A1A-8342-9087003E9751}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.Policy", "..\Resources\Policy.Autorest\Az.Policy.csproj", "{E980C1BE-CCDA-4D03-AC11-3B818F695BBC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blueprint.Management.Sdk", "Blueprint.Management.Sdk\Blueprint.Management.Sdk.csproj", "{F31A4D84-8DC4-4885-B3AA-69842AA7C218}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {3E40F9C5-9E33-423F-952A-605DC7990281}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3E40F9C5-9E33-423F-952A-605DC7990281}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -108,18 +107,17 @@ Global {9A74916D-E00D-4CC5-ADA2-FA563F5F9505}.Debug|Any CPU.Build.0 = Debug|Any CPU {9A74916D-E00D-4CC5-ADA2-FA563F5F9505}.Release|Any CPU.ActiveCfg = Release|Any CPU {9A74916D-E00D-4CC5-ADA2-FA563F5F9505}.Release|Any CPU.Build.0 = Release|Any CPU - {F4F6BB5E-14A9-4510-9420-05977BAA7977}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F4F6BB5E-14A9-4510-9420-05977BAA7977}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F4F6BB5E-14A9-4510-9420-05977BAA7977}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F4F6BB5E-14A9-4510-9420-05977BAA7977}.Release|Any CPU.Build.0 = Release|Any CPU - {23589F07-AB5F-4548-A2F9-11E8BCE94CCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {23589F07-AB5F-4548-A2F9-11E8BCE94CCA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {23589F07-AB5F-4548-A2F9-11E8BCE94CCA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {23589F07-AB5F-4548-A2F9-11E8BCE94CCA}.Release|Any CPU.Build.0 = Release|Any CPU - {F438E115-EFA5-4A1A-8342-9087003E9751}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F438E115-EFA5-4A1A-8342-9087003E9751}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F438E115-EFA5-4A1A-8342-9087003E9751}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F438E115-EFA5-4A1A-8342-9087003E9751}.Release|Any CPU.Build.0 = Release|Any CPU + {E980C1BE-CCDA-4D03-AC11-3B818F695BBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E980C1BE-CCDA-4D03-AC11-3B818F695BBC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E980C1BE-CCDA-4D03-AC11-3B818F695BBC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E980C1BE-CCDA-4D03-AC11-3B818F695BBC}.Release|Any CPU.Build.0 = Release|Any CPU + {F31A4D84-8DC4-4885-B3AA-69842AA7C218}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F31A4D84-8DC4-4885-B3AA-69842AA7C218}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F31A4D84-8DC4-4885-B3AA-69842AA7C218}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F31A4D84-8DC4-4885-B3AA-69842AA7C218}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {3E40F9C5-9E33-423F-952A-605DC7990281} = {8E7C6C0C-BFD1-4E1A-B042-79FB992B3558} @@ -137,4 +135,7 @@ Global {6C83208C-9E59-4EBA-86AB-E850FC13BD68} = {77D2C987-7CEB-4CFA-AA47-5171BD5B7C0A} {9A74916D-E00D-4CC5-ADA2-FA563F5F9505} = {77D2C987-7CEB-4CFA-AA47-5171BD5B7C0A} EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5CDB3790-4408-4927-A8AC-7C96CE1DBCAD} + EndGlobalSection EndGlobal diff --git a/src/Blueprint/Blueprint/Az.Blueprint.psd1 b/src/Blueprint/Blueprint/Az.Blueprint.psd1 index 6fba9d477793..967edc804a3e 100644 --- a/src/Blueprint/Blueprint/Az.Blueprint.psd1 +++ b/src/Blueprint/Blueprint/Az.Blueprint.psd1 @@ -56,7 +56,7 @@ DotNetFrameworkVersion = '4.7.2' RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '3.0.0'; }) # Assemblies that must be loaded prior to importing this module -RequiredAssemblies = 'Microsoft.Azure.Management.Blueprint.dll' +RequiredAssemblies = 'Microsoft.Azure.PowerShell.Blueprint.Management.Sdk.dll' # Script files (.ps1) that are run in the caller's environment prior to importing this module. # ScriptsToProcess = @() diff --git a/src/Blueprint/Blueprint/Blueprint.csproj b/src/Blueprint/Blueprint/Blueprint.csproj index 7c58d509f158..13526a64e86a 100644 --- a/src/Blueprint/Blueprint/Blueprint.csproj +++ b/src/Blueprint/Blueprint/Blueprint.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Blueprint/Blueprint/ChangeLog.md b/src/Blueprint/Blueprint/ChangeLog.md index 2fa38c2c5904..d4fb027beaed 100644 --- a/src/Blueprint/Blueprint/ChangeLog.md +++ b/src/Blueprint/Blueprint/ChangeLog.md @@ -18,6 +18,8 @@ - Additional information about change #1 --> ## Upcoming Release +* Removed Microsoft.Azure.Management.Blueprint 0.20.7-preview dependencies +* Added Microsoft.Azure.PowerShell.Blueprint.Management.Sdk ## Version 0.4.3 * Removed the outdated deps.json file.