use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.
the class AddMember method execute.
@Action(name = ADD_MEMBER, description = ADD_MEMBER_DESCRIPTION, outputs = { @Output(RETURN_RESULT), @Output(STATUS_CODE), @Output(RETURN_CODE), @Output(EXCEPTION) }, responses = { @Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) })
public Map<String, String> execute(@Param(value = HOST, description = HOST_DESCRIPTION, required = true) String hostName, @Param(value = PROTOCOL, description = PROTOCOL_DESCRIPTION) String protocol, @Param(value = AUTH_TOKEN, description = AUTH_TOKEN_DESCRIPTION, required = true) String authToken, @Param(value = SAFE_URL_ID, description = SAFE_URL_ID_DESCRIPTION, required = true) String safeUrlId, @Param(value = MEMBER_NAME, description = MEMBER_NAME_DESCRIPTION, required = true) String memberName, @Param(value = SEARCH_IN, description = SEARCH_IN_DESCRIPTION) String searchIn, @Param(value = MEMBERSHIP_EXPIRATION_DATE, description = MEMBERSHIP_EXPIRATION_DATE_DESCRIPTION) String membershipExpirationDate, @Param(value = PERMISSIONS, description = PERMISSIONS_DESCRIPTION) String permissions, @Param(value = IS_READ_ONLY, description = IS_READ_ONLY_DESCRIPTION) String isReadOnly, @Param(value = MEMBER_TYPE, description = MEMBER_TYPE_DESCRIPTION) String memberType, @Param(value = PROXY_HOST, description = PROXY_HOST_DESCRIPTION) String proxyHost, @Param(value = PROXY_PORT, description = PROXY_PORT_DESCRIPTION) String proxyPort, @Param(value = PROXY_USERNAME, description = PROXY_USERNAME_DESCRIPTION) String proxyUsername, @Param(value = PROXY_PASSWORD, encrypted = true, description = PROXY_PASSWORD_DESCRIPTION) String proxyPassword, @Param(value = TLS_VERSION, description = TLS_VERSION_DESCRIPTION) String tlsVersion, @Param(value = ALLOWED_CIPHERS, description = ALLOWED_CIPHERS_DESCRIPTION) String allowedCiphers, @Param(value = TRUST_ALL_ROOTS, description = TRUST_ALL_ROOTS_DESCRIPTION) String trustAllRoots, @Param(value = X509_HOSTNAME_VERIFIER, description = X509_HOSTNAME_VERIFIER_DESCRIPTION) String x509HostnameVerifier, @Param(value = TRUST_KEYSTORE, description = TRUST_KEYSTORE_DESCRIPTION) String trustKeystore, @Param(value = TRUST_PASSWORD, encrypted = true, description = TRUST_PASSWORD_DESCRIPTION) String trustPassword, @Param(value = KEYSTORE, description = KEYSTORE_DESCRIPTION) String keystore, @Param(value = KEYSTORE_PASSWORD, encrypted = true, description = KEYSTORE_PASSWORD_DESCRIPTION) String keystorePassword, @Param(value = CONNECT_TIMEOUT, description = CONNECT_TIMEOUT_DESCRIPTION) String connectTimeout, @Param(value = EXECUTION_TIMEOUT, description = EXECUTION_TIMEOUT_DESCRIPTION) String executionTimeout, @Param(value = KEEP_ALIVE, description = KEEP_ALIVE_DESCRIPTION) String keepAlive, @Param(value = CONNECTIONS_MAX_PER_ROUTE, description = CONNECTIONS_MAX_PER_ROUTE_DESCRIPTION) String connectionsMaxPerRoute, @Param(value = CONNECTIONS_MAX_TOTAL, description = CONNECTIONS_MAX_TOTAL_DESCRIPTION) String connectionsMaxTotal, @Param(value = SESSION_COOKIES, description = SESSION_COOKIES_DESC) SerializableSessionObject sessionCookies, @Param(value = SESSION_CONNECTION_POOL, description = SESSION_CONNECTION_POOL_DESC) GlobalSessionObject sessionConnectionPool) {
try {
validateProtocol(protocol);
JSONObject body = new JSONObject();
body.put(MEMBER_NAME, memberName);
body.put(SEARCH_IN, searchIn);
if (!StringUtils.isEmpty(membershipExpirationDate))
body.put(MEMBERSHIP_EXPIRATION_DATE, membershipExpirationDate);
JSONObject permissionsJson = new JSONObject();
if (!StringUtils.isEmpty(permissions))
Arrays.stream(permissions.trim().split(SEMICOLON)).map(permission -> permission.split(EQUALS)).forEach(permission -> permissionsJson.put(permission[0], permission[1]));
body.put(PERMISSIONS, permissionsJson);
body.put(IS_READ_ONLY, isReadOnly);
body.put(MEMBER_TYPE, memberType);
Map<String, String> result = new HttpClientPostAction().execute(protocol + PROTOCOL_DELIMITER + hostName + ADD_MEMBER_ENDPOINT + safeUrlId + MEMBERS, ANONYMOUS, EMPTY, EMPTY, EMPTY, proxyHost, proxyPort, proxyUsername, proxyPassword, tlsVersion, allowedCiphers, trustAllRoots, x509HostnameVerifier, trustKeystore, trustPassword, keystore, keystorePassword, keepAlive, connectionsMaxPerRoute, connectionsMaxTotal, EMPTY, EMPTY, CONTENT_TYPE + APPLICATION_JSON + COMMA + AUTHORIZATION + authToken, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, body.toString(), APPLICATION_JSON, EMPTY, connectTimeout, EMPTY, executionTimeout, sessionCookies, sessionConnectionPool);
processHttpResult(result);
return result;
} catch (Exception exception) {
return OutputUtilities.getFailureResultsMap(exception);
}
}
use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.
the class DeleteSafe method execute.
@Action(name = DELETE_SAFE, description = DELETE_SAFE_DESCRIPTION, outputs = { @Output(RETURN_RESULT), @Output(STATUS_CODE), @Output(RETURN_CODE), @Output(EXCEPTION) }, responses = { @Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) })
public Map<String, String> execute(@Param(value = HOST, description = HOST_DESCRIPTION, required = true) String hostname, @Param(value = PROTOCOL, description = PROTOCOL_DESCRIPTION) String protocol, @Param(value = AUTH_TOKEN, description = AUTH_TOKEN_DESCRIPTION, required = true) String authToken, @Param(value = SAFE_URL_ID, description = SAFE_URL_ID_DESCRIPTION, required = true) String safeUrlId, @Param(value = PROXY_HOST, description = PROXY_HOST_DESCRIPTION) String proxyHost, @Param(value = PROXY_PORT, description = PROXY_PORT_DESCRIPTION) String proxyPort, @Param(value = PROXY_USERNAME, description = PROXY_USERNAME_DESCRIPTION) String proxyUsername, @Param(value = PROXY_PASSWORD, encrypted = true, description = PROXY_PASSWORD_DESCRIPTION) String proxyPassword, @Param(value = TLS_VERSION, description = TLS_VERSION_DESCRIPTION) String tlsVersion, @Param(value = ALLOWED_CIPHERS, description = ALLOWED_CIPHERS_DESCRIPTION) String allowedCiphers, @Param(value = TRUST_ALL_ROOTS, description = TRUST_ALL_ROOTS_DESCRIPTION) String trustAllRoots, @Param(value = X509_HOSTNAME_VERIFIER, description = X509_HOSTNAME_VERIFIER_DESCRIPTION) String x509HostnameVerifier, @Param(value = TRUST_KEYSTORE, description = TRUST_KEYSTORE_DESCRIPTION) String trustKeystore, @Param(value = TRUST_PASSWORD, encrypted = true, description = TRUST_PASSWORD_DESCRIPTION) String trustPassword, @Param(value = KEYSTORE, description = KEYSTORE_DESCRIPTION) String keystore, @Param(value = KEYSTORE_PASSWORD, encrypted = true, description = KEYSTORE_PASSWORD_DESCRIPTION) String keystorePassword, @Param(value = CONNECT_TIMEOUT, description = CONNECT_TIMEOUT_DESCRIPTION) String connectTimeout, @Param(value = EXECUTION_TIMEOUT, description = EXECUTION_TIMEOUT_DESCRIPTION) String executionTimeout, @Param(value = KEEP_ALIVE, description = KEEP_ALIVE_DESCRIPTION) String keepAlive, @Param(value = CONNECTIONS_MAX_PER_ROUTE, description = CONNECTIONS_MAX_PER_ROUTE_DESCRIPTION) String connectionsMaxPerRoute, @Param(value = CONNECTIONS_MAX_TOTAL, description = CONNECTIONS_MAX_TOTAL_DESCRIPTION) String connectionsMaxTotal, @Param(value = SESSION_COOKIES, description = SESSION_COOKIES_DESC) SerializableSessionObject sessionCookies, @Param(value = SESSION_CONNECTION_POOL, description = SESSION_CONNECTION_POOL_DESC) GlobalSessionObject sessionConnectionPool) {
try {
validateProtocol(protocol);
Map<String, String> result = new HttpClientDeleteAction().execute(protocol + PROTOCOL_DELIMITER + hostname + DELETE_SAFE_ENDPOINT + safeUrlId, ANONYMOUS, EMPTY, EMPTY, EMPTY, proxyHost, proxyPort, proxyUsername, proxyPassword, tlsVersion, allowedCiphers, trustAllRoots, x509HostnameVerifier, trustKeystore, trustPassword, keystore, keystorePassword, keepAlive, connectionsMaxPerRoute, connectionsMaxTotal, EMPTY, CONTENT_TYPE + APPLICATION_JSON + COMMA + AUTHORIZATION + authToken, EMPTY, EMPTY, connectTimeout, EMPTY, executionTimeout, sessionCookies, sessionConnectionPool);
processHttpResult(result);
return result;
} catch (Exception exception) {
return OutputUtilities.getFailureResultsMap(exception);
}
}
use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.
the class GetAllSafeMembers method execute.
@Action(name = GET_ALL_SAFE_MEMBERS, description = GET_ALL_SAFE_MEMBERS_DESCRIPTION, outputs = { @Output(RETURN_RESULT), @Output(STATUS_CODE), @Output(RETURN_CODE), @Output(EXCEPTION) }, responses = { @Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) })
public Map<String, String> execute(@Param(value = HOST, description = HOST_DESCRIPTION, required = true) String hostname, @Param(value = PROTOCOL, description = PROTOCOL_DESCRIPTION) String protocol, @Param(value = AUTH_TOKEN, description = AUTH_TOKEN_DESCRIPTION, required = true) String authToken, @Param(value = SAFE_URL_ID, description = SAFE_URL_ID_DESCRIPTION, required = true) String safeUrlId, @Param(value = FILTER, description = FILTER_DESCRIPTION) String filter, @Param(value = SEARCH, description = SEARCH_DESCRIPTION) String search, @Param(value = OFFSET, description = OFFSET_DESCRIPTION) String offset, @Param(value = LIMIT, description = LIMIT_DESCRIPTION) String limit, @Param(value = SORT, description = SORT_DESCRIPTION) String sort, @Param(value = PROXY_HOST, description = PROXY_HOST_DESCRIPTION) String proxyHost, @Param(value = PROXY_PORT, description = PROXY_PORT_DESCRIPTION) String proxyPort, @Param(value = PROXY_USERNAME, description = PROXY_USERNAME_DESCRIPTION) String proxyUsername, @Param(value = PROXY_PASSWORD, encrypted = true, description = PROXY_PASSWORD_DESCRIPTION) String proxyPassword, @Param(value = TLS_VERSION, description = TLS_VERSION_DESCRIPTION) String tlsVersion, @Param(value = ALLOWED_CIPHERS, description = ALLOWED_CIPHERS_DESCRIPTION) String allowedCiphers, @Param(value = TRUST_ALL_ROOTS, description = TRUST_ALL_ROOTS_DESCRIPTION) String trustAllRoots, @Param(value = X509_HOSTNAME_VERIFIER, description = X509_HOSTNAME_VERIFIER_DESCRIPTION) String x509HostnameVerifier, @Param(value = TRUST_KEYSTORE, description = TRUST_KEYSTORE_DESCRIPTION) String trustKeystore, @Param(value = TRUST_PASSWORD, encrypted = true, description = TRUST_PASSWORD_DESCRIPTION) String trustPassword, @Param(value = KEYSTORE, description = KEYSTORE_DESCRIPTION) String keystore, @Param(value = KEYSTORE_PASSWORD, encrypted = true, description = KEYSTORE_PASSWORD_DESCRIPTION) String keystorePassword, @Param(value = CONNECT_TIMEOUT, description = CONNECT_TIMEOUT_DESCRIPTION) String connectTimeout, @Param(value = EXECUTION_TIMEOUT, description = EXECUTION_TIMEOUT_DESCRIPTION) String executionTimeout, @Param(value = KEEP_ALIVE, description = KEEP_ALIVE_DESCRIPTION) String keepAlive, @Param(value = CONNECTIONS_MAX_PER_ROUTE, description = CONNECTIONS_MAX_PER_ROUTE_DESCRIPTION) String connectionsMaxPerRoute, @Param(value = CONNECTIONS_MAX_TOTAL, description = CONNECTIONS_MAX_TOTAL_DESCRIPTION) String connectionsMaxTotal, @Param(value = SESSION_COOKIES, description = SESSION_COOKIES_DESC) SerializableSessionObject sessionCookies, @Param(value = SESSION_CONNECTION_POOL, description = SESSION_CONNECTION_POOL_DESC) GlobalSessionObject sessionConnectionPool) {
Map<String, String> queryParams = new HashMap<>();
queryParams.put(FILTER, filter);
queryParams.put(SEARCH, search);
queryParams.put(OFFSET, offset);
queryParams.put(LIMIT, limit);
queryParams.put(SORT, sort);
try {
validateProtocol(protocol);
Map<String, String> result = new HttpClientGetAction().execute(protocol + PROTOCOL_DELIMITER + hostname + GET_ALL_SAFES_ENDPOINT + FORWARD_SLASH + safeUrlId + MEMBERS + FORWARD_SLASH, ANONYMOUS, EMPTY, EMPTY, EMPTY, proxyHost, proxyPort, proxyUsername, proxyPassword, tlsVersion, allowedCiphers, trustAllRoots, x509HostnameVerifier, trustKeystore, trustPassword, keystore, keystorePassword, keepAlive, connectionsMaxPerRoute, connectionsMaxTotal, EMPTY, EMPTY, CONTENT_TYPE + APPLICATION_JSON + COMMA + AUTHORIZATION + authToken, EMPTY, EMPTY, getQueryParamsString(queryParams), EMPTY, EMPTY, connectTimeout, EMPTY, executionTimeout, sessionCookies, sessionConnectionPool);
processHttpResult(result);
return result;
} catch (Exception exception) {
return OutputUtilities.getFailureResultsMap(exception);
}
}
use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.
the class GetAllSafes method execute.
@Action(name = GET_ALL_SAFES, description = GET_ALL_SAFES_DESCRIPTION, outputs = { @Output(RETURN_RESULT), @Output(STATUS_CODE), @Output(RETURN_CODE), @Output(EXCEPTION) }, responses = { @Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) })
public Map<String, String> execute(@Param(value = HOST, description = HOST_DESCRIPTION, required = true) String hostname, @Param(value = PROTOCOL, description = PROTOCOL_DESCRIPTION) String protocol, @Param(value = AUTH_TOKEN, description = AUTH_TOKEN_DESCRIPTION, required = true) String authToken, @Param(value = SEARCH, description = SEARCH_DESCRIPTION) String search, @Param(value = OFFSET, description = OFFSET_DESCRIPTION) String offset, @Param(value = SORT, description = SORT_DESCRIPTION) String sort, @Param(value = LIMIT, description = LIMIT_DESCRIPTION) String limit, @Param(value = INCLUDE_ACCOUNTS, description = INCLUDE_ACCOUNTS_DESCRIPTION) String includeAccounts, @Param(value = EXTENDED_DETAILS, description = EXTENDED_DETAILS_DESCRIPTION) String extendedDetails, @Param(value = PROXY_HOST, description = PROXY_HOST_DESCRIPTION) String proxyHost, @Param(value = PROXY_PORT, description = PROXY_PORT_DESCRIPTION) String proxyPort, @Param(value = PROXY_USERNAME, description = PROXY_USERNAME_DESCRIPTION) String proxyUsername, @Param(value = PROXY_PASSWORD, encrypted = true, description = PROXY_PASSWORD_DESCRIPTION) String proxyPassword, @Param(value = TLS_VERSION, description = TLS_VERSION_DESCRIPTION) String tlsVersion, @Param(value = ALLOWED_CIPHERS, description = ALLOWED_CIPHERS_DESCRIPTION) String allowedCiphers, @Param(value = TRUST_ALL_ROOTS, description = TRUST_ALL_ROOTS_DESCRIPTION) String trustAllRoots, @Param(value = X509_HOSTNAME_VERIFIER, description = X509_HOSTNAME_VERIFIER_DESCRIPTION) String x509HostnameVerifier, @Param(value = TRUST_KEYSTORE, description = TRUST_KEYSTORE_DESCRIPTION) String trustKeystore, @Param(value = TRUST_PASSWORD, encrypted = true, description = TRUST_PASSWORD_DESCRIPTION) String trustPassword, @Param(value = KEYSTORE, description = KEYSTORE_DESCRIPTION) String keystore, @Param(value = KEYSTORE_PASSWORD, encrypted = true, description = KEYSTORE_PASSWORD_DESCRIPTION) String keystorePassword, @Param(value = CONNECT_TIMEOUT, description = CONNECT_TIMEOUT_DESCRIPTION) String connectTimeout, @Param(value = EXECUTION_TIMEOUT, description = EXECUTION_TIMEOUT_DESCRIPTION) String executionTimeout, @Param(value = KEEP_ALIVE, description = KEEP_ALIVE_DESCRIPTION) String keepAlive, @Param(value = CONNECTIONS_MAX_PER_ROUTE, description = CONNECTIONS_MAX_PER_ROUTE_DESCRIPTION) String connectionsMaxPerRoute, @Param(value = CONNECTIONS_MAX_TOTAL, description = CONNECTIONS_MAX_TOTAL_DESCRIPTION) String connectionsMaxTotal, @Param(value = SESSION_COOKIES, description = SESSION_COOKIES_DESC) SerializableSessionObject sessionCookies, @Param(value = SESSION_CONNECTION_POOL, description = SESSION_CONNECTION_POOL_DESC) GlobalSessionObject sessionConnectionPool) {
Map<String, String> queryParams = new HashMap<>();
queryParams.put(SEARCH, search);
queryParams.put(OFFSET, offset);
queryParams.put(SORT, sort);
queryParams.put(LIMIT, limit);
queryParams.put(INCLUDE_ACCOUNTS, includeAccounts);
queryParams.put(EXTENDED_DETAILS, extendedDetails);
try {
validateProtocol(protocol);
Map<String, String> result = new HttpClientGetAction().execute(protocol + PROTOCOL_DELIMITER + hostname + GET_ALL_SAFES_ENDPOINT, ANONYMOUS, EMPTY, EMPTY, EMPTY, proxyHost, proxyPort, proxyUsername, proxyPassword, tlsVersion, allowedCiphers, trustAllRoots, x509HostnameVerifier, trustKeystore, trustPassword, keystore, keystorePassword, keepAlive, connectionsMaxPerRoute, connectionsMaxTotal, EMPTY, EMPTY, CONTENT_TYPE + APPLICATION_JSON + COMMA + AUTHORIZATION + authToken, EMPTY, EMPTY, getQueryParamsString(queryParams), EMPTY, EMPTY, connectTimeout, EMPTY, executionTimeout, sessionCookies, sessionConnectionPool);
processHttpResult(result);
return result;
} catch (Exception exception) {
return OutputUtilities.getFailureResultsMap(exception);
}
}
use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.
the class GetClusterDetails method execute.
/**
* Retrieves cluster information.
* https://developer.couchbase.com/documentation/server/4.6/rest-api/rest-cluster-get.html
*
* @param endpoint Endpoint to which request will be sent. A valid endpoint will be formatted as it shows in
* bellow example.
* Example: "http://somewhere.couchbase.com:8091"
* @param username Username used in basic authentication.
* @param password Password associated with "username" input to be used in basic authentication.
* @param proxyHost Optional - proxy server used to connect to Couchbase API. If empty no proxy will be used.
* @param proxyPort Optional - proxy server port. You must either specify values for both proxyHost and
* proxyPort inputs or leave them both empty.
* @param proxyUsername Optional - proxy server user name.
* @param proxyPassword Optional - proxy server password associated with the proxyUsername input value.
* @param trustAllRoots Optional - specifies whether to enable weak security over SSL/TSL. A certificate is
* trusted even if no trusted certification authority issued it.
* Valid values: "true", "false"
* Default value: "true"
* @param x509HostnameVerifier Optional - specifies the way the server hostname must match a domain name in the subject's
* Common Name (CN) or subjectAltName field of the X.509 certificate. Set this to "allow_all"
* to skip any checking. For the value "browser_compatible" the hostname verifier works
* the same way as Curl and Firefox. The hostname must match either the first CN, or any
* of the subject-alts. A wildcard can occur in the CN, and in any of the subject-alts.
* The only difference between "browser_compatible" and "strict" is that a wildcard (such
* as "*.foo.com") with "browser_compatible" matches all subdomains, including "a.b.foo.com".
* Valid values: "strict", "browser_compatible", "allow_all"
* Default value: "allow_all"
* @param trustKeystore Optional - pathname of the Java TrustStore file. This contains certificates from other
* parties that you expect to communicate with, or from Certificate Authorities that you
* trust to identify other parties. If the protocol (specified by the "url") is not "https"
* or if trustAllRoots is "true" this input is ignored.
* Default value: ../java/lib/security/cacerts
* Format: Java KeyStore (JKS)
* @param trustPassword Optional - password associated with the TrustStore file. If trustAllRoots is "false"
* and trustKeystore is empty, trustPassword default will be supplied.
* Default value: "changeit"
* @param keystore Optional - pathname of the Java KeyStore file. You only need this if the server requires
* client authentication. If the protocol (specified by the "url") is not "https" or if
* trustAllRoots is "true" this input is ignored.
* Format: Java KeyStore (JKS)
* Default value: ../java/lib/security/cacerts.
* @param keystorePassword Optional - password associated with the KeyStore file. If trustAllRoots is "false" and
* keystore is empty, keystorePassword default will be supplied.
* Default value: "changeit"
* @param connectTimeout Optional - time to wait for a connection to be established, in seconds. A timeout value
* of "0" represents an infinite timeout.
* Default value: "0"
* @param socketTimeout Optional - timeout for waiting for data (a maximum period inactivity between two
* consecutive data packets), in seconds. A socketTimeout value of "0" represents an
* infinite timeout.
* Default value: "0"
* @param useCookies Optional - specifies whether to enable cookie tracking or not. Cookies are stored between
* consecutive calls in a serializable session object therefore they will be available on
* a branch level. If you specify a non-boolean value, the default value is used.
* Valid values: "true", "false"
* Default value: "true"
* @param keepAlive Optional - specifies whether to create a shared connection that will be used in subsequent
* calls. If keepAlive is "false", the already open connection will be used and after
* execution it will close it.
* Valid values: "true", "false"
* Default value: "true"
* @return A map with strings as keys and strings as values that contains: outcome of the action (or failure message
* and the exception if there is one), returnCode of the operation and the ID of the request
*/
@Action(name = "Get Cluster Details", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(EXCEPTION) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) })
public Map<String, String> execute(@Param(value = ENDPOINT, required = true) String endpoint, @Param(value = USERNAME, required = true) String username, @Param(value = PASSWORD, required = true, encrypted = true) String password, @Param(value = PROXY_HOST) String proxyHost, @Param(value = PROXY_PORT) String proxyPort, @Param(value = PROXY_USERNAME) String proxyUsername, @Param(value = PROXY_PASSWORD, encrypted = true) String proxyPassword, @Param(value = TRUST_ALL_ROOTS) String trustAllRoots, @Param(value = X509_HOSTNAME_VERIFIER) String x509HostnameVerifier, @Param(value = TRUST_KEYSTORE) String trustKeystore, @Param(value = TRUST_PASSWORD, encrypted = true) String trustPassword, @Param(value = KEYSTORE) String keystore, @Param(value = KEYSTORE_PASSWORD, encrypted = true) String keystorePassword, @Param(value = CONNECT_TIMEOUT) String connectTimeout, @Param(value = SOCKET_TIMEOUT) String socketTimeout, @Param(value = USE_COOKIES) String useCookies, @Param(value = KEEP_ALIVE) String keepAlive) {
try {
final HttpClientInputs httpClientInputs = getHttpClientInputs(username, password, proxyHost, proxyPort, proxyUsername, proxyPassword, trustAllRoots, x509HostnameVerifier, trustKeystore, trustPassword, keystore, keystorePassword, connectTimeout, socketTimeout, useCookies, keepAlive, METHOD_NAME);
final CommonInputs commonInputs = new CommonInputs.Builder().withAction(GET_CLUSTER_DETAILS).withApi(CLUSTER).withEndpoint(endpoint).build();
return new CouchbaseService().execute(httpClientInputs, commonInputs);
} catch (Exception exception) {
return getFailureResultsMap(exception);
}
}
Aggregations