Skip to content

Commit

Permalink
[Blueprint] Remove Blueprint 0.20.7-preview dependencies on released …
Browse files Browse the repository at this point in the history
…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 <[email protected]>
  • Loading branch information
2 people authored and azure-powershell-bot committed Sep 13, 2024
1 parent 535f9c8 commit cb81935
Show file tree
Hide file tree
Showing 90 changed files with 14,717 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PsModuleName>Blueprint</PsModuleName>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)..\..\Az.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Microsoft.Azure.PowerShell.Blueprint.Management.Sdk</AssemblyName>
<RootNamespace>Microsoft.Azure.Management.Blueprint</RootNamespace>
<NoWarn>$(NoWarn);CS0108;CS1573</NoWarn>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., build.proj))\src\Az.Post.props" />
</Project>
56 changes: 56 additions & 0 deletions src/Blueprint/Blueprint.Management.Sdk/Customizations/Constants.cs
Original file line number Diff line number Diff line change
@@ -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}";

}

/// <summary>
/// Allowed target scope of blueprint.
/// </summary>
public static class BlueprintTargetScopes
{
public const string Subscription = "subscription";
}

/// <summary>
/// allowed parameter types, align with Azure Resource Template
/// </summary>
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";

}
}
}
Original file line number Diff line number Diff line change
@@ -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;

/// <summary>
/// Extension methods for ArtifactsOperations.
/// </summary>
public static partial class ManagementGroupArtifactsExtensions
{
/// <summary>
/// Create or update Blueprint artifact.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='managementGroupName'>
/// azure managementGroup name, which we save the blueprint to.
/// </param>
/// <param name='blueprintName'>
/// name of the blueprint.
/// </param>
/// <param name='artifactName'>
/// name of the artifact.
/// </param>
/// <param name='artifact'>
/// Blueprint artifact to save.
/// </param>
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();
}

/// <summary>
/// Create or update Blueprint artifact.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='managementGroupName'>
/// azure managementGroup name, which we save the blueprint to.
/// </param>
/// <param name='blueprintName'>
/// name of the blueprint.
/// </param>
/// <param name='artifactName'>
/// name of the artifact.
/// </param>
/// <param name='artifact'>
/// Blueprint artifact to save.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Artifact> 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;
}
}

/// <summary>
/// Get a Blueprint artifact.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='managementGroupName'>
/// azure managementGroup name, which we save the blueprint to.
/// </param>
/// <param name='blueprintName'>
/// name of the blueprint.
/// </param>
/// <param name='artifactName'>
/// name of the artifact.
/// </param>
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();
}

/// <summary>
/// Get a Blueprint artifact.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='managementGroupName'>
/// azure managementGroup name, which we save the blueprint to.
/// </param>
/// <param name='blueprintName'>
/// name of the blueprint.
/// </param>
/// <param name='artifactName'>
/// name of the artifact.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Artifact> 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;
}
}

/// <summary>
/// Delete a Blueprint artifact.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='managementGroupName'>
/// azure managementGroup name, which we save the blueprint to.
/// </param>
/// <param name='blueprintName'>
/// name of the blueprint.
/// </param>
/// <param name='artifactName'>
/// name of the artifact.
/// </param>
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();
}

/// <summary>
/// Delete a Blueprint artifact.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='managementGroupName'>
/// azure managementGroup name, which we save the blueprint to.
/// </param>
/// <param name='blueprintName'>
/// name of the blueprint.
/// </param>
/// <param name='artifactName'>
/// name of the artifact.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Artifact> 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;
}
}

/// <summary>
/// List artifacts for a given Blueprint.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='managementGroupName'>
/// azure managementGroup name, which we save the blueprint to.
/// </param>
/// <param name='blueprintName'>
/// name of the blueprint.
/// </param>
public static IPage<Artifact> ListInManagementGroup(this IArtifactsOperations operations, string managementGroupName, string blueprintName)
{
var scope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName);
return operations.ListAsync(scope, blueprintName).GetAwaiter().GetResult();
}

/// <summary>
/// List artifacts for a given Blueprint.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='managementGroupName'>
/// azure managementGroup name, which we save the blueprint to.
/// </param>
/// <param name='blueprintName'>
/// name of the blueprint.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<IPage<Artifact>> 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;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
namespace Microsoft.Azure.Management.Blueprint
{
using Microsoft.Rest.Azure;
using Models;
using System.Threading;
using System.Threading.Tasks;

/// <summary>
/// Extension methods for AssignmentOperations.
/// </summary>
public static partial class ManagementGroupAssignmentOperationsExtensions
{
/// <summary>
/// Lists Operations for given blueprint assignment within a management group.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='managementGroupName'>
/// The name of the management group where the assignment is saved.
/// </param>
/// <param name='assignmentName'>
/// The name of the assignment.
/// </param>
public static IPage<AssignmentOperation> ListInManagementGroup(this IAssignmentOperations operations, string managementGroupName, string assignmentName)
{
var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName);
return operations.ListAsync(resourceScope, assignmentName).GetAwaiter().GetResult();
}

/// <summary>
/// Lists Operations for given blueprint assignment within a management group.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='managementGroupName'>
/// The name of the management group where the assignment is saved.
/// </param>
/// <param name='assignmentName'>
/// The name of the assignment.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<IPage<AssignmentOperation>> 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;
}
}

/// <summary>
/// Gets a Blueprint assignment operation.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='managementGroupName'>
/// The name of the management group where the assignment is saved.
/// </param>
/// <param name='assignmentName'>
/// The name of the assignment.
/// </param>
/// <param name='assignmentOperationName'>
/// The name of the assignment operation.
/// </param>
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();
}

/// <summary>
/// Gets a Blueprint assignment operation.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='managementGroupName'>
/// The name of the management group where the assignment is saved.
/// </param>
/// <param name='assignmentName'>
/// The name of the assignment.
/// </param>
/// <param name='assignmentOperationName'>
/// The name of the assignment operation.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<AssignmentOperation> 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;
}
}
}
}

Loading

0 comments on commit cb81935

Please sign in to comment.