Beispiel #1
0
 def from_0_0_1(c: dict):
     bastion = c.pop("bastion")
     machine_image = bastion.pop("machine_image", None)
     return from_loader(
         "config.vpc",
         VPC(
             create=c.pop("create"),
             id=c.pop("id", None),
             cidr=c.pop("cidr"),
             availability_zones=c.pop("availability_zones", []),
             max_azs=c.pop("max_azs"),
             bastion=VPC.Bastion(
                 enabled=bastion.pop("enabled"),
                 key_name=bastion.pop("key_name", None),
                 instance_type=bastion.pop("instance_type"),
                 ingress_ports=IngressRule.load_rules("config.vpc.bastion", bastion.pop("ingress_ports")),
                 machine_image=MachineImage(
                     ami_id=machine_image.pop("ami_id"),
                     user_data=machine_image.pop("user_data"),
                 )
                 if machine_image
                 else None,
             ),
         ),
         c,
     )
Beispiel #2
0
 def test_from_loader_warning(self):
     with patch("domino_cdk.config.util.log.warning") as warn:
         test_thing = "arbitrary_variable"
         x = from_loader("myname", test_thing, {'boing': 'peng'})
         warn.assert_called_with(
             "Warning: Unused/unsupported config entries in myname: {'boing': 'peng'}"
         )
         self.assertEqual(x, test_thing)
Beispiel #3
0
 def from_0_0_0(c: dict):
     buckets = c.pop("buckets")
     return from_loader(
         "config.s3",
         S3(
             buckets={
                 name: S3.Bucket(
                     auto_delete_objects=b.pop("auto_delete_objects",
                                               False),
                     removal_policy_destroy=b.pop("removal_policy_destroy",
                                                  False),
                     sse_kms_key_id=b.pop("sse_kms_key_id", None),
                 )
                 for name, b in buckets.items()
             }),
         c,
     )
Beispiel #4
0
 def from_0_0_0(c: dict):
     backup = c.pop("backup")
     return from_loader(
         "config.efs",
         EFS(
             backup=EFS.Backup(
                 enable=backup.pop("enable"),
                 schedule=backup.pop("schedule"),
                 move_to_cold_storage_after=backup.pop(
                     "move_to_cold_storage_after", None),
                 delete_after=backup.pop("delete_after", None),
                 removal_policy=backup.pop("removal_policy", None),
             ),
             removal_policy_destroy=c.pop("removal_policy_destroy", None),
         ),
         c,
     )
Beispiel #5
0
 def from_0_0_1(c: dict):
     return from_loader(
         "config",
         DominoCDKConfig(
             schema=__version__,
             name=c.pop("name"),
             aws_region=c.pop("aws_region"),
             aws_account_id=c.pop("aws_account_id"),
             tags=c.pop("tags", {}),
             install=c.pop("install", {}),
             vpc=VPC.from_0_0_1(c.pop("vpc")),
             efs=EFS.from_0_0_0(c.pop("efs")),
             route53=Route53.from_0_0_0(c.pop("route53")),
             eks=EKS.from_0_0_1(c.pop("eks")),
             s3=S3.from_0_0_0(c.pop("s3")),
         ),
         c,
     )
Beispiel #6
0
 def from_0_0_1(c: dict):
     return from_loader(
         "config.eks",
         EKS(
             version=c.pop("version"),
             private_api=c.pop("private_api"),
             max_nodegroup_azs=c.pop("max_nodegroup_azs"),
             global_node_labels=c.pop("global_node_labels"),
             global_node_tags=c.pop("global_node_tags"),
             managed_nodegroups={
                 name: EKS.ManagedNodegroup.load(ng) for name, ng in c.pop("managed_nodegroups", {}).items()
             },
             unmanaged_nodegroups={
                 name: EKS.UnmanagedNodegroup.load(ng) for name, ng in c.pop("unmanaged_nodegroups", {}).items()
             },
         ),
         c,
     )
Beispiel #7
0
 def from_0_0_0(c: dict):
     return from_loader(
         "config.vpc",
         VPC(
             create=c.pop("create"),
             id=c.pop("id", None),
             cidr=c.pop("cidr"),
             availability_zones=c.pop("availability_zones", []),
             max_azs=c.pop("max_azs"),
             bastion=VPC.Bastion(
                 enabled=False,
                 key_name=None,
                 instance_type=None,
                 ingress_ports=None,
                 machine_image=None,
             ),
         ),
         c,
     )
Beispiel #8
0
 def from_0_0_0(c: dict):
     return from_loader("config.route53",
                        Route53(zone_ids=c.pop("zone_ids", None)), c)
Beispiel #9
0
 def test_from_loader(self):
     with patch("domino_cdk.config.util.log.warning") as warn:
         test_thing = "arbitrary_variable"
         x = from_loader("myname", test_thing, {})
         warn.assert_not_called()
         self.assertEqual(x, test_thing)