Class: AWSCDK::ECS::ClusterAttributes

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ecs/cluster_attributes.rb

Overview

The properties to import from the ECS cluster.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cluster_name:, vpc:, autoscaling_group: nil, cluster_arn: nil, default_cloud_map_namespace: nil, execute_command_configuration: nil, has_ec2_capacity: nil, security_groups: nil) ⇒ ClusterAttributes

Returns a new instance of ClusterAttributes.

Parameters:

  • cluster_name (String)

    The name of the cluster.

  • vpc (AWSCDK::EC2::IVPC)

    The VPC associated with the cluster.

  • autoscaling_group (AWSCDK::Autoscaling::IAutoScalingGroup, nil) (defaults to: nil)

    Autoscaling group added to the cluster if capacity is added.

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

    The Amazon Resource Name (ARN) that identifies the cluster.

  • default_cloud_map_namespace (AWSCDK::ServiceDiscovery::INamespace, nil) (defaults to: nil)

    The AWS Cloud Map namespace to associate with the cluster.

  • execute_command_configuration (AWSCDK::ECS::ExecuteCommandConfiguration, nil) (defaults to: nil)

    The execute command configuration for the cluster.

  • has_ec2_capacity (Boolean, nil) (defaults to: nil)

    Specifies whether the cluster has EC2 instance capacity.

  • security_groups (Array<AWSCDK::EC2::ISecurityGroup>, nil) (defaults to: nil)

    The security groups associated with the container instances registered to the cluster.



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

def initialize(cluster_name:, vpc:, autoscaling_group: nil, cluster_arn: nil, default_cloud_map_namespace: nil, execute_command_configuration: nil, has_ec2_capacity: nil, security_groups: nil)
  @cluster_name = cluster_name
  Jsii::Type.check_type(@cluster_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "clusterName")
  @vpc = vpc
  Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc")
  @autoscaling_group = autoscaling_group
  Jsii::Type.check_type(@autoscaling_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuSUF1dG9TY2FsaW5nR3JvdXAifQ==")), "autoscalingGroup") unless @autoscaling_group.nil?
  @cluster_arn = cluster_arn
  Jsii::Type.check_type(@cluster_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "clusterArn") unless @cluster_arn.nil?
  @default_cloud_map_namespace = default_cloud_map_namespace
  Jsii::Type.check_type(@default_cloud_map_namespace, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VydmljZWRpc2NvdmVyeS5JTmFtZXNwYWNlIn0=")), "defaultCloudMapNamespace") unless @default_cloud_map_namespace.nil?
  @execute_command_configuration = execute_command_configuration.is_a?(Hash) ? ::AWSCDK::ECS::ExecuteCommandConfiguration.new(**execute_command_configuration.transform_keys(&:to_sym)) : execute_command_configuration
  Jsii::Type.check_type(@execute_command_configuration, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkV4ZWN1dGVDb21tYW5kQ29uZmlndXJhdGlvbiJ9")), "executeCommandConfiguration") unless @execute_command_configuration.nil?
  @has_ec2_capacity = has_ec2_capacity
  Jsii::Type.check_type(@has_ec2_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "hasEc2Capacity") unless @has_ec2_capacity.nil?
  @security_groups = security_groups
  Jsii::Type.check_type(@security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVNlY3VyaXR5R3JvdXAifSwia2luZCI6ImFycmF5In19")), "securityGroups") unless @security_groups.nil?
end

Instance Attribute Details

#autoscaling_groupAWSCDK::Autoscaling::IAutoScalingGroup? (readonly)

Note:

Default: - No default autoscaling group

Autoscaling group added to the cluster if capacity is added.



46
47
48
# File 'ecs/cluster_attributes.rb', line 46

def autoscaling_group
  @autoscaling_group
end

#cluster_arnString? (readonly)

Note:

Default: Derived from clusterName

The Amazon Resource Name (ARN) that identifies the cluster.

Returns:

  • (String, nil)


51
52
53
# File 'ecs/cluster_attributes.rb', line 51

def cluster_arn
  @cluster_arn
end

#cluster_nameString (readonly)

The name of the cluster.

Returns:

  • (String)


37
38
39
# File 'ecs/cluster_attributes.rb', line 37

def cluster_name
  @cluster_name
end

#default_cloud_map_namespaceAWSCDK::ServiceDiscovery::INamespace? (readonly)

Note:

Default: - No default namespace

The AWS Cloud Map namespace to associate with the cluster.



56
57
58
# File 'ecs/cluster_attributes.rb', line 56

def default_cloud_map_namespace
  @default_cloud_map_namespace
end

#execute_command_configurationAWSCDK::ECS::ExecuteCommandConfiguration? (readonly)

Note:

Default: - none.

The execute command configuration for the cluster.



61
62
63
# File 'ecs/cluster_attributes.rb', line 61

def execute_command_configuration
  @execute_command_configuration
end

#has_ec2_capacityBoolean? (readonly)

Note:

Default: true

Specifies whether the cluster has EC2 instance capacity.

Returns:

  • (Boolean, nil)


66
67
68
# File 'ecs/cluster_attributes.rb', line 66

def has_ec2_capacity
  @has_ec2_capacity
end

#security_groupsArray<AWSCDK::EC2::ISecurityGroup>? (readonly)

Note:

Default: - no security groups

The security groups associated with the container instances registered to the cluster.

Returns:



71
72
73
# File 'ecs/cluster_attributes.rb', line 71

def security_groups
  @security_groups
end

#vpcAWSCDK::EC2::IVPC (readonly)

The VPC associated with the cluster.

Returns:



41
42
43
# File 'ecs/cluster_attributes.rb', line 41

def vpc
  @vpc
end

Class Method Details

.jsii_propertiesObject



73
74
75
76
77
78
79
80
81
82
83
84
# File 'ecs/cluster_attributes.rb', line 73

def self.jsii_properties
  {
    :cluster_name => "clusterName",
    :vpc => "vpc",
    :autoscaling_group => "autoscalingGroup",
    :cluster_arn => "clusterArn",
    :default_cloud_map_namespace => "defaultCloudMapNamespace",
    :execute_command_configuration => "executeCommandConfiguration",
    :has_ec2_capacity => "hasEc2Capacity",
    :security_groups => "securityGroups",
  }
end

Instance Method Details

#to_jsiiObject



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'ecs/cluster_attributes.rb', line 86

def to_jsii
  result = {}
  result.merge!({
    "clusterName" => @cluster_name,
    "vpc" => @vpc,
    "autoscalingGroup" => @autoscaling_group,
    "clusterArn" => @cluster_arn,
    "defaultCloudMapNamespace" => @default_cloud_map_namespace,
    "executeCommandConfiguration" => @execute_command_configuration,
    "hasEc2Capacity" => @has_ec2_capacity,
    "securityGroups" => @security_groups,
  })
  result.compact
end