1. Packages
  2. HashiCorp Nomad
  3. API Docs
  4. getAllocations
Nomad v2.2.0 published on Wednesday, Mar 13, 2024 by Pulumi

nomad.getAllocations

Explore with Pulumi AI

nomad logo
Nomad v2.2.0 published on Wednesday, Mar 13, 2024 by Pulumi

    Retrieve a list of allocations from Nomad.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as nomad from "@pulumi/nomad";
    
    const example = nomad.getAllocations({
        filter: "JobID == \"example\"",
    });
    
    import pulumi
    import pulumi_nomad as nomad
    
    example = nomad.get_allocations(filter="JobID == \"example\"")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-nomad/sdk/v2/go/nomad"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := nomad.GetAllocations(ctx, &nomad.GetAllocationsArgs{
    			Filter: pulumi.StringRef("JobID == \"example\""),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Nomad = Pulumi.Nomad;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Nomad.GetAllocations.Invoke(new()
        {
            Filter = "JobID == \"example\"",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.nomad.NomadFunctions;
    import com.pulumi.nomad.inputs.GetAllocationsArgs;
    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 example = NomadFunctions.getAllocations(GetAllocationsArgs.builder()
                .filter("JobID == \"example\"")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: nomad:getAllocations
          Arguments:
            filter: JobID == "example"
    

    Using getAllocations

    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 getAllocations(args: GetAllocationsArgs, opts?: InvokeOptions): Promise<GetAllocationsResult>
    function getAllocationsOutput(args: GetAllocationsOutputArgs, opts?: InvokeOptions): Output<GetAllocationsResult>
    def get_allocations(filter: Optional[str] = None,
                        namespace: Optional[str] = None,
                        prefix: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetAllocationsResult
    def get_allocations_output(filter: Optional[pulumi.Input[str]] = None,
                        namespace: Optional[pulumi.Input[str]] = None,
                        prefix: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetAllocationsResult]
    func GetAllocations(ctx *Context, args *GetAllocationsArgs, opts ...InvokeOption) (*GetAllocationsResult, error)
    func GetAllocationsOutput(ctx *Context, args *GetAllocationsOutputArgs, opts ...InvokeOption) GetAllocationsResultOutput

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

    public static class GetAllocations 
    {
        public static Task<GetAllocationsResult> InvokeAsync(GetAllocationsArgs args, InvokeOptions? opts = null)
        public static Output<GetAllocationsResult> Invoke(GetAllocationsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAllocationsResult> getAllocations(GetAllocationsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: nomad:index/getAllocations:getAllocations
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filter string
    (string: <optional>) - Specifies the [expression][nomad_api_filter] used to filter the results.
    Namespace string
    (string: <optional>) - Specifies the namespace to search for allocations in.
    Prefix string
    (string: <optional>) - Specifies a string to filter allocations based on an ID prefix.
    Filter string
    (string: <optional>) - Specifies the [expression][nomad_api_filter] used to filter the results.
    Namespace string
    (string: <optional>) - Specifies the namespace to search for allocations in.
    Prefix string
    (string: <optional>) - Specifies a string to filter allocations based on an ID prefix.
    filter String
    (string: <optional>) - Specifies the [expression][nomad_api_filter] used to filter the results.
    namespace String
    (string: <optional>) - Specifies the namespace to search for allocations in.
    prefix String
    (string: <optional>) - Specifies a string to filter allocations based on an ID prefix.
    filter string
    (string: <optional>) - Specifies the [expression][nomad_api_filter] used to filter the results.
    namespace string
    (string: <optional>) - Specifies the namespace to search for allocations in.
    prefix string
    (string: <optional>) - Specifies a string to filter allocations based on an ID prefix.
    filter str
    (string: <optional>) - Specifies the [expression][nomad_api_filter] used to filter the results.
    namespace str
    (string: <optional>) - Specifies the namespace to search for allocations in.
    prefix str
    (string: <optional>) - Specifies a string to filter allocations based on an ID prefix.
    filter String
    (string: <optional>) - Specifies the [expression][nomad_api_filter] used to filter the results.
    namespace String
    (string: <optional>) - Specifies the namespace to search for allocations in.
    prefix String
    (string: <optional>) - Specifies a string to filter allocations based on an ID prefix.

    getAllocations Result

    The following output properties are available:

    Allocations List<GetAllocationsAllocation>
    (list of allocations) - A list of allocations matching the search criteria.
    Id string
    The provider-assigned unique ID for this managed resource.
    Filter string
    Namespace string
    (string) - The namespace the allocation belongs to.
    Prefix string
    Allocations []GetAllocationsAllocation
    (list of allocations) - A list of allocations matching the search criteria.
    Id string
    The provider-assigned unique ID for this managed resource.
    Filter string
    Namespace string
    (string) - The namespace the allocation belongs to.
    Prefix string
    allocations List<GetAllocationsAllocation>
    (list of allocations) - A list of allocations matching the search criteria.
    id String
    The provider-assigned unique ID for this managed resource.
    filter String
    namespace String
    (string) - The namespace the allocation belongs to.
    prefix String
    allocations GetAllocationsAllocation[]
    (list of allocations) - A list of allocations matching the search criteria.
    id string
    The provider-assigned unique ID for this managed resource.
    filter string
    namespace string
    (string) - The namespace the allocation belongs to.
    prefix string
    allocations Sequence[GetAllocationsAllocation]
    (list of allocations) - A list of allocations matching the search criteria.
    id str
    The provider-assigned unique ID for this managed resource.
    filter str
    namespace str
    (string) - The namespace the allocation belongs to.
    prefix str
    allocations List<Property Map>
    (list of allocations) - A list of allocations matching the search criteria.
    id String
    The provider-assigned unique ID for this managed resource.
    filter String
    namespace String
    (string) - The namespace the allocation belongs to.
    prefix String

    Supporting Types

    GetAllocationsAllocation

    ClientStatus string
    (string) - The current client status of the allocation.
    CreateIndex int
    (int) - The Raft index in which the allocation was created.
    CreateTime int
    (int) - The timestamp of when the allocation was created.
    DesiredStatus string
    (string) - The current desired status of the allocation.
    EvalId string
    (string) - The ID of the evaluation that generated the allocation.
    FollowupEvalId string
    (string) - The ID of the evaluation that succeeds the allocation evaluation.
    Id string
    (string) - The ID of the allocation.
    JobId string
    (string) - The ID of the job related to the allocation.
    JobType string
    (string) - The type of the job related to the allocation.
    JobVersion int
    (int) - The version of the job that generated the allocation.
    ModifyIndex int
    (int) - The Raft index in which the allocation was last modified.
    ModifyTime int
    (int) - The timestamp of when the allocation was last modified.
    Name string
    (string) - The name of the allocation.
    Namespace string
    (string: <optional>) - Specifies the namespace to search for allocations in.
    NextAllocation string
    (string) - The ID of the allocation that succeeds the allocation.
    NodeId string
    (string) - The ID of the node to which the allocation was scheduled.
    NodeName string
    (string) - The ID of the node to which the allocation was scheduled.
    PreemptedByAllocation string
    (string) - The ID of the allocation that preempted the allocation.
    TaskGroup string
    (string) - The job task group related to the allocation.
    ClientStatus string
    (string) - The current client status of the allocation.
    CreateIndex int
    (int) - The Raft index in which the allocation was created.
    CreateTime int
    (int) - The timestamp of when the allocation was created.
    DesiredStatus string
    (string) - The current desired status of the allocation.
    EvalId string
    (string) - The ID of the evaluation that generated the allocation.
    FollowupEvalId string
    (string) - The ID of the evaluation that succeeds the allocation evaluation.
    Id string
    (string) - The ID of the allocation.
    JobId string
    (string) - The ID of the job related to the allocation.
    JobType string
    (string) - The type of the job related to the allocation.
    JobVersion int
    (int) - The version of the job that generated the allocation.
    ModifyIndex int
    (int) - The Raft index in which the allocation was last modified.
    ModifyTime int
    (int) - The timestamp of when the allocation was last modified.
    Name string
    (string) - The name of the allocation.
    Namespace string
    (string: <optional>) - Specifies the namespace to search for allocations in.
    NextAllocation string
    (string) - The ID of the allocation that succeeds the allocation.
    NodeId string
    (string) - The ID of the node to which the allocation was scheduled.
    NodeName string
    (string) - The ID of the node to which the allocation was scheduled.
    PreemptedByAllocation string
    (string) - The ID of the allocation that preempted the allocation.
    TaskGroup string
    (string) - The job task group related to the allocation.
    clientStatus String
    (string) - The current client status of the allocation.
    createIndex Integer
    (int) - The Raft index in which the allocation was created.
    createTime Integer
    (int) - The timestamp of when the allocation was created.
    desiredStatus String
    (string) - The current desired status of the allocation.
    evalId String
    (string) - The ID of the evaluation that generated the allocation.
    followupEvalId String
    (string) - The ID of the evaluation that succeeds the allocation evaluation.
    id String
    (string) - The ID of the allocation.
    jobId String
    (string) - The ID of the job related to the allocation.
    jobType String
    (string) - The type of the job related to the allocation.
    jobVersion Integer
    (int) - The version of the job that generated the allocation.
    modifyIndex Integer
    (int) - The Raft index in which the allocation was last modified.
    modifyTime Integer
    (int) - The timestamp of when the allocation was last modified.
    name String
    (string) - The name of the allocation.
    namespace String
    (string: <optional>) - Specifies the namespace to search for allocations in.
    nextAllocation String
    (string) - The ID of the allocation that succeeds the allocation.
    nodeId String
    (string) - The ID of the node to which the allocation was scheduled.
    nodeName String
    (string) - The ID of the node to which the allocation was scheduled.
    preemptedByAllocation String
    (string) - The ID of the allocation that preempted the allocation.
    taskGroup String
    (string) - The job task group related to the allocation.
    clientStatus string
    (string) - The current client status of the allocation.
    createIndex number
    (int) - The Raft index in which the allocation was created.
    createTime number
    (int) - The timestamp of when the allocation was created.
    desiredStatus string
    (string) - The current desired status of the allocation.
    evalId string
    (string) - The ID of the evaluation that generated the allocation.
    followupEvalId string
    (string) - The ID of the evaluation that succeeds the allocation evaluation.
    id string
    (string) - The ID of the allocation.
    jobId string
    (string) - The ID of the job related to the allocation.
    jobType string
    (string) - The type of the job related to the allocation.
    jobVersion number
    (int) - The version of the job that generated the allocation.
    modifyIndex number
    (int) - The Raft index in which the allocation was last modified.
    modifyTime number
    (int) - The timestamp of when the allocation was last modified.
    name string
    (string) - The name of the allocation.
    namespace string
    (string: <optional>) - Specifies the namespace to search for allocations in.
    nextAllocation string
    (string) - The ID of the allocation that succeeds the allocation.
    nodeId string
    (string) - The ID of the node to which the allocation was scheduled.
    nodeName string
    (string) - The ID of the node to which the allocation was scheduled.
    preemptedByAllocation string
    (string) - The ID of the allocation that preempted the allocation.
    taskGroup string
    (string) - The job task group related to the allocation.
    client_status str
    (string) - The current client status of the allocation.
    create_index int
    (int) - The Raft index in which the allocation was created.
    create_time int
    (int) - The timestamp of when the allocation was created.
    desired_status str
    (string) - The current desired status of the allocation.
    eval_id str
    (string) - The ID of the evaluation that generated the allocation.
    followup_eval_id str
    (string) - The ID of the evaluation that succeeds the allocation evaluation.
    id str
    (string) - The ID of the allocation.
    job_id str
    (string) - The ID of the job related to the allocation.
    job_type str
    (string) - The type of the job related to the allocation.
    job_version int
    (int) - The version of the job that generated the allocation.
    modify_index int
    (int) - The Raft index in which the allocation was last modified.
    modify_time int
    (int) - The timestamp of when the allocation was last modified.
    name str
    (string) - The name of the allocation.
    namespace str
    (string: <optional>) - Specifies the namespace to search for allocations in.
    next_allocation str
    (string) - The ID of the allocation that succeeds the allocation.
    node_id str
    (string) - The ID of the node to which the allocation was scheduled.
    node_name str
    (string) - The ID of the node to which the allocation was scheduled.
    preempted_by_allocation str
    (string) - The ID of the allocation that preempted the allocation.
    task_group str
    (string) - The job task group related to the allocation.
    clientStatus String
    (string) - The current client status of the allocation.
    createIndex Number
    (int) - The Raft index in which the allocation was created.
    createTime Number
    (int) - The timestamp of when the allocation was created.
    desiredStatus String
    (string) - The current desired status of the allocation.
    evalId String
    (string) - The ID of the evaluation that generated the allocation.
    followupEvalId String
    (string) - The ID of the evaluation that succeeds the allocation evaluation.
    id String
    (string) - The ID of the allocation.
    jobId String
    (string) - The ID of the job related to the allocation.
    jobType String
    (string) - The type of the job related to the allocation.
    jobVersion Number
    (int) - The version of the job that generated the allocation.
    modifyIndex Number
    (int) - The Raft index in which the allocation was last modified.
    modifyTime Number
    (int) - The timestamp of when the allocation was last modified.
    name String
    (string) - The name of the allocation.
    namespace String
    (string: <optional>) - Specifies the namespace to search for allocations in.
    nextAllocation String
    (string) - The ID of the allocation that succeeds the allocation.
    nodeId String
    (string) - The ID of the node to which the allocation was scheduled.
    nodeName String
    (string) - The ID of the node to which the allocation was scheduled.
    preemptedByAllocation String
    (string) - The ID of the allocation that preempted the allocation.
    taskGroup String
    (string) - The job task group related to the allocation.

    Package Details

    Repository
    HashiCorp Nomad pulumi/pulumi-nomad
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the nomad Terraform Provider.
    nomad logo
    Nomad v2.2.0 published on Wednesday, Mar 13, 2024 by Pulumi