Skip to main content

ResourceShape

Struct ResourceShape 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§identifier_field: String

Default body-field name carrying the resource identifier (defaults to "Name"). Per-CRUD-method overrides in per_method win when present.

§identifier_pointer: bool

Default 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: bool

Emit 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: bool

M6.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

Source

pub fn name_pointer() -> Self

Body-field with *string identifier (e.g. Name *string).

Source

pub fn alt_field(field: impl Into<String>) -> Self

Body-field with a non-Name string identifier (e.g. EsmName, UscName, Path, Hostname).

Source

pub fn stub() -> Self

Stub controller — body shape doesn’t fit any expressible ResourceShape; deeper M3.2 graduation needed.

Source

pub fn with_method_override( self, method: CrudMethod, ov: MethodOverride, ) -> Self

Add a per-method override and return self (chainable builder).

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ResourceShape

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ResourceShape

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for ResourceShape

Source§

impl PartialEq for ResourceShape

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ResourceShape

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.