Skip to content

flayer.extensions.builtins

Module source

flayer.extensions.builtins

Usable extension adapters for the existing Yandex providers and secure gateway.

YANDEX_READ_ONLY module-attribute

YANDEX_READ_ONLY = ExtensionDescriptor(ExtensionKind.PROVIDER, 'yandex-read-only', 'f-layer', __version__, PROVIDER_GROUP, 'flayer.extensions.builtins:YandexReadOnlyExtension')

YANDEX_LIFECYCLE module-attribute

YANDEX_LIFECYCLE = ExtensionDescriptor(ExtensionKind.PROVIDER, 'yandex-lifecycle', 'f-layer', __version__, PROVIDER_GROUP, 'flayer.extensions.builtins:YandexLifecycleExtension')

SECURE_GATEWAY module-attribute

SECURE_GATEWAY = ExtensionDescriptor(ExtensionKind.PROFILE, 'secure-gateway', 'f-layer', __version__, PROFILE_GROUP, 'flayer.extensions.builtins:SecureGatewayExtension')

YandexReadOnlyExtension

Build the real read-only Yandex adapter with an external CLI profile reference.

Descriptor property

Descriptor: ExtensionDescriptor

Return the immutable built-in identity used by registry lookup.

CreateProvider

CreateProvider(context: ProviderContext) -> CloudProvider

Construct a real adapter without running CLI commands or reading credentials.

Source code in installed/flayer/extensions/builtins.py
61
62
63
64
65
66
67
68
69
70
71
72
def CreateProvider(self, context: ProviderContext) -> CloudProvider:
    """Construct a real adapter without running CLI commands or reading credentials."""

    from flayer.providers.yandex import YandexCloudProvider, YandexCloudSettings

    if not isinstance(context, ProviderContext):
        raise ExtensionError("Provider construction requires a validated ProviderContext")

    return YandexCloudProvider(YandexCloudSettings(
        folder_id=context.scope_id, profile=context.authentication_reference,
        command_timeout=context.command_timeout, inventory_limit=context.inventory_limit,
    ))

YandexLifecycleExtension

Bases: YandexReadOnlyExtension

Opt in separately to the existing exact-scope owned resource mutation contract.

Descriptor property

Descriptor: ExtensionDescriptor

Return the distinct identity that explicitly advertises lifecycle construction.

CreateLifecycleProvider

CreateLifecycleProvider(context: ProviderContext) -> LifecycleProvider

Construct the real lifecycle adapter without performing provider operations.

Source code in installed/flayer/extensions/builtins.py
84
85
86
87
88
89
90
91
92
93
94
95
96
def CreateLifecycleProvider(self, context: ProviderContext) -> LifecycleProvider:
    """Construct the real lifecycle adapter without performing provider operations."""

    from flayer.providers.yandex import YandexCloudSettings
    from flayer.providers.yandex_lifecycle import YandexLifecycleProvider

    if not isinstance(context, ProviderContext):
        raise ExtensionError("Provider construction requires a validated ProviderContext")

    return YandexLifecycleProvider(YandexCloudSettings(
        folder_id=context.scope_id, profile=context.authentication_reference,
        command_timeout=context.command_timeout, inventory_limit=context.inventory_limit,
    ))

SecureGatewayExtension

Compile the real strict gateway schema through the additive extension boundary.

Descriptor property

Descriptor: ExtensionDescriptor

Return the immutable built-in profile identity.

CompileProfile

CompileProfile(configuration: Mapping[str, object], context: ProfileContext) -> CompiledProfile

Reject identity disagreement before constructing a real gateway plan.

Source code in installed/flayer/extensions/builtins.py
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
def CompileProfile(
    self, configuration: Mapping[str, object], context: ProfileContext,
) -> CompiledProfile:
    """Reject identity disagreement before constructing a real gateway plan."""

    from flayer.profiles.gateway import CompileGateway, ParseGatewayProfile

    if not isinstance(context, ProfileContext):
        raise ExtensionError("Profile compilation requires a validated ProfileContext")

    profile = ParseGatewayProfile(configuration)

    if profile.identity != context.identity:
        raise ExtensionError("Profile configuration does not match its exact ownership context")

    return _CompiledGateway(CompileGateway(profile))

BuiltinDescriptors

BuiltinDescriptors() -> tuple[ExtensionDescriptor, ...]

Return static descriptors without importing provider or profile implementations.

Source code in installed/flayer/extensions/builtins.py
46
47
48
49
def BuiltinDescriptors() -> tuple[ExtensionDescriptor, ...]:
    """Return static descriptors without importing provider or profile implementations."""

    return (YANDEX_READ_ONLY, YANDEX_LIFECYCLE, SECURE_GATEWAY)

LoadBuiltin

Load only an exact known built-in descriptor, rejecting invented built-in targets.

Source code in installed/flayer/extensions/builtins.py
153
154
155
156
157
158
159
160
161
162
163
164
165
def LoadBuiltin(descriptor: ExtensionDescriptor) -> ProviderExtension | ProfileExtension:
    """Load only an exact known built-in descriptor, rejecting invented built-in targets."""

    if descriptor == YANDEX_READ_ONLY:
        return YandexReadOnlyExtension()

    if descriptor == YANDEX_LIFECYCLE:
        return YandexLifecycleExtension()

    if descriptor == SECURE_GATEWAY:
        return SecureGatewayExtension()

    raise ExtensionError("Extension is not an exact registered F-Layer built-in")