Class: AWSCDK::ECSPatterns::QueueProcessingEC2Service
- Inherits:
-
QueueProcessingServiceBase
- Object
- QueueProcessingServiceBase
- AWSCDK::ECSPatterns::QueueProcessingEC2Service
- Defined in:
- ecs_patterns/queue_processing_ec2_service.rb
Overview
Class to create a queue processing EC2 service.
Class Method Summary collapse
Instance Method Summary collapse
-
#cluster ⇒ AWSCDK::ECS::ICluster
The cluster where your service will be deployed.
-
#configure_autoscaling_for_service(service) ⇒ void
Configure autoscaling based off of CPU utilization as well as the number of messages visible in the SQS queue.
-
#dead_letter_queue ⇒ AWSCDK::SQS::IQueue?
The dead letter queue for the primary SQS queue.
-
#environment ⇒ Hash{String => String}
Environment variables that will include the queue name.
-
#get_default_cluster(scope, vpc = nil) ⇒ AWSCDK::ECS::Cluster
Returns the default cluster.
-
#grant_permissions_to_service(service) ⇒ void
Grant SQS permissions to an ECS service.
-
#initialize(scope, id, props = nil) ⇒ QueueProcessingEC2Service
constructor
Constructs a new instance of the QueueProcessingEc2Service class.
-
#log_driver ⇒ AWSCDK::ECS::LogDriver?
The AwsLogDriver to use for logging if logging is enabled.
-
#max_capacity ⇒ Numeric
The maximum number of instances for autoscaling to scale up to.
-
#min_capacity ⇒ Numeric
The minimum number of instances for autoscaling to scale down to.
-
#node ⇒ Constructs::Node
The tree node.
-
#scaling_steps ⇒ Array<AWSCDK::ApplicationAutoScaling::ScalingInterval>
The scaling interval for autoscaling based off an SQS Queue size.
-
#secrets ⇒ Hash{String => AWSCDK::ECS::Secret}?
The secret environment variables.
-
#service ⇒ AWSCDK::ECS::EC2Service
The EC2 service in this construct.
-
#sqs_queue ⇒ AWSCDK::SQS::IQueue
The SQS queue that the service will process from.
-
#task_definition ⇒ AWSCDK::ECS::EC2TaskDefinition
The EC2 task definition in this construct.
-
#to_string ⇒ String
Returns a string representation of this construct.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Constructor Details
#initialize(scope, id, props = nil) ⇒ QueueProcessingEC2Service
Constructs a new instance of the QueueProcessingEc2Service class.
13 14 15 16 17 18 19 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 13 def initialize(scope, id, props = nil) props = props.is_a?(Hash) ? ::AWSCDK::ECSPatterns::QueueProcessingEC2ServiceProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzX3BhdHRlcm5zLlF1ZXVlUHJvY2Vzc2luZ0VjMlNlcnZpY2VQcm9wcyJ9")), "props") unless props.nil? Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props) end |
Class Method Details
.jsii_overridable_methods ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 21 def self.jsii_overridable_methods { :node => { kind: :property, name: "node", is_optional: false }, :cluster => { kind: :property, name: "cluster", is_optional: false }, :environment => { kind: :property, name: "environment", is_optional: false }, :max_capacity => { kind: :property, name: "maxCapacity", is_optional: false }, :min_capacity => { kind: :property, name: "minCapacity", is_optional: false }, :scaling_steps => { kind: :property, name: "scalingSteps", is_optional: false }, :sqs_queue => { kind: :property, name: "sqsQueue", is_optional: false }, :dead_letter_queue => { kind: :property, name: "deadLetterQueue", is_optional: true }, :log_driver => { kind: :property, name: "logDriver", is_optional: true }, :secrets => { kind: :property, name: "secrets", is_optional: true }, :service => { kind: :property, name: "service", is_optional: false }, :task_definition => { kind: :property, name: "taskDefinition", is_optional: false }, :to_string => { kind: :method, name: "toString", is_optional: false }, :with => { kind: :method, name: "with", is_optional: false }, :configure_autoscaling_for_service => { kind: :method, name: "configureAutoscalingForService", is_optional: false }, :get_default_cluster => { kind: :method, name: "getDefaultCluster", is_optional: false }, :grant_permissions_to_service => { kind: :method, name: "grantPermissionsToService", is_optional: false }, } end |
Instance Method Details
#cluster ⇒ AWSCDK::ECS::ICluster
The cluster where your service will be deployed.
53 54 55 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 53 def cluster() jsii_get_property("cluster") end |
#configure_autoscaling_for_service(service) ⇒ void
This method returns an undefined value.
Configure autoscaling based off of CPU utilization as well as the number of messages visible in the SQS queue.
154 155 156 157 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 154 def configure_autoscaling_for_service(service) Jsii::Type.check_type(service, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkJhc2VTZXJ2aWNlIn0=")), "service") jsii_call_method("configureAutoscalingForService", [service]) end |
#dead_letter_queue ⇒ AWSCDK::SQS::IQueue?
The dead letter queue for the primary SQS queue.
95 96 97 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 95 def dead_letter_queue() jsii_get_property("deadLetterQueue") end |
#environment ⇒ Hash{String => String}
Environment variables that will include the queue name.
60 61 62 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 60 def environment() jsii_get_property("environment") end |
#get_default_cluster(scope, vpc = nil) ⇒ AWSCDK::ECS::Cluster
Returns the default cluster.
164 165 166 167 168 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 164 def get_default_cluster(scope, vpc = nil) Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") unless vpc.nil? jsii_call_method("getDefaultCluster", [scope, vpc]) end |
#grant_permissions_to_service(service) ⇒ void
This method returns an undefined value.
Grant SQS permissions to an ECS service.
174 175 176 177 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 174 def (service) Jsii::Type.check_type(service, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkJhc2VTZXJ2aWNlIn0=")), "service") jsii_call_method("grantPermissionsToService", [service]) end |
#log_driver ⇒ AWSCDK::ECS::LogDriver?
The AwsLogDriver to use for logging if logging is enabled.
102 103 104 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 102 def log_driver() jsii_get_property("logDriver") end |
#max_capacity ⇒ Numeric
The maximum number of instances for autoscaling to scale up to.
67 68 69 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 67 def max_capacity() jsii_get_property("maxCapacity") end |
#min_capacity ⇒ Numeric
The minimum number of instances for autoscaling to scale down to.
74 75 76 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 74 def min_capacity() jsii_get_property("minCapacity") end |
#node ⇒ Constructs::Node
The tree node.
46 47 48 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 46 def node() jsii_get_property("node") end |
#scaling_steps ⇒ Array<AWSCDK::ApplicationAutoScaling::ScalingInterval>
The scaling interval for autoscaling based off an SQS Queue size.
81 82 83 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 81 def scaling_steps() jsii_get_property("scalingSteps") end |
#secrets ⇒ Hash{String => AWSCDK::ECS::Secret}?
The secret environment variables.
109 110 111 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 109 def secrets() jsii_get_property("secrets") end |
#service ⇒ AWSCDK::ECS::EC2Service
The EC2 service in this construct.
116 117 118 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 116 def service() jsii_get_property("service") end |
#sqs_queue ⇒ AWSCDK::SQS::IQueue
The SQS queue that the service will process from.
88 89 90 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 88 def sqs_queue() jsii_get_property("sqsQueue") end |
#task_definition ⇒ AWSCDK::ECS::EC2TaskDefinition
The EC2 task definition in this construct.
123 124 125 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 123 def task_definition() jsii_get_property("taskDefinition") end |
#to_string ⇒ String
Returns a string representation of this construct.
130 131 132 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 130 def to_string() jsii_call_method("toString", []) end |
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
143 144 145 146 147 148 |
# File 'ecs_patterns/queue_processing_ec2_service.rb', line 143 def with(*mixins) mixins.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]") end jsii_call_method("with", [*mixins]) end |