AIRAVATA-2500 Javadoc for SSHAccountProvisioner interfaces
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/2425187b Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/2425187b Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/2425187b Branch: refs/heads/develop Commit: 2425187bb505fbc21580d52dc2192043bb18551a Parents: 66689a8 Author: Marcus Christie <machris...@apache.org> Authored: Wed Sep 20 15:05:18 2017 -0400 Committer: Marcus Christie <machris...@apache.org> Committed: Wed Sep 20 15:05:18 2017 -0400 ---------------------------------------------------------------------- .../SSHAccountProvisioner.java | 43 ++++++++++++++++++++ .../SSHAccountProvisionerProvider.java | 21 ++++++++++ 2 files changed, 64 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/2425187b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisioner.java ---------------------------------------------------------------------- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisioner.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisioner.java index 866ef5c..395b622 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisioner.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisioner.java @@ -22,11 +22,54 @@ package org.apache.airavata.accountprovisioning; import java.util.Map; +/** + * An SSHAccountProvisioner is capable of installing an Airavata-managed SSH public key onto a compute host for a user. + * SSHAccountProvisioners may also optionally provide the capability to create accounts directly on the compute host + * for the user. An SSHAccountProvisioner's {@link SSHAccountProvisionerProvider} provides some methods to define the + * configuration params that this SSHAccountProvisioner requires as well as some metadata method to describe the + * capabilities of this SSHAccountProvisioner. + */ public interface SSHAccountProvisioner { + /** + * Initialize this SSHAccountProvisioner. + * @param config + */ void init(Map<ConfigParam, String> config); + + /** + * Return true if this user has an account on the compute host + * @param userId the Airavata user id + * @return + * @throws InvalidUsernameException + */ boolean hasAccount(String userId) throws InvalidUsernameException; + + /** + * Create an account for the user if no account exists. May throw {@link UnsupportedOperationException} if + * unimplemented for this SSHAccountProvisioner. + * @param userId the Airavata user id + * @param sshPublicKey the public key part of an Airavata managed SSH credential + * @throws InvalidUsernameException + */ void createAccount(String userId, String sshPublicKey) throws InvalidUsernameException; + + /** + * Install an SSH key for the user on the compute host. + * @param userId the Airavata user id + * @param sshPublicKey the public key part of an Airavata managed SSH credential + * @throws InvalidUsernameException + */ void installSSHKey(String userId, String sshPublicKey) throws InvalidUsernameException; + + /** + * Get the scratch location that should be created for the user. Note: this method doesn't create the scratch + * location on the compute host, it merely determines a path to a good scratch location to be used by a gateway + * on behalf of the user. + * + * @param userId + * @return a filesystem path (e.g. "/N/scratch/username/some-gateway") + * @throws InvalidUsernameException + */ String getScratchLocation(String userId) throws InvalidUsernameException; } http://git-wip-us.apache.org/repos/asf/airavata/blob/2425187b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisionerProvider.java ---------------------------------------------------------------------- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisionerProvider.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisionerProvider.java index 297c757..c0407d5 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisionerProvider.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisionerProvider.java @@ -32,8 +32,29 @@ public interface SSHAccountProvisionerProvider { default String getName() { return this.getClass().getName(); } + + /** + * Return the {@link ConfigParam}s for the associated SSHAccountProvisioner. + * @return + */ List<ConfigParam> getConfigParams(); + + /** + * Instantiate and initialize the associated SSHAccountProvisioner. + * @param config + * @return + */ SSHAccountProvisioner createSSHAccountProvisioner(Map<ConfigParam,String> config); + + /** + * Return true if the associated SSHAccountProvisioner can create accounts for a user on a compute host. + * @return + */ boolean canCreateAccount(); + + /** + * Return true if the associated SSHAccountProvisioner can install an SSH public key on a compute host for the user. + * @return + */ boolean canInstallSSHKey(); }