#[non_exhaustive]pub struct ResourceShape {
pub identifier_field: String,
pub identifier_pointer: bool,
pub per_method: BTreeMap<CrudMethod, MethodOverride>,
pub stub: bool,
pub push_for_provider_fields: bool,
}Expand description
Per-resource shape configuration consumed by the controller
emitter. Captures the heterogeneity across SDK body types — some
use Name string, some Name *string, some a different field
entirely (e.g. EsmName, UscName, Path), and some use
composite keys / mixed-per-CRUD identifiers that don’t fit the
single-identifier pattern.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.identifier_field: StringDefault body-field name carrying the resource identifier
(defaults to "Name"). Per-CRUD-method overrides in
per_method win when present.
identifier_pointer: boolDefault for whether the identifier field is *string instead
of string. Per-CRUD-method overrides in per_method win.
per_method: BTreeMap<CrudMethod, MethodOverride>Per-CRUD-method overrides — populated for resources whose SDK
body shape varies per method (e.g. kmip_client.Name string
on Create vs *string on Read/Delete).
stub: boolEmit a stub controller (no SDK calls) for resources whose body shape requires composite keys / mixed-int64-vs-string IDs / singleton bodies that ResourceShape can’t yet express. Stubs satisfy the ExternalClient interface but no-op every method.
push_for_provider_fields: boolM6.2 broad walk — when true, Create+Update bodies push every
non-computed non-identifier scalar attribute from
cr.Spec.ForProvider.X onto the SDK body composite.
Default false because the akeyless TOML’s IacType disagrees
with the akeyless-go SDK body’s Go type for several common
fields (DeleteProtection bool/string, RotationHour int64/int32,
UseTls bool/string, TargetName/RotatorType missing on Update,
etc.) — naïve broad-walk produces compile errors on ~62% of
the 119-resource corpus. Resources opt in only after their
type alignment + body_field_skips are verified by go build.
M6.4 (schema-driven filtering) will replace this opt-in flag by reading the SDK body schema from the OpenAPI spec at emit time and auto-skipping fields whose name+type don’t match.
Implementations§
Source§impl ResourceShape
impl ResourceShape
Sourcepub fn name_pointer() -> Self
pub fn name_pointer() -> Self
Body-field with *string identifier (e.g. Name *string).
Sourcepub fn alt_field(field: impl Into<String>) -> Self
pub fn alt_field(field: impl Into<String>) -> Self
Body-field with a non-Name string identifier
(e.g. EsmName, UscName, Path, Hostname).
Sourcepub fn stub() -> Self
pub fn stub() -> Self
Stub controller — body shape doesn’t fit any expressible
ResourceShape; deeper M3.2 graduation needed.
Sourcepub fn with_method_override(
self,
method: CrudMethod,
ov: MethodOverride,
) -> Self
pub fn with_method_override( self, method: CrudMethod, ov: MethodOverride, ) -> Self
Add a per-method override and return self (chainable builder).
Sourcepub fn for_method(&self, method: CrudMethod) -> EffectiveShape
pub fn for_method(&self, method: CrudMethod) -> EffectiveShape
Resolve the effective shape for one CRUD method, applying
per_method overrides on top of the top-level defaults.
Sourcepub fn needs_strconv_import(&self) -> bool
pub fn needs_strconv_import(&self) -> bool
True when at least one method uses
BodyTemplate::Int64FromExternalName. Drives conditional
strconv import in the emitted controller file.
Sourcepub fn needs_meta_import(&self) -> bool
pub fn needs_meta_import(&self) -> bool
True when at least one method’s body construction calls
meta.GetExternalName(cr). False when every method uses
BodyTemplate::NoIdentifier or BodyTemplate::SpecFields
(neither references meta). Drives conditional meta import.
Sourcepub fn body_uses_cr(&self, method: CrudMethod) -> bool
pub fn body_uses_cr(&self, method: CrudMethod) -> bool
True when this method’s body construction references cr
(the type-asserted spec). Used by build_*_func to decide
between cr, ok := (referenced) and _, ok := (discarded).
Trait Implementations§
Source§impl Clone for ResourceShape
impl Clone for ResourceShape
Source§impl Debug for ResourceShape
impl Debug for ResourceShape
Source§impl Default for ResourceShape
impl Default for ResourceShape
impl Eq for ResourceShape
Source§impl PartialEq for ResourceShape
impl PartialEq for ResourceShape
impl StructuralPartialEq for ResourceShape
Auto Trait Implementations§
impl Freeze for ResourceShape
impl RefUnwindSafe for ResourceShape
impl Send for ResourceShape
impl Sync for ResourceShape
impl Unpin for ResourceShape
impl UnsafeUnpin for ResourceShape
impl UnwindSafe for ResourceShape
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.