import { Configuration } from "@atomist/automation-client/lib/configuration";
import { ProjectOperationCredentials } from "@atomist/automation-client/lib/operations/common/ProjectOperationCredentials";
import { RemoteRepoRef } from "@atomist/automation-client/lib/operations/common/RepoId";
import { RepoScmProvider, ScmProviders } from "../../../typings/types";
import { SyncRepoRef } from "../config";
export interface RepoCredentials {
    credentials: ProjectOperationCredentials;
    repo: RemoteRepoRef;
}
/**
 * If called and no sync repo is provided in the SDM configuration, a
 * warning is emitted and `undefined` is returned.
 *
 * If the SDM configuration contains a RemoteRepoRef as the value of
 * the `sdm.configuration.sdm.k8s.options.sync.repo` option and truthy
 * credentials, those are returned.
 *
 * Otherwise, the code cycles through all workspaces, querying cortex
 * for the information it needs.  If the value of the `sync.repo`
 * option is a [[SyncRepoRef]], each workspace is queried for a repo
 * matching the provided sync repo.  If none is found, it cycles
 * through all the workspaces again querying for all SCM providers and
 * try to clone the repo with the provided credentials or, if no
 * credentials are provided, the SCM provider credentials from cortex.
 * Once a repo is found using either method, an object is returned
 * with its remote repo ref and the credentials able to clone it.  In
 * addition, the `sdm` passed in will have its
 * `sdm.configuration.sdm.k8s.options.sync.repo`
 * and`sdm.configuration.sdm.k8s.options.sync.credentials` updated
 * with the objects appropriate objects.
 *
 * @param sdm this SDM object (modified if repo credentials found)
 * @param repoRef repository to look for
 * @return true if sync options set and repo found or false and sync options deleted
 */
export declare function queryForScmProvider(configuration: Configuration): Promise<boolean>;
/**
 * See if provided sync repo is a RemoteRepoRef.
 */
export declare function isRemoteRepo(repo: SyncRepoRef | RemoteRepoRef): repo is RemoteRepoRef;
/**
 * Create RemoteRepoRef and Credentials object from SDM and repo from
 * cortex.  If the provided repo does not contain an org with a
 * provider, it returns `undefined`.  Otherwise it uses the SCM
 * provider to call [[scmCredentials]] and return its value.
 */
export declare function repoCredentials(configuration: Configuration, repo: RepoScmProvider.Repo, workspaceId: string): Promise<RepoCredentials | undefined>;
/**
 * Given the SDM and an SCM, use the configured repo ref resolver to
 * create a RemoteRepoRef.  Use the SDM Kubernetes option sync
 * credentials or SCM `credential.secret` to create the credentials,
 * giving the SDM sync credentials preference.  Return `undefined` if
 * there is not enough information to created the repo credential
 * object.
 */
export declare function scmCredentials(configuration: Configuration, scm: ScmProviders.ScmProvider, workspaceId: string): Promise<RepoCredentials | undefined>;
/** Create repo slug string. */
export declare function repoSlug(repo: SyncRepoRef | RemoteRepoRef): string;
//# sourceMappingURL=repo.d.ts.map