Class: AWSCDK::ECS::BaseService
- Inherits:
-
Resource
- Object
- Resource
- AWSCDK::ECS::BaseService
- Includes:
- IBaseService, AWSCDK::ElasticLoadBalancing::ILoadBalancerTarget, AWSCDK::ElasticLoadBalancingv2::IApplicationLoadBalancerTarget, AWSCDK::ElasticLoadBalancingv2::INetworkLoadBalancerTarget
- Defined in:
- ecs/base_service.rb
Overview
The base class for Ec2Service and FargateService services.
Direct Known Subclasses
Class Method Summary collapse
-
.from_service_arn_with_cluster(scope, id, service_arn) ⇒ AWSCDK::ECS::IBaseService
Import an existing ECS/Fargate Service using the service cluster format.
- .jsii_overridable_methods ⇒ Object
Instance Method Summary collapse
-
#add_lifecycle_hook(target) ⇒ void
Add a deployment lifecycle hook target.
-
#add_volume(volume) ⇒ void
Adds a volume to the Service.
-
#apply_cross_stack_reference_strength(strength) ⇒ void
Override the cross-stack reference strength for this resource.
-
#apply_removal_policy(policy) ⇒ void
Apply the given removal policy to this resource.
-
#associate_cloud_map_service(options) ⇒ void
Associates this service with a CloudMap service.
-
#attach_to_application_target_group(target_group) ⇒ AWSCDK::ElasticLoadBalancingv2::LoadBalancerTargetProps
This method is called to attach this service to an Application Load Balancer.
-
#attach_to_classic_lb(load_balancer) ⇒ void
Registers the service as a target of a Classic Load Balancer (CLB).
-
#attach_to_network_target_group(target_group) ⇒ AWSCDK::ElasticLoadBalancingv2::LoadBalancerTargetProps
This method is called to attach this service to a Network Load Balancer.
-
#auto_scale_task_count(props) ⇒ AWSCDK::ECS::ScalableTaskCount
An attribute representing the minimum and maximum task count for an AutoScalingGroup.
-
#cloud_map_service ⇒ AWSCDK::ServiceDiscovery::IService?
The CloudMap service created for this service, if any.
-
#cloudmap_service ⇒ AWSCDK::ServiceDiscovery::Service?
The details of the AWS Cloud Map service.
- #cloudmap_service=(value) ⇒ Object
-
#cluster ⇒ AWSCDK::ECS::ICluster
The cluster that hosts the service.
-
#configure_aws_vpc_networking_with_security_groups(vpc, assign_public_ip = nil, vpc_subnets = nil, security_groups = nil) ⇒ void
This method is called to create a networkConfiguration.
-
#connections ⇒ AWSCDK::EC2::Connections
The security groups which manage the allowed network traffic for the service.
- #deployment_alarms ⇒ AWSCDK::ECS::CfnService::DeploymentAlarmsProperty?
- #deployment_alarms=(value) ⇒ Object
-
#enable_cloud_map(options) ⇒ AWSCDK::ServiceDiscovery::Service
Enable CloudMap service discovery for the service.
-
#enable_deployment_alarms(alarm_names, options = nil) ⇒ void
Enable Deployment Alarms which take advantage of arbitrary alarms and configure them after service initialization.
-
#enable_service_connect(config = nil) ⇒ void
Enable Service Connect on this service.
-
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
-
#force_new_deployment(nonce = nil) ⇒ void
Forces a new deployment of the service.
- #generate_physical_name ⇒ String
-
#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g.
bucket.bucketArn). -
#get_resource_name_attribute(name_attr) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g.
bucket.bucketName). -
#initialize(scope, id, props, additional_props, task_definition) ⇒ BaseService
constructor
Constructs a new instance of the BaseService class.
-
#is_using_ecs_deployment_controller ⇒ Boolean
Checks if the service is using the ECS deployment controller.
-
#load_balancer_target(options) ⇒ AWSCDK::ECS::IECSLoadBalancerTarget
Return a load balancing target for a specific container and port.
-
#load_balancers ⇒ Array<AWSCDK::ECS::CfnService::LoadBalancerProperty>
A list of Elastic Load Balancing load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.
- #load_balancers=(value) ⇒ Object
-
#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric
This method returns the specified CloudWatch metric name for this service.
-
#metric_cpu_utilization(props = nil) ⇒ AWSCDK::CloudWatch::Metric
This method returns the CloudWatch metric for this service's CPU utilization.
-
#metric_memory_utilization(props = nil) ⇒ AWSCDK::CloudWatch::Metric
This method returns the CloudWatch metric for this service's memory utilization.
- #network_configuration ⇒ AWSCDK::ECS::CfnService::NetworkConfigurationProperty?
- #network_configuration=(value) ⇒ Object
-
#node ⇒ Constructs::Node
The tree node.
-
#physical_name ⇒ String
Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
-
#register_load_balancer_targets(*targets) ⇒ void
Use this function to create all load balancer targets to be registered in this service, add them to target groups, and attach target groups to listeners accordingly.
-
#service_arn ⇒ String
The Amazon Resource Name (ARN) of the service.
-
#service_name ⇒ String
The name of the service.
-
#service_ref ⇒ AWSCDK::Interfaces::AWSECS::ServiceReference
A reference to this service.
-
#service_registries ⇒ Array<AWSCDK::ECS::CfnService::ServiceRegistryProperty>
The details of the service discovery registries to assign to this service.
- #service_registries=(value) ⇒ Object
-
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
-
#task_definition ⇒ AWSCDK::ECS::TaskDefinition
The task definition to use for tasks in the service.
-
#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, additional_props, task_definition) ⇒ BaseService
Constructs a new instance of the BaseService class.
19 20 21 22 23 24 25 26 27 |
# File 'ecs/base_service.rb', line 19 def initialize(scope, id, props, additional_props, task_definition) props = props.is_a?(Hash) ? ::AWSCDK::ECS::BaseServiceProps.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("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkJhc2VTZXJ2aWNlUHJvcHMifQ==")), "props") Jsii::Type.check_type(additional_props, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "additionalProps") Jsii::Type.check_type(task_definition, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlRhc2tEZWZpbml0aW9uIn0=")), "taskDefinition") Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props, additional_props, task_definition) end |
Class Method Details
.from_service_arn_with_cluster(scope, id, service_arn) ⇒ AWSCDK::ECS::IBaseService
Import an existing ECS/Fargate Service using the service cluster format.
The format is the "new" format "arn:aws:ecs:region:aws_account_id:service/cluster-name/service-name".
84 85 86 87 88 89 |
# File 'ecs/base_service.rb', line 84 def self.from_service_arn_with_cluster(scope, id, service_arn) 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(service_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "serviceArn") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.BaseService", "fromServiceArnWithCluster", [scope, id, service_arn]) end |
.jsii_overridable_methods ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'ecs/base_service.rb', line 29 def self.jsii_overridable_methods { :node => { kind: :property, name: "node", is_optional: false }, :env => { kind: :property, name: "env", is_optional: false }, :physical_name => { kind: :property, name: "physicalName", is_optional: false }, :stack => { kind: :property, name: "stack", is_optional: false }, :cluster => { kind: :property, name: "cluster", is_optional: false }, :connections => { kind: :property, name: "connections", is_optional: false }, :service_arn => { kind: :property, name: "serviceArn", is_optional: false }, :service_name => { kind: :property, name: "serviceName", is_optional: false }, :service_ref => { kind: :property, name: "serviceRef", is_optional: false }, :task_definition => { kind: :property, name: "taskDefinition", is_optional: false }, :cloud_map_service => { kind: :property, name: "cloudMapService", is_optional: true }, :load_balancers => { kind: :property, name: "loadBalancers", is_optional: false }, :service_registries => { kind: :property, name: "serviceRegistries", is_optional: false }, :cloudmap_service => { kind: :property, name: "cloudmapService", is_optional: true }, :deployment_alarms => { kind: :property, name: "deploymentAlarms", is_optional: true }, :network_configuration => { kind: :property, name: "networkConfiguration", is_optional: true }, :to_string => { kind: :method, name: "toString", is_optional: false }, :with => { kind: :method, name: "with", is_optional: false }, :apply_cross_stack_reference_strength => { kind: :method, name: "applyCrossStackReferenceStrength", is_optional: false }, :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false }, :generate_physical_name => { kind: :method, name: "generatePhysicalName", is_optional: false }, :get_resource_arn_attribute => { kind: :method, name: "getResourceArnAttribute", is_optional: false }, :get_resource_name_attribute => { kind: :method, name: "getResourceNameAttribute", is_optional: false }, :add_lifecycle_hook => { kind: :method, name: "addLifecycleHook", is_optional: false }, :add_volume => { kind: :method, name: "addVolume", is_optional: false }, :associate_cloud_map_service => { kind: :method, name: "associateCloudMapService", is_optional: false }, :attach_to_application_target_group => { kind: :method, name: "attachToApplicationTargetGroup", is_optional: false }, :attach_to_classic_lb => { kind: :method, name: "attachToClassicLB", is_optional: false }, :attach_to_network_target_group => { kind: :method, name: "attachToNetworkTargetGroup", is_optional: false }, :auto_scale_task_count => { kind: :method, name: "autoScaleTaskCount", is_optional: false }, :configure_aws_vpc_networking_with_security_groups => { kind: :method, name: "configureAwsVpcNetworkingWithSecurityGroups", is_optional: false }, :enable_cloud_map => { kind: :method, name: "enableCloudMap", is_optional: false }, :enable_deployment_alarms => { kind: :method, name: "enableDeploymentAlarms", is_optional: false }, :enable_service_connect => { kind: :method, name: "enableServiceConnect", is_optional: false }, :force_new_deployment => { kind: :method, name: "forceNewDeployment", is_optional: false }, :is_using_ecs_deployment_controller => { kind: :method, name: "isUsingECSDeploymentController", is_optional: false }, :load_balancer_target => { kind: :method, name: "loadBalancerTarget", is_optional: false }, :metric => { kind: :method, name: "metric", is_optional: false }, :metric_cpu_utilization => { kind: :method, name: "metricCpuUtilization", is_optional: false }, :metric_memory_utilization => { kind: :method, name: "metricMemoryUtilization", is_optional: false }, :register_load_balancer_targets => { kind: :method, name: "registerLoadBalancerTargets", is_optional: false }, } end |
Instance Method Details
#add_lifecycle_hook(target) ⇒ void
This method returns an undefined value.
Add a deployment lifecycle hook target.
339 340 341 342 |
# File 'ecs/base_service.rb', line 339 def add_lifecycle_hook(target) Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLklEZXBsb3ltZW50TGlmZWN5Y2xlSG9va1RhcmdldCJ9")), "target") jsii_call_method("addLifecycleHook", [target]) end |
#add_volume(volume) ⇒ void
This method returns an undefined value.
Adds a volume to the Service.
348 349 350 351 |
# File 'ecs/base_service.rb', line 348 def add_volume(volume) Jsii::Type.check_type(volume, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlNlcnZpY2VNYW5hZ2VkVm9sdW1lIn0=")), "volume") jsii_call_method("addVolume", [volume]) end |
#apply_cross_stack_reference_strength(strength) ⇒ void
This method returns an undefined value.
Override the cross-stack reference strength for this resource.
When set, any cross-stack reference to this resource will use the specified
mechanism instead of the global default determined by the
@aws-cdk/core:defaultCrossStackReferences context key. This is useful for
selectively weakening specific references to avoid the "deadly embrace" problem
without changing the app-wide default.
278 279 280 281 |
# File 'ecs/base_service.rb', line 278 def apply_cross_stack_reference_strength(strength) Jsii::Type.check_type(strength, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZWZlcmVuY2VTdHJlbmd0aCJ9")), "strength") jsii_call_method("applyCrossStackReferenceStrength", [strength]) end |
#apply_removal_policy(policy) ⇒ void
This method returns an undefined value.
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN).
295 296 297 298 |
# File 'ecs/base_service.rb', line 295 def apply_removal_policy(policy) Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy") jsii_call_method("applyRemovalPolicy", [policy]) end |
#associate_cloud_map_service(options) ⇒ void
This method returns an undefined value.
Associates this service with a CloudMap service.
357 358 359 360 361 |
# File 'ecs/base_service.rb', line 357 def associate_cloud_map_service() = .is_a?(Hash) ? ::AWSCDK::ECS::AssociateCloudMapServiceOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkFzc29jaWF0ZUNsb3VkTWFwU2VydmljZU9wdGlvbnMifQ==")), "options") jsii_call_method("associateCloudMapService", []) end |
#attach_to_application_target_group(target_group) ⇒ AWSCDK::ElasticLoadBalancingv2::LoadBalancerTargetProps
This method is called to attach this service to an Application Load Balancer.
Don't call this function directly. Instead, call listener.addTargets()
to add this service to a load balancer.
370 371 372 373 |
# File 'ecs/base_service.rb', line 370 def attach_to_application_target_group(target_group) Jsii::Type.check_type(target_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5JQXBwbGljYXRpb25UYXJnZXRHcm91cCJ9")), "targetGroup") jsii_call_method("attachToApplicationTargetGroup", [target_group]) end |
#attach_to_classic_lb(load_balancer) ⇒ void
This method returns an undefined value.
Registers the service as a target of a Classic Load Balancer (CLB).
Don't call this. Call loadBalancer.addTarget() instead.
381 382 383 384 |
# File 'ecs/base_service.rb', line 381 def attach_to_classic_lb(load_balancer) Jsii::Type.check_type(load_balancer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmcuTG9hZEJhbGFuY2VyIn0=")), "loadBalancer") jsii_call_method("attachToClassicLB", [load_balancer]) end |
#attach_to_network_target_group(target_group) ⇒ AWSCDK::ElasticLoadBalancingv2::LoadBalancerTargetProps
This method is called to attach this service to a Network Load Balancer.
Don't call this function directly. Instead, call listener.addTargets()
to add this service to a load balancer.
393 394 395 396 |
# File 'ecs/base_service.rb', line 393 def attach_to_network_target_group(target_group) Jsii::Type.check_type(target_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5JTmV0d29ya1RhcmdldEdyb3VwIn0=")), "targetGroup") jsii_call_method("attachToNetworkTargetGroup", [target_group]) end |
#auto_scale_task_count(props) ⇒ AWSCDK::ECS::ScalableTaskCount
An attribute representing the minimum and maximum task count for an AutoScalingGroup.
402 403 404 405 406 |
# File 'ecs/base_service.rb', line 402 def auto_scale_task_count(props) props = props.is_a?(Hash) ? ::AWSCDK::ApplicationAutoScaling::EnableScalingProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwbGljYXRpb25hdXRvc2NhbGluZy5FbmFibGVTY2FsaW5nUHJvcHMifQ==")), "props") jsii_call_method("autoScaleTaskCount", [props]) end |
#cloud_map_service ⇒ AWSCDK::ServiceDiscovery::IService?
The CloudMap service created for this service, if any.
179 180 181 |
# File 'ecs/base_service.rb', line 179 def cloud_map_service() jsii_get_property("cloudMapService") end |
#cloudmap_service ⇒ AWSCDK::ServiceDiscovery::Service?
The details of the AWS Cloud Map service.
214 215 216 |
# File 'ecs/base_service.rb', line 214 def cloudmap_service() jsii_get_property("cloudmapService") end |
#cloudmap_service=(value) ⇒ Object
218 219 220 221 |
# File 'ecs/base_service.rb', line 218 def cloudmap_service=(value) Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VydmljZWRpc2NvdmVyeS5TZXJ2aWNlIn0=")), "cloudmapService") unless value.nil? jsii_set_property("cloudmapService", value) end |
#cluster ⇒ AWSCDK::ECS::ICluster
The cluster that hosts the service.
137 138 139 |
# File 'ecs/base_service.rb', line 137 def cluster() jsii_get_property("cluster") end |
#configure_aws_vpc_networking_with_security_groups(vpc, assign_public_ip = nil, vpc_subnets = nil, security_groups = nil) ⇒ void
This method returns an undefined value.
This method is called to create a networkConfiguration.
415 416 417 418 419 420 421 422 |
# File 'ecs/base_service.rb', line 415 def configure_aws_vpc_networking_with_security_groups(vpc, assign_public_ip = nil, vpc_subnets = nil, security_groups = nil) Jsii::Type.check_type(vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") Jsii::Type.check_type(assign_public_ip, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "assignPublicIp") unless assign_public_ip.nil? vpc_subnets = vpc_subnets.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**vpc_subnets.transform_keys(&:to_sym)) : vpc_subnets Jsii::Type.check_type(vpc_subnets, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "vpcSubnets") unless vpc_subnets.nil? Jsii::Type.check_type(security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVNlY3VyaXR5R3JvdXAifSwia2luZCI6ImFycmF5In19")), "securityGroups") unless security_groups.nil? jsii_call_method("configureAwsVpcNetworkingWithSecurityGroups", [vpc, assign_public_ip, vpc_subnets, security_groups]) end |
#connections ⇒ AWSCDK::EC2::Connections
The security groups which manage the allowed network traffic for the service.
144 145 146 |
# File 'ecs/base_service.rb', line 144 def connections() jsii_get_property("connections") end |
#deployment_alarms ⇒ AWSCDK::ECS::CfnService::DeploymentAlarmsProperty?
224 225 226 |
# File 'ecs/base_service.rb', line 224 def deployment_alarms() jsii_get_property("deploymentAlarms") end |
#deployment_alarms=(value) ⇒ Object
228 229 230 231 232 |
# File 'ecs/base_service.rb', line 228 def deployment_alarms=(value) value = value.is_a?(Hash) ? ::AWSCDK::ECS::CfnService::DeploymentAlarmsProperty.new(**value.transform_keys(&:to_sym)) : value Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNmblNlcnZpY2UuRGVwbG95bWVudEFsYXJtc1Byb3BlcnR5In0=")), "deploymentAlarms") unless value.nil? jsii_set_property("deploymentAlarms", value) end |
#enable_cloud_map(options) ⇒ AWSCDK::ServiceDiscovery::Service
Enable CloudMap service discovery for the service.
428 429 430 431 432 |
# File 'ecs/base_service.rb', line 428 def enable_cloud_map() = .is_a?(Hash) ? ::AWSCDK::ECS::CloudMapOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNsb3VkTWFwT3B0aW9ucyJ9")), "options") jsii_call_method("enableCloudMap", []) end |
#enable_deployment_alarms(alarm_names, options = nil) ⇒ void
This method returns an undefined value.
Enable Deployment Alarms which take advantage of arbitrary alarms and configure them after service initialization.
If you have already enabled deployment alarms, this function can be used to tell ECS about additional alarms that should interrupt a deployment.
New alarms specified in subsequent calls of this function will be appended to the existing list of alarms.
The same Alarm Behavior must be used on all deployment alarms. If you specify different AlarmBehavior values in multiple calls to this function, or the Alarm Behavior used here doesn't match the one used in the service constructor, an error will be thrown.
If the alarm's metric references the service, you cannot pass Alarm.alarmName here. That will cause a circular
dependency between the service and its deployment alarm. See this package's README for options to alarm on service
metrics, and avoid this circular dependency.
452 453 454 455 456 457 |
# File 'ecs/base_service.rb', line 452 def enable_deployment_alarms(alarm_names, = nil) Jsii::Type.check_type(alarm_names, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "alarmNames") = .is_a?(Hash) ? ::AWSCDK::ECS::DeploymentAlarmOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkRlcGxveW1lbnRBbGFybU9wdGlvbnMifQ==")), "options") unless .nil? jsii_call_method("enableDeploymentAlarms", [alarm_names, ]) end |
#enable_service_connect(config = nil) ⇒ void
This method returns an undefined value.
Enable Service Connect on this service.
463 464 465 466 467 |
# File 'ecs/base_service.rb', line 463 def enable_service_connect(config = nil) config = config.is_a?(Hash) ? ::AWSCDK::ECS::ServiceConnectProps.new(**config.transform_keys(&:to_sym)) : config Jsii::Type.check_type(config, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlNlcnZpY2VDb25uZWN0UHJvcHMifQ==")), "config") unless config.nil? jsii_call_method("enableServiceConnect", [config]) end |
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
109 110 111 |
# File 'ecs/base_service.rb', line 109 def env() jsii_get_property("env") end |
#force_new_deployment(nonce = nil) ⇒ void
This method returns an undefined value.
Forces a new deployment of the service.
This can be used to trigger a deployment without changing the task definition or desired count. ECS will start a new deployment even if there are no changes to the service configuration.
Important: When called without a nonce, a timestamp is generated automatically, which means
every cdk synth produces a different template and every cdk deploy triggers a new deployment
regardless of whether any code has changed. To avoid this, provide a stable nonce value that only
changes when you intentionally want to force a redeployment (e.g., an image digest or a version string).
481 482 483 484 |
# File 'ecs/base_service.rb', line 481 def force_new_deployment(nonce = nil) Jsii::Type.check_type(nonce, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nonce") unless nonce.nil? jsii_call_method("forceNewDeployment", [nonce]) end |
#generate_physical_name ⇒ String
301 302 303 |
# File 'ecs/base_service.rb', line 301 def generate_physical_name() jsii_call_method("generatePhysicalName", []) end |
#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn).
Normally, this token will resolve to arn_attr, but if the resource is
referenced across environments, arn_components will be used to synthesize
a concrete ARN with the resource's physical name. Make sure to reference
this.physicalName in arn_components.
315 316 317 318 319 320 |
# File 'ecs/base_service.rb', line 315 def get_resource_arn_attribute(arn_attr, arn_components) Jsii::Type.check_type(arn_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "arnAttr") arn_components = arn_components.is_a?(Hash) ? ::AWSCDK::ARNComponents.new(**arn_components.transform_keys(&:to_sym)) : arn_components Jsii::Type.check_type(arn_components, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Bcm5Db21wb25lbnRzIn0=")), "arnComponents") jsii_call_method("getResourceArnAttribute", [arn_attr, arn_components]) end |
#get_resource_name_attribute(name_attr) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName).
Normally, this token will resolve to name_attr, but if the resource is
referenced across environments, it will be resolved to this.physicalName,
which will be a concrete name.
330 331 332 333 |
# File 'ecs/base_service.rb', line 330 def get_resource_name_attribute(name_attr) Jsii::Type.check_type(name_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nameAttr") jsii_call_method("getResourceNameAttribute", [name_attr]) end |
#is_using_ecs_deployment_controller ⇒ Boolean
Checks if the service is using the ECS deployment controller.
489 490 491 |
# File 'ecs/base_service.rb', line 489 def is_using_ecs_deployment_controller() jsii_call_method("isUsingECSDeploymentController", []) end |
#load_balancer_target(options) ⇒ AWSCDK::ECS::IECSLoadBalancerTarget
Return a load balancing target for a specific container and port.
Use this function to create a load balancer target if you want to load balance to another container than the first essential container or the first mapped port on the container.
Use the return value of this function where you would normally use a load balancer
target, instead of the Service object itself.
517 518 519 520 521 |
# File 'ecs/base_service.rb', line 517 def load_balancer_target() = .is_a?(Hash) ? ::AWSCDK::ECS::LoadBalancerTargetOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkxvYWRCYWxhbmNlclRhcmdldE9wdGlvbnMifQ==")), "options") jsii_call_method("loadBalancerTarget", []) end |
#load_balancers ⇒ Array<AWSCDK::ECS::CfnService::LoadBalancerProperty>
A list of Elastic Load Balancing load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.
186 187 188 |
# File 'ecs/base_service.rb', line 186 def load_balancers() jsii_get_property("loadBalancers") end |
#load_balancers=(value) ⇒ Object
190 191 192 193 194 |
# File 'ecs/base_service.rb', line 190 def load_balancers=(value) value = value.is_a?(Array) ? value.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ECS::CfnService::LoadBalancerProperty.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : value Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuQ2ZuU2VydmljZS5Mb2FkQmFsYW5jZXJQcm9wZXJ0eSJ9LCJraW5kIjoiYXJyYXkifX0=")), "loadBalancers") jsii_set_property("loadBalancers", value) end |
#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric
This method returns the specified CloudWatch metric name for this service.
528 529 530 531 532 533 |
# File 'ecs/base_service.rb', line 528 def metric(metric_name, props = nil) Jsii::Type.check_type(metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName") props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metric", [metric_name, props]) end |
#metric_cpu_utilization(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Default: average over 5 minutes
This method returns the CloudWatch metric for this service's CPU utilization.
540 541 542 543 544 |
# File 'ecs/base_service.rb', line 540 def metric_cpu_utilization(props = nil) props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metricCpuUtilization", [props]) end |
#metric_memory_utilization(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Default: average over 5 minutes
This method returns the CloudWatch metric for this service's memory utilization.
551 552 553 554 555 |
# File 'ecs/base_service.rb', line 551 def metric_memory_utilization(props = nil) props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metricMemoryUtilization", [props]) end |
#network_configuration ⇒ AWSCDK::ECS::CfnService::NetworkConfigurationProperty?
235 236 237 |
# File 'ecs/base_service.rb', line 235 def network_configuration() jsii_get_property("networkConfiguration") end |
#network_configuration=(value) ⇒ Object
239 240 241 242 243 |
# File 'ecs/base_service.rb', line 239 def network_configuration=(value) value = value.is_a?(Hash) ? ::AWSCDK::ECS::CfnService::NetworkConfigurationProperty.new(**value.transform_keys(&:to_sym)) : value Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNmblNlcnZpY2UuTmV0d29ya0NvbmZpZ3VyYXRpb25Qcm9wZXJ0eSJ9")), "networkConfiguration") unless value.nil? jsii_set_property("networkConfiguration", value) end |
#node ⇒ Constructs::Node
The tree node.
94 95 96 |
# File 'ecs/base_service.rb', line 94 def node() jsii_get_property("node") end |
#physical_name ⇒ String
Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
This value will resolve to one of the following:
- a concrete value (e.g.
"my-awesome-bucket") undefined, when a name should be generated by CloudFormation- a concrete name generated automatically during synthesis, in cross-environment scenarios.
123 124 125 |
# File 'ecs/base_service.rb', line 123 def physical_name() jsii_get_property("physicalName") end |
#register_load_balancer_targets(*targets) ⇒ void
This method returns an undefined value.
Use this function to create all load balancer targets to be registered in this service, add them to target groups, and attach target groups to listeners accordingly.
Alternatively, you can use listener.addTargets() to create targets and add them to target groups.
575 576 577 578 579 580 581 |
# File 'ecs/base_service.rb', line 575 def register_load_balancer_targets(*targets) targets.map! { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ECS::ECSTarget.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } targets.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkVjc1RhcmdldCJ9")), "targets[#{index}]") end jsii_call_method("registerLoadBalancerTargets", [*targets]) end |
#service_arn ⇒ String
The Amazon Resource Name (ARN) of the service.
151 152 153 |
# File 'ecs/base_service.rb', line 151 def service_arn() jsii_get_property("serviceArn") end |
#service_name ⇒ String
The name of the service.
158 159 160 |
# File 'ecs/base_service.rb', line 158 def service_name() jsii_get_property("serviceName") end |
#service_ref ⇒ AWSCDK::Interfaces::AWSECS::ServiceReference
A reference to this service.
165 166 167 |
# File 'ecs/base_service.rb', line 165 def service_ref() jsii_get_property("serviceRef") end |
#service_registries ⇒ Array<AWSCDK::ECS::CfnService::ServiceRegistryProperty>
The details of the service discovery registries to assign to this service.
For more information, see Service Discovery.
201 202 203 |
# File 'ecs/base_service.rb', line 201 def service_registries() jsii_get_property("serviceRegistries") end |
#service_registries=(value) ⇒ Object
205 206 207 208 209 |
# File 'ecs/base_service.rb', line 205 def service_registries=(value) value = value.is_a?(Array) ? value.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ECS::CfnService::ServiceRegistryProperty.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : value Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuQ2ZuU2VydmljZS5TZXJ2aWNlUmVnaXN0cnlQcm9wZXJ0eSJ9LCJraW5kIjoiYXJyYXkifX0=")), "serviceRegistries") jsii_set_property("serviceRegistries", value) end |
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
130 131 132 |
# File 'ecs/base_service.rb', line 130 def stack() jsii_get_property("stack") end |
#task_definition ⇒ AWSCDK::ECS::TaskDefinition
The task definition to use for tasks in the service.
172 173 174 |
# File 'ecs/base_service.rb', line 172 def task_definition() jsii_get_property("taskDefinition") end |
#to_string ⇒ String
Returns a string representation of this construct.
248 249 250 |
# File 'ecs/base_service.rb', line 248 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.
261 262 263 264 265 266 |
# File 'ecs/base_service.rb', line 261 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 |