Class: AWSCDK::ECS::ExternalService

Inherits:
BaseService
  • Object
show all
Includes:
IExternalService
Defined in:
ecs/external_service.rb

Overview

This creates a service using the External launch type on an ECS cluster.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props) ⇒ ExternalService

Constructs a new instance of the ExternalService class.

Parameters:



14
15
16
17
18
19
20
# File 'ecs/external_service.rb', line 14

def initialize(scope, id, props)
  props = props.is_a?(Hash) ? ::AWSCDK::ECS::ExternalServiceProps.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("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkV4dGVybmFsU2VydmljZVByb3BzIn0=")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.from_external_service_arn(scope, id, external_service_arn) ⇒ AWSCDK::ECS::IExternalService

Imports from the specified service ARN.

Parameters:

  • scope (Constructs::Construct)
  • id (String)
  • external_service_arn (String)

Returns:



74
75
76
77
78
79
# File 'ecs/external_service.rb', line 74

def self.from_external_service_arn(scope, id, external_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(external_service_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "externalServiceArn")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.ExternalService", "fromExternalServiceArn", [scope, id, external_service_arn])
end

.from_external_service_attributes(scope, id, attrs) ⇒ AWSCDK::ECS::IBaseService

Imports from the specified service attributes.

Parameters:

Returns:



87
88
89
90
91
92
93
# File 'ecs/external_service.rb', line 87

def self.from_external_service_attributes(scope, id, attrs)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  attrs = attrs.is_a?(Hash) ? ::AWSCDK::ECS::ExternalServiceAttributes.new(**attrs.transform_keys(&:to_sym)) : attrs
  Jsii::Type.check_type(attrs, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkV4dGVybmFsU2VydmljZUF0dHJpYnV0ZXMifQ==")), "attrs")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.ExternalService", "fromExternalServiceAttributes", [scope, id, attrs])
end

.jsii_overridable_methodsObject



22
23
24
25
26
27
28
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
# File 'ecs/external_service.rb', line 22

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

.PROPERTY_INJECTION_IDString

Uniquely identifies this class.

Returns:

  • (String)


252
253
254
# File 'ecs/external_service.rb', line 252

def self.PROPERTY_INJECTION_ID()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_ecs.ExternalService", "PROPERTY_INJECTION_ID")
end

Instance Method Details

#add_lifecycle_hook(target) ⇒ void

This method returns an undefined value.

Add a deployment lifecycle hook target.

Parameters:



350
351
352
353
# File 'ecs/external_service.rb', line 350

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.

Parameters:



359
360
361
362
# File 'ecs/external_service.rb', line 359

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.

Parameters:



289
290
291
292
# File 'ecs/external_service.rb', line 289

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).

Parameters:



306
307
308
309
# File 'ecs/external_service.rb', line 306

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.

Overridden method to throw error as associateCloudMapService is not supported for external service.



368
369
370
371
372
# File 'ecs/external_service.rb', line 368

def associate_cloud_map_service(_options)
  _options = _options.is_a?(Hash) ? ::AWSCDK::ECS::AssociateCloudMapServiceOptions.new(**_options.transform_keys(&:to_sym)) : _options
  Jsii::Type.check_type(_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkFzc29jaWF0ZUNsb3VkTWFwU2VydmljZU9wdGlvbnMifQ==")), "_options")
  jsii_call_method("associateCloudMapService", [_options])
end

#attach_to_application_target_group(_target_group) ⇒ AWSCDK::ElasticLoadBalancingv2::LoadBalancerTargetProps

Overridden method to throw error as attachToApplicationTargetGroup is not supported for external service.



378
379
380
381
# File 'ecs/external_service.rb', line 378

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.

Parameters:



389
390
391
392
# File 'ecs/external_service.rb', line 389

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.



401
402
403
404
# File 'ecs/external_service.rb', line 401

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

Overridden method to throw error as autoScaleTaskCount is not supported for external service.



410
411
412
413
414
# File 'ecs/external_service.rb', line 410

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_serviceAWSCDK::ServiceDiscovery::IService?

The CloudMap service created for this service, if any.



183
184
185
# File 'ecs/external_service.rb', line 183

def cloud_map_service()
  jsii_get_property("cloudMapService")
end

#cloudmap_serviceAWSCDK::ServiceDiscovery::Service?

The details of the AWS Cloud Map service.



218
219
220
# File 'ecs/external_service.rb', line 218

def cloudmap_service()
  jsii_get_property("cloudmapService")
end

#cloudmap_service=(value) ⇒ Object



222
223
224
225
# File 'ecs/external_service.rb', line 222

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

#clusterAWSCDK::ECS::ICluster

The cluster that hosts the service.



141
142
143
# File 'ecs/external_service.rb', line 141

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.

Overridden method to throw error as configureAwsVpcNetworkingWithSecurityGroups is not supported for external service.

Parameters:



423
424
425
426
427
428
429
430
# File 'ecs/external_service.rb', line 423

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

#connectionsAWSCDK::EC2::Connections

The security groups which manage the allowed network traffic for the service.



148
149
150
# File 'ecs/external_service.rb', line 148

def connections()
  jsii_get_property("connections")
end

#deployment_alarmsAWSCDK::ECS::CfnService::DeploymentAlarmsProperty?



228
229
230
# File 'ecs/external_service.rb', line 228

def deployment_alarms()
  jsii_get_property("deploymentAlarms")
end

#deployment_alarms=(value) ⇒ Object



232
233
234
235
236
# File 'ecs/external_service.rb', line 232

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

Overridden method to throw error as enableCloudMap is not supported for external service.



436
437
438
439
440
# File 'ecs/external_service.rb', line 436

def enable_cloud_map(_options)
  _options = _options.is_a?(Hash) ? ::AWSCDK::ECS::CloudMapOptions.new(**_options.transform_keys(&:to_sym)) : _options
  Jsii::Type.check_type(_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNsb3VkTWFwT3B0aW9ucyJ9")), "_options")
  jsii_call_method("enableCloudMap", [_options])
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.

Parameters:



460
461
462
463
464
465
# File 'ecs/external_service.rb', line 460

def enable_deployment_alarms(alarm_names, options = nil)
  Jsii::Type.check_type(alarm_names, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "alarmNames")
  options = options.is_a?(Hash) ? ::AWSCDK::ECS::DeploymentAlarmOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkRlcGxveW1lbnRBbGFybU9wdGlvbnMifQ==")), "options") unless options.nil?
  jsii_call_method("enableDeploymentAlarms", [alarm_names, options])
end

#enable_service_connect(config = nil) ⇒ void

This method returns an undefined value.

Enable Service Connect on this service.

Parameters:



471
472
473
474
475
# File 'ecs/external_service.rb', line 471

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

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



113
114
115
# File 'ecs/external_service.rb', line 113

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).

Parameters:

  • nonce (String, nil) (defaults to: nil)
    • A unique string (1-255 characters) that signals ECS to start a new deployment.


489
490
491
492
# File 'ecs/external_service.rb', line 489

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_nameString

Returns:

  • (String)


312
313
314
# File 'ecs/external_service.rb', line 312

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.

Parameters:

  • arn_attr (String)

    The CFN attribute which resolves to the ARN of the resource.

  • arn_components (AWSCDK::ARNComponents)

    The format of the ARN of this resource.

Returns:

  • (String)


326
327
328
329
330
331
# File 'ecs/external_service.rb', line 326

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.

Parameters:

  • name_attr (String)

    The CFN attribute which resolves to the resource's name.

Returns:

  • (String)


341
342
343
344
# File 'ecs/external_service.rb', line 341

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_controllerBoolean

Checks if the service is using the ECS deployment controller.

Returns:

  • (Boolean)

    true if the service is using the ECS deployment controller or if no deployment controller is specified (defaults to ECS)



497
498
499
# File 'ecs/external_service.rb', line 497

def is_using_ecs_deployment_controller()
  jsii_call_method("isUsingECSDeploymentController", [])
end

#load_balancer_target(_options) ⇒ AWSCDK::ECS::IECSLoadBalancerTarget

Overridden method to throw error as loadBalancerTarget is not supported for external service.



505
506
507
508
509
# File 'ecs/external_service.rb', line 505

def load_balancer_target(_options)
  _options = _options.is_a?(Hash) ? ::AWSCDK::ECS::LoadBalancerTargetOptions.new(**_options.transform_keys(&:to_sym)) : _options
  Jsii::Type.check_type(_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkxvYWRCYWxhbmNlclRhcmdldE9wdGlvbnMifQ==")), "_options")
  jsii_call_method("loadBalancerTarget", [_options])
end

#load_balancersArray<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.



190
191
192
# File 'ecs/external_service.rb', line 190

def load_balancers()
  jsii_get_property("loadBalancers")
end

#load_balancers=(value) ⇒ Object



194
195
196
197
198
# File 'ecs/external_service.rb', line 194

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.

Parameters:

Returns:



516
517
518
519
520
521
# File 'ecs/external_service.rb', line 516

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

Note:

Default: average over 5 minutes

This method returns the CloudWatch metric for this service's CPU utilization.

Parameters:

Returns:



528
529
530
531
532
# File 'ecs/external_service.rb', line 528

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

Note:

Default: average over 5 minutes

This method returns the CloudWatch metric for this service's memory utilization.

Parameters:

Returns:



539
540
541
542
543
# File 'ecs/external_service.rb', line 539

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_configurationAWSCDK::ECS::CfnService::NetworkConfigurationProperty?



239
240
241
# File 'ecs/external_service.rb', line 239

def network_configuration()
  jsii_get_property("networkConfiguration")
end

#network_configuration=(value) ⇒ Object



243
244
245
246
247
# File 'ecs/external_service.rb', line 243

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

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


98
99
100
# File 'ecs/external_service.rb', line 98

def node()
  jsii_get_property("node")
end

#physical_nameString

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.

Returns:

  • (String)


127
128
129
# File 'ecs/external_service.rb', line 127

def physical_name()
  jsii_get_property("physicalName")
end

#register_load_balancer_targets(*_targets) ⇒ void

This method returns an undefined value.

Overridden method to throw error as registerLoadBalancerTargets is not supported for external service.

Parameters:



549
550
551
552
553
554
555
# File 'ecs/external_service.rb', line 549

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_arnString

The Amazon Resource Name (ARN) of the service.

Returns:

  • (String)


155
156
157
# File 'ecs/external_service.rb', line 155

def service_arn()
  jsii_get_property("serviceArn")
end

#service_nameString

The name of the service.

Returns:

  • (String)


162
163
164
# File 'ecs/external_service.rb', line 162

def service_name()
  jsii_get_property("serviceName")
end

#service_refAWSCDK::Interfaces::AWSECS::ServiceReference

A reference to this service.



169
170
171
# File 'ecs/external_service.rb', line 169

def service_ref()
  jsii_get_property("serviceRef")
end

#service_registriesArray<AWSCDK::ECS::CfnService::ServiceRegistryProperty>

The details of the service discovery registries to assign to this service.

For more information, see Service Discovery.



205
206
207
# File 'ecs/external_service.rb', line 205

def service_registries()
  jsii_get_property("serviceRegistries")
end

#service_registries=(value) ⇒ Object



209
210
211
212
213
# File 'ecs/external_service.rb', line 209

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

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



134
135
136
# File 'ecs/external_service.rb', line 134

def stack()
  jsii_get_property("stack")
end

#task_definitionAWSCDK::ECS::TaskDefinition

The task definition to use for tasks in the service.



176
177
178
# File 'ecs/external_service.rb', line 176

def task_definition()
  jsii_get_property("taskDefinition")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


259
260
261
# File 'ecs/external_service.rb', line 259

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>)

Returns:

  • (Constructs::IConstruct)


272
273
274
275
276
277
# File 'ecs/external_service.rb', line 272

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