com.pulumi.alicloud.bastionhost.HostAccountUserGroupAttachment Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alicloud Show documentation
Show all versions of alicloud Show documentation
A Pulumi package for creating and managing AliCloud resources.
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.alicloud.bastionhost;
import com.pulumi.alicloud.Utilities;
import com.pulumi.alicloud.bastionhost.HostAccountUserGroupAttachmentArgs;
import com.pulumi.alicloud.bastionhost.inputs.HostAccountUserGroupAttachmentState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import java.util.List;
import javax.annotation.Nullable;
/**
* Provides a Bastion Host Host Account Attachment resource to add list host accounts into one user group.
*
* > **NOTE:** Available since v1.135.0.
*
* ## Example Usage
*
* Basic Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* 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.UserGroup;
* import com.pulumi.alicloud.bastionhost.UserGroupArgs;
* import com.pulumi.alicloud.bastionhost.HostAccountUserGroupAttachment;
* import com.pulumi.alicloud.bastionhost.HostAccountUserGroupAttachmentArgs;
* 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 default = AlicloudFunctions.getZones(GetZonesArgs.builder()
* .availableResourceCreation("VSwitch")
* .build());
*
* final var defaultGetNetworks = VpcFunctions.getNetworks(GetNetworksArgs.builder()
* .nameRegex("^default-NODELETING$")
* .cidrBlock("10.4.0.0/16")
* .build());
*
* final var defaultGetSwitches = VpcFunctions.getSwitches(GetSwitchesArgs.builder()
* .cidrBlock("10.4.0.0/24")
* .vpcId(defaultGetNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0]))
* .zoneId(default_.zones()[0].id())
* .build());
*
* var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
* .vpcId(defaultGetNetworks.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(defaultGetSwitches.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 defaultUserGroup = new UserGroup("defaultUserGroup", UserGroupArgs.builder()
* .instanceId(defaultHost.instanceId())
* .userGroupName(name)
* .build());
*
* var defaultHostAccountUserGroupAttachment = new HostAccountUserGroupAttachment("defaultHostAccountUserGroupAttachment", HostAccountUserGroupAttachmentArgs.builder()
* .instanceId(defaultHost.instanceId())
* .userGroupId(defaultUserGroup.userGroupId())
* .hostId(defaultHost.hostId())
* .hostAccountIds(defaultHostAccount.hostAccountId())
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Bastion Host Host Account can be imported using the id, e.g.
*
* ```sh
* $ pulumi import alicloud:bastionhost/hostAccountUserGroupAttachment:HostAccountUserGroupAttachment example <instance_id>:<user_group_id>:<host_id>
* ```
*
*/
@ResourceType(type="alicloud:bastionhost/hostAccountUserGroupAttachment:HostAccountUserGroupAttachment")
public class HostAccountUserGroupAttachment extends com.pulumi.resources.CustomResource {
/**
* A list IDs of the host account.
*
*/
@Export(name="hostAccountIds", refs={List.class,String.class}, tree="[0,1]")
private Output> hostAccountIds;
/**
* @return A list IDs of the host account.
*
*/
public Output> hostAccountIds() {
return this.hostAccountIds;
}
/**
* The ID of the host.
*
*/
@Export(name="hostId", refs={String.class}, tree="[0]")
private Output hostId;
/**
* @return The ID of the host.
*
*/
public Output hostId() {
return this.hostId;
}
/**
* The ID of the Bastionhost instance where you want to authorize the user group to manage the specified hosts and host accounts.
*
*/
@Export(name="instanceId", refs={String.class}, tree="[0]")
private Output instanceId;
/**
* @return The ID of the Bastionhost instance where you want to authorize the user group to manage the specified hosts and host accounts.
*
*/
public Output instanceId() {
return this.instanceId;
}
/**
* The ID of the user group that you want to authorize to manage the specified hosts and host accounts.
*
*/
@Export(name="userGroupId", refs={String.class}, tree="[0]")
private Output userGroupId;
/**
* @return The ID of the user group that you want to authorize to manage the specified hosts and host accounts.
*
*/
public Output userGroupId() {
return this.userGroupId;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public HostAccountUserGroupAttachment(java.lang.String name) {
this(name, HostAccountUserGroupAttachmentArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public HostAccountUserGroupAttachment(java.lang.String name, HostAccountUserGroupAttachmentArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public HostAccountUserGroupAttachment(java.lang.String name, HostAccountUserGroupAttachmentArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:bastionhost/hostAccountUserGroupAttachment:HostAccountUserGroupAttachment", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private HostAccountUserGroupAttachment(java.lang.String name, Output id, @Nullable HostAccountUserGroupAttachmentState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:bastionhost/hostAccountUserGroupAttachment:HostAccountUserGroupAttachment", name, state, makeResourceOptions(options, id), false);
}
private static HostAccountUserGroupAttachmentArgs makeArgs(HostAccountUserGroupAttachmentArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? HostAccountUserGroupAttachmentArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static HostAccountUserGroupAttachment get(java.lang.String name, Output id, @Nullable HostAccountUserGroupAttachmentState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new HostAccountUserGroupAttachment(name, id, state, options);
}
}