The code to do that is more verbose than necessary because the Organization schema does not declare an href property, so we have to read that property from AdditionalProperties and then, because AdditionalProperties can contain properties of any type, we have to cast the href property to a string.
If the Organization schema in the Metal API spec were updated to declare an href property that is type: string, we could simply do organization.GetHref().
In
terraform-provider-equinix
, there's a place where we use thehref
of a project's organization to get the organization ID without having to include the full organization, which would increase response latency.The code to do that is more verbose than necessary because the
Organization
schema does not declare anhref
property, so we have to read that property fromAdditionalProperties
and then, becauseAdditionalProperties
can contain properties of any type, we have to cast thehref
property to a string.If the
Organization
schema in the Metal API spec were updated to declare anhref
property that istype: string
, we could simply doorganization.GetHref()
.