NAME
WebService::BitbucketServer::SSH::V1 - Bindings for a Bitbucket Server REST API
VERSION
version 0.600
SYNOPSIS
my $stash = WebService::BitbucketServer->new(
base_url => 'https://stash.example.com/',
username => 'bob',
password => 'secret',
);
my $api = $stash->ssh;
DESCRIPTION
This is a Bitbucket Server REST API for SSH::V1.
Original API documentation created by and copyright Atlassian.
ATTRIBUTES
context
Get the instance of WebService::BitbucketServer passed to "new".
METHODS
new
$api = WebService::BitbucketServer::SSH::V1->new(context => $webservice_bitbucketserver_obj);
Create a new API.
Normally you would use $webservice_bitbucketserver_obj->ssh
instead.
get_keys_for_repository
Retrieves the access keys for the repository identified in the URL.
GET keys/1.0/projects/{projectKey}/repos/{repositorySlug}/ssh
Parameters:
filter
- string, default: noneif specified only SSH access keys with a label prefixed with the supplied string will be returned
effective
- boolean, default: falseControls whether SSH access keys configured at the project level should be included in the results or not. When set to
true
all keys that have access to the repository (including project level keys) are included in the results. When set tofalse
, only access keys configured for the specifiedrepository
are considered. Default isfalse
.permission
- string, default: noneif specified only SSH access keys with at least the supplied permission will be returned Default is
Permission.REPO_READ
.
Responses:
200
- page, type: application/jsonA single page of access keys for the repository.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the access keys for this repository
404
- errors, type: application/jsonThe specified repository does not exist
add_key_for_repository
Register a new SSH key and grants access to the repository identified in the URL.
POST keys/1.0/projects/{projectKey}/repos/{repositorySlug}/ssh
Responses:
200
- data, type: application/jsonThe newly created access key
400
- errors, type: application/jsonThe current request contains invalid or missing values.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to add an access key to the repository
404
- errors, type: application/jsonThe specified repository does not exist
get_key_for_repository
Retrieves the access keys for the repository identified in the URL.
GET keys/1.0/projects/{projectKey}/repos/{repositorySlug}/ssh/{keyId}
Parameters:
keyId
- int, default: nonethe identifier of the SSH key
Responses:
200
- page, type: application/jsonA single page of access keys for the repository.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the access keys for this repository
404
- errors, type: application/jsonThe specified repository does not exist
revoke_key_for_repository
Remove an existing access key for the repository identified in the URL. If the same SSH key is used as an access key for multiple projects or repositories, only the access to the repository identified in the URL will be revoked.
DELETE keys/1.0/projects/{projectKey}/repos/{repositorySlug}/ssh/{keyId}
Parameters:
keyId
- int, default: nonethe identifier of the SSH key
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to remove access keys for this repository
204
- data, type: application/jsonThe access key was deleted (or none was found matching the given id).
update_permission_for_repository
Updates the permission granted to the specified SSH key to the project identified in the URL.
PUT keys/1.0/projects/{projectKey}/repos/{repositorySlug}/ssh/{keyId}/permission/{permission}
Parameters:
keyId
- int, default: nonethe SSH key ID
permission
- string, default: nonethe new permission to be granted to the SSH key
Responses:
200
- data, type: application/jsonThe newly created access key
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions on the project to edit its access keys
404
- errors, type: application/jsonThe specified project does not exist
get_keys_for_project
Retrieves the access keys for the project identified in the URL.
GET keys/1.0/projects/{projectKey}/ssh
Parameters:
filter
- string, default: noneif specified only SSH access keys with a label prefixed with the supplied string will be returned
permission
- string, default: noneif specified only SSH access keys with at least the supplied permission will be returned Default is {@link Permission#PROJECT_READ}.
Responses:
200
- page, type: application/jsonA single page of access keys associated with the project.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the access keys for this project
404
- errors, type: application/jsonThe specified project does not exist
add_key_for_project
Register a new SSH key and grants access to the project identified in the URL.
POST keys/1.0/projects/{projectKey}/ssh
Responses:
200
- data, type: application/jsonThe newly created access key
400
- errors, type: application/jsonThe current request contains invalid or missing values.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to add an access key to the project.
404
- errors, type: application/jsonThe specified project does not exist
get_key_for_project
Retrieves the access keys for the project identified in the URL.
GET keys/1.0/projects/{projectKey}/ssh/{keyId}
Parameters:
keyId
- int, default: nonethe identifier of the SSH key
Responses:
200
- page, type: application/jsonA single page of access keys associated with the project.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the access keys for this project
404
- errors, type: application/jsonThe specified project does not exist
revoke_key_for_project
Remove an existing access key for the project identified in the URL. If the same SSH key is used as an access key for multiple projects or repositories, only the access to the project identified in the URL will be revoked.
DELETE keys/1.0/projects/{projectKey}/ssh/{keyId}
Parameters:
keyId
- int, default: nonethe identifier of the SSH key
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to remove access keys for this project
204
- data, type: application/jsonThe access key was deleted (or none was found matching the given id).
update_permission_for_project
Updates the permission granted to the specified SSH key to the project identified in the URL.
PUT keys/1.0/projects/{projectKey}/ssh/{keyId}/permission/{permission}
Parameters:
keyId
- int, default: nonethe SSH key ID
permission
- string, default: nonethe new permission to be granted to the SSH key
Responses:
200
- data, type: application/jsonThe newly created access key
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions on the project to edit its access keys
404
- errors, type: application/jsonThe specified project does not exist
revoke_key
Remove an existing access key for the projects and repositories in the submitted entity. If the same SSH key is used as an access key for multiple projects or repositories not supplied, only the access to the projects or repositories identified will be revoked.
DELETE keys/1.0/ssh/{keyId}
Parameters:
keyId
- int, default: nonethe identifier of the SSH key
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to remove access keys for one or more of the specified projects or repositories
204
- data, type: application/jsonThe access keys were deleted (or none was found matching the given id and repositories or projects).
404
- errors, type: application/jsonOn or more of the specified repositories or projects does not exist or the key itself does not exist
get_projects_for_key
Retrieves all project-related access keys for the SSH key with id keyId
. If the current user is not an admin any of the projects the key provides access to, none are returned.
GET keys/1.0/ssh/{keyId}/projects
Parameters:
keyId
- int, default: none
Responses:
200
- page, type: application/jsonthe SSH key with ID
keyId
.404
- errors, type: application/jsonThe specified key does not exist
get_repositories_for_key
Retrieves all repository-related access keys for the SSH key with id keyId
. If the current user is not an admin of any of the projects the key provides access to, none are returned.
GET keys/1.0/ssh/{keyId}/repos
Parameters:
keyId
- int, default: none
Responses:
200
- page, type: application/jsonthe SSH key with ID
keyId
.404
- errors, type: application/jsonThe specified key does not exist
get_ssh_keys
Retrieve a page of ssh keys.
GET ssh/1.0/keys
Parameters:
user
- string, default: nonethe username of the user to retrieve the keys for. If no username is specified, the ssh keys will be retrieved for the current authenticated user.
Responses:
200
- page, type: application/jsonA page of ssh keys.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the ssh keys. This is only possible when a user is explicitly supplied.
404
- errors, type: application/jsonNo user matches the supplied user
add_ssh_key
Add a new ssh key to a supplied user.
POST ssh/1.0/keys
Parameters:
user
- string, default: nonethe username of the user to add the ssh key for. If no username is specified, the ssh key will be added for the current authenticated user.
Responses:
201
- sshKey, type: application/jsonThe newly created ssh key.
400
- errors, type: application/jsonThe ssh key was not created because the key was not a valid RSA/DSA/ECDSA/Ed25519 key of a supported length.
401
- errors, type: application/jsonEither there is no authenticated user or the currently authenticated user has insufficient permissions to add an ssh key. The latter is only possible when a user is explicitly supplied.
404
- errors, type: application/jsonNo user matches the supplied user
409
- errors, type: application/jsonThe ssh key already exists on the system.
delete_ssh_keys
Delete all ssh keys for a supplied user.
DELETE ssh/1.0/keys
Parameters:
user
- string, default: nonethe username of the user to delete the keys for. If no username is specified, the ssh keys will be deleted for the current authenticated user.
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to delete the ssh keys. This is only possible when a user is explicitly supplied.
204
- data, type: unknownThe ssh keys matching the supplied user were deleted.
404
- errors, type: application/jsonNo user matches the supplied user
delete_ssh_key
Delete an ssh key.
DELETE ssh/1.0/keys/{keyId}
Parameters:
keyId
- int, default: nonethe id of the key to delete.
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to delete the ssh key.
204
- data, type: unknownThe ssh key matching the supplied id was deleted or did not exist.
get_ssh_settings
GET ssh/1.0/settings
Responses:
200
- data, type: application/jsonThe ssh settings from upstream
401
- errors, type: application/jsonThe request was not authenticated
SEE ALSO
BUGS
Please report any bugs or feature requests on the bugtracker website https://github.com/chazmcgarvey/WebService-BitbucketServer/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
AUTHOR
Charles McGarvey <ccm@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2017 by Charles McGarvey.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.