1. Packages
  2. Linode Provider
  3. API Docs
  4. getLocks
Linode v5.6.0 published on Wednesday, Dec 24, 2025 by Pulumi
linode logo
Linode v5.6.0 published on Wednesday, Dec 24, 2025 by Pulumi

    Early Access: Lock functionality is in early access and may not be available to all users.

    Important Only unrestricted users can view locks. Restricted users cannot access lock information even if they have permissions for the resources.

    Provides information about Linode Locks that match a set of filters. Locks prevent accidental deletion, rebuild operations, and service transfers of resources.

    For more information, see the Linode APIv4 docs (TBD).

    Example Usage

    Get all locks in a type:

    import * as pulumi from "@pulumi/pulumi";
    import * as linode from "@pulumi/linode";
    
    const myInstanceLocks = linode.getLocks({
        filters: [{
            name: "lock_type",
            values: ["cannot_delete"],
        }],
    });
    
    import pulumi
    import pulumi_linode as linode
    
    my_instance_locks = linode.get_locks(filters=[{
        "name": "lock_type",
        "values": ["cannot_delete"],
    }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-linode/sdk/v5/go/linode"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := linode.GetLocks(ctx, &linode.GetLocksArgs{
    			Filters: []linode.GetLocksFilter{
    				{
    					Name: "lock_type",
    					Values: []string{
    						"cannot_delete",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Linode = Pulumi.Linode;
    
    return await Deployment.RunAsync(() => 
    {
        var myInstanceLocks = Linode.GetLocks.Invoke(new()
        {
            Filters = new[]
            {
                new Linode.Inputs.GetLocksFilterInputArgs
                {
                    Name = "lock_type",
                    Values = new[]
                    {
                        "cannot_delete",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.linode.LinodeFunctions;
    import com.pulumi.linode.inputs.GetLocksArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var myInstanceLocks = LinodeFunctions.getLocks(GetLocksArgs.builder()
                .filters(GetLocksFilterArgs.builder()
                    .name("lock_type")
                    .values("cannot_delete")
                    .build())
                .build());
    
        }
    }
    
    variables:
      myInstanceLocks:
        fn::invoke:
          function: linode:getLocks
          arguments:
            filters:
              - name: lock_type
                values:
                  - cannot_delete
    

    Get information about all locks:

    import * as pulumi from "@pulumi/pulumi";
    import * as linode from "@pulumi/linode";
    
    const all = linode.getLocks({});
    export const allLockIds = all.then(all => all.locks.map(__item => __item.id));
    
    import pulumi
    import pulumi_linode as linode
    
    all = linode.get_locks()
    pulumi.export("allLockIds", [__item.id for __item in all.locks])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-linode/sdk/v5/go/linode"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    all, err := linode.GetLocks(ctx, &linode.GetLocksArgs{
    }, nil);
    if err != nil {
    return err
    }
    ctx.Export("allLockIds", pulumi.IntArray(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:3,11-26)))
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Linode = Pulumi.Linode;
    
    return await Deployment.RunAsync(() => 
    {
        var all = Linode.GetLocks.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["allLockIds"] = all.Apply(getLocksResult => getLocksResult.Locks).Select(__item => __item.Id).ToList(),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.linode.LinodeFunctions;
    import com.pulumi.linode.inputs.GetLocksArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var all = LinodeFunctions.getLocks(GetLocksArgs.builder()
                .build());
    
            ctx.export("allLockIds", all.locks().stream().map(element -> element.id()).collect(toList()));
        }
    }
    
    Example coming soon!
    

    Filterable Fields

    • id

    • lock_type

    Using getLocks

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getLocks(args: GetLocksArgs, opts?: InvokeOptions): Promise<GetLocksResult>
    function getLocksOutput(args: GetLocksOutputArgs, opts?: InvokeOptions): Output<GetLocksResult>
    def get_locks(filters: Optional[Sequence[GetLocksFilter]] = None,
                  order: Optional[str] = None,
                  order_by: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetLocksResult
    def get_locks_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetLocksFilterArgs]]]] = None,
                  order: Optional[pulumi.Input[str]] = None,
                  order_by: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetLocksResult]
    func GetLocks(ctx *Context, args *GetLocksArgs, opts ...InvokeOption) (*GetLocksResult, error)
    func GetLocksOutput(ctx *Context, args *GetLocksOutputArgs, opts ...InvokeOption) GetLocksResultOutput

    > Note: This function is named GetLocks in the Go SDK.

    public static class GetLocks 
    {
        public static Task<GetLocksResult> InvokeAsync(GetLocksArgs args, InvokeOptions? opts = null)
        public static Output<GetLocksResult> Invoke(GetLocksInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetLocksResult> getLocks(GetLocksArgs args, InvokeOptions options)
    public static Output<GetLocksResult> getLocks(GetLocksArgs args, InvokeOptions options)
    
    fn::invoke:
      function: linode:index/getLocks:getLocks
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<GetLocksFilter>
    Order string
    The order in which results should be returned. (asc, desc; default asc)
    OrderBy string
    The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
    Filters []GetLocksFilter
    Order string
    The order in which results should be returned. (asc, desc; default asc)
    OrderBy string
    The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
    filters List<GetLocksFilter>
    order String
    The order in which results should be returned. (asc, desc; default asc)
    orderBy String
    The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
    filters GetLocksFilter[]
    order string
    The order in which results should be returned. (asc, desc; default asc)
    orderBy string
    The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
    filters Sequence[GetLocksFilter]
    order str
    The order in which results should be returned. (asc, desc; default asc)
    order_by str
    The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
    filters List<Property Map>
    order String
    The order in which results should be returned. (asc, desc; default asc)
    orderBy String
    The attribute to order the results by. See the Filterable Fields section for a list of valid fields.

    getLocks Result

    The following output properties are available:

    Id string
    The unique ID of the Lock.
    Locks List<GetLocksLock>
    A list of Linode Locks that match the filter criteria.
    Filters List<GetLocksFilter>
    Order string
    OrderBy string
    Id string
    The unique ID of the Lock.
    Locks []GetLocksLock
    A list of Linode Locks that match the filter criteria.
    Filters []GetLocksFilter
    Order string
    OrderBy string
    id String
    The unique ID of the Lock.
    locks List<GetLocksLock>
    A list of Linode Locks that match the filter criteria.
    filters List<GetLocksFilter>
    order String
    orderBy String
    id string
    The unique ID of the Lock.
    locks GetLocksLock[]
    A list of Linode Locks that match the filter criteria.
    filters GetLocksFilter[]
    order string
    orderBy string
    id str
    The unique ID of the Lock.
    locks Sequence[GetLocksLock]
    A list of Linode Locks that match the filter criteria.
    filters Sequence[GetLocksFilter]
    order str
    order_by str
    id String
    The unique ID of the Lock.
    locks List<Property Map>
    A list of Linode Locks that match the filter criteria.
    filters List<Property Map>
    order String
    orderBy String

    Supporting Types

    GetLocksFilter

    Name string
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    Values List<string>
    A list of values for the filter to allow. These values should all be in string form.
    MatchBy string
    The method to match the field by. (exact, regex, substring; default exact)
    Name string
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    Values []string
    A list of values for the filter to allow. These values should all be in string form.
    MatchBy string
    The method to match the field by. (exact, regex, substring; default exact)
    name String
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    values List<String>
    A list of values for the filter to allow. These values should all be in string form.
    matchBy String
    The method to match the field by. (exact, regex, substring; default exact)
    name string
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    values string[]
    A list of values for the filter to allow. These values should all be in string form.
    matchBy string
    The method to match the field by. (exact, regex, substring; default exact)
    name str
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    values Sequence[str]
    A list of values for the filter to allow. These values should all be in string form.
    match_by str
    The method to match the field by. (exact, regex, substring; default exact)
    name String
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    values List<String>
    A list of values for the filter to allow. These values should all be in string form.
    matchBy String
    The method to match the field by. (exact, regex, substring; default exact)

    GetLocksLock

    EntityId int
    The ID of the locked entity.
    EntityLabel string
    The label of the locked entity.
    EntityType string
    The type of the locked entity.
    EntityUrl string
    The URL of the locked entity.
    Id int
    The unique ID of the Lock.
    LockType string
    The type of lock.
    EntityId int
    The ID of the locked entity.
    EntityLabel string
    The label of the locked entity.
    EntityType string
    The type of the locked entity.
    EntityUrl string
    The URL of the locked entity.
    Id int
    The unique ID of the Lock.
    LockType string
    The type of lock.
    entityId Integer
    The ID of the locked entity.
    entityLabel String
    The label of the locked entity.
    entityType String
    The type of the locked entity.
    entityUrl String
    The URL of the locked entity.
    id Integer
    The unique ID of the Lock.
    lockType String
    The type of lock.
    entityId number
    The ID of the locked entity.
    entityLabel string
    The label of the locked entity.
    entityType string
    The type of the locked entity.
    entityUrl string
    The URL of the locked entity.
    id number
    The unique ID of the Lock.
    lockType string
    The type of lock.
    entity_id int
    The ID of the locked entity.
    entity_label str
    The label of the locked entity.
    entity_type str
    The type of the locked entity.
    entity_url str
    The URL of the locked entity.
    id int
    The unique ID of the Lock.
    lock_type str
    The type of lock.
    entityId Number
    The ID of the locked entity.
    entityLabel String
    The label of the locked entity.
    entityType String
    The type of the locked entity.
    entityUrl String
    The URL of the locked entity.
    id Number
    The unique ID of the Lock.
    lockType String
    The type of lock.

    Package Details

    Repository
    Linode pulumi/pulumi-linode
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the linode Terraform Provider.
    linode logo
    Linode v5.6.0 published on Wednesday, Dec 24, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate