Alibaba Cloud

v3.28.0 published on Tuesday, Aug 16, 2022 by Pulumi

getHostGroups

This data source provides the Bastionhost Host Groups of the current Alibaba Cloud user.

NOTE: Available in v1.134.0+.

Example Usage

Basic Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var ids = Output.Create(AliCloud.BastionHost.GetHostGroups.InvokeAsync(new AliCloud.BastionHost.GetHostGroupsArgs
        {
            InstanceId = "bastionhost-cn-tl3xxxxxxx",
            Ids = 
            {
                "example_value-1",
                "example_value-2",
            },
        }));
        this.BastionhostHostGroupId1 = ids.Apply(ids => ids.Groups?[0]?.Id);
        var nameRegex = Output.Create(AliCloud.BastionHost.GetHostGroups.InvokeAsync(new AliCloud.BastionHost.GetHostGroupsArgs
        {
            InstanceId = "bastionhost-cn-tl3xxxxxxx",
            NameRegex = "^my-HostGroup",
        }));
        this.BastionhostHostGroupId2 = nameRegex.Apply(nameRegex => nameRegex.Groups?[0]?.Id);
    }

    [Output("bastionhostHostGroupId1")]
    public Output<string> BastionhostHostGroupId1 { get; set; }
    [Output("bastionhostHostGroupId2")]
    public Output<string> BastionhostHostGroupId2 { get; set; }
}
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/bastionhost"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ids, err := bastionhost.GetHostGroups(ctx, &bastionhost.GetHostGroupsArgs{
			InstanceId: "bastionhost-cn-tl3xxxxxxx",
			Ids: []string{
				"example_value-1",
				"example_value-2",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("bastionhostHostGroupId1", ids.Groups[0].Id)
		nameRegex, err := bastionhost.GetHostGroups(ctx, &bastionhost.GetHostGroupsArgs{
			InstanceId: "bastionhost-cn-tl3xxxxxxx",
			NameRegex:  pulumi.StringRef("^my-HostGroup"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("bastionhostHostGroupId2", nameRegex.Groups[0].Id)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.bastionhost.BastionhostFunctions;
import com.pulumi.alicloud.bastionhost.inputs.GetHostGroupsArgs;
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 ids = BastionhostFunctions.getHostGroups(GetHostGroupsArgs.builder()
            .instanceId("bastionhost-cn-tl3xxxxxxx")
            .ids(            
                "example_value-1",
                "example_value-2")
            .build());

        ctx.export("bastionhostHostGroupId1", ids.applyValue(getHostGroupsResult -> getHostGroupsResult.groups()[0].id()));
        final var nameRegex = BastionhostFunctions.getHostGroups(GetHostGroupsArgs.builder()
            .instanceId("bastionhost-cn-tl3xxxxxxx")
            .nameRegex("^my-HostGroup")
            .build());

        ctx.export("bastionhostHostGroupId2", nameRegex.applyValue(getHostGroupsResult -> getHostGroupsResult.groups()[0].id()));
    }
}
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.bastionhost.get_host_groups(instance_id="bastionhost-cn-tl3xxxxxxx",
    ids=[
        "example_value-1",
        "example_value-2",
    ])
pulumi.export("bastionhostHostGroupId1", ids.groups[0].id)
name_regex = alicloud.bastionhost.get_host_groups(instance_id="bastionhost-cn-tl3xxxxxxx",
    name_regex="^my-HostGroup")
pulumi.export("bastionhostHostGroupId2", name_regex.groups[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const ids = alicloud.bastionhost.getHostGroups({
    instanceId: "bastionhost-cn-tl3xxxxxxx",
    ids: [
        "example_value-1",
        "example_value-2",
    ],
});
export const bastionhostHostGroupId1 = ids.then(ids => ids.groups?[0]?.id);
const nameRegex = alicloud.bastionhost.getHostGroups({
    instanceId: "bastionhost-cn-tl3xxxxxxx",
    nameRegex: "^my-HostGroup",
});
export const bastionhostHostGroupId2 = nameRegex.then(nameRegex => nameRegex.groups?[0]?.id);
variables:
  ids:
    Fn::Invoke:
      Function: alicloud:bastionhost:getHostGroups
      Arguments:
        instanceId: bastionhost-cn-tl3xxxxxxx
        ids:
          - example_value-1
          - example_value-2
  nameRegex:
    Fn::Invoke:
      Function: alicloud:bastionhost:getHostGroups
      Arguments:
        instanceId: bastionhost-cn-tl3xxxxxxx
        nameRegex: ^my-HostGroup
outputs:
  bastionhostHostGroupId1: ${ids.groups[0].id}
  bastionhostHostGroupId2: ${nameRegex.groups[0].id}

Using getHostGroups

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 getHostGroups(args: GetHostGroupsArgs, opts?: InvokeOptions): Promise<GetHostGroupsResult>
function getHostGroupsOutput(args: GetHostGroupsOutputArgs, opts?: InvokeOptions): Output<GetHostGroupsResult>
def get_host_groups(host_group_name: Optional[str] = None,
                    ids: Optional[Sequence[str]] = None,
                    instance_id: Optional[str] = None,
                    name_regex: Optional[str] = None,
                    output_file: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetHostGroupsResult
def get_host_groups_output(host_group_name: Optional[pulumi.Input[str]] = None,
                    ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                    instance_id: Optional[pulumi.Input[str]] = None,
                    name_regex: Optional[pulumi.Input[str]] = None,
                    output_file: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetHostGroupsResult]
func GetHostGroups(ctx *Context, args *GetHostGroupsArgs, opts ...InvokeOption) (*GetHostGroupsResult, error)
func GetHostGroupsOutput(ctx *Context, args *GetHostGroupsOutputArgs, opts ...InvokeOption) GetHostGroupsResultOutput

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

public static class GetHostGroups 
{
    public static Task<GetHostGroupsResult> InvokeAsync(GetHostGroupsArgs args, InvokeOptions? opts = null)
    public static Output<GetHostGroupsResult> Invoke(GetHostGroupsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetHostGroupsResult> getHostGroups(GetHostGroupsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: alicloud:bastionhost/getHostGroups:getHostGroups
  arguments:
    # arguments dictionary

The following arguments are supported:

InstanceId string

Specify the New Host Group Where the Bastion Host ID of.

HostGroupName string

Specify the New Host Group Name, Supports up to 128 Characters.

Ids List<string>

A list of Host Group IDs.

NameRegex string

A regex string to filter results by Host Group name.

OutputFile string
InstanceId string

Specify the New Host Group Where the Bastion Host ID of.

HostGroupName string

Specify the New Host Group Name, Supports up to 128 Characters.

Ids []string

A list of Host Group IDs.

NameRegex string

A regex string to filter results by Host Group name.

OutputFile string
instanceId String

Specify the New Host Group Where the Bastion Host ID of.

hostGroupName String

Specify the New Host Group Name, Supports up to 128 Characters.

ids List<String>

A list of Host Group IDs.

nameRegex String

A regex string to filter results by Host Group name.

outputFile String
instanceId string

Specify the New Host Group Where the Bastion Host ID of.

hostGroupName string

Specify the New Host Group Name, Supports up to 128 Characters.

ids string[]

A list of Host Group IDs.

nameRegex string

A regex string to filter results by Host Group name.

outputFile string
instance_id str

Specify the New Host Group Where the Bastion Host ID of.

host_group_name str

Specify the New Host Group Name, Supports up to 128 Characters.

ids Sequence[str]

A list of Host Group IDs.

name_regex str

A regex string to filter results by Host Group name.

output_file str
instanceId String

Specify the New Host Group Where the Bastion Host ID of.

hostGroupName String

Specify the New Host Group Name, Supports up to 128 Characters.

ids List<String>

A list of Host Group IDs.

nameRegex String

A regex string to filter results by Host Group name.

outputFile String

getHostGroups Result

The following output properties are available:

Groups List<Pulumi.AliCloud.BastionHost.Outputs.GetHostGroupsGroup>
Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>
InstanceId string
Names List<string>
HostGroupName string
NameRegex string
OutputFile string
Groups []GetHostGroupsGroup
Id string

The provider-assigned unique ID for this managed resource.

Ids []string
InstanceId string
Names []string
HostGroupName string
NameRegex string
OutputFile string
groups List<GetHostGroupsGroup>
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
instanceId String
names List<String>
hostGroupName String
nameRegex String
outputFile String
groups GetHostGroupsGroup[]
id string

The provider-assigned unique ID for this managed resource.

ids string[]
instanceId string
names string[]
hostGroupName string
nameRegex string
outputFile string
groups Sequence[GetHostGroupsGroup]
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]
instance_id str
names Sequence[str]
host_group_name str
name_regex str
output_file str
groups List<Property Map>
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
instanceId String
names List<String>
hostGroupName String
nameRegex String
outputFile String

Supporting Types

GetHostGroupsGroup

Comment string

Specify the New Host Group of Notes, Supports up to 500 Characters.

HostGroupId string

Host Group ID.

HostGroupName string

Specify the New Host Group Name, Supports up to 128 Characters.

Id string

The ID of the Host Group.

InstanceId string

Specify the New Host Group Where the Bastion Host ID of.

Comment string

Specify the New Host Group of Notes, Supports up to 500 Characters.

HostGroupId string

Host Group ID.

HostGroupName string

Specify the New Host Group Name, Supports up to 128 Characters.

Id string

The ID of the Host Group.

InstanceId string

Specify the New Host Group Where the Bastion Host ID of.

comment String

Specify the New Host Group of Notes, Supports up to 500 Characters.

hostGroupId String

Host Group ID.

hostGroupName String

Specify the New Host Group Name, Supports up to 128 Characters.

id String

The ID of the Host Group.

instanceId String

Specify the New Host Group Where the Bastion Host ID of.

comment string

Specify the New Host Group of Notes, Supports up to 500 Characters.

hostGroupId string

Host Group ID.

hostGroupName string

Specify the New Host Group Name, Supports up to 128 Characters.

id string

The ID of the Host Group.

instanceId string

Specify the New Host Group Where the Bastion Host ID of.

comment str

Specify the New Host Group of Notes, Supports up to 500 Characters.

host_group_id str

Host Group ID.

host_group_name str

Specify the New Host Group Name, Supports up to 128 Characters.

id str

The ID of the Host Group.

instance_id str

Specify the New Host Group Where the Bastion Host ID of.

comment String

Specify the New Host Group of Notes, Supports up to 500 Characters.

hostGroupId String

Host Group ID.

hostGroupName String

Specify the New Host Group Name, Supports up to 128 Characters.

id String

The ID of the Host Group.

instanceId String

Specify the New Host Group Where the Bastion Host ID of.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.