alicloud.bastionhost.getUserGroups
This data source provides the Bastionhost User Groups of the current Alibaba Cloud user.
NOTE: Available in v1.132.0+.
Example Usage
Basic Usage
using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.BastionHost.GetUserGroups.Invoke(new()
{
InstanceId = "bastionhost-cn-xxxx",
Ids = new[]
{
"1",
"2",
},
});
var nameRegex = AliCloud.BastionHost.GetUserGroups.Invoke(new()
{
InstanceId = "bastionhost-cn-xxxx",
NameRegex = "^my-UserGroup",
});
return new Dictionary<string, object?>
{
["bastionhostUserGroupId1"] = ids.Apply(getUserGroupsResult => getUserGroupsResult.Groups[0]?.Id),
["bastionhostUserGroupId2"] = nameRegex.Apply(getUserGroupsResult => getUserGroupsResult.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.GetUserGroups(ctx, &bastionhost.GetUserGroupsArgs{
InstanceId: "bastionhost-cn-xxxx",
Ids: []string{
"1",
"2",
},
}, nil)
if err != nil {
return err
}
ctx.Export("bastionhostUserGroupId1", ids.Groups[0].Id)
nameRegex, err := bastionhost.GetUserGroups(ctx, &bastionhost.GetUserGroupsArgs{
InstanceId: "bastionhost-cn-xxxx",
NameRegex: pulumi.StringRef("^my-UserGroup"),
}, nil)
if err != nil {
return err
}
ctx.Export("bastionhostUserGroupId2", 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.GetUserGroupsArgs;
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.getUserGroups(GetUserGroupsArgs.builder()
.instanceId("bastionhost-cn-xxxx")
.ids(
"1",
"2")
.build());
ctx.export("bastionhostUserGroupId1", ids.applyValue(getUserGroupsResult -> getUserGroupsResult.groups()[0].id()));
final var nameRegex = BastionhostFunctions.getUserGroups(GetUserGroupsArgs.builder()
.instanceId("bastionhost-cn-xxxx")
.nameRegex("^my-UserGroup")
.build());
ctx.export("bastionhostUserGroupId2", nameRegex.applyValue(getUserGroupsResult -> getUserGroupsResult.groups()[0].id()));
}
}
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.bastionhost.get_user_groups(instance_id="bastionhost-cn-xxxx",
ids=[
"1",
"2",
])
pulumi.export("bastionhostUserGroupId1", ids.groups[0].id)
name_regex = alicloud.bastionhost.get_user_groups(instance_id="bastionhost-cn-xxxx",
name_regex="^my-UserGroup")
pulumi.export("bastionhostUserGroupId2", name_regex.groups[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.bastionhost.getUserGroups({
instanceId: "bastionhost-cn-xxxx",
ids: [
"1",
"2",
],
});
export const bastionhostUserGroupId1 = ids.then(ids => ids.groups?.[0]?.id);
const nameRegex = alicloud.bastionhost.getUserGroups({
instanceId: "bastionhost-cn-xxxx",
nameRegex: "^my-UserGroup",
});
export const bastionhostUserGroupId2 = nameRegex.then(nameRegex => nameRegex.groups?.[0]?.id);
variables:
ids:
fn::invoke:
Function: alicloud:bastionhost:getUserGroups
Arguments:
instanceId: bastionhost-cn-xxxx
ids:
- '1'
- '2'
nameRegex:
fn::invoke:
Function: alicloud:bastionhost:getUserGroups
Arguments:
instanceId: bastionhost-cn-xxxx
nameRegex: ^my-UserGroup
outputs:
bastionhostUserGroupId1: ${ids.groups[0].id}
bastionhostUserGroupId2: ${nameRegex.groups[0].id}
Using getUserGroups
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 getUserGroups(args: GetUserGroupsArgs, opts?: InvokeOptions): Promise<GetUserGroupsResult>
function getUserGroupsOutput(args: GetUserGroupsOutputArgs, opts?: InvokeOptions): Output<GetUserGroupsResult>
def get_user_groups(ids: Optional[Sequence[str]] = None,
instance_id: Optional[str] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
user_group_name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetUserGroupsResult
def get_user_groups_output(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,
user_group_name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetUserGroupsResult]
func GetUserGroups(ctx *Context, args *GetUserGroupsArgs, opts ...InvokeOption) (*GetUserGroupsResult, error)
func GetUserGroupsOutput(ctx *Context, args *GetUserGroupsOutputArgs, opts ...InvokeOption) GetUserGroupsResultOutput
> Note: This function is named GetUserGroups
in the Go SDK.
public static class GetUserGroups
{
public static Task<GetUserGroupsResult> InvokeAsync(GetUserGroupsArgs args, InvokeOptions? opts = null)
public static Output<GetUserGroupsResult> Invoke(GetUserGroupsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetUserGroupsResult> getUserGroups(GetUserGroupsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: alicloud:bastionhost/getUserGroups:getUserGroups
arguments:
# arguments dictionary
The following arguments are supported:
- Instance
Id string Specify the New Group of the Bastion Host of Instance Id.
- Ids List<string>
A list of User Group self IDs.
- Name
Regex string A regex string to filter results by User Group name.
- Output
File string - User
Group stringName Specify the New Group Name. Supports up to 128 Characters.
- Instance
Id string Specify the New Group of the Bastion Host of Instance Id.
- Ids []string
A list of User Group self IDs.
- Name
Regex string A regex string to filter results by User Group name.
- Output
File string - User
Group stringName Specify the New Group Name. Supports up to 128 Characters.
- instance
Id String Specify the New Group of the Bastion Host of Instance Id.
- ids List<String>
A list of User Group self IDs.
- name
Regex String A regex string to filter results by User Group name.
- output
File String - user
Group StringName Specify the New Group Name. Supports up to 128 Characters.
- instance
Id string Specify the New Group of the Bastion Host of Instance Id.
- ids string[]
A list of User Group self IDs.
- name
Regex string A regex string to filter results by User Group name.
- output
File string - user
Group stringName Specify the New Group Name. Supports up to 128 Characters.
- instance_
id str Specify the New Group of the Bastion Host of Instance Id.
- ids Sequence[str]
A list of User Group self IDs.
- name_
regex str A regex string to filter results by User Group name.
- output_
file str - user_
group_ strname Specify the New Group Name. Supports up to 128 Characters.
- instance
Id String Specify the New Group of the Bastion Host of Instance Id.
- ids List<String>
A list of User Group self IDs.
- name
Regex String A regex string to filter results by User Group name.
- output
File String - user
Group StringName Specify the New Group Name. Supports up to 128 Characters.
getUserGroups Result
The following output properties are available:
- Groups
List<Pulumi.
Ali Cloud. Bastion Host. Outputs. Get User Groups Group> - Id string
The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Instance
Id string - Names List<string>
- Name
Regex string - Output
File string - User
Group stringName
- Groups
[]Get
User Groups Group - Id string
The provider-assigned unique ID for this managed resource.
- Ids []string
- Instance
Id string - Names []string
- Name
Regex string - Output
File string - User
Group stringName
- groups
List<Get
User Groups Group> - id String
The provider-assigned unique ID for this managed resource.
- ids List<String>
- instance
Id String - names List<String>
- name
Regex String - output
File String - user
Group StringName
- groups
Get
User Groups Group[] - id string
The provider-assigned unique ID for this managed resource.
- ids string[]
- instance
Id string - names string[]
- name
Regex string - output
File string - user
Group stringName
- groups
Sequence[Get
User Groups Group] - id str
The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- instance_
id str - names Sequence[str]
- name_
regex str - output_
file str - user_
group_ strname
- groups List<Property Map>
- id String
The provider-assigned unique ID for this managed resource.
- ids List<String>
- instance
Id String - names List<String>
- name
Regex String - output
File String - user
Group StringName
Supporting Types
GetUserGroupsGroup
- Comment string
Specify the New Group of Remark Information. Supports up to 500 Characters.
- Id string
The ID of the User Group.
- Instance
Id string Specify the New Group of the Bastion Host of Instance Id.
- User
Group stringId The User Group ID.
- User
Group stringName Specify the New Group Name. Supports up to 128 Characters.
- Comment string
Specify the New Group of Remark Information. Supports up to 500 Characters.
- Id string
The ID of the User Group.
- Instance
Id string Specify the New Group of the Bastion Host of Instance Id.
- User
Group stringId The User Group ID.
- User
Group stringName Specify the New Group Name. Supports up to 128 Characters.
- comment String
Specify the New Group of Remark Information. Supports up to 500 Characters.
- id String
The ID of the User Group.
- instance
Id String Specify the New Group of the Bastion Host of Instance Id.
- user
Group StringId The User Group ID.
- user
Group StringName Specify the New Group Name. Supports up to 128 Characters.
- comment string
Specify the New Group of Remark Information. Supports up to 500 Characters.
- id string
The ID of the User Group.
- instance
Id string Specify the New Group of the Bastion Host of Instance Id.
- user
Group stringId The User Group ID.
- user
Group stringName Specify the New Group Name. Supports up to 128 Characters.
- comment str
Specify the New Group of Remark Information. Supports up to 500 Characters.
- id str
The ID of the User Group.
- instance_
id str Specify the New Group of the Bastion Host of Instance Id.
- user_
group_ strid The User Group ID.
- user_
group_ strname Specify the New Group Name. Supports up to 128 Characters.
- comment String
Specify the New Group of Remark Information. Supports up to 500 Characters.
- id String
The ID of the User Group.
- instance
Id String Specify the New Group of the Bastion Host of Instance Id.
- user
Group StringId The User Group ID.
- user
Group StringName Specify the New Group Name. Supports up to 128 Characters.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
alicloud
Terraform Provider.