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
idlock_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 dictionaryThe following arguments are supported:
- Filters
List<Get
Locks Filter> - Order string
- The order in which results should be returned. (
asc,desc; defaultasc) - Order
By string - The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
- Filters
[]Get
Locks Filter - Order string
- The order in which results should be returned. (
asc,desc; defaultasc) - Order
By string - The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
- filters
List<Get
Locks Filter> - order String
- The order in which results should be returned. (
asc,desc; defaultasc) - order
By String - The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
- filters
Get
Locks Filter[] - order string
- The order in which results should be returned. (
asc,desc; defaultasc) - order
By string - The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
- filters
Sequence[Get
Locks Filter] - order str
- The order in which results should be returned. (
asc,desc; defaultasc) - 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; defaultasc) - order
By 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<Get
Locks Lock> - A list of Linode Locks that match the filter criteria.
- Filters
List<Get
Locks Filter> - Order string
- Order
By string
- Id string
- The unique ID of the Lock.
- Locks
[]Get
Locks Lock - A list of Linode Locks that match the filter criteria.
- Filters
[]Get
Locks Filter - Order string
- Order
By string
- id String
- The unique ID of the Lock.
- locks
List<Get
Locks Lock> - A list of Linode Locks that match the filter criteria.
- filters
List<Get
Locks Filter> - order String
- order
By String
- id string
- The unique ID of the Lock.
- locks
Get
Locks Lock[] - A list of Linode Locks that match the filter criteria.
- filters
Get
Locks Filter[] - order string
- order
By string
- id str
- The unique ID of the Lock.
- locks
Sequence[Get
Locks Lock] - A list of Linode Locks that match the filter criteria.
- filters
Sequence[Get
Locks Filter] - 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
- order
By 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.
- Match
By string - The method to match the field by. (
exact,regex,substring; defaultexact)
- 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.
- Match
By string - The method to match the field by. (
exact,regex,substring; defaultexact)
- 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.
- match
By String - The method to match the field by. (
exact,regex,substring; defaultexact)
- 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.
- match
By string - The method to match the field by. (
exact,regex,substring; defaultexact)
- 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; defaultexact)
- 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.
- match
By String - The method to match the field by. (
exact,regex,substring; defaultexact)
GetLocksLock
- Entity
Id int - The ID of the locked entity.
- Entity
Label string - The label of the locked entity.
- Entity
Type string - The type of the locked entity.
- Entity
Url string - The URL of the locked entity.
- Id int
- The unique ID of the Lock.
- Lock
Type string - The type of lock.
- Entity
Id int - The ID of the locked entity.
- Entity
Label string - The label of the locked entity.
- Entity
Type string - The type of the locked entity.
- Entity
Url string - The URL of the locked entity.
- Id int
- The unique ID of the Lock.
- Lock
Type string - The type of lock.
- entity
Id Integer - The ID of the locked entity.
- entity
Label String - The label of the locked entity.
- entity
Type String - The type of the locked entity.
- entity
Url String - The URL of the locked entity.
- id Integer
- The unique ID of the Lock.
- lock
Type String - The type of lock.
- entity
Id number - The ID of the locked entity.
- entity
Label string - The label of the locked entity.
- entity
Type string - The type of the locked entity.
- entity
Url string - The URL of the locked entity.
- id number
- The unique ID of the Lock.
- lock
Type 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.
- entity
Id Number - The ID of the locked entity.
- entity
Label String - The label of the locked entity.
- entity
Type String - The type of the locked entity.
- entity
Url String - The URL of the locked entity.
- id Number
- The unique ID of the Lock.
- lock
Type String - The type of lock.
Package Details
- Repository
- Linode pulumi/pulumi-linode
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
linodeTerraform Provider.
