Class: AWSCDK::EC2::KeyPairProps

Inherits:
ResourceProps
  • Object
show all
Defined in:
ec2/key_pair_props.rb

Overview

The properties of a Key Pair.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account: nil, environment_from_arn: nil, physical_name: nil, region: nil, format: nil, key_pair_name: nil, public_key_material: nil, type: nil) ⇒ KeyPairProps

Returns a new instance of KeyPairProps.

Parameters:

  • account (String, nil) (defaults to: nil)

    The AWS account ID this resource belongs to.

  • environment_from_arn (String, nil) (defaults to: nil)

    ARN to deduce region and account from.

  • physical_name (String, nil) (defaults to: nil)

    The value passed in by users to the physical name prop of the resource.

  • region (String, nil) (defaults to: nil)

    The AWS region this resource belongs to.

  • format (AWSCDK::EC2::KeyPairFormat, nil) (defaults to: nil)

    The format of the key pair.

  • key_pair_name (String, nil) (defaults to: nil)

    A unique name for the key pair.

  • public_key_material (String, nil) (defaults to: nil)

    The public key material.

  • type (AWSCDK::EC2::KeyPairType, nil) (defaults to: nil)

    The type of key pair.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'ec2/key_pair_props.rb', line 15

def initialize(account: nil, environment_from_arn: nil, physical_name: nil, region: nil, format: nil, key_pair_name: nil, public_key_material: nil, type: nil)
  @account = 
  Jsii::Type.check_type(@account, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "account") unless @account.nil?
  @environment_from_arn = environment_from_arn
  Jsii::Type.check_type(@environment_from_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "environmentFromArn") unless @environment_from_arn.nil?
  @physical_name = physical_name
  Jsii::Type.check_type(@physical_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "physicalName") unless @physical_name.nil?
  @region = region
  Jsii::Type.check_type(@region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "region") unless @region.nil?
  @format = format
  Jsii::Type.check_type(@format, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLktleVBhaXJGb3JtYXQifQ==")), "format") unless @format.nil?
  @key_pair_name = key_pair_name
  Jsii::Type.check_type(@key_pair_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "keyPairName") unless @key_pair_name.nil?
  @public_key_material = public_key_material
  Jsii::Type.check_type(@public_key_material, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "publicKeyMaterial") unless @public_key_material.nil?
  @type = type
  Jsii::Type.check_type(@type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLktleVBhaXJUeXBlIn0=")), "type") unless @type.nil?
end

Instance Attribute Details

#accountString? (readonly)

Note:

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

The AWS account ID this resource belongs to.

Returns:

  • (String, nil)


38
39
40
# File 'ec2/key_pair_props.rb', line 38

def 
  @account
end

#environment_from_arnString? (readonly)

Note:

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

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.

Returns:

  • (String, nil)


48
49
50
# File 'ec2/key_pair_props.rb', line 48

def environment_from_arn
  @environment_from_arn
end

#formatAWSCDK::EC2::KeyPairFormat? (readonly)

Note:

Default: PEM

The format of the key pair.

Returns:



69
70
71
# File 'ec2/key_pair_props.rb', line 69

def format
  @format
end

#key_pair_nameString? (readonly)

Note:

Default: A generated name

A unique name for the key pair.

Returns:

  • (String, nil)


74
75
76
# File 'ec2/key_pair_props.rb', line 74

def key_pair_name
  @key_pair_name
end

#physical_nameString? (readonly)

Note:

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

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.

Returns:

  • (String, nil)


59
60
61
# File 'ec2/key_pair_props.rb', line 59

def physical_name
  @physical_name
end

#public_key_materialString? (readonly)

Note:

Default: a public and private key will be generated

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.

Returns:

  • (String, nil)


84
85
86
# File 'ec2/key_pair_props.rb', line 84

def public_key_material
  @public_key_material
end

#regionString? (readonly)

Note:

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

The AWS region this resource belongs to.

Returns:

  • (String, nil)


64
65
66
# File 'ec2/key_pair_props.rb', line 64

def region
  @region
end

#typeAWSCDK::EC2::KeyPairType? (readonly)

Note:

Default: RSA (ignored if keyMaterial is provided)

The type of key pair.

Returns:



89
90
91
# File 'ec2/key_pair_props.rb', line 89

def type
  @type
end

Class Method Details

.jsii_propertiesObject



91
92
93
94
95
96
97
98
99
100
101
102
# File 'ec2/key_pair_props.rb', line 91

def self.jsii_properties
  {
    :account => "account",
    :environment_from_arn => "environmentFromArn",
    :physical_name => "physicalName",
    :region => "region",
    :format => "format",
    :key_pair_name => "keyPairName",
    :public_key_material => "publicKeyMaterial",
    :type => "type",
  }
end

Instance Method Details

#to_jsiiObject



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'ec2/key_pair_props.rb', line 104

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "account" => @account,
    "environmentFromArn" => @environment_from_arn,
    "physicalName" => @physical_name,
    "region" => @region,
    "format" => @format,
    "keyPairName" => @key_pair_name,
    "publicKeyMaterial" => @public_key_material,
    "type" => @type,
  })
  result.compact
end