Linode v4.30.0 published on Friday, Nov 8, 2024 by Pulumi
linode.getPlacementGroups
Explore with Pulumi AI
Provides information about a list of Linode Placement Groups that match a set of filters. For more information, see the Linode APIv4 docs.
Example Usage
The following example shows how one might use this data source to list Placement Groups.
import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";
export = async () => {
    const all = await linode.getPlacementGroups({});
    const filtered = await linode.getPlacementGroups({
        filters: [{
            name: "label",
            values: ["my-label"],
        }],
    });
    return {
        "all-pgs": all.placementGroups,
        "filtered-pgs": filtered.placementGroups,
    };
}
import pulumi
import pulumi_linode as linode
all = linode.get_placement_groups()
filtered = linode.get_placement_groups(filters=[{
    "name": "label",
    "values": ["my-label"],
}])
pulumi.export("all-pgs", all.placement_groups)
pulumi.export("filtered-pgs", filtered.placement_groups)
package main
import (
	"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		all, err := linode.GetPlacementGroups(ctx, &linode.GetPlacementGroupsArgs{}, nil)
		if err != nil {
			return err
		}
		filtered, err := linode.GetPlacementGroups(ctx, &linode.GetPlacementGroupsArgs{
			Filters: []linode.GetPlacementGroupsFilter{
				{
					Name: "label",
					Values: []string{
						"my-label",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("all-pgs", all.PlacementGroups)
		ctx.Export("filtered-pgs", filtered.PlacementGroups)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Linode = Pulumi.Linode;
return await Deployment.RunAsync(() => 
{
    var all = Linode.GetPlacementGroups.Invoke();
    var filtered = Linode.GetPlacementGroups.Invoke(new()
    {
        Filters = new[]
        {
            new Linode.Inputs.GetPlacementGroupsFilterInputArgs
            {
                Name = "label",
                Values = new[]
                {
                    "my-label",
                },
            },
        },
    });
    return new Dictionary<string, object?>
    {
        ["all-pgs"] = all.Apply(getPlacementGroupsResult => getPlacementGroupsResult.PlacementGroups),
        ["filtered-pgs"] = filtered.Apply(getPlacementGroupsResult => getPlacementGroupsResult.PlacementGroups),
    };
});
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.GetPlacementGroupsArgs;
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.getPlacementGroups();
        final var filtered = LinodeFunctions.getPlacementGroups(GetPlacementGroupsArgs.builder()
            .filters(GetPlacementGroupsFilterArgs.builder()
                .name("label")
                .values("my-label")
                .build())
            .build());
        ctx.export("all-pgs", all.applyValue(getPlacementGroupsResult -> getPlacementGroupsResult.placementGroups()));
        ctx.export("filtered-pgs", filtered.applyValue(getPlacementGroupsResult -> getPlacementGroupsResult.placementGroups()));
    }
}
variables:
  all:
    fn::invoke:
      Function: linode:getPlacementGroups
      Arguments: {}
  filtered:
    fn::invoke:
      Function: linode:getPlacementGroups
      Arguments:
        filters:
          - name: label
            values:
              - my-label
outputs:
  all-pgs: ${all.placementGroups}
  filtered-pgs: ${filtered.placementGroups}
Filterable Fields
idlabelregionplacement_group_typeplacement_group_policyis_compliant
Using getPlacementGroups
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 getPlacementGroups(args: GetPlacementGroupsArgs, opts?: InvokeOptions): Promise<GetPlacementGroupsResult>
function getPlacementGroupsOutput(args: GetPlacementGroupsOutputArgs, opts?: InvokeOptions): Output<GetPlacementGroupsResult>def get_placement_groups(filters: Optional[Sequence[GetPlacementGroupsFilter]] = None,
                         order: Optional[str] = None,
                         order_by: Optional[str] = None,
                         placement_groups: Optional[Sequence[GetPlacementGroupsPlacementGroup]] = None,
                         opts: Optional[InvokeOptions] = None) -> GetPlacementGroupsResult
def get_placement_groups_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetPlacementGroupsFilterArgs]]]] = None,
                         order: Optional[pulumi.Input[str]] = None,
                         order_by: Optional[pulumi.Input[str]] = None,
                         placement_groups: Optional[pulumi.Input[Sequence[pulumi.Input[GetPlacementGroupsPlacementGroupArgs]]]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetPlacementGroupsResult]func GetPlacementGroups(ctx *Context, args *GetPlacementGroupsArgs, opts ...InvokeOption) (*GetPlacementGroupsResult, error)
func GetPlacementGroupsOutput(ctx *Context, args *GetPlacementGroupsOutputArgs, opts ...InvokeOption) GetPlacementGroupsResultOutput> Note: This function is named GetPlacementGroups in the Go SDK.
public static class GetPlacementGroups 
{
    public static Task<GetPlacementGroupsResult> InvokeAsync(GetPlacementGroupsArgs args, InvokeOptions? opts = null)
    public static Output<GetPlacementGroupsResult> Invoke(GetPlacementGroupsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetPlacementGroupsResult> getPlacementGroups(GetPlacementGroupsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: linode:index/getPlacementGroups:getPlacementGroups
  arguments:
    # arguments dictionaryThe following arguments are supported:
getPlacementGroups Result
The following output properties are available:
- id String
 - filters List<Property Map>
 - order String
 - order
By String - placement
Groups List<Property Map> 
Supporting Types
GetPlacementGroupsFilter   
- 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) 
GetPlacementGroupsPlacementGroup    
- Id int
 - The ID of the placement group.
 - Is
Compliant bool - Whether this Linode is currently compliant with the group's placement group type.
 - Label string
 - The label of the Placement Group. This field can only contain ASCII letters, digits and dashes.
 - Placement
Group stringPolicy  - Whether Linodes must be able to become compliant during assignment. (Default 
strict) - Placement
Group stringType  - The placement group type to use when placing Linodes in this group.
 - Region string
 - The region of the Placement Group.
 - Members
List<Get
Placement Groups Placement Group Member>  - A set of Linodes currently assigned to this Placement Group.
 
- Id int
 - The ID of the placement group.
 - Is
Compliant bool - Whether this Linode is currently compliant with the group's placement group type.
 - Label string
 - The label of the Placement Group. This field can only contain ASCII letters, digits and dashes.
 - Placement
Group stringPolicy  - Whether Linodes must be able to become compliant during assignment. (Default 
strict) - Placement
Group stringType  - The placement group type to use when placing Linodes in this group.
 - Region string
 - The region of the Placement Group.
 - Members
[]Get
Placement Groups Placement Group Member  - A set of Linodes currently assigned to this Placement Group.
 
- id Integer
 - The ID of the placement group.
 - is
Compliant Boolean - Whether this Linode is currently compliant with the group's placement group type.
 - label String
 - The label of the Placement Group. This field can only contain ASCII letters, digits and dashes.
 - placement
Group StringPolicy  - Whether Linodes must be able to become compliant during assignment. (Default 
strict) - placement
Group StringType  - The placement group type to use when placing Linodes in this group.
 - region String
 - The region of the Placement Group.
 - members
List<Get
Placement Groups Placement Group Member>  - A set of Linodes currently assigned to this Placement Group.
 
- id number
 - The ID of the placement group.
 - is
Compliant boolean - Whether this Linode is currently compliant with the group's placement group type.
 - label string
 - The label of the Placement Group. This field can only contain ASCII letters, digits and dashes.
 - placement
Group stringPolicy  - Whether Linodes must be able to become compliant during assignment. (Default 
strict) - placement
Group stringType  - The placement group type to use when placing Linodes in this group.
 - region string
 - The region of the Placement Group.
 - members
Get
Placement Groups Placement Group Member[]  - A set of Linodes currently assigned to this Placement Group.
 
- id int
 - The ID of the placement group.
 - is_
compliant bool - Whether this Linode is currently compliant with the group's placement group type.
 - label str
 - The label of the Placement Group. This field can only contain ASCII letters, digits and dashes.
 - placement_
group_ strpolicy  - Whether Linodes must be able to become compliant during assignment. (Default 
strict) - placement_
group_ strtype  - The placement group type to use when placing Linodes in this group.
 - region str
 - The region of the Placement Group.
 - members
Sequence[Get
Placement Groups Placement Group Member]  - A set of Linodes currently assigned to this Placement Group.
 
- id Number
 - The ID of the placement group.
 - is
Compliant Boolean - Whether this Linode is currently compliant with the group's placement group type.
 - label String
 - The label of the Placement Group. This field can only contain ASCII letters, digits and dashes.
 - placement
Group StringPolicy  - Whether Linodes must be able to become compliant during assignment. (Default 
strict) - placement
Group StringType  - The placement group type to use when placing Linodes in this group.
 - region String
 - The region of the Placement Group.
 - members List<Property Map>
 - A set of Linodes currently assigned to this Placement Group.
 
GetPlacementGroupsPlacementGroupMember     
- Is
Compliant bool - Whether this Linode is currently compliant with the group's placement group type.
 - Linode
Id int - The ID of the Linode.
 
- Is
Compliant bool - Whether this Linode is currently compliant with the group's placement group type.
 - Linode
Id int - The ID of the Linode.
 
- is
Compliant Boolean - Whether this Linode is currently compliant with the group's placement group type.
 - linode
Id Integer - The ID of the Linode.
 
- is
Compliant boolean - Whether this Linode is currently compliant with the group's placement group type.
 - linode
Id number - The ID of the Linode.
 
- is_
compliant bool - Whether this Linode is currently compliant with the group's placement group type.
 - linode_
id int - The ID of the Linode.
 
- is
Compliant Boolean - Whether this Linode is currently compliant with the group's placement group type.
 - linode
Id Number - The ID of the Linode.
 
Package Details
- Repository
 - Linode pulumi/pulumi-linode
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
linodeTerraform Provider.