Class: AWSCDK::EC2::CfnKeyPairProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ec2/cfn_key_pair_props.rb

Overview

Properties for defining a CfnKeyPair.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key_name:, key_format: nil, key_type: nil, public_key_material: nil, tags: nil) ⇒ CfnKeyPairProps

Returns a new instance of CfnKeyPairProps.

Parameters:

  • key_name (String)

    A unique name for the key pair.

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

    The format of the key pair.

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

    The type of key pair. Note that ED25519 keys are not supported for Windows instances.

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

    The public key material.

  • tags (Array<AWSCDK::CfnTag>, nil) (defaults to: nil)

    The tags to apply to the key pair.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'ec2/cfn_key_pair_props.rb', line 14

def initialize(key_name:, key_format: nil, key_type: nil, public_key_material: nil, tags: nil)
  @key_name = key_name
  Jsii::Type.check_type(@key_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "keyName")
  @key_format = key_format
  Jsii::Type.check_type(@key_format, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "keyFormat") unless @key_format.nil?
  @key_type = key_type
  Jsii::Type.check_type(@key_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "keyType") unless @key_type.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?
  @tags = tags.is_a?(Array) ? tags.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CfnTag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmblRhZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tags") unless @tags.nil?
end

Instance Attribute Details

#key_formatString? (readonly)

Note:

Default: - "pem"

The format of the key pair.

Default: pem



41
42
43
# File 'ec2/cfn_key_pair_props.rb', line 41

def key_format
  @key_format
end

#key_nameString (readonly)

A unique name for the key pair.

Constraints: Up to 255 ASCII characters



33
34
35
# File 'ec2/cfn_key_pair_props.rb', line 33

def key_name
  @key_name
end

#key_typeString? (readonly)

Note:

Default: - "rsa"

The type of key pair. Note that ED25519 keys are not supported for Windows instances.

If the PublicKeyMaterial property is specified, the KeyType property is ignored, and the key type is inferred from the PublicKeyMaterial value.

Default: rsa



51
52
53
# File 'ec2/cfn_key_pair_props.rb', line 51

def key_type
  @key_type
end

#public_key_materialString? (readonly)

The public key material.

The PublicKeyMaterial property is used to import a key pair. If this property is not specified, then a new key pair will be created.



58
59
60
# File 'ec2/cfn_key_pair_props.rb', line 58

def public_key_material
  @public_key_material
end

#tagsArray<AWSCDK::CfnTag>? (readonly)

The tags to apply to the key pair.



63
64
65
# File 'ec2/cfn_key_pair_props.rb', line 63

def tags
  @tags
end

Class Method Details

.jsii_propertiesObject



65
66
67
68
69
70
71
72
73
# File 'ec2/cfn_key_pair_props.rb', line 65

def self.jsii_properties
  {
    :key_name => "keyName",
    :key_format => "keyFormat",
    :key_type => "keyType",
    :public_key_material => "publicKeyMaterial",
    :tags => "tags",
  }
end

Instance Method Details

#to_jsiiObject



75
76
77
78
79
80
81
82
83
84
85
# File 'ec2/cfn_key_pair_props.rb', line 75

def to_jsii
  result = {}
  result.merge!({
    "keyName" => @key_name,
    "keyFormat" => @key_format,
    "keyType" => @key_type,
    "publicKeyMaterial" => @public_key_material,
    "tags" => @tags,
  })
  result.compact
end