/// <summary> /// Creates or updates a management lock at the subscription level. /// </summary> /// <remarks> /// When you apply a lock at a parent scope, all child resources inherit the /// same lock. To create management locks, you must have access to /// Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of /// the built-in roles, only Owner and User Access Administrator are granted /// those actions. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='lockName'> /// The name of lock. The lock name can be a maximum of 260 characters. It /// cannot contain <, > %, &, :, \, ?, /, or any control characters. /// </param> /// <param name='parameters'> /// The management lock parameters. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ManagementLockObjectInner> CreateOrUpdateAtSubscriptionLevelAsync(this IManagementLocksOperations operations, string lockName, ManagementLockObjectInner parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateAtSubscriptionLevelWithHttpMessagesAsync(lockName, parameters, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Deletes the management lock at the subscription level. /// </summary> /// <remarks> /// To delete management locks, you must have access to /// Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of /// the built-in roles, only Owner and User Access Administrator are granted /// those actions. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='lockName'> /// The name of lock to delete. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task DeleteAtSubscriptionLevelAsync(this IManagementLocksOperations operations, string lockName, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteAtSubscriptionLevelWithHttpMessagesAsync(lockName, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <summary> /// Creates or updates a management lock at the resource level or any level /// below the resource. /// </summary> /// <remarks> /// When you apply a lock at a parent scope, all child resources inherit the /// same lock. To create management locks, you must have access to /// Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of /// the built-in roles, only Owner and User Access Administrator are granted /// those actions. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group containing the resource to lock. /// </param> /// <param name='resourceProviderNamespace'> /// The resource provider namespace of the resource to lock. /// </param> /// <param name='parentResourcePath'> /// The parent resource identity. /// </param> /// <param name='resourceType'> /// The resource type of the resource to lock. /// </param> /// <param name='resourceName'> /// The name of the resource to lock. /// </param> /// <param name='lockName'> /// The name of lock. The lock name can be a maximum of 260 characters. It /// cannot contain <, > %, &, :, \, ?, /, or any control characters. /// </param> /// <param name='parameters'> /// Parameters for creating or updating a management lock. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ManagementLockObjectInner> CreateOrUpdateAtResourceLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, ManagementLockObjectInner parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateAtResourceLevelWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, parameters, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Deletes the management lock of a resource or any level below the resource. /// </summary> /// <remarks> /// To delete management locks, you must have access to /// Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of /// the built-in roles, only Owner and User Access Administrator are granted /// those actions. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group containing the resource with the lock to /// delete. /// </param> /// <param name='resourceProviderNamespace'> /// The resource provider namespace of the resource with the lock to delete. /// </param> /// <param name='parentResourcePath'> /// The parent resource identity. /// </param> /// <param name='resourceType'> /// The resource type of the resource with the lock to delete. /// </param> /// <param name='resourceName'> /// The name of the resource with the lock to delete. /// </param> /// <param name='lockName'> /// The name of the lock to delete. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task DeleteAtResourceLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteAtResourceLevelWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <summary> /// Gets all the management locks for a subscription. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='nextPageLink'> /// The NextLink from the previous successful call to List operation. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IPage <ManagementLockObject> > ListAtSubscriptionLevelNextAsync(this IManagementLocksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListAtSubscriptionLevelNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Deletes a management lock at the resource group level. /// </summary> /// To delete management locks, you must have access to /// Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of /// the built-in roles, only Owner and User Access Administrator are granted /// those actions. /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group containing the lock. /// </param> /// <param name='lockName'> /// The name of lock to delete. /// </param> public static void DeleteAtResourceGroupLevel(this IManagementLocksOperations operations, string resourceGroupName, string lockName) { Task.Factory.StartNew(s => ((IManagementLocksOperations)s).DeleteAtResourceGroupLevelAsync(resourceGroupName, lockName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Gets all the management locks for a subscription. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='odataQuery'> /// OData parameters to apply to the operation. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IPage <ManagementLockObject> > ListAtSubscriptionLevelAsync(this IManagementLocksOperations operations, ODataQuery <ManagementLockObject> odataQuery = default(ODataQuery <ManagementLockObject>), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListAtSubscriptionLevelWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Gets all the management locks for a subscription. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='nextPageLink'> /// The NextLink from the previous successful call to List operation. /// </param> public static IPage <ManagementLockObject> ListAtSubscriptionLevelNext(this IManagementLocksOperations operations, string nextPageLink) { return(Task.Factory.StartNew(s => ((IManagementLocksOperations)s).ListAtSubscriptionLevelNextAsync(nextPageLink), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Gets all the management locks for a resource or any level below resource. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group containing the locked resource. The name is /// case insensitive. /// </param> /// <param name='resourceProviderNamespace'> /// The namespace of the resource provider. /// </param> /// <param name='parentResourcePath'> /// The parent resource identity. /// </param> /// <param name='resourceType'> /// The resource type of the locked resource. /// </param> /// <param name='resourceName'> /// The name of the locked resource. /// </param> /// <param name='odataQuery'> /// OData parameters to apply to the operation. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IPage <ManagementLockObject> > ListAtResourceLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery <ManagementLockObject> odataQuery = default(ODataQuery <ManagementLockObject>), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListAtResourceLevelWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Gets all the management locks for a subscription. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='odataQuery'> /// OData parameters to apply to the operation. /// </param> public static IPage <ManagementLockObject> ListAtSubscriptionLevel(this IManagementLocksOperations operations, ODataQuery <ManagementLockObject> odataQuery = default(ODataQuery <ManagementLockObject>)) { return(Task.Factory.StartNew(s => ((IManagementLocksOperations)s).ListAtSubscriptionLevelAsync(odataQuery), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Gets all the management locks for a resource or any level below resource. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group containing the locked resource. The name is /// case insensitive. /// </param> /// <param name='resourceProviderNamespace'> /// The namespace of the resource provider. /// </param> /// <param name='parentResourcePath'> /// The parent resource identity. /// </param> /// <param name='resourceType'> /// The resource type of the locked resource. /// </param> /// <param name='resourceName'> /// The name of the locked resource. /// </param> /// <param name='odataQuery'> /// OData parameters to apply to the operation. /// </param> public static IPage <ManagementLockObject> ListAtResourceLevel(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery <ManagementLockObject> odataQuery = default(ODataQuery <ManagementLockObject>)) { return(Task.Factory.StartNew(s => ((IManagementLocksOperations)s).ListAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Gets a management lock at the subscription level. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='lockName'> /// The name of the lock to get. /// </param> public static ManagementLockObject GetAtSubscriptionLevel(this IManagementLocksOperations operations, string lockName) { return(Task.Factory.StartNew(s => ((IManagementLocksOperations)s).GetAtSubscriptionLevelAsync(lockName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Creates or updates a management lock at the resource group level. /// </summary> /// When you apply a lock at a parent scope, all child resources inherit the /// same lock. To create management locks, you must have access to /// Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of /// the built-in roles, only Owner and User Access Administrator are granted /// those actions. /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group to lock. /// </param> /// <param name='lockName'> /// The lock name. The lock name can be a maximum of 260 characters. It cannot /// contain <, > %, &, :, \\\\, ?, /, or any control characters. /// </param> /// <param name='parameters'> /// The management lock parameters. /// </param> public static ManagementLockObject CreateOrUpdateAtResourceGroupLevel(this IManagementLocksOperations operations, string resourceGroupName, string lockName, ManagementLockObject parameters) { return(Task.Factory.StartNew(s => ((IManagementLocksOperations)s).CreateOrUpdateAtResourceGroupLevelAsync(resourceGroupName, lockName, parameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Delete a management lock by scope. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='scope'> /// The scope for the lock. /// </param> /// <param name='lockName'> /// The name of lock. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task DeleteByScopeAsync(this IManagementLocksOperations operations, string scope, string lockName, CancellationToken cancellationToken = default(CancellationToken)) { await operations.DeleteByScopeWithHttpMessagesAsync(scope, lockName, null, cancellationToken).ConfigureAwait(false); }
/// <summary> /// Deletes a management lock at the resource group level. /// </summary> /// To delete management locks, you must have access to /// Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of /// the built-in roles, only Owner and User Access Administrator are granted /// those actions. /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group containing the lock. /// </param> /// <param name='lockName'> /// The name of lock to delete. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task DeleteAtResourceGroupLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string lockName, CancellationToken cancellationToken = default(CancellationToken)) { await operations.DeleteAtResourceGroupLevelWithHttpMessagesAsync(resourceGroupName, lockName, null, cancellationToken).ConfigureAwait(false); }