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
bucketstr: Object-store bucket to pull from.labelstr: Human-readable label for the connection, unique within the workspace or project it is scoped to.workspace_idstr | None: Workspace the connection belongs to. If omitted andproject_idis also omitted, falls back to the client's configured default workspace (aip.init(workspace_id=...)/AIP_WORKSPACE_ID). Pass this orproject_id, not both: a project already determines its workspace.project_idstr | None: System-under-test's workspace project the connection is associated with.sut_idstr | None: System-under-test the pulled traces are attributed to.prefixstr | None: Key prefix within the bucket to scope the pull.endpointstr | None: External object-store host, ashostorhost:port— without a scheme, path, or credentials. Omit it to pull from a platform-configured bucket.access_keystr | None: Object-store access key (write-only). Requiresendpointandsecret_key.secret_keystr | None: Object-store secret key (write-only). Requiresendpointandaccess_key.securebool: Whether to connect toendpointover HTTPS.regionstr | None: Object-store region. Requiresendpoint.retention_daysint | None: Retention window for pulled data — one ofRETENTION_DAYS. WhenNone, the platform default applies.clientAPIClient | None: Optional API client.
Returns
TraceSourceConnection: The created connection, with credential fields masked.
Raises
NoWorkspaceSelectedError: If no workspace is passed and none is configured for the session.InvalidArgumentError: Ifbucketis empty,retention_daysis not a supported window, only one ofaccess_key/secret_keyis given, a credential orregionis given without anendpoint, or bothproject_idandworkspace_idare given — a project already determines its workspace.AuthError: If credentials are missing or invalid.ForbiddenError: Ifbucket,prefix, orendpointnames 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 thislabelalready 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.