public interface

SshAccessKeyService

com.atlassian.bitbucket.ssh.SshAccessKeyService

Class Overview

Manages SSH access keys and their access to Project projects and Repository repositories

Summary

Public Methods
boolean existsForProject(Project project)
boolean existsForRepository(Repository repository)
@Nonnull Page<SshAccessKey> findByKeyForProjects(int sshKeyId, PageRequest pageRequest)
Finds SSH access keys for projects accessible to the current user for the supplied key's ID
@Nonnull Page<SshAccessKey> findByKeyForRepositories(int sshKeyId, PageRequest pageRequest)
Finds SSH access keys for repositories accessible to the current user for the supplied key's ID
@Deprecated @Nonnull Page<SshAccessKey> findByProject(Project project, PageRequest pageRequest)
This method is deprecated. since 5.0 for removal in 6.0. Use search(SshAccessKeySearchRequest, PageRequest) instead.
@Nonnull @Deprecated Page<SshAccessKey> findByRepository(Repository repository, PageRequest pageRequest)
This method is deprecated. since 5.0 for removal in 6.0. Use search(SshAccessKeySearchRequest, PageRequest) instead.
@Nonnull Optional<SshAccessKey> getByKeyAndProject(int sshKeyId, Project project)
Retrieves the access key with SSH key ID sshKeyId for the provided project
@Nonnull Optional<SshAccessKey> getByKeyAndRepository(int sshKeyId, Repository repository)
Retrieves the access key with SSH key ID sshKeyId for the provided repository
void revoke(int sshKeyId, Project project)
Revokes access for the provided SSH key to the project
void revoke(int sshKeyId, Repository repository)
Revokes access for the provided SSH key to the repository
void revoke(int sshKeyId, Set<Repository> repositories, Set<Project> projects)
Revokes all access for the provided SSH key to the supplied repositories and projects
@Nonnull Page<SshAccessKey> search(SshAccessKeySearchRequest request, PageRequest pageRequest)
Retrieves SSH access keys that match the provided request.
@Nonnull SshAccessKey set(SetSshAccessKeyRequest request)
Creates a new access key or updates the access level of an existing access key on a Project or Repository

Public Methods

public boolean existsForProject (Project project)

Parameters
project the project to query
Returns
  • true if any SSH access keys have been defined for the provided project

public boolean existsForRepository (Repository repository)

Parameters
repository the repository to query
Returns
  • true if any SSH access keys have been defined for the provided repository

@Nonnull public Page<SshAccessKey> findByKeyForProjects (int sshKeyId, PageRequest pageRequest)

Finds SSH access keys for projects accessible to the current user for the supplied key's ID

Parameters
sshKeyId the key ID to search for
pageRequest the page request
Returns
  • a page of matching access keys

@Nonnull public Page<SshAccessKey> findByKeyForRepositories (int sshKeyId, PageRequest pageRequest)

Finds SSH access keys for repositories accessible to the current user for the supplied key's ID

Parameters
sshKeyId the key ID to search for
pageRequest the page request
Returns
  • a page of matching access keys

@Deprecated @Nonnull public Page<SshAccessKey> findByProject (Project project, PageRequest pageRequest)

This method is deprecated.
since 5.0 for removal in 6.0. Use search(SshAccessKeySearchRequest, PageRequest) instead.

Finds SSH access keys for the supplied project

Parameters
project the project to search by
pageRequest the page request
Returns
  • a page of matching access keys

@Nonnull @Deprecated public Page<SshAccessKey> findByRepository (Repository repository, PageRequest pageRequest)

This method is deprecated.
since 5.0 for removal in 6.0. Use search(SshAccessKeySearchRequest, PageRequest) instead.

Finds SSH access keys for the supplied repository

Parameters
repository the repository to search by
pageRequest the page request
Returns
  • a page of matching access keys

@Nonnull public Optional<SshAccessKey> getByKeyAndProject (int sshKeyId, Project project)

Retrieves the access key with SSH key ID sshKeyId for the provided project

Parameters
sshKeyId the ID of the SSH key
project the project
Returns

@Nonnull public Optional<SshAccessKey> getByKeyAndRepository (int sshKeyId, Repository repository)

Retrieves the access key with SSH key ID sshKeyId for the provided repository

Parameters
sshKeyId the ID of the SSH key
repository the repository
Returns
  • the access key, or empty() if the provided key does not have access to the repository

public void revoke (int sshKeyId, Project project)

Revokes access for the provided SSH key to the project

Parameters
sshKeyId id of the SSH key
project the project

public void revoke (int sshKeyId, Repository repository)

Revokes access for the provided SSH key to the repository

Parameters
sshKeyId id of the SSH key
repository the repository

public void revoke (int sshKeyId, Set<Repository> repositories, Set<Project> projects)

Revokes all access for the provided SSH key to the supplied repositories and projects

Parameters
sshKeyId id of the SSH key
repositories the repositories
projects the repositories

@Nonnull public Page<SshAccessKey> search (SshAccessKeySearchRequest request, PageRequest pageRequest)

Retrieves SSH access keys that match the provided request.

Parameters
request a request object describing the SSH access keys to retrieve
pageRequest the page request
Returns
  • the requested page of SSH access keys that match the search request, possibly empty but never null

@Nonnull public SshAccessKey set (SetSshAccessKeyRequest request)

Creates a new access key or updates the access level of an existing access key on a Project or Repository

Parameters
request the request detailing the desired access level
Returns
  • a SshAccessKey instance representing the created or updated access key