Exemplo n.º 1
0
 /// <summary>
 /// Creates or updates a management lock at the resource group 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='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 &lt;, &gt; %, &amp;, :, \, ?, /, or any control characters.
 /// </param>
 /// <param name='parameters'>
 /// The management lock parameters.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ManagementLockObject> CreateOrUpdateAtResourceGroupLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateOrUpdateAtResourceGroupLevelWithHttpMessagesAsync(resourceGroupName, lockName, parameters, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Exemplo n.º 2
0
 /// <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 &lt;, &gt; %, &amp;, :, \, ?, /, or any control characters.
 /// </param>
 /// <param name='parameters'>
 /// The management lock parameters.
 /// </param>
 public static ManagementLockObject CreateOrUpdateAtSubscriptionLevel(this IManagementLocksOperations operations, string lockName, ManagementLockObject parameters)
 {
     return(operations.CreateOrUpdateAtSubscriptionLevelAsync(lockName, parameters).GetAwaiter().GetResult());
 }
Exemplo n.º 3
0
 /// <summary>
 /// Creates or updates a management lock at the resource group 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='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 &lt;, &gt; %, &amp;, :, \, ?, /, 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(operations.CreateOrUpdateAtResourceGroupLevelAsync(resourceGroupName, lockName, parameters).GetAwaiter().GetResult());
 }
Exemplo n.º 4
0
 /// <summary>
 /// Create or update 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. When providing a scope for the assignment, use
 /// '/subscriptions/{subscriptionId}' for subscriptions,
 /// '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for
 /// resource groups, and
 /// '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}'
 /// for resources.
 /// </param>
 /// <param name='lockName'>
 /// The name of lock.
 /// </param>
 /// <param name='parameters'>
 /// Create or update management lock parameters.
 /// </param>
 public static ManagementLockObject CreateOrUpdateByScope(this IManagementLocksOperations operations, string scope, string lockName, ManagementLockObject parameters)
 {
     return(operations.CreateOrUpdateByScopeAsync(scope, lockName, parameters).GetAwaiter().GetResult());
 }
Exemplo n.º 5
0
 /// <summary>
 /// Create or update a management lock at the resource level 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.
 /// </param>
 /// <param name='resourceProviderNamespace'>
 /// Resource identity.
 /// </param>
 /// <param name='parentResourcePath'>
 /// Resource identity.
 /// </param>
 /// <param name='resourceType'>
 /// Resource identity.
 /// </param>
 /// <param name='resourceName'>
 /// Resource identity.
 /// </param>
 /// <param name='lockName'>
 /// The name of lock.
 /// </param>
 /// <param name='parameters'>
 /// Create or update management lock parameters.
 /// </param>
 public static ManagementLockObject CreateOrUpdateAtResourceLevel(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, ManagementLockObject parameters)
 {
     return(Task.Factory.StartNew(s => ((IManagementLocksOperations)s).CreateOrUpdateAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, parameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemplo n.º 6
0
 /// <summary>
 /// Create or update 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 lock.
 /// </param>
 /// <param name='parameters'>
 /// The management lock parameters.
 /// </param>
 public static ManagementLockObject CreateOrUpdateAtSubscriptionLevel(this IManagementLocksOperations operations, string lockName, ManagementLockObject parameters)
 {
     return(Task.Factory.StartNew(s => ((IManagementLocksOperations)s).CreateOrUpdateAtSubscriptionLevelAsync(lockName, parameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }