Class Lock
Manages a Management Lock which is scoped to a Subscription, Resource Group or Resource.
Example Usage (Subscription Level Lock)
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var current = Output.Create(Azure.Core.GetSubscription.InvokeAsync());
var subscription_level = new Azure.Management.Lock("subscription-level", new Azure.Management.LockArgs
{
Scope = current.Apply(current => current.Id),
LockLevel = "CanNotDelete",
Notes = "Items can't be deleted in this subscription!",
});
}
}
## Example Usage (Resource Group Level Lock)
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var example = new Azure.Core.ResourceGroup("example", new Azure.Core.ResourceGroupArgs
{
Location = "West Europe",
});
var resource_group_level = new Azure.Management.Lock("resource-group-level", new Azure.Management.LockArgs
{
Scope = example.Id,
LockLevel = "ReadOnly",
Notes = "This Resource Group is Read-Only",
});
}
}
Example Usage (Resource Level Lock)
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "West Europe",
});
var examplePublicIp = new Azure.Network.PublicIp("examplePublicIp", new Azure.Network.PublicIpArgs
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
AllocationMethod = "Static",
IdleTimeoutInMinutes = 30,
});
var public_ip = new Azure.Management.Lock("public-ip", new Azure.Management.LockArgs
{
Scope = examplePublicIp.Id,
LockLevel = "CanNotDelete",
Notes = "Locked because it's needed by a third-party",
});
}
}
Inherited Members
Namespace: Pulumi.Azure.Management
Assembly: Pulumi.Azure.dll
Syntax
public class Lock : CustomResource
Constructors
View SourceLock(String, LockArgs, CustomResourceOptions)
Create a Lock resource with the given unique name, arguments, and options.
Declaration
public Lock(string name, LockArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| LockArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceLockLevel
Specifies the Level to be used for this Lock. Possible values are CanNotDelete and ReadOnly. Changing this forces a new resource to be created.
Declaration
public Output<string> LockLevel { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Name
Specifies the name of the Management Lock. Changing this forces a new resource to be created.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Notes
Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.
Declaration
public Output<string> Notes { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Scope
Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.
Declaration
public Output<string> Scope { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, LockState, CustomResourceOptions)
Get an existing Lock resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static Lock Get(string name, Input<string> id, LockState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| LockState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| Lock |