Skip to content

Commit 9e5f538

Browse files
committed
add constant ZITI_NET_RESOURCES to describe types that are backed 1:1 by zitiId
1 parent 9c378ac commit 9e5f538

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

netfoundry/utility.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ def camel(self, snake_str):
436436

437437

438438
NET_RESOURCES = dict() # resources in network domain
439+
ZITI_NET_RESOURCES = dict() # network resources that can be updated
439440
MUTABLE_NET_RESOURCES = dict() # network resources that can be updated
440441
MUTABLE_RESOURCE_ABBREV = dict() # unique abbreviations for ^
441442
EMBED_NET_RESOURCES = dict() # network resources that may be fetched as embedded collections
@@ -508,6 +509,7 @@ class ResourceType(ResourceTypeParent):
508509
abbreviation: str = field(default='default')
509510
status_symbols: dict = field(default_factory=lambda: RESOURCE_STATUS_SYMBOLS) # dictionary with three predictable keys: complete, progress, error, each a tuple associating status symbols with a state
510511
host: bool = field(default=False) # may have a managed host in NF cloud
512+
ziti: bool = field(default=False)
511513

512514
def __post_init__(self):
513515
"""Compute and assign _embedded if not supplied and then check types in parent class."""
@@ -533,6 +535,8 @@ def __post_init__(self):
533535
if self.host:
534536
HOSTABLE_NET_RESOURCES[self.name] = self
535537
HOSTABLE_RESOURCE_ABBREV[self.abbreviation] = self
538+
if self.ziti:
539+
ZITI_NET_RESOURCES[self.name] = self
536540
return super().__post_init__()
537541

538542

@@ -649,7 +653,9 @@ def __post_init__(self):
649653
"attributes": [],
650654
"enrollmentMethod": {"ott": True},
651655
"name": "Name"
652-
}),
656+
},
657+
ziti=True,
658+
),
653659
'edge-routers': ResourceType(
654660
name='edge-routers',
655661
domain='network',
@@ -658,6 +664,7 @@ def __post_init__(self):
658664
no_update_props=['registration'],
659665
create_responses=["ACCEPTED"],
660666
host=True,
667+
ziti=True,
661668
),
662669
'edge-router-policies': ResourceType(
663670
name='edge-router-policies',
@@ -672,13 +679,15 @@ def __post_init__(self):
672679
mutable=True,
673680
embeddable=True,
674681
create_responses=["ACCEPTED"],
682+
ziti=True,
675683
),
676684
'service-policies': ResourceType(
677685
name='service-policies',
678686
domain='network',
679687
mutable=True,
680688
embeddable=True,
681689
create_responses=["ACCEPTED"],
690+
ziti=True,
682691
),
683692
'app-wans': ResourceType(
684693
name='app-wans',
@@ -694,41 +703,47 @@ def __post_init__(self):
694703
mutable=True,
695704
embeddable=True,
696705
create_responses=["ACCEPTED"],
706+
ziti=True,
697707
),
698708
'posture-checks': ResourceType(
699709
name='posture-checks',
700710
domain='network',
701711
mutable=True,
702712
embeddable=True,
703713
create_responses=["ACCEPTED"],
714+
ziti=True,
704715
),
705716
'certificate-authorities': ResourceType(
706717
name='certificate-authorities',
707718
domain='network',
708719
mutable=True,
709720
embeddable=True,
710721
create_responses=["ACCEPTED"],
722+
ziti=True,
711723
),
712724
'config-types': ResourceType(
713725
name='config-types',
714726
domain='network',
715727
mutable=True,
716728
embeddable=True,
717729
create_responses=["ACCEPTED"],
730+
ziti=True,
718731
),
719732
'configs': ResourceType(
720733
name='configs',
721734
domain='network',
722735
mutable=True,
723736
embeddable=True,
724737
create_responses=["ACCEPTED"],
738+
ziti=True,
725739
),
726740
'terminators': ResourceType(
727741
name='terminators',
728742
domain='network',
729743
mutable=True,
730744
embeddable=True,
731745
create_responses=["ACCEPTED"],
746+
ziti=True,
732747
),
733748
}
734749

0 commit comments

Comments
 (0)