Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ReleasePR Microsoft.Azure.Management.Blueprint] [Blueprint] Remove length limitation from RG name and location properties #11470

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
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
{
/// <summary>
/// Creates or updates a Blueprint assignment in 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 will be saved.
/// </param>
/// <param name='assignmentName'>
/// The name of the assignment.
/// </param>
/// <param name='assignment'>
/// The assignment object to save.
/// </param>

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();
}

/// <summary>
/// Creates or updates a Blueprint assignment in 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 will be saved.
/// </param>
/// <param name='assignmentName'>
/// The name of the assignment.
/// </param>
/// <param name='assignment'>
/// The assignment object to save.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Assignment> 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;
}
}

/// <summary>
/// Gets a Blueprint assignment in 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 Assignment GetInSubscription(this IAssignmentsOperations operations, string managementGroupName, string assignmentName)
{
var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName);
return operations.GetInSubscriptionAsync(resourceScope, assignmentName).GetAwaiter().GetResult();
}

/// <summary>
/// Gets a Blueprint assignment in 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<Assignment> 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;
}
}

/// <summary>
/// Deletes a Blueprint assignment in 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 Assignment DeleteInManagementGroup(this IAssignmentsOperations operations, string managementGroupName, string assignmentName)
{
var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName);
return operations.DeleteAsync(resourceScope, assignmentName).GetAwaiter().GetResult();
}

/// <summary>
/// Deletes a Blueprint assignment in 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<Assignment> DeleteInManagementGroupAsync(this IAssignmentsOperations operations, string managementGroupName, string assignmentName, CancellationToken cancellationToken = default(CancellationToken))
{
var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName);
using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceScope, assignmentName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}

/// <summary>
/// Lists Blueprint assignments 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 assignments are saved.
/// </param>
public static IPage<Assignment> ListInManagementGroup(this IAssignmentsOperations operations, string managementGroupName)
{
var resourceScope = string.Format(Constants.ResourceScopes.ManagementGroupScope, managementGroupName);
return operations.ListAsync(resourceScope).GetAwaiter().GetResult();
}

/// <summary>
/// Lists Blueprint assignments 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 assignments are saved.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<IPage<Assignment>> 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;
}
}

}
}

Loading