Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi
alicloud.bastionhost.getHostGroups
Explore with Pulumi AI
This data source provides the Bastionhost Host Groups of the current Alibaba Cloud user.
NOTE: Available in v1.134.0+.
Example Usage
Basic Usage
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);
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)
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
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.BastionHost.GetHostGroups.Invoke(new()
{
InstanceId = "bastionhost-cn-tl3xxxxxxx",
Ids = new[]
{
"example_value-1",
"example_value-2",
},
});
var nameRegex = AliCloud.BastionHost.GetHostGroups.Invoke(new()
{
InstanceId = "bastionhost-cn-tl3xxxxxxx",
NameRegex = "^my-HostGroup",
});
return new Dictionary<string, object?>
{
["bastionhostHostGroupId1"] = ids.Apply(getHostGroupsResult => getHostGroupsResult.Groups[0]?.Id),
["bastionhostHostGroupId2"] = nameRegex.Apply(getHostGroupsResult => getHostGroupsResult.Groups[0]?.Id),
};
});
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()));
}
}
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:
- Instance
Id string - Specify the New Host Group Where the Bastion Host ID of.
- Host
Group stringName - Specify the New Host Group Name, Supports up to 128 Characters.
- Ids List<string>
- A list of Host Group IDs.
- Name
Regex string - A regex string to filter results by Host Group name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- Instance
Id string - Specify the New Host Group Where the Bastion Host ID of.
- Host
Group stringName - Specify the New Host Group Name, Supports up to 128 Characters.
- Ids []string
- A list of Host Group IDs.
- Name
Regex string - A regex string to filter results by Host Group name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- instance
Id String - Specify the New Host Group Where the Bastion Host ID of.
- host
Group StringName - Specify the New Host Group Name, Supports up to 128 Characters.
- ids List<String>
- A list of Host Group IDs.
- name
Regex String - A regex string to filter results by Host Group name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
- instance
Id string - Specify the New Host Group Where the Bastion Host ID of.
- host
Group stringName - Specify the New Host Group Name, Supports up to 128 Characters.
- ids string[]
- A list of Host Group IDs.
- name
Regex string - A regex string to filter results by Host Group name.
- output
File string - File name where to save data source results (after running
pulumi preview
).
- instance_
id str - Specify the New Host Group Where the Bastion Host ID of.
- host_
group_ strname - 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 - File name where to save data source results (after running
pulumi preview
).
- instance
Id String - Specify the New Host Group Where the Bastion Host ID of.
- host
Group StringName - Specify the New Host Group Name, Supports up to 128 Characters.
- ids List<String>
- A list of Host Group IDs.
- name
Regex String - A regex string to filter results by Host Group name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
getHostGroups Result
The following output properties are available:
- Groups
List<Pulumi.
Ali Cloud. Bastion Host. Outputs. Get Host Groups Group> - Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Instance
Id string - Names List<string>
- Host
Group stringName - Name
Regex string - Output
File string
- Groups
[]Get
Host Groups Group - Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Instance
Id string - Names []string
- Host
Group stringName - Name
Regex string - Output
File string
- groups
List<Get
Host Groups Group> - id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- instance
Id String - names List<String>
- host
Group StringName - name
Regex String - output
File String
- groups
Get
Host Groups Group[] - id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- instance
Id string - names string[]
- host
Group stringName - name
Regex string - output
File string
- groups
Sequence[Get
Host Groups Group] - id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- instance_
id str - names Sequence[str]
- host_
group_ strname - name_
regex str - output_
file str
- groups List<Property Map>
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- instance
Id String - names List<String>
- host
Group StringName - name
Regex String - output
File String
Supporting Types
GetHostGroupsGroup
- Comment string
- Specify the New Host Group of Notes, Supports up to 500 Characters.
- Host
Group stringId - Host Group ID.
- Host
Group stringName - Specify the New Host Group Name, Supports up to 128 Characters.
- Id string
- The ID of the Host Group.
- Instance
Id 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.
- Host
Group stringId - Host Group ID.
- Host
Group stringName - Specify the New Host Group Name, Supports up to 128 Characters.
- Id string
- The ID of the Host Group.
- Instance
Id 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.
- host
Group StringId - Host Group ID.
- host
Group StringName - Specify the New Host Group Name, Supports up to 128 Characters.
- id String
- The ID of the Host Group.
- instance
Id 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.
- host
Group stringId - Host Group ID.
- host
Group stringName - Specify the New Host Group Name, Supports up to 128 Characters.
- id string
- The ID of the Host Group.
- instance
Id 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_ strid - Host Group ID.
- host_
group_ strname - 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.
- host
Group StringId - Host Group ID.
- host
Group StringName - Specify the New Host Group Name, Supports up to 128 Characters.
- id String
- The ID of the Host Group.
- instance
Id String - Specify the New Host Group Where the Bastion Host ID of.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.