Package com.pulumi.alicloud.bastionhost
Class HostAccountUserAttachment
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.alicloud.bastionhost.HostAccountUserAttachment
-
public class HostAccountUserAttachment extends com.pulumi.resources.CustomResource
Provides a Bastion Host Host Account Attachment resource to add list host accounts into one user. > **NOTE:** Available since v1.135.0. ## Example Usage Basic Usage ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.alicloud.AlicloudFunctions; import com.pulumi.alicloud.inputs.GetZonesArgs; import com.pulumi.alicloud.vpc.VpcFunctions; import com.pulumi.alicloud.vpc.inputs.GetNetworksArgs; import com.pulumi.alicloud.vpc.inputs.GetSwitchesArgs; import com.pulumi.alicloud.ecs.SecurityGroup; import com.pulumi.alicloud.ecs.SecurityGroupArgs; import com.pulumi.alicloud.bastionhost.Instance; import com.pulumi.alicloud.bastionhost.InstanceArgs; import com.pulumi.alicloud.bastionhost.Host; import com.pulumi.alicloud.bastionhost.HostArgs; import com.pulumi.alicloud.bastionhost.HostAccount; import com.pulumi.alicloud.bastionhost.HostAccountArgs; import com.pulumi.alicloud.bastionhost.User; import com.pulumi.alicloud.bastionhost.UserArgs; import com.pulumi.alicloud.bastionhost.HostAccountUserAttachment; import com.pulumi.alicloud.bastionhost.HostAccountUserAttachmentArgs; 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 config = ctx.config(); final var name = config.get("name").orElse("tf_example"); final var defaultZones = AlicloudFunctions.getZones(GetZonesArgs.builder() .availableResourceCreation("VSwitch") .build()); final var defaultNetworks = VpcFunctions.getNetworks(GetNetworksArgs.builder() .nameRegex("^default-NODELETING$") .cidrBlock("10.4.0.0/16") .build()); final var defaultSwitches = VpcFunctions.getSwitches(GetSwitchesArgs.builder() .cidrBlock("10.4.0.0/24") .vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0])) .zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id())) .build()); var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder() .vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0])) .build()); var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder() .description(name) .licenseCode("bhah_ent_50_asset") .planCode("cloudbastion") .storage("5") .bandwidth("5") .period("1") .vswitchId(defaultSwitches.applyValue(getSwitchesResult -> getSwitchesResult.ids()[0])) .securityGroupIds(defaultSecurityGroup.id()) .build()); var defaultHost = new Host("defaultHost", HostArgs.builder() .instanceId(defaultInstance.id()) .hostName(name) .activeAddressType("Private") .hostPrivateAddress("172.16.0.10") .osType("Linux") .source("Local") .build()); var defaultHostAccount = new HostAccount("defaultHostAccount", HostAccountArgs.builder() .hostAccountName(name) .hostId(defaultHost.hostId()) .instanceId(defaultHost.instanceId()) .protocolName("SSH") .password("YourPassword12345") .build()); var localUser = new User("localUser", UserArgs.builder() .instanceId(defaultInstance.id()) .mobileCountryCode("CN") .mobile("13312345678") .password("YourPassword-123") .source("Local") .userName(String.format("%s_local_user", name)) .build()); var defaultHostAccountUserAttachment = new HostAccountUserAttachment("defaultHostAccountUserAttachment", HostAccountUserAttachmentArgs.builder() .instanceId(defaultHost.instanceId()) .userId(localUser.userId()) .hostId(defaultHost.hostId()) .hostAccountIds(defaultHostAccount.hostAccountId()) .build()); } } ``` ## Import Bastion Host Host Account can be imported using the id, e.g. ```sh $ pulumi import alicloud:bastionhost/hostAccountUserAttachment:HostAccountUserAttachment example <instance_id>:<user_id>:<host_id> ```
-
-
Constructor Summary
Constructors Constructor Description HostAccountUserAttachment(java.lang.String name)
HostAccountUserAttachment(java.lang.String name, HostAccountUserAttachmentArgs args)
HostAccountUserAttachment(java.lang.String name, HostAccountUserAttachmentArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HostAccountUserAttachment
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, HostAccountUserAttachmentState state, com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.util.List<java.lang.String>>
hostAccountIds()
com.pulumi.core.Output<java.lang.String>
hostId()
com.pulumi.core.Output<java.lang.String>
instanceId()
com.pulumi.core.Output<java.lang.String>
userId()
-
-
-
Constructor Detail
-
HostAccountUserAttachment
public HostAccountUserAttachment(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
HostAccountUserAttachment
public HostAccountUserAttachment(java.lang.String name, HostAccountUserAttachmentArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
HostAccountUserAttachment
public HostAccountUserAttachment(java.lang.String name, HostAccountUserAttachmentArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.options
- A bag of options that control this resource's behavior.
-
-
Method Detail
-
hostAccountIds
public com.pulumi.core.Output<java.util.List<java.lang.String>> hostAccountIds()
- Returns:
- A list IDs of the host account.
-
hostId
public com.pulumi.core.Output<java.lang.String> hostId()
- Returns:
- The ID of the host.
-
instanceId
public com.pulumi.core.Output<java.lang.String> instanceId()
- Returns:
- The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.
-
userId
public com.pulumi.core.Output<java.lang.String> userId()
- Returns:
- The ID of the user that you want to authorize to manage the specified hosts and host accounts.
-
get
public static HostAccountUserAttachment get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable HostAccountUserAttachmentState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name
- The _unique_ name of the resulting resource.id
- The _unique_ provider ID of the resource to lookup.state
-options
- Optional settings to control the behavior of the CustomResource.
-
-