Class: AWSCDK::ECSPatterns::QueueProcessingServiceBase
- Inherits:
-
Constructs::Construct
- Object
- Constructs::Construct
- AWSCDK::ECSPatterns::QueueProcessingServiceBase
- Defined in:
- ecs_patterns/queue_processing_service_base.rb
Overview
The base class for QueueProcessingEc2Service and QueueProcessingFargateService services.
Direct Known Subclasses
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) ⇒ QueueProcessingServiceBase
constructor
Constructs a new instance of the QueueProcessingServiceBase 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.
-
#sqs_queue ⇒ AWSCDK::SQS::IQueue
The SQS queue that the service will process from.
-
#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) ⇒ QueueProcessingServiceBase
Constructs a new instance of the QueueProcessingServiceBase class.
13 14 15 16 17 18 19 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 13 def initialize(scope, id, props) props = props.is_a?(Hash) ? ::AWSCDK::ECSPatterns::QueueProcessingServiceBaseProps.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("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzX3BhdHRlcm5zLlF1ZXVlUHJvY2Vzc2luZ1NlcnZpY2VCYXNlUHJvcHMifQ==")), "props") 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 |
# File 'ecs_patterns/queue_processing_service_base.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 }, :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.
51 52 53 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 51 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.
138 139 140 141 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 138 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.
93 94 95 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 93 def dead_letter_queue() jsii_get_property("deadLetterQueue") end |
#environment ⇒ Hash{String => String}
Environment variables that will include the queue name.
58 59 60 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 58 def environment() jsii_get_property("environment") end |
#get_default_cluster(scope, vpc = nil) ⇒ AWSCDK::ECS::Cluster
Returns the default cluster.
148 149 150 151 152 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 148 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.
158 159 160 161 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 158 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.
100 101 102 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 100 def log_driver() jsii_get_property("logDriver") end |
#max_capacity ⇒ Numeric
The maximum number of instances for autoscaling to scale up to.
65 66 67 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 65 def max_capacity() jsii_get_property("maxCapacity") end |
#min_capacity ⇒ Numeric
The minimum number of instances for autoscaling to scale down to.
72 73 74 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 72 def min_capacity() jsii_get_property("minCapacity") end |
#node ⇒ Constructs::Node
The tree node.
44 45 46 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 44 def node() jsii_get_property("node") end |
#scaling_steps ⇒ Array<AWSCDK::ApplicationAutoScaling::ScalingInterval>
The scaling interval for autoscaling based off an SQS Queue size.
79 80 81 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 79 def scaling_steps() jsii_get_property("scalingSteps") end |
#secrets ⇒ Hash{String => AWSCDK::ECS::Secret}?
The secret environment variables.
107 108 109 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 107 def secrets() jsii_get_property("secrets") end |
#sqs_queue ⇒ AWSCDK::SQS::IQueue
The SQS queue that the service will process from.
86 87 88 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 86 def sqs_queue() jsii_get_property("sqsQueue") end |
#to_string ⇒ String
Returns a string representation of this construct.
114 115 116 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 114 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.
127 128 129 130 131 132 |
# File 'ecs_patterns/queue_processing_service_base.rb', line 127 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 |