in azext_edge/edge/providers/orchestration/targets.py [0:0]
def get_trust_settings_target_map(self) -> dict:
source = "SelfSigned"
if self.trust_settings or self.user_trust:
source = "CustomerManaged"
result = {"source": source}
if self.trust_settings:
target_settings: Dict[str, str] = {}
trust_bundle_def = TEMPLATE_BLUEPRINT_ENABLEMENT.get_type_definition("_1.TrustBundleSettings")[
"properties"
]
allowed_issuer_kinds: Optional[List[str]] = trust_bundle_def.get(TRUST_ISSUER_KIND_KEY, {}).get(
"allowedValues"
)
for key in TRUST_SETTING_KEYS:
if key not in self.trust_settings:
raise InvalidArgumentValueError(f"{key} is a required trust setting/key.")
if key == TRUST_ISSUER_KIND_KEY:
if allowed_issuer_kinds and self.trust_settings[key] not in allowed_issuer_kinds:
raise InvalidArgumentValueError(f"{key} allowed values are {allowed_issuer_kinds}.")
target_settings[key] = self.trust_settings[key]
result["settings"] = target_settings
return result