use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.
the class SFTPDeleteDirectory method execute.
@Action(name = SFTP_DELETE_DIRECTORY, description = SFTP_DELETE_DIRECTORY_DESCRIPTION, outputs = { @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC), @Output(value = RETURN_CODE, description = RETURN_CODE_DESC), @Output(value = EXCEPTION, description = EXCEPTION_DESC) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = COMPARE_EQUAL, responseType = RESOLVED, description = DELETE_DIR_SUCCESS_DESC), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = COMPARE_EQUAL, responseType = ERROR, description = FAILURE_DELETE_DIR_DESC) })
public Map<String, String> execute(@Param(value = HOST, description = HOST_NAME, required = true) String host, @Param(value = PORT, description = PORT_DESC) String port, @Param(value = USERNAME, description = USERNAME_DESC, required = true) String username, @Param(value = PASSWORD, description = PASSWORD_DESC, required = true, encrypted = true) String password, @Param(value = PROXY_HOST, description = PROXY_HOST_DESC) String proxyHost, @Param(value = PROXY_PORT, description = PROXY_PORT_DESC) String proxyPort, @Param(value = PROXY_USERNAME, description = PROXY_USERNAME_DESC) String proxyUsername, @Param(value = PROXY_PASSWORD, description = PROXY_PASSWORD_DESC, encrypted = true) String proxyPassword, @Param(value = PRIVATE_KEY, description = PRIVATE_KEY_DESC) String privateKey, @Param(value = REMOTE_PATH, description = REMOTE_PATH_DELETE_DESC, required = true) String remotePath, @Param(value = SSH_SESSIONS_DEFAULT_ID, description = GLOBAL_SESSION_DESC) GlobalSessionObject<Map<String, SFTPConnection>> globalSessionObject, @Param(value = CHARACTER_SET, description = CHARACTER_SET_DESC) String characterSet, @Param(value = CLOSE_SESSION, description = CLOSE_SESSION_DESC) String closeSession, @Param(value = CONNECTION_TIMEOUT, description = CONNECTION_TIMEOUT_DESC) String connectionTimeout, @Param(value = EXECUTION_TIMEOUT, description = EXECUTION_TIMEOUT_DESC) String executionTimeout) {
host = defaultIfEmpty(host, EMPTY);
port = defaultIfEmpty(port, String.valueOf(DEFAULT_PORT));
username = defaultIfEmpty(username, EMPTY);
password = defaultIfEmpty(password, EMPTY);
proxyPort = defaultIfEmpty(proxyPort, String.valueOf(DEFAULT_PROXY_PORT));
privateKey = defaultIfEmpty(privateKey, EMPTY);
remotePath = defaultIfEmpty(remotePath, EMPTY);
characterSet = defaultIfEmpty(characterSet, CHARACTER_SET_UTF8);
closeSession = defaultIfEmpty(closeSession, BOOLEAN_TRUE);
connectionTimeout = defaultIfEmpty(connectionTimeout, CONNECTION_TIMEOUT);
executionTimeout = defaultIfEmpty(executionTimeout, EXECUTION_TIMEOUT);
final List<String> exceptionMessages = verifyInputsFolders(remotePath, host, port, username, password, proxyPort, characterSet, closeSession, connectionTimeout, executionTimeout);
if (!exceptionMessages.isEmpty()) {
return getFailureResultsMap(StringUtilities.join(exceptionMessages, NEW_LINE));
}
SFTPGeneralDirectoryInputs sftpDeleteDirectoryInputs = SFTPGeneralDirectoryInputs.builder().remotePath(remotePath).sftpCommonInputs(SFTPCommonInputs.builder().host(host).port(port).username(username).password(password).proxyHost(proxyHost).proxyPort(proxyPort).proxyUsername(proxyUsername).proxyPassword(proxyPassword).connectionTimeout(connectionTimeout).executionTimeout(executionTimeout).privateKey(privateKey).characterSet(characterSet).closeSession(closeSession).globalSessionObject(globalSessionObject).build()).build();
return new SFTPService().execute(sftpDeleteDirectoryInputs, SFTPOperation.DELETE_DIRECTORY);
}
use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.
the class SFTPDeleteFile method execute.
@Action(name = SFTP_DELETE_FILE, description = SFTP_DELETE_FILE_DESCRIPTION, outputs = { @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC), @Output(value = RETURN_CODE, description = RETURN_CODE_DESC), @Output(value = EXCEPTION, description = EXCEPTION_DESC) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = COMPARE_EQUAL, responseType = RESOLVED, description = SUCCESS_DESC), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = COMPARE_EQUAL, responseType = ERROR, description = FAILURE_DESC) })
public Map<String, String> execute(@Param(value = HOST, description = HOST_NAME, required = true) String host, @Param(value = PORT, description = PORT_DESC) String port, @Param(value = USERNAME, description = USERNAME_DESC, required = true) String username, @Param(value = PASSWORD, description = PASSWORD_DESC, required = true, encrypted = true) String password, @Param(value = PROXY_HOST, description = PROXY_HOST_DESC) String proxyHost, @Param(value = PROXY_PORT, description = PROXY_PORT_DESC) String proxyPort, @Param(value = PROXY_USERNAME, description = PROXY_USERNAME_DESC) String proxyUsername, @Param(value = PROXY_PASSWORD, description = PROXY_PASSWORD_DESC, encrypted = true) String proxyPassword, @Param(value = PRIVATE_KEY, description = PRIVATE_KEY_DESC) String privateKey, @Param(value = REMOTE_PATH, description = REMOTE_PATH_DELETE_FILE_DESC, required = true) String remotePath, @Param(value = REMOTE_FILE, description = REMOTE_FILE_DELETE_DESC, required = true) String remoteFile, @Param(value = SSH_SESSIONS_DEFAULT_ID, description = GLOBAL_SESSION_DESC) GlobalSessionObject<Map<String, SFTPConnection>> globalSessionObject, @Param(value = CHARACTER_SET, description = CHARACTER_SET_DESC) String characterSet, @Param(value = CLOSE_SESSION, description = CLOSE_SESSION_DESC) String closeSession, @Param(value = CONNECTION_TIMEOUT, description = CONNECTION_TIMEOUT_DESC) String connectionTimeout, @Param(value = EXECUTION_TIMEOUT, description = EXECUTION_TIMEOUT_DESC) String executionTimeout) {
host = defaultIfEmpty(host, EMPTY);
port = defaultIfEmpty(port, String.valueOf(DEFAULT_PORT));
username = defaultIfEmpty(username, EMPTY);
password = defaultIfEmpty(password, EMPTY);
proxyPort = defaultIfEmpty(proxyPort, String.valueOf(DEFAULT_PROXY_PORT));
privateKey = defaultIfEmpty(privateKey, EMPTY);
remotePath = defaultIfEmpty(remotePath, EMPTY);
characterSet = defaultIfEmpty(characterSet, CHARACTER_SET_UTF8);
closeSession = defaultIfEmpty(closeSession, BOOLEAN_TRUE);
connectionTimeout = defaultIfEmpty(connectionTimeout, CONNECTION_TIMEOUT);
executionTimeout = defaultIfEmpty(executionTimeout, EXECUTION_TIMEOUT);
final List<String> exceptionMessages = verifyDeleteFileInputs(remoteFile, remotePath, host, port, username, password, proxyPort, characterSet, closeSession, connectionTimeout, executionTimeout);
if (!exceptionMessages.isEmpty()) {
return getFailureResultsMap(StringUtilities.join(exceptionMessages, NEW_LINE));
}
SFTPDeleteFileInputs sftpDeleteFileInputsInputs = SFTPDeleteFileInputs.builder().remotePath(remotePath).remoteFile(remoteFile).sftpCommonInputs(SFTPCommonInputs.builder().host(host).port(port).username(username).password(password).proxyHost(proxyHost).proxyPort(proxyPort).proxyUsername(proxyUsername).proxyPassword(proxyPassword).connectionTimeout(connectionTimeout).executionTimeout(executionTimeout).privateKey(privateKey).characterSet(characterSet).closeSession(closeSession).globalSessionObject(globalSessionObject).build()).build();
return new SFTPService().execute(sftpDeleteFileInputsInputs, SFTPOperation.DELETE_FILE);
}
use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.
the class SFTPDownloadFile method execute.
@Action(name = SFTP_DOWNLOAD_FILE, outputs = { @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC), @Output(value = RETURN_CODE, description = RETURN_CODE_DESC), @Output(value = EXCEPTION, description = EXCEPTION_DESC) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = COMPARE_EQUAL, responseType = RESOLVED, description = SUCCESS_DESC), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = COMPARE_EQUAL, responseType = ERROR, description = FAILURE_DESC) })
public Map<String, String> execute(@Param(value = HOST, description = HOST_NAME, required = true) String host, @Param(value = PORT, description = PORT_DESC) String port, @Param(value = USERNAME, description = USERNAME_DESC, required = true) String username, @Param(value = PASSWORD, description = PASSWORD_DESC, required = true, encrypted = true) String password, @Param(value = PROXY_HOST, description = PROXY_HOST_DESC) String proxyHost, @Param(value = PROXY_PORT, description = PROXY_PORT_DESC) String proxyPort, @Param(value = PROXY_USERNAME, description = PROXY_USERNAME_DESC) String proxyUsername, @Param(value = PROXY_PASSWORD, description = PROXY_PASSWORD_DESC, encrypted = true) String proxyPassword, @Param(value = PRIVATE_KEY, description = PRIVATE_KEY_DESC) String privateKey, @Param(value = REMOTE_FILE, description = REMOTE_FILE_DESC, required = true) String remoteFile, @Param(value = REMOTE_LOCATION, description = REMOTE_LOCATION_DESC, required = true) String remotePath, @Param(value = LOCAL_PATH, description = LOCAL_LOCATION_DESC, required = true) String localPath, @Param(value = SSH_SESSIONS_DEFAULT_ID, description = GLOBAL_SESSION_DESC) GlobalSessionObject<Map<String, SFTPConnection>> globalSessionObject, @Param(value = CHARACTER_SET, description = CHARACTER_SET_DESC) String characterSet, @Param(value = CLOSE_SESSION, description = CLOSE_SESSION_DESC) String closeSession, @Param(value = CONNECTION_TIMEOUT, description = CONNECTION_TIMEOUT_DESC) String connectionTimeout, @Param(value = EXECUTION_TIMEOUT, description = EXECUTION_TIMEOUT_DESC) String executionTimeout) {
host = defaultIfEmpty(host, EMPTY);
port = defaultIfEmpty(port, String.valueOf(DEFAULT_PORT));
username = defaultIfEmpty(username, EMPTY);
password = defaultIfEmpty(password, EMPTY);
proxyPort = defaultIfEmpty(proxyPort, String.valueOf(DEFAULT_PROXY_PORT));
privateKey = defaultIfEmpty(privateKey, EMPTY);
remoteFile = defaultIfEmpty(remoteFile, EMPTY);
remotePath = defaultIfEmpty(remotePath, EMPTY);
localPath = defaultIfEmpty(localPath, EMPTY);
characterSet = defaultIfEmpty(characterSet, CHARACTER_SET_UTF8);
closeSession = defaultIfEmpty(closeSession, BOOLEAN_TRUE);
connectionTimeout = defaultIfEmpty(connectionTimeout, DEFAULT_CONNECTION_TIMEOUT);
executionTimeout = defaultIfEmpty(executionTimeout, DEFAULT_EXECUTION_TIMEOUT);
final List<String> exceptionMessages = verifySFTPDownloadFileInputs(host, port, username, password, proxyPort, characterSet, closeSession, remoteFile, remotePath, localPath, connectionTimeout, executionTimeout);
if (!exceptionMessages.isEmpty()) {
return getFailureResultsMap(StringUtilities.join(exceptionMessages, NEW_LINE));
}
SFTPDownloadFileInputs sftpDownloadFileInputs = SFTPDownloadFileInputs.builder().remoteFile(remoteFile).remotePath(remotePath).localPath(localPath).sftpCommonInputs(SFTPCommonInputs.builder().host(host).port(port).username(username).password(password).proxyHost(proxyHost).proxyPort(proxyPort).proxyUsername(proxyUsername).proxyPassword(proxyPassword).connectionTimeout(connectionTimeout).executionTimeout(executionTimeout).privateKey(privateKey).characterSet(characterSet).closeSession(closeSession).globalSessionObject(globalSessionObject).build()).build();
return new SFTPService().execute(sftpDownloadFileInputs, SFTPOperation.GET);
}
use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.
the class SFTPRename method execute.
@Action(name = SFTP_RENAME, description = SFTP_RENAME_DESCRIPTION, outputs = { @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC), @Output(value = RETURN_CODE, description = RETURN_CODE_DESC), @Output(value = EXCEPTION, description = EXCEPTION_DESC) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = COMPARE_EQUAL, responseType = RESOLVED, description = RENAME_SUCCESS_DESC), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = COMPARE_EQUAL, responseType = ERROR, description = RENAME_FAILURE_DESC) })
public Map<String, String> execute(@Param(value = HOST, description = HOST_NAME, required = true) String host, @Param(value = PORT, description = PORT_DESC) String port, @Param(value = USERNAME, description = USERNAME_DESC, required = true) String username, @Param(value = PASSWORD, description = PASSWORD_DESC, required = true, encrypted = true) String password, @Param(value = PROXY_HOST, description = PROXY_HOST_DESC) String proxyHost, @Param(value = PROXY_PORT, description = PROXY_PORT_DESC) String proxyPort, @Param(value = PROXY_USERNAME, description = PROXY_USERNAME_DESC) String proxyUsername, @Param(value = PROXY_PASSWORD, description = PROXY_PASSWORD_DESC, encrypted = true) String proxyPassword, @Param(value = PRIVATE_KEY, description = PRIVATE_KEY_DESC) String privateKey, @Param(value = REMOTE_PATH, description = RENAME_REMOTE_PATH_DESC, required = true) String remotePath, @Param(value = REMOTE_FILE, description = RENAME_REMOTE_FILE_DESC) String remoteFile, @Param(value = NEW_REMOTE_PATH, description = RENAME_NEW_REMOTE_PATH_DESC, required = true) String newRemotePath, @Param(value = NEW_REMOTE_FILE, description = NEW_REMOTE_FILE_DESC) String newRemoteFile, @Param(value = SSH_SESSIONS_DEFAULT_ID, description = GLOBAL_SESSION_DESC) GlobalSessionObject<Map<String, SFTPConnection>> globalSessionObject, @Param(value = CHARACTER_SET, description = CHARACTER_SET_DESC) String characterSet, @Param(value = CLOSE_SESSION, description = CLOSE_SESSION_DESC) String closeSession, @Param(value = CONNECTION_TIMEOUT, description = CONNECTION_TIMEOUT_DESC) String connectionTimeout, @Param(value = EXECUTION_TIMEOUT, description = EXECUTION_TIMEOUT_DESC) String executionTimeout) {
host = defaultIfEmpty(host, EMPTY);
port = defaultIfEmpty(port, String.valueOf(DEFAULT_PORT));
username = defaultIfEmpty(username, EMPTY);
password = defaultIfEmpty(password, EMPTY);
proxyPort = defaultIfEmpty(proxyPort, String.valueOf(DEFAULT_PROXY_PORT));
privateKey = defaultIfEmpty(privateKey, EMPTY);
remotePath = defaultIfEmpty(remotePath, EMPTY);
newRemotePath = defaultIfEmpty(newRemotePath, EMPTY);
characterSet = defaultIfEmpty(characterSet, CHARACTER_SET_UTF8);
closeSession = defaultIfEmpty(closeSession, BOOLEAN_TRUE);
connectionTimeout = defaultIfEmpty(connectionTimeout, CONNECTION_TIMEOUT);
executionTimeout = defaultIfEmpty(executionTimeout, EXECUTION_TIMEOUT);
final List<String> exceptionMessages = verifyInputsSFTPRename(remotePath, newRemotePath, host, port, username, password, proxyPort, characterSet, closeSession, connectionTimeout, executionTimeout);
if (!exceptionMessages.isEmpty()) {
return getFailureResultsMap(StringUtilities.join(exceptionMessages, NEW_LINE));
}
SFTPRenameInputs sftpRenameInputs = SFTPRenameInputs.builder().remotePath(remotePath).remoteFile(remoteFile).newRemotePath(newRemotePath).newRemoteFile(newRemoteFile).sftpCommonInputs(SFTPCommonInputs.builder().host(host).port(port).username(username).password(password).proxyHost(proxyHost).proxyPort(proxyPort).proxyUsername(proxyUsername).proxyPassword(proxyPassword).connectionTimeout(connectionTimeout).executionTimeout(executionTimeout).privateKey(privateKey).characterSet(characterSet).closeSession(closeSession).globalSessionObject(globalSessionObject).build()).build();
return new SFTPService().execute(sftpRenameInputs, SFTPOperation.RENAME);
}
use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.
the class SFTPUploadFile method execute.
@Action(name = "SFTP Upload Operation", outputs = { @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC), @Output(value = RETURN_CODE, description = RETURN_CODE_DESC), @Output(value = EXCEPTION, description = EXCEPTION_DESC) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = COMPARE_EQUAL, responseType = RESOLVED, description = SUCCESS_DESC), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = COMPARE_EQUAL, responseType = ERROR, description = FAILURE_DESC) })
public Map<String, String> execute(@Param(value = HOST, description = HOST_NAME, required = true) String host, @Param(value = PORT, description = PORT_DESC) String port, @Param(value = USERNAME, description = USERNAME_DESC, required = true) String username, @Param(value = PASSWORD, description = PASSWORD_DESC, required = true, encrypted = true) String password, @Param(value = PROXY_HOST, description = PROXY_HOST_DESC) String proxyHost, @Param(value = PROXY_PORT, description = PROXY_PORT_DESC) String proxyPort, @Param(value = PROXY_USERNAME, description = PROXY_USERNAME_DESC) String proxyUsername, @Param(value = PROXY_PASSWORD, description = PROXY_PASSWORD_DESC, encrypted = true) String proxyPassword, @Param(value = PRIVATE_KEY, description = PRIVATE_KEY_DESC) String privateKey, @Param(value = REMOTE_PATH, description = REMOTE_LOCATION_DESC, required = true) String remotePath, @Param(value = LOCAL_PATH, description = LOCAL_LOCATION_DESC, required = true) String localPath, @Param(value = LOCAL_FILE, description = LOCAL_FILE_DESC, required = true) String localFile, @Param(value = SSH_SESSIONS_DEFAULT_ID, description = GLOBAL_SESSION_DESC) GlobalSessionObject<Map<String, SFTPConnection>> globalSessionObject, @Param(value = CHARACTER_SET, description = CHARACTER_SET_DESC) String characterSet, @Param(value = CLOSE_SESSION, description = CLOSE_SESSION_DESC) String closeSession, @Param(value = CONNECTION_TIMEOUT, description = CONNECTION_TIMEOUT_DESC) String connectionTimeout, @Param(value = EXECUTION_TIMEOUT, description = EXECUTION_TIMEOUT_DESC) String executionTimeout) {
host = defaultIfEmpty(host, EMPTY);
port = defaultIfEmpty(port, String.valueOf(DEFAULT_PORT));
username = defaultIfEmpty(username, EMPTY);
password = defaultIfEmpty(password, EMPTY);
proxyPort = defaultIfEmpty(proxyPort, String.valueOf(DEFAULT_PROXY_PORT));
privateKey = defaultIfEmpty(privateKey, EMPTY);
remotePath = defaultIfEmpty(remotePath, EMPTY);
localPath = defaultIfEmpty(localPath, EMPTY);
localFile = defaultIfEmpty(localFile, EMPTY);
characterSet = defaultIfEmpty(characterSet, CHARACTER_SET_UTF8);
closeSession = defaultIfEmpty(closeSession, BOOLEAN_TRUE);
connectionTimeout = defaultIfEmpty(connectionTimeout, DEFAULT_CONNECTION_TIMEOUT);
executionTimeout = defaultIfEmpty(executionTimeout, DEFAULT_EXECUTION_TIMEOUT);
final List<String> exceptionMessages = verifySFTPUploadFileInputs(host, port, username, password, proxyPort, characterSet, closeSession, localPath, localFile, connectionTimeout, executionTimeout);
if (!exceptionMessages.isEmpty()) {
return getFailureResultsMap(StringUtilities.join(exceptionMessages, NEW_LINE));
}
SFTPUploadFileInputs sftpUploadFileInputs = SFTPUploadFileInputs.builder().remotePath(remotePath).localPath(localPath).localFile(localFile).sftpCommonInputs(SFTPCommonInputs.builder().host(host).port(port).username(username).password(password).proxyHost(proxyHost).proxyPort(proxyPort).proxyUsername(proxyUsername).proxyPassword(proxyPassword).privateKey(privateKey).globalSessionObject(globalSessionObject).characterSet(characterSet).closeSession(closeSession).connectionTimeout(connectionTimeout).executionTimeout(executionTimeout).build()).build();
return new SFTPService().execute(sftpUploadFileInputs, SFTPOperation.PUT);
}
Aggregations