-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshared_capacity_groups.py
More file actions
33 lines (27 loc) · 1.02 KB
/
Copy pathshared_capacity_groups.py
File metadata and controls
33 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
Shared Capacity Groups: create and delete.
Usage: DIDWW_API_KEY=xxx python examples/shared_capacity_groups.py
"""
import uuid
from client_factory import create_client
from didww.resources.capacity_pool import CapacityPool
from didww.resources.shared_capacity_group import SharedCapacityGroup
client = create_client()
suffix = uuid.uuid4().hex[:8]
# Get a capacity pool
pool = client.capacity_pools().list().data[0]
# Create a shared capacity group
group = SharedCapacityGroup()
group.name = f"My Channel Group {suffix}"
group.metered_channels_count = 10
group.shared_channels_count = 1
group.capacity_pool = CapacityPool.build(pool.id)
created = client.shared_capacity_groups().create(group).data
print(f"Created: {created.id}")
print(f" name: {created.name}")
print(f" metered: {created.metered_channels_count}")
print(f" shared: {created.shared_channels_count}")
print(f" external_reference_id: {created.external_reference_id}")
# Delete
client.shared_capacity_groups().delete(created.id)
print("Deleted shared capacity group")