use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.
the class CreateOrEditBucket method execute.
/**
* Create new bucket with provided name or edit specified bucket if already exist.
* https://developer.couchbase.com/documentation/server/4.6/rest-api/rest-bucket-create.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"
* @param bucketName Name of the bucket to be created/edited
* @param authType Optional - type of authorization to be enabled for the new bucket. Defaults to
* blank password if not specified. "sasl" enables authentication, "none" disables
* authentication.
* Valid values: "none", "sasl"
* Default value: "none"
* @param bucketType Optional - type of bucket to be created. "memcached" configures as Memcached
* bucket, "couchbase" configures as Couchbase bucket.
* Valid values: "couchbase", "memcached"
* Default value: "memcached"
* Note: bucketType value cannot be changed for a pre-existing bucket.
* @param conflictResolutionType Optional - "lww" means timestamp-based conflict resolution, "seqno" means revision
* ID-based conflict resolution.
* Valid values: "lww", "seqno"
* Default value: "seqno"
* Note: conflictResolutionType value cannot be changed once a bucket has been created.
* @param couchbaseProxyPort Optional - proxy port on which the bucket communicates. Must be a valid network
* port which is not already in use. You must provide a valid port number if the
* authorization type is not "sasl".
* @param evictionPolicy Optional - parameter that determines what is ejected: only the value or the key,
* value, and all metadata.
* Valid values: "fullEviction", "valueOnly"
* Default value: "valueOnly"
* Note: If you change the ejection policy of a pre-existing bucket then it will
* be restarted, resulting in temporary inaccessibility of data while the bucket
* warms up.
* @param flushEnabled Optional - enables/disables the "flush all" functionality of the bucket.
* Valid values: "true", "false"
* Default value: "false"
* @param parallelDBAndViewCompaction Optional - indicates whether database and view files on disk can be compacted
* simultaneously.
* Valid values: "true", "false"
* Default value: "false"
* @param ramQuotaMB Optional - RAM Quota for new bucket in MB. Minimum you can specify is 100, and
* the maximum can only be as great as the memory quota established for the node.
* If other buckets are associated with a node, RAM Quota can only be as large as
* the amount memory remaining for the node, accounting for the other bucket memory
* quota.
* Default value: "100"
* @param replicaIndex Optional - enables/disables replica indexes for replica bucket data
* Valid values: "true", "false"
* Default value: "true"
* Note: replicaIndex value cannot be changed for a pre-existing bucket.
* @param replicaNumber Optional - number of replicas to be configured for this bucket. Required parameter
* when creating a Couchbase bucket.
* Valid values: "0", "1", "2", "3"
* Default value: "1"
* @param saslPassword Optional - Password for SASL authentication. Required if SASL authentication has
* been enabled.
* @param threadsNumber Optional - change the number of concurrent readers and writers for the data bucket.
* Valid values: "2", "3", "4", "5", "6", "7", "8"
* Default value: "2"
* Note: If you change this setting for a pre-existing bucket then it will be restarted,
* resulting in temporary inaccessibility of data while the bucket warms up.
* @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 = "Create Or Edit Bucket", 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, @Param(value = BUCKET_NAME, required = true) String bucketName, @Param(value = AUTH_TYPE) String authType, @Param(value = BUCKET_TYPE) String bucketType, @Param(value = CONFLICT_RESOLUTION_TYPE) String conflictResolutionType, @Param(value = COUCHBASE_PROXY_PORT) String couchbaseProxyPort, @Param(value = EVICTION_POLICY) String evictionPolicy, @Param(value = FLUSH_ENABLED) String flushEnabled, @Param(value = PARALLEL_DB_VIEW_COMPACTION) String parallelDBAndViewCompaction, @Param(value = RAM_QUOTA_DB) String ramQuotaMB, @Param(value = REPLICA_INDEX) String replicaIndex, @Param(value = REPLICA_NUMBER) String replicaNumber, @Param(value = SASL_PASSWORD) String saslPassword, @Param(value = THREADS_NUMBER) String threadsNumber) {
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(CREATE_OR_EDIT_BUCKET).withApi(BUCKETS).withEndpoint(endpoint).build();
final BucketInputs bucketInputs = new BucketInputs.Builder().withBucketName(bucketName).withAuthType(authType).withBucketType(bucketType).withConflictResolutionType(conflictResolutionType).withProxyPort(couchbaseProxyPort).withEvictionPolicy(evictionPolicy).withFlushEnabled(flushEnabled).withParallelDBAndViewCompaction(parallelDBAndViewCompaction).withRamQuotaMB(ramQuotaMB).withReplicaIndex(replicaIndex).withReplicaNumber(replicaNumber).withSaslPassword(saslPassword).withThreadsNumber(threadsNumber).build();
return new CouchbaseService().execute(httpClientInputs, commonInputs, bucketInputs);
} catch (Exception exception) {
return getFailureResultsMap(exception);
}
}
use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.
the class DeleteBucket method execute.
/**
* Deletes specified bucket.
* https://developer.couchbase.com/documentation/server/4.6/rest-api/rest-bucket-delete.html
*
* Note: Bucket deletion is a synchronous operation. When a cluster has multiple servers, some servers might not be
* able to delete the bucket within the standard 30 second timeout period.
* If the bucket is deleted on all servers within the standard timeout of 30 seconds, a 200 response code is returned.
* If the bucket is not deleted on all servers within the 30 second timeout, a 500 error code is returned.
* If the bucket is not deleted on all servers and another request is made to delete the bucket, a 404 error code is
* returned.
* If the bucket is not deleted on all servers and a request is made to crate a new bucket with the same name, an error
* might be returned indicating that the bucket is still being deleted.
*
* @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"
* @param bucketName Name of the bucket to be deleted
* @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 = "Delete Bucket", 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, @Param(value = BUCKET_NAME, required = true) String bucketName) {
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(DELETE_BUCKET).withApi(BUCKETS).withEndpoint(endpoint).build();
final BucketInputs bucketInputs = new BucketInputs.Builder().withBucketName(bucketName).build();
return new CouchbaseService().execute(httpClientInputs, commonInputs, bucketInputs);
} catch (Exception exception) {
return getFailureResultsMap(exception);
}
}
use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.
the class FlushBucket method execute.
/**
* Empties the contents of the specified bucket, deleting all stored data..
* https://docs.couchbase.com/server/6.5/rest-api/rest-bucket-flush.html
* <p>
* Note:
* 1. The Flush Bucket operation succeeds only if flush was configured either during the initial bucket setup or after
* the bucket settings have been changed.
* 2. Parameters and payload data are ignored, but the request must including the authorization header if the system
* has been secured.
* 3. The flush request may lead to significant disk activity as the data in the bucket is deleted from the database.
* The high disk utilization may affect the performance of your server until the data has been successfully deleted.
* 4. The flush request is not transmitted over XDCR replication configurations. The remote bucket is not flushed.
* <p>
* Warning: It is recommended that the flush capability is not used in production systems as it irreversibly deletes
* every document in the bucket. Even for use cases where this is the desired behaviour, flushing is not recommended
* as it is a very disruptive process. You can control and limit the ability to flush individual buckets by setting
* the flushEnabled parameter on a bucket in the Couchbase Web Console.
*
* @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"
* @param bucketName Name of the bucket to be deleted
* @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 = "Flush Bucket", 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, @Param(value = BUCKET_NAME, required = true) String bucketName) {
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(FLUSH_BUCKET).withApi(BUCKETS).withEndpoint(endpoint).build();
final BucketInputs bucketInputs = new BucketInputs.Builder().withBucketName(bucketName).build();
return new CouchbaseService().execute(httpClientInputs, commonInputs, bucketInputs);
} catch (Exception exception) {
return getFailureResultsMap(exception);
}
}
use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.
the class DeleteAccount method execute.
@Action(name = DELETE_ACCOUNT, description = DELETE_ACCOUNT_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 = ID, description = ID_DESCRIPTION, required = true) String id, @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_ACCOUNT_ENDPOINT + FORWARD_SLASH + id, 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 GetPasswordValue method execute.
@Action(name = GET_PASSWORD_VALUE, description = GET_PASSWORD_VALUE_DESCRIPTION, outputs = { @Output(RETURN_RESULT), @Output(STATUS_CODE), @Output(RETURN_CODE), @Output(EXCEPTION), @Output(PASSWORD_VALUE) }, 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 = APP_ID, description = APP_ID_DESCRIPTION, required = true) String appId, @Param(value = QUERY, description = QUERY_DESCRIPTION) String query, @Param(value = QUERY_FORMAT, description = QUERY_FORMAT_DESCRIPTION) String queryFormat, @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(APP_ID, appId);
queryParams.put(QUERY, query);
queryParams.put(QUERY_FORMAT, queryFormat);
try {
validateProtocol(protocol);
Map<String, String> result = new HttpClientGetAction().execute(protocol + PROTOCOL_DELIMITER + hostname + GET_PASSWORD_VALUE_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, EMPTY, EMPTY, getQueryParamsString(queryParams), EMPTY, EMPTY, connectTimeout, EMPTY, executionTimeout, sessionCookies, sessionConnectionPool);
processHttpResult(result);
if (result.get(RETURN_CODE).equals("0")) {
JSONParser parser = new JSONParser();
JSONObject json = (JSONObject) parser.parse(result.get(RETURN_RESULT));
result.put(PASSWORD_VALUE, json.getAsString(CONTENT));
}
return result;
} catch (Exception exception) {
return OutputUtilities.getFailureResultsMap(exception);
}
}
Aggregations