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;
+
+ ///