Skip to main content

aip_sdk.create_source_connection

aip_sdk.create_source_connection(*, bucket: str, label: str = 'default', workspace_id: str | None = None, project_id: str | None = None, sut_id: str | None = None, prefix: str | None = None, endpoint: str | None = None, access_key: str | None = None, secret_key: str | None = None, secure: bool = True, region: str | None = None, retention_days: int | None = None, client: APIClient | None = None) -> TraceSourceConnection

Create a saved object-store connection traces can be pulled from.

An object store authenticates with an access_key/secret_key pair, which must be supplied together and only alongside an endpoint. Omit endpoint to pull from a bucket the platform is already configured for, in which case no per-connection credential or region applies. Credentials are stored write-only and are never returned in plaintext.

Parameters

  • bucket str: Object-store bucket to pull from.
  • label str: Human-readable label for the connection, unique within the workspace or project it is scoped to.
  • workspace_id str | None: Workspace the connection belongs to. If omitted and project_id is also omitted, falls back to the client's configured default workspace (aip.init(workspace_id=...) / AIP_WORKSPACE_ID). Pass this or project_id, not both: a project already determines its workspace.
  • project_id str | None: System-under-test's workspace project the connection is associated with.
  • sut_id str | None: System-under-test the pulled traces are attributed to.
  • prefix str | None: Key prefix within the bucket to scope the pull.
  • endpoint str | None: External object-store host, as host or host:port — without a scheme, path, or credentials. Omit it to pull from a platform-configured bucket.
  • access_key str | None: Object-store access key (write-only). Requires endpoint and secret_key.
  • secret_key str | None: Object-store secret key (write-only). Requires endpoint and access_key.
  • secure bool: Whether to connect to endpoint over HTTPS.
  • region str | None: Object-store region. Requires endpoint.
  • retention_days int | None: Retention window for pulled data — one of RETENTION_DAYS. When None, the platform default applies.
  • client APIClient | None: Optional API client.

Returns

Raises

  • NoWorkspaceSelectedError: If no workspace is passed and none is configured for the session.
  • InvalidArgumentError: If bucket is empty, retention_days is not a supported window, only one of access_key/secret_key is given, a credential or region is given without an endpoint, or both project_id and workspace_id are given — a project already determines its workspace.
  • AuthError: If credentials are missing or invalid.
  • ForbiddenError: If bucket, prefix, or endpoint names a source the platform may not pull from; the message names the constraint and the values that would satisfy it, so no connection is saved that cannot be landed from. Also raised, with an access message instead, if the caller lacks rights to create a connection in the workspace.
  • ConflictError: If a connection with this label already exists in the same scope.
  • UnprocessableEntityError: If the connection configuration is rejected by the platform.
  • ResponseParseError: If the platform's response does not match this SDK version.