Class: AWSCDK::ElasticLoadBalancingv2::BaseLoadBalancer

Inherits:
Resource
  • Object
show all
Defined in:
elastic_load_balancingv2/base_load_balancer.rb

Overview

Base class for both Application and Network Load Balancers.

Direct Known Subclasses

ApplicationLoadBalancer, NetworkLoadBalancer

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, base_props, additional_props) ⇒ BaseLoadBalancer

Returns a new instance of BaseLoadBalancer.

Parameters:



12
13
14
15
16
17
18
19
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 12

def initialize(scope, id, base_props, additional_props)
  base_props = base_props.is_a?(Hash) ? ::AWSCDK::ElasticLoadBalancingv2::BaseLoadBalancerProps.new(**base_props.transform_keys(&:to_sym)) : base_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(base_props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5CYXNlTG9hZEJhbGFuY2VyUHJvcHMifQ==")), "baseProps")
  Jsii::Type.check_type(additional_props, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "additionalProps")
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, base_props, additional_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
40
41
42
43
44
45
46
47
48
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 21

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 },
    :load_balancer_arn => { kind: :property, name: "loadBalancerArn", is_optional: false },
    :load_balancer_canonical_hosted_zone_id => { kind: :property, name: "loadBalancerCanonicalHostedZoneId", is_optional: false },
    :load_balancer_dns_name => { kind: :property, name: "loadBalancerDnsName", is_optional: false },
    :load_balancer_full_name => { kind: :property, name: "loadBalancerFullName", is_optional: false },
    :load_balancer_name => { kind: :property, name: "loadBalancerName", is_optional: false },
    :load_balancer_ref => { kind: :property, name: "loadBalancerRef", is_optional: false },
    :load_balancer_security_groups => { kind: :property, name: "loadBalancerSecurityGroups", is_optional: false },
    :vpc => { kind: :property, name: "vpc", 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 },
    :log_access_logs => { kind: :method, name: "logAccessLogs", is_optional: false },
    :remove_attribute => { kind: :method, name: "removeAttribute", is_optional: false },
    :resource_policy_principal => { kind: :method, name: "resourcePolicyPrincipal", is_optional: false },
    :set_attribute => { kind: :method, name: "setAttribute", is_optional: false },
    :validate_load_balancer => { kind: :method, name: "validateLoadBalancer", is_optional: false },
  }
end

Instance Method Details

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



192
193
194
195
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 192

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:



209
210
211
212
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 209

def apply_removal_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy")
  jsii_call_method("applyRemovalPolicy", [policy])
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.



68
69
70
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 68

def env()
  jsii_get_property("env")
end

#generate_physical_nameString

Returns:

  • (String)


215
216
217
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 215

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)


229
230
231
232
233
234
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 229

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)


244
245
246
247
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 244

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

#load_balancer_arnString

The ARN of this load balancer.

Example value: arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-internal-load-balancer/50dc6c495c0c9188

Returns:

  • (String)


98
99
100
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 98

def load_balancer_arn()
  jsii_get_property("loadBalancerArn")
end

#load_balancer_canonical_hosted_zone_idString

The canonical hosted zone ID of this load balancer.

Example value: Z2P70J7EXAMPLE

Returns:

  • (String)


107
108
109
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 107

def load_balancer_canonical_hosted_zone_id()
  jsii_get_property("loadBalancerCanonicalHostedZoneId")
end

#load_balancer_dns_nameString

The DNS name of this load balancer.

Example value: my-load-balancer-424835706.us-west-2.elb.amazonaws.com

Returns:

  • (String)


116
117
118
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 116

def load_balancer_dns_name()
  jsii_get_property("loadBalancerDnsName")
end

#load_balancer_full_nameString

The full name of this load balancer.

Example value: app/my-load-balancer/50dc6c495c0c9188

Returns:

  • (String)


125
126
127
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 125

def load_balancer_full_name()
  jsii_get_property("loadBalancerFullName")
end

#load_balancer_nameString

The name of this load balancer.

Example value: my-load-balancer

Returns:

  • (String)


134
135
136
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 134

def load_balancer_name()
  jsii_get_property("loadBalancerName")
end

#load_balancer_refAWSCDK::Interfaces::AWSElasticloadbalancingv2::LoadBalancerReference

A reference to this load balancer.



141
142
143
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 141

def load_balancer_ref()
  jsii_get_property("loadBalancerRef")
end

#load_balancer_security_groupsArray<String>

Returns:

  • (Array<String>)


146
147
148
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 146

def load_balancer_security_groups()
  jsii_get_property("loadBalancerSecurityGroups")
end

#log_access_logs(bucket, prefix = nil) ⇒ void

This method returns an undefined value.

Enable access logging for this load balancer.

A region must be specified on the stack containing the load balancer; you cannot enable logging on environment-agnostic stacks. See https://docs.aws.amazon.com/cdk/latest/guide/environments.html

Parameters:



257
258
259
260
261
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 257

def log_access_logs(bucket, prefix = nil)
  Jsii::Type.check_type(bucket, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuSUJ1Y2tldCJ9")), "bucket")
  Jsii::Type.check_type(prefix, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "prefix") unless prefix.nil?
  jsii_call_method("logAccessLogs", [bucket, prefix])
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


53
54
55
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 53

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)


82
83
84
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 82

def physical_name()
  jsii_get_property("physicalName")
end

#remove_attribute(key) ⇒ void

This method returns an undefined value.

Remove an attribute from the load balancer.

Parameters:

  • key (String)


267
268
269
270
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 267

def remove_attribute(key)
  Jsii::Type.check_type(key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "key")
  jsii_call_method("removeAttribute", [key])
end

#resource_policy_principalAWSCDK::IAM::IPrincipal



273
274
275
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 273

def resource_policy_principal()
  jsii_call_method("resourcePolicyPrincipal", [])
end

#set_attribute(key, value = nil) ⇒ void

This method returns an undefined value.

Set a non-standard attribute on the load balancer.



283
284
285
286
287
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 283

def set_attribute(key, value = nil)
  Jsii::Type.check_type(key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "key")
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "value") unless value.nil?
  jsii_call_method("setAttribute", [key, value])
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



89
90
91
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 89

def stack()
  jsii_get_property("stack")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


162
163
164
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 162

def to_string()
  jsii_call_method("toString", [])
end

#validate_load_balancerArray<String>

Returns:

  • (Array<String>)


290
291
292
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 290

def validate_load_balancer()
  jsii_call_method("validateLoadBalancer", [])
end

#vpcAWSCDK::EC2::IVPC?

The VPC this load balancer has been created in.

This property is always defined (not null or undefined) for sub-classes of BaseLoadBalancer.

Returns:



155
156
157
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 155

def vpc()
  jsii_get_property("vpc")
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)


175
176
177
178
179
180
# File 'elastic_load_balancingv2/base_load_balancer.rb', line 175

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