Terrajinja extension for automation using cdktf
Project description
terrajinja-sbp-generic
python helper functions for other terrajinja resources
human_read_to_megabyte
converts human readable numbers (e.g. "10TB") to a size in MB (int)
def human_read_to_megabyte(size: str) -> int:
Convert human formatted size to megabytes value.
Args:
size: string of human formatted size
Returns:
megabytes represented in the initial human format
placement policies
various commands to control the placement policy of a vm
# create a placement polict based on placements and strategy
placement_policy = SbpGenericVmPlacementPolicy(strategy=placement_strategy, placements=placements)
# create a vm iteration that combines placement policy and naming policy
vms = SbpGenericVm(placement_policy=placement_policy, name=name, count=count, first_digit=first_digit,
formatting=naming_format, ip_addresses=ip_addresses)
# list all vm's in policy
for vm in vms:
print(f'- host: {vm.name} in zone: {vm.zone_name} ip: {vm.ip}')
# return the placement policy id for the creation of the vm in the correct place
placement_policy_id = SbpDataVcdVmPlacementPolicy(scope=scope, id_='', name=vms.placement_policy.name,
urn=vdc_urn).id
History
0.0.1 (14-03-2024)
- First code creation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for terrajinja-sbp-generic-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4e6e990f24c88a660bf3cb1b02264f1e8a4e947920a816d21be2d1a39c75bb3 |
|
MD5 | adc578d8cef5783e1ea136abc4a1d7ac |
|
BLAKE2b-256 | 32c3a92f722a411a4e6416f367911c6bc2f96f616814f772f2103d9a1421fdf3 |
Close
Hashes for terrajinja_sbp_generic-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 524571c7517cf63349e2f91d57da250f060fd73e4063faaa32614bdd170cb45e |
|
MD5 | 25ff7b7d8492b69a6301d371e1a23765 |
|
BLAKE2b-256 | 4bc9524be93d91a4ca6078eb37d46736350e784a8df4e618203ee35393124506 |