Class: AWSCDK::ECSPatterns::QueueProcessingServiceBase

Inherits:
Constructs::Construct
  • Object
show all
Defined in:
ecs_patterns/queue_processing_service_base.rb

Overview

The base class for QueueProcessingEc2Service and QueueProcessingFargateService services.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props) ⇒ QueueProcessingServiceBase

Constructs a new instance of the QueueProcessingServiceBase class.

Parameters:



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_methodsObject



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

#clusterAWSCDK::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.

Parameters:



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_queueAWSCDK::SQS::IQueue?

The dead letter queue for the primary SQS queue.

Returns:



93
94
95
# File 'ecs_patterns/queue_processing_service_base.rb', line 93

def dead_letter_queue()
  jsii_get_property("deadLetterQueue")
end

#environmentHash{String => String}

Environment variables that will include the queue name.

Returns:

  • (Hash{String => String})


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.

Parameters:

Returns:



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.

Parameters:



158
159
160
161
# File 'ecs_patterns/queue_processing_service_base.rb', line 158

def grant_permissions_to_service(service)
  Jsii::Type.check_type(service, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkJhc2VTZXJ2aWNlIn0=")), "service")
  jsii_call_method("grantPermissionsToService", [service])
end

#log_driverAWSCDK::ECS::LogDriver?

The AwsLogDriver to use for logging if logging is enabled.

Returns:



100
101
102
# File 'ecs_patterns/queue_processing_service_base.rb', line 100

def log_driver()
  jsii_get_property("logDriver")
end

#max_capacityNumeric

The maximum number of instances for autoscaling to scale up to.

Returns:

  • (Numeric)


65
66
67
# File 'ecs_patterns/queue_processing_service_base.rb', line 65

def max_capacity()
  jsii_get_property("maxCapacity")
end

#min_capacityNumeric

The minimum number of instances for autoscaling to scale down to.

Returns:

  • (Numeric)


72
73
74
# File 'ecs_patterns/queue_processing_service_base.rb', line 72

def min_capacity()
  jsii_get_property("minCapacity")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


44
45
46
# File 'ecs_patterns/queue_processing_service_base.rb', line 44

def node()
  jsii_get_property("node")
end

#scaling_stepsArray<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

#secretsHash{String => AWSCDK::ECS::Secret}?

The secret environment variables.

Returns:



107
108
109
# File 'ecs_patterns/queue_processing_service_base.rb', line 107

def secrets()
  jsii_get_property("secrets")
end

#sqs_queueAWSCDK::SQS::IQueue

The SQS queue that the service will process from.

Returns:



86
87
88
# File 'ecs_patterns/queue_processing_service_base.rb', line 86

def sqs_queue()
  jsii_get_property("sqsQueue")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


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.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



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