Created
January 14, 2024 19:59
-
-
Save LMnet/1bcbaba0e00f55c40f0b4e05b2312fae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@dataclass | |
class InstanceGroups: | |
master_nodes: Ec2InstancesGroup | |
core_nodes: Ec2InstancesGroup | |
@dataclass | |
class InstanceFleets: | |
config: list[dict[str, any]] | |
subnets: set[KnownEc2Subnets] | |
Instances = InstanceGroups | InstanceFleets | |
match instances: | |
case InstanceGroups(master_nodes, core_nodes): | |
instances_config = common_instances_config | { | |
'InstanceGroups': [ | |
{ | |
'Name': "Master nodes", | |
'InstanceRole': 'MASTER', | |
} | master_nodes, | |
{ | |
'Name': "Slave nodes", | |
'InstanceRole': 'CORE', | |
} | core_nodes, | |
], | |
'Ec2SubnetId': KnownEc2Subnets.InternalPrivateSubnet1a.value, | |
} | |
case InstanceFleets(config, subnets): | |
instances_config = common_instances_config | { | |
'InstanceFleets': config, | |
'Ec2SubnetIds': [subnet.value for subnet in subnets], | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment