Class KeyPair.Builder

java.lang.Object
software.amazon.awscdk.services.ec2.KeyPair.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<KeyPair>
Enclosing class:
KeyPair

@Stability(Stable) public static final class KeyPair.Builder extends Object implements software.amazon.jsii.Builder<KeyPair>
A fluent builder for KeyPair.
  • Method Details

    • create

      @Stability(Stable) public static KeyPair.Builder create(software.constructs.Construct scope, String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      Returns:
      a new instance of KeyPair.Builder.
    • account

      @Stability(Stable) public KeyPair.Builder account(String account)
      The AWS account ID this resource belongs to.

      Default: - the resource is in the same account as the stack it belongs to

      Parameters:
      account - The AWS account ID this resource belongs to. This parameter is required.
      Returns:
      this
    • environmentFromArn

      @Stability(Stable) public KeyPair.Builder environmentFromArn(String environmentFromArn)
      ARN to deduce region and account from.

      The ARN is parsed and the account and region are taken from the ARN. This should be used for imported resources.

      Cannot be supplied together with either account or region.

      Default: - take environment from `account`, `region` parameters, or use Stack environment.

      Parameters:
      environmentFromArn - ARN to deduce region and account from. This parameter is required.
      Returns:
      this
    • physicalName

      @Stability(Stable) public KeyPair.Builder physicalName(String physicalName)
      The value passed in by users to the physical name prop of the resource.

      • undefined implies that a physical name will be allocated by CloudFormation during deployment.
      • a concrete value implies a specific physical name
      • PhysicalName.GENERATE_IF_NEEDED is a marker that indicates that a physical will only be generated by the CDK if it is needed for cross-environment references. Otherwise, it will be allocated by CloudFormation.

      Default: - The physical name will be allocated by CloudFormation at deployment time

      Parameters:
      physicalName - The value passed in by users to the physical name prop of the resource. This parameter is required.
      Returns:
      this
    • region

      @Stability(Stable) public KeyPair.Builder region(String region)
      The AWS region this resource belongs to.

      Default: - the resource is in the same region as the stack it belongs to

      Parameters:
      region - The AWS region this resource belongs to. This parameter is required.
      Returns:
      this
    • format

      @Stability(Stable) public KeyPair.Builder format(KeyPairFormat format)
      The format of the key pair.

      Default: PEM

      Parameters:
      format - The format of the key pair. This parameter is required.
      Returns:
      this
    • keyPairName

      @Stability(Stable) public KeyPair.Builder keyPairName(String keyPairName)
      A unique name for the key pair.

      Default: A generated name

      Parameters:
      keyPairName - A unique name for the key pair. This parameter is required.
      Returns:
      this
    • publicKeyMaterial

      @Stability(Stable) public KeyPair.Builder publicKeyMaterial(String publicKeyMaterial)
      The public key material.

      If this is provided the key is considered "imported". For imported keys, it is assumed that you already have the private key material so the private key material will not be returned or stored in AWS Systems Manager Parameter Store.

      Default: a public and private key will be generated

      Parameters:
      publicKeyMaterial - The public key material. This parameter is required.
      Returns:
      this
    • type

      @Stability(Stable) public KeyPair.Builder type(KeyPairType type)
      The type of key pair.

      Default: RSA (ignored if keyMaterial is provided)

      Parameters:
      type - The type of key pair. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public KeyPair build()
      Specified by:
      build in interface software.amazon.jsii.Builder<KeyPair>
      Returns:
      a newly built instance of KeyPair.