airbyte_ops_mcp.cloud_admin

Cloud API client for Airbyte admin operations.

This package provides functionality for interacting with Airbyte Cloud APIs, particularly for connector version management and pinning operations.

 1# Copyright (c) 2025 Airbyte, Inc., all rights reserved.
 2"""Cloud API client for Airbyte admin operations.
 3
 4This package provides functionality for interacting with Airbyte Cloud APIs,
 5particularly for connector version management and pinning operations.
 6"""
 7
 8from __future__ import annotations
 9
10__all__ = [
11    "ENV_AIRBYTE_INTERNAL_ADMIN_FLAG",
12    "ENV_AIRBYTE_INTERNAL_ADMIN_USER",
13    "EXPECTED_ADMIN_EMAIL_DOMAIN",
14    "EXPECTED_ADMIN_FLAG_VALUE",
15    "ConnectorVersionInfo",
16    "VersionOverrideOperationResult",
17]
18
19from airbyte_ops_mcp.cloud_admin.models import (
20    ConnectorVersionInfo,
21    VersionOverrideOperationResult,
22)
23from airbyte_ops_mcp.constants import (
24    ENV_AIRBYTE_INTERNAL_ADMIN_FLAG,
25    ENV_AIRBYTE_INTERNAL_ADMIN_USER,
26    EXPECTED_ADMIN_EMAIL_DOMAIN,
27    EXPECTED_ADMIN_FLAG_VALUE,
28)
ENV_AIRBYTE_INTERNAL_ADMIN_FLAG = 'AIRBYTE_INTERNAL_ADMIN_FLAG'
ENV_AIRBYTE_INTERNAL_ADMIN_USER = 'AIRBYTE_INTERNAL_ADMIN_USER'
EXPECTED_ADMIN_EMAIL_DOMAIN = '@airbyte.io'
EXPECTED_ADMIN_FLAG_VALUE = 'airbyte.io'
class ConnectorVersionInfo(pydantic.main.BaseModel):
16class ConnectorVersionInfo(BaseModel):
17    """Information about a cloud connector's version.
18
19    This model represents the current version state of a deployed connector,
20    including whether a version override (pin) is active.
21    """
22
23    connector_id: str = Field(description="The ID of the deployed connector")
24    connector_type: Literal["source", "destination"] = Field(
25        description="The type of connector (source or destination)"
26    )
27    version: str = Field(description="The current version string (e.g., '0.1.0')")
28    is_version_pinned: bool = Field(
29        description="Whether a version override is active for this connector"
30    )
31
32    def __str__(self) -> str:
33        """Return a string representation of the version."""
34        pinned_suffix = " (pinned)" if self.is_version_pinned else ""
35        return (
36            f"{self.connector_type} {self.connector_id}: {self.version}{pinned_suffix}"
37        )

Information about a cloud connector's version.

This model represents the current version state of a deployed connector, including whether a version override (pin) is active.

connector_id: str = PydanticUndefined

The ID of the deployed connector

connector_type: Literal['source', 'destination'] = PydanticUndefined

The type of connector (source or destination)

version: str = PydanticUndefined

The current version string (e.g., '0.1.0')

is_version_pinned: bool = PydanticUndefined

Whether a version override is active for this connector

class VersionOverrideOperationResult(pydantic.main.BaseModel):
40class VersionOverrideOperationResult(BaseModel):
41    """Result of a version override operation (set or clear).
42
43    This model provides detailed information about the outcome of a version
44    pinning or unpinning operation.
45    """
46
47    success: bool = Field(description="Whether the operation succeeded")
48    message: str = Field(description="Human-readable message describing the result")
49    connector_id: str = Field(description="The ID of the connector that was modified")
50    connector_type: Literal["source", "destination"] = Field(
51        description="The type of connector (source or destination)"
52    )
53    previous_version: str | None = Field(
54        default=None,
55        description="The version before the operation (None if not available)",
56    )
57    new_version: str | None = Field(
58        default=None,
59        description="The version after the operation (None if cleared or failed)",
60    )
61    was_pinned_before: bool | None = Field(
62        default=None,
63        description="Whether a pin was active before the operation",
64    )
65    is_pinned_after: bool | None = Field(
66        default=None,
67        description="Whether a pin is active after the operation",
68    )
69    customer_tier: str | None = Field(
70        default=None,
71        description="Customer tier of the affected entity (TIER_0, TIER_1, TIER_2). "
72        "Included as a guardrail annotation.",
73    )
74    is_eu: bool | None = Field(
75        default=None,
76        description="Whether the affected entity is in the EU region.",
77    )
78    tier_warning: str | None = Field(
79        default=None,
80        description="Warning message if the operation targets a sensitive customer tier.",
81    )
82
83    def __str__(self) -> str:
84        """Return a string representation of the operation result."""
85        if self.success:
86            return f"✓ {self.message}"
87        return f"✗ {self.message}"

Result of a version override operation (set or clear).

This model provides detailed information about the outcome of a version pinning or unpinning operation.

success: bool = PydanticUndefined

Whether the operation succeeded

message: str = PydanticUndefined

Human-readable message describing the result

connector_id: str = PydanticUndefined

The ID of the connector that was modified

connector_type: Literal['source', 'destination'] = PydanticUndefined

The type of connector (source or destination)

previous_version: str | None = None

The version before the operation (None if not available)

new_version: str | None = None

The version after the operation (None if cleared or failed)

was_pinned_before: bool | None = None

Whether a pin was active before the operation

is_pinned_after: bool | None = None

Whether a pin is active after the operation

customer_tier: str | None = None

Customer tier of the affected entity (TIER_0, TIER_1, TIER_2). Included as a guardrail annotation.

is_eu: bool | None = None

Whether the affected entity is in the EU region.

tier_warning: str | None = None

Warning message if the operation targets a sensitive customer tier.