aws-cdk-lib 2.208.0__py3-none-any.whl → 2.209.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of aws-cdk-lib might be problematic. Click here for more details.

@@ -1813,28 +1813,40 @@ class ApplicationListenerRule(
1813
1813
  ):
1814
1814
  '''Define a new listener rule.
1815
1815
 
1816
- :exampleMetadata: fixture=_generated
1816
+ :exampleMetadata: infused
1817
1817
 
1818
1818
  Example::
1819
1819
 
1820
- # The code below shows an example of how to instantiate this type.
1821
- # The values are placeholders you should change.
1822
- from aws_cdk import aws_elasticloadbalancingv2 as elbv2
1820
+ import aws_cdk.aws_lambda as lambda_
1823
1821
 
1824
- # application_listener: elbv2.ApplicationListener
1825
- # application_target_group: elbv2.ApplicationTargetGroup
1826
- # listener_action: elbv2.ListenerAction
1827
- # listener_condition: elbv2.ListenerCondition
1822
+ # cluster: ecs.Cluster
1823
+ # task_definition: ecs.TaskDefinition
1824
+ # lambda_hook: lambda.Function
1825
+ # blue_target_group: elbv2.ApplicationTargetGroup
1826
+ # green_target_group: elbv2.ApplicationTargetGroup
1827
+ # prod_listener_rule: elbv2.ApplicationListenerRule
1828
1828
 
1829
- application_listener_rule = elbv2.ApplicationListenerRule(self, "MyApplicationListenerRule",
1830
- listener=application_listener,
1831
- priority=123,
1832
1829
 
1833
- # the properties below are optional
1834
- action=listener_action,
1835
- conditions=[listener_condition],
1836
- target_groups=[application_target_group]
1830
+ service = ecs.FargateService(self, "Service",
1831
+ cluster=cluster,
1832
+ task_definition=task_definition,
1833
+ deployment_strategy=ecs.DeploymentStrategy.BLUE_GREEN
1837
1834
  )
1835
+
1836
+ service.add_lifecycle_hook(ecs.DeploymentLifecycleLambdaTarget(lambda_hook, "PreScaleHook",
1837
+ lifecycle_stages=[ecs.DeploymentLifecycleStage.PRE_SCALE_UP]
1838
+ ))
1839
+
1840
+ target = service.load_balancer_target(ecs.LoadBalancerTargetOptions(
1841
+ container_name="nginx",
1842
+ container_port=80,
1843
+ protocol=ecs.Protocol.TCP
1844
+ ), ecs.AlternateTarget("AlternateTarget",
1845
+ alternate_target_group=green_target_group,
1846
+ production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
1847
+ ))
1848
+
1849
+ target.attach_to_application_target_group(blue_target_group)
1838
1850
  '''
1839
1851
 
1840
1852
  def __init__(
@@ -11698,32 +11698,30 @@ class CfnVersionProps:
11698
11698
  class Code(metaclass=jsii.JSIIAbstractClass, jsii_type="aws-cdk-lib.aws_lambda.Code"):
11699
11699
  '''Represents the Lambda Handler Code.
11700
11700
 
11701
- :exampleMetadata: infused
11701
+ :exampleMetadata: fixture=default infused
11702
11702
 
11703
11703
  Example::
11704
11704
 
11705
- import aws_cdk.aws_lambda as lambda_
11705
+ # Create or reference an existing L1 CfnApplicationInferenceProfile
11706
+ cfn_profile = aws_bedrock_cfn.CfnApplicationInferenceProfile(self, "CfnProfile",
11707
+ inference_profile_name="my-cfn-profile",
11708
+ model_source=aws_bedrock_cfn.CfnApplicationInferenceProfile.InferenceProfileModelSourceProperty(
11709
+ copy_from=bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0.invokable_arn
11710
+ ),
11711
+ description="Profile created via L1 construct"
11712
+ )
11706
11713
 
11714
+ # Import the L1 construct as an L2 ApplicationInferenceProfile
11715
+ imported_from_cfn = bedrock.ApplicationInferenceProfile.from_cfn_application_inference_profile(cfn_profile)
11707
11716
 
11708
- fn = lambda_.Function(self, "MyFunc",
11709
- runtime=lambda_.Runtime.NODEJS_LATEST,
11717
+ # Grant permissions to use the imported profile
11718
+ lambda_function = lambda_.Function(self, "MyFunction",
11719
+ runtime=lambda_.Runtime.PYTHON_3_11,
11710
11720
  handler="index.handler",
11711
- code=lambda_.Code.from_inline("exports.handler = handler.toString()")
11712
- )
11713
-
11714
- rule = events.Rule(self, "rule",
11715
- event_pattern=events.EventPattern(
11716
- source=["aws.ec2"]
11717
- )
11721
+ code=lambda_.Code.from_inline("def handler(event, context): return \"Hello\"")
11718
11722
  )
11719
11723
 
11720
- queue = sqs.Queue(self, "Queue")
11721
-
11722
- rule.add_target(targets.LambdaFunction(fn,
11723
- dead_letter_queue=queue, # Optional: add a dead letter queue
11724
- max_event_age=Duration.hours(2), # Optional: set the maxEventAge retry policy
11725
- retry_attempts=2
11726
- ))
11724
+ imported_from_cfn.grant_profile_usage(lambda_function)
11727
11725
  '''
11728
11726
 
11729
11727
  def __init__(self) -> None:
@@ -16838,32 +16836,30 @@ class FunctionProps(FunctionOptions):
16838
16836
  :param handler: The name of the method within your code that Lambda calls to execute your function. The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime. For more information, see https://docs.aws.amazon.com/lambda/latest/dg/foundation-progmodel.html. Use ``Handler.FROM_IMAGE`` when defining a function from a Docker image. NOTE: If you specify your source code as inline text by specifying the ZipFile property within the Code property, specify index.function_name as the handler.
16839
16837
  :param runtime: The runtime environment for the Lambda function that you are uploading. For valid values, see the Runtime property in the AWS Lambda Developer Guide. Use ``Runtime.FROM_IMAGE`` when defining a function from a Docker image.
16840
16838
 
16841
- :exampleMetadata: infused
16839
+ :exampleMetadata: fixture=default infused
16842
16840
 
16843
16841
  Example::
16844
16842
 
16845
- import aws_cdk.aws_lambda as lambda_
16843
+ # Create or reference an existing L1 CfnApplicationInferenceProfile
16844
+ cfn_profile = aws_bedrock_cfn.CfnApplicationInferenceProfile(self, "CfnProfile",
16845
+ inference_profile_name="my-cfn-profile",
16846
+ model_source=aws_bedrock_cfn.CfnApplicationInferenceProfile.InferenceProfileModelSourceProperty(
16847
+ copy_from=bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0.invokable_arn
16848
+ ),
16849
+ description="Profile created via L1 construct"
16850
+ )
16846
16851
 
16852
+ # Import the L1 construct as an L2 ApplicationInferenceProfile
16853
+ imported_from_cfn = bedrock.ApplicationInferenceProfile.from_cfn_application_inference_profile(cfn_profile)
16847
16854
 
16848
- fn = lambda_.Function(self, "MyFunc",
16849
- runtime=lambda_.Runtime.NODEJS_LATEST,
16855
+ # Grant permissions to use the imported profile
16856
+ lambda_function = lambda_.Function(self, "MyFunction",
16857
+ runtime=lambda_.Runtime.PYTHON_3_11,
16850
16858
  handler="index.handler",
16851
- code=lambda_.Code.from_inline("exports.handler = handler.toString()")
16859
+ code=lambda_.Code.from_inline("def handler(event, context): return \"Hello\"")
16852
16860
  )
16853
16861
 
16854
- rule = events.Rule(self, "rule",
16855
- event_pattern=events.EventPattern(
16856
- source=["aws.ec2"]
16857
- )
16858
- )
16859
-
16860
- queue = sqs.Queue(self, "Queue")
16861
-
16862
- rule.add_target(targets.LambdaFunction(fn,
16863
- dead_letter_queue=queue, # Optional: add a dead letter queue
16864
- max_event_age=Duration.hours(2), # Optional: set the maxEventAge retry policy
16865
- retry_attempts=2
16866
- ))
16862
+ imported_from_cfn.grant_profile_usage(lambda_function)
16867
16863
  '''
16868
16864
  if isinstance(adot_instrumentation, dict):
16869
16865
  adot_instrumentation = AdotInstrumentationConfig(**adot_instrumentation)
@@ -20553,6 +20549,18 @@ class LambdaInsightsVersion(
20553
20549
  '''Version 1.0.333.0.'''
20554
20550
  return typing.cast("LambdaInsightsVersion", jsii.sget(cls, "VERSION_1_0_333_0"))
20555
20551
 
20552
+ @jsii.python.classproperty
20553
+ @jsii.member(jsii_name="VERSION_1_0_391_0")
20554
+ def VERSION_1_0_391_0(cls) -> "LambdaInsightsVersion":
20555
+ '''Version 1.0.391.0.'''
20556
+ return typing.cast("LambdaInsightsVersion", jsii.sget(cls, "VERSION_1_0_391_0"))
20557
+
20558
+ @jsii.python.classproperty
20559
+ @jsii.member(jsii_name="VERSION_1_0_404_0")
20560
+ def VERSION_1_0_404_0(cls) -> "LambdaInsightsVersion":
20561
+ '''Version 1.0.404.0.'''
20562
+ return typing.cast("LambdaInsightsVersion", jsii.sget(cls, "VERSION_1_0_404_0"))
20563
+
20556
20564
  @jsii.python.classproperty
20557
20565
  @jsii.member(jsii_name="VERSION_1_0_54_0")
20558
20566
  def VERSION_1_0_54_0(cls) -> "LambdaInsightsVersion":
@@ -22317,27 +22325,30 @@ class Runtime(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.aws_lambda.Runtime
22317
22325
  If you need to use a runtime name that doesn't exist as a static member, you
22318
22326
  can instantiate a ``Runtime`` object, e.g: ``new Runtime('nodejs99.99')``.
22319
22327
 
22320
- :exampleMetadata: infused
22328
+ :exampleMetadata: fixture=default infused
22321
22329
 
22322
22330
  Example::
22323
22331
 
22324
- import aws_cdk.aws_signer as signer
22325
-
22326
-
22327
- signing_profile = signer.SigningProfile(self, "SigningProfile",
22328
- platform=signer.Platform.AWS_LAMBDA_SHA384_ECDSA
22332
+ # Create or reference an existing L1 CfnApplicationInferenceProfile
22333
+ cfn_profile = aws_bedrock_cfn.CfnApplicationInferenceProfile(self, "CfnProfile",
22334
+ inference_profile_name="my-cfn-profile",
22335
+ model_source=aws_bedrock_cfn.CfnApplicationInferenceProfile.InferenceProfileModelSourceProperty(
22336
+ copy_from=bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0.invokable_arn
22337
+ ),
22338
+ description="Profile created via L1 construct"
22329
22339
  )
22330
22340
 
22331
- code_signing_config = lambda_.CodeSigningConfig(self, "CodeSigningConfig",
22332
- signing_profiles=[signing_profile]
22333
- )
22341
+ # Import the L1 construct as an L2 ApplicationInferenceProfile
22342
+ imported_from_cfn = bedrock.ApplicationInferenceProfile.from_cfn_application_inference_profile(cfn_profile)
22334
22343
 
22335
- lambda_.Function(self, "Function",
22336
- code_signing_config=code_signing_config,
22337
- runtime=lambda_.Runtime.NODEJS_18_X,
22344
+ # Grant permissions to use the imported profile
22345
+ lambda_function = lambda_.Function(self, "MyFunction",
22346
+ runtime=lambda_.Runtime.PYTHON_3_11,
22338
22347
  handler="index.handler",
22339
- code=lambda_.Code.from_asset(path.join(__dirname, "lambda-handler"))
22348
+ code=lambda_.Code.from_inline("def handler(event, context): return \"Hello\"")
22340
22349
  )
22350
+
22351
+ imported_from_cfn.grant_profile_usage(lambda_function)
22341
22352
  '''
22342
22353
 
22343
22354
  def __init__(
@@ -29414,32 +29425,30 @@ class Function(
29414
29425
  This construct does not yet reproduce all features from the underlying resource
29415
29426
  library.
29416
29427
 
29417
- :exampleMetadata: infused
29428
+ :exampleMetadata: fixture=default infused
29418
29429
 
29419
29430
  Example::
29420
29431
 
29421
- import aws_cdk.aws_lambda as lambda_
29432
+ # Create or reference an existing L1 CfnApplicationInferenceProfile
29433
+ cfn_profile = aws_bedrock_cfn.CfnApplicationInferenceProfile(self, "CfnProfile",
29434
+ inference_profile_name="my-cfn-profile",
29435
+ model_source=aws_bedrock_cfn.CfnApplicationInferenceProfile.InferenceProfileModelSourceProperty(
29436
+ copy_from=bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0.invokable_arn
29437
+ ),
29438
+ description="Profile created via L1 construct"
29439
+ )
29422
29440
 
29441
+ # Import the L1 construct as an L2 ApplicationInferenceProfile
29442
+ imported_from_cfn = bedrock.ApplicationInferenceProfile.from_cfn_application_inference_profile(cfn_profile)
29423
29443
 
29424
- fn = lambda_.Function(self, "MyFunc",
29425
- runtime=lambda_.Runtime.NODEJS_LATEST,
29444
+ # Grant permissions to use the imported profile
29445
+ lambda_function = lambda_.Function(self, "MyFunction",
29446
+ runtime=lambda_.Runtime.PYTHON_3_11,
29426
29447
  handler="index.handler",
29427
- code=lambda_.Code.from_inline("exports.handler = handler.toString()")
29428
- )
29429
-
29430
- rule = events.Rule(self, "rule",
29431
- event_pattern=events.EventPattern(
29432
- source=["aws.ec2"]
29433
- )
29448
+ code=lambda_.Code.from_inline("def handler(event, context): return \"Hello\"")
29434
29449
  )
29435
29450
 
29436
- queue = sqs.Queue(self, "Queue")
29437
-
29438
- rule.add_target(targets.LambdaFunction(fn,
29439
- dead_letter_queue=queue, # Optional: add a dead letter queue
29440
- max_event_age=Duration.hours(2), # Optional: set the maxEventAge retry policy
29441
- retry_attempts=2
29442
- ))
29451
+ imported_from_cfn.grant_profile_usage(lambda_function)
29443
29452
  '''
29444
29453
 
29445
29454
  def __init__(
@@ -3221,6 +3221,12 @@ class AuroraMysqlEngineVersion(
3221
3221
  '''Version "8.0.mysql_aurora.3.09.0".'''
3222
3222
  return typing.cast("AuroraMysqlEngineVersion", jsii.sget(cls, "VER_3_09_0"))
3223
3223
 
3224
+ @jsii.python.classproperty
3225
+ @jsii.member(jsii_name="VER_3_10_0")
3226
+ def VER_3_10_0(cls) -> "AuroraMysqlEngineVersion":
3227
+ '''Version "8.0.mysql_aurora.3.10.0".'''
3228
+ return typing.cast("AuroraMysqlEngineVersion", jsii.sget(cls, "VER_3_10_0"))
3229
+
3224
3230
  @jsii.python.classproperty
3225
3231
  @jsii.member(jsii_name="VER_5_7_12")
3226
3232
  def VER_5_7_12(cls) -> "AuroraMysqlEngineVersion":