当前位置: 首页>>代码示例>>Java>>正文


Java ResponseType类代码示例

本文整理汇总了Java中com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType的典型用法代码示例。如果您正苦于以下问题:Java ResponseType类的具体用法?Java ResponseType怎么用?Java ResponseType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ResponseType类属于com.hp.oo.sdk.content.plugin.ActionMetadata包,在下文中一共展示了ResponseType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeEmptyElements

import com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType; //导入依赖的package包/类
@Action(name = "Remove Empty Elements",
        outputs = {
                @Output(OutputNames.RETURN_CODE),
                @Output(OutputNames.RETURN_RESULT)
        },
        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> removeEmptyElements(@Param(value = Constants.InputNames.JSON_OBJECT, required = true) String json) {
    try {
        final String result = new JsonService().removeEmptyElementsJson(json);
        return OutputUtilities.getSuccessResultsMap(result);
    } catch (Exception ex) {
        return OutputUtilities.getFailureResultsMap(ex);
    }

}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:19,代码来源:RemoveEmptyElementAction.java

示例2: execute

import com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType; //导入依赖的package包/类
/**
 * This operation takes a reference to JSON (in the form of a string) and runs a specified JSON Path query on it.
 * It returns the results as a JSON Object.
 *
 * @param jsonObject The JSON in the form of a string.
 * @param jsonPath   The JSON Path query to run.
 * @return           A map which contains the resulted JSON from the given path.
 */
@Action(name = "JSON Path Query",
        outputs = {
                @Output(OutputNames.RETURN_RESULT),
                @Output(OutputNames.RETURN_CODE),
                @Output(OutputNames.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 = Constants.InputNames.JSON_OBJECT, required = true) String jsonObject,
        @Param(value = Constants.InputNames.JSON_PATH, required = true) String jsonPath) {
    try {
        final JsonNode jsonNode = JsonService.evaluateJsonPathQuery(jsonObject, jsonPath);
        if (!jsonNode.isNull()) {
            return OutputUtilities.getSuccessResultsMap(jsonNode.toString());
        }
        return OutputUtilities.getSuccessResultsMap(NULL_STRING);
    } catch (Exception exception) {
        return OutputUtilities.getFailureResultsMap(exception);
    }
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:32,代码来源:JsonPathQuery.java

示例3: copyTo

import com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType; //导入依赖的package包/类
/**
 * Executes a Shell command(s) on the remote machine using the SSH protocol.
 *
 * @param sourceHost The hostname or ip address of the source remote machine.
 * @param sourcePath The path to the file that needs to be copied from the source remote machine.
 * @param sourcePort The port number for running the command on the source remote machine.
 * @param sourceUsername The username of the account on the source remote machine.
 * @param sourcePassword The password of the user for the source remote machine.
 * @param sourcePrivateKeyFile The path to the private key file (OpenSSH type) on the source machine.
 * @param destinationHost The hostname or ip address of the destination remote machine.
 * @param destinationPath The path to the location where the file will be copied on the destination remote machine.
 * @param destinationPort The port number for running the command on the destination remote machine.
 * @param destinationUsername The username of the account on the destination remote machine.
 * @param destinationPassword The password of the user for the destination remote machine.
 * @param destinationPrivateKeyFile The path to the private key file (OpenSSH type) on the destination machine.
 * @param knownHostsPolicy The policy used for managing known_hosts file. Valid values: allow, strict, add. Default value: strict
 * @param knownHostsPath The path to the known hosts file.
 * @param timeout Time in milliseconds to wait for the command to complete. Default value is 90000 (90 seconds)
 * @param proxyHost The HTTP proxy host
 * @param proxyPort The HTTP proxy port
 *
 * @return - a map containing the output of the operation. Keys present in the map are:
 *     <br><b>returnResult</b> - The primary output.
 *     <br><b>returnCode</b> - the return code of the operation. 0 if the operation goes to success, -1 if the operation goes to failure.
 *     <br><b>exception</b> - the exception message if the operation goes to failure.
 *
 */

@Action(name = "Remote Secure Copy",
        outputs = {
                @Output(Constants.OutputNames.RETURN_CODE),
                @Output(Constants.OutputNames.RETURN_RESULT),
                @Output(Constants.OutputNames.EXCEPTION)
        },
        responses = {
                @Response(text = Constants.ResponseNames.SUCCESS, field = Constants.OutputNames.RETURN_CODE, value = Constants.ReturnCodes.RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
                @Response(text = Constants.ResponseNames.FAILURE, field = Constants.OutputNames.RETURN_CODE, value = Constants.ReturnCodes.RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
        }
)
public Map<String, String> copyTo(
        @Param(value = Constants.InputNames.SOURCE_HOST) String sourceHost,
        @Param(value = Constants.InputNames.SOURCE_PATH, required = true) String sourcePath,
        @Param(Constants.InputNames.SOURCE_PORT) String sourcePort,
        @Param(Constants.InputNames.SOURCE_USERNAME) String sourceUsername,
        @Param(value = Constants.InputNames.SOURCE_PASSWORD, encrypted = true) String sourcePassword,
        @Param(Constants.InputNames.SOURCE_PRIVATE_KEY_FILE) String sourcePrivateKeyFile,
        @Param(value = Constants.InputNames.DESTINATION_HOST, required = true) String destinationHost,
        @Param(value = Constants.InputNames.DESTINATION_PATH, required = true) String destinationPath,
        @Param(Constants.InputNames.DESTINATION_PORT) String destinationPort,
        @Param(value = Constants.InputNames.DESTINATION_USERNAME, required = true) String destinationUsername,
        @Param(value = Constants.InputNames.DESTINATION_PASSWORD, encrypted = true) String destinationPassword,
        @Param(Constants.InputNames.DESTINATION_PRIVATE_KEY_FILE) String destinationPrivateKeyFile,
        @Param(Constants.InputNames.KNOWN_HOSTS_POLICY) String knownHostsPolicy,
        @Param(Constants.InputNames.KNOWN_HOSTS_PATH) String knownHostsPath,
        @Param(Constants.InputNames.TIMEOUT) String timeout,
        @Param(Constants.InputNames.PROXY_HOST) String proxyHost,
        @Param(Constants.InputNames.PROXY_PORT) String proxyPort) {

    RemoteSecureCopyInputs remoteSecureCopyInputs = new RemoteSecureCopyInputs(sourcePath, destinationHost, destinationPath, destinationUsername);
    remoteSecureCopyInputs.setSrcHost(sourceHost);
    remoteSecureCopyInputs.setSrcPort(sourcePort);
    remoteSecureCopyInputs.setSrcPrivateKeyFile(sourcePrivateKeyFile);
    remoteSecureCopyInputs.setSrcUsername(sourceUsername);
    remoteSecureCopyInputs.setSrcPassword(sourcePassword);
    remoteSecureCopyInputs.setDestPort(destinationPort);
    remoteSecureCopyInputs.setDestPrivateKeyFile(destinationPrivateKeyFile);
    remoteSecureCopyInputs.setDestPassword(destinationPassword);
    remoteSecureCopyInputs.setKnownHostsPolicy(knownHostsPolicy);
    remoteSecureCopyInputs.setKnownHostsPath(knownHostsPath);
    remoteSecureCopyInputs.setTimeout(timeout);
    remoteSecureCopyInputs.setProxyHost(proxyHost);
    remoteSecureCopyInputs.setProxyPort(proxyPort);

    return new RemoteSecureCopyService().execute(remoteSecureCopyInputs);

}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:77,代码来源:RemoteSecureCopyAction.java

示例4: listVMsAndTemplates

import com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType; //导入依赖的package包/类
/**
 * Connects to a specified data center and to retrieve retrieve a list with all the virtual machines and templates
 * within.
 *
 * @param host          VMware host or IP - Example: "vc6.subdomain.example.com"
 * @param port          optional - the port to connect through - Examples: "443", "80" - Default: "443"
 * @param protocol      optional - the connection protocol - Valid: "http", "https" - Default: "https"
 * @param username      the VMware username use to connect
 * @param password      the password associated with "username" input
 * @param trustEveryone optional - if "true" will allow connections from any host, if "false" the connection will
 *                      be allowed only using a valid vCenter certificate - Default: "true"
 *                      Check the: https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_java_development.4.3.html
 *                      to see how to import a certificate into Java Keystore and
 *                      https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_sg_server_certificate_Appendix.6.4.html
 *                      to see how to obtain a valid vCenter certificate
 * @param closeSession  Whether to use the flow session context to cache the Connection to the host or not. If set to
 *                      "false" it will close and remove any connection from the session context, otherwise the Connection
 *                      will be kept alive and not removed.
 *                      Valid values: "true", "false"
 *                      Default value: "true"
 * @param delimiter     the delimiter that will be used in response list - Default: ","
 * @return resultMap with String as key and value that contains returnCode of the operation, a list that contains
 * all the virtual machines and templates within the data center  or failure message and the exception if there is
 * one
 */
@Action(name = "List VMs and Templates",
        outputs = {
                @Output(Outputs.RETURN_CODE),
                @Output(Outputs.RETURN_RESULT),
                @Output(Outputs.EXCEPTION)
        },
        responses = {
                @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
                @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
        })
public Map<String, String> listVMsAndTemplates(@Param(value = HOST, required = true) String host,
                                               @Param(value = PORT) String port,
                                               @Param(value = PROTOCOL) String protocol,
                                               @Param(value = USERNAME, required = true) String username,
                                               @Param(value = PASSWORD, encrypted = true) String password,
                                               @Param(value = TRUST_EVERYONE) String trustEveryone,
                                               @Param(value = CLOSE_SESSION) String closeSession,

                                               @Param(value = DELIMITER) String delimiter,
                                               @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) {
    try {
        final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder()
                .withHost(host)
                .withPort(port)
                .withProtocol(protocol)
                .withUsername(username)
                .withPassword(password)
                .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE))
                .withCloseSession(defaultIfEmpty(closeSession, TRUE))
                .withGlobalSessionObject(globalSessionObject)
                .build();

        final VmInputs vmInputs = new VmInputs.VmInputsBuilder().build();

        return new VmService().listVMsAndTemplates(httpInputs, vmInputs, delimiter);
    } catch (Exception ex) {
        return getFailureResultsMap(ex);
    }
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:67,代码来源:ListVMsAndTemplates.java

示例5: deleteVM

import com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType; //导入依赖的package包/类
/**
 * Connects to a specified data center and deletes a virtual machine identified by the inputs provided.
 *
 * @param host               VMware host or IP - Example: "vc6.subdomain.example.com"
 * @param port               optional - the port to connect through - Examples: "443", "80" - Default: "443"
 * @param protocol           optional - the connection protocol - Valid: "http", "https" - Default: "https"
 * @param username           the VMware username use to connect
 * @param password           the password associated with "username" input
 * @param trustEveryone      optional - if "true" will allow connections from any host, if "false" the connection will
 *                           be allowed only using a valid vCenter certificate - Default: "true"
 *                           Check the: https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_java_development.4.3.html
 *                           to see how to import a certificate into Java Keystore and
 *                           https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_sg_server_certificate_Appendix.6.4.html
 *                           to see how to obtain a valid vCenter certificate
 * @param closeSession       Whether to use the flow session context to cache the Connection to the host or not. If set to
 *                           "false" it will close and remove any connection from the session context, otherwise the Connection
 *                           will be kept alive and not removed.
 *                           Valid values: "true", "false"
 *                           Default value: "true"
 * @param virtualMachineName the name of the virtual machine that will be deleted
 * @return resultMap with String as key and value that contains returnCode of the operation, success message with
 * task id of the execution or failure message and the exception if there is one
 */
@Action(name = "Delete Virtual Machine",
        outputs = {
                @Output(Outputs.RETURN_CODE),
                @Output(Outputs.RETURN_RESULT),
                @Output(Outputs.EXCEPTION)
        },
        responses = {
                @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
                @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
        })
public Map<String, String> deleteVM(@Param(value = HOST, required = true) String host,
                                    @Param(value = PORT) String port,
                                    @Param(value = PROTOCOL) String protocol,
                                    @Param(value = USERNAME, required = true) String username,
                                    @Param(value = PASSWORD, encrypted = true) String password,
                                    @Param(value = TRUST_EVERYONE) String trustEveryone,
                                    @Param(value = CLOSE_SESSION) String closeSession,

                                    @Param(value = VM_NAME, required = true) String virtualMachineName,
                                    @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) {

    try {
        final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder()
                .withHost(host)
                .withPort(port)
                .withProtocol(protocol)
                .withUsername(username)
                .withPassword(password)
                .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE))
                .withCloseSession(defaultIfEmpty(closeSession, TRUE))
                .withGlobalSessionObject(globalSessionObject)
                .build();

        final VmInputs vmInputs = new VmInputs.VmInputsBuilder()
                .withVirtualMachineName(virtualMachineName)
                .build();

        return new VmService().deleteVM(httpInputs, vmInputs);
    } catch (Exception ex) {
        return OutputUtilities.getFailureResultsMap(ex);
    }

}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:69,代码来源:DeleteVM.java

示例6: getOsDescriptors

import com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType; //导入依赖的package包/类
/**
 * Connects to a data center to retrieve a list with all the guest operating system descriptors supported by the
 * host system.
 *
 * @param host           VMware host or IP - Example: "vc6.subdomain.example.com"
 * @param port           optional - the port to connect through - Examples: "443", "80" - Default: "443"
 * @param protocol       optional - the connection protocol - Valid: "http", "https" - Default: "https"
 * @param username       the VMware username use to connect
 * @param password       the password associated with "username" input
 * @param trustEveryone  optional - if "true" will allow connections from any host, if "false" the connection will be
 *                       allowed only using a valid vCenter certificate - Default: "true"
 *                       Check the: https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_java_development.4.3.html
 *                       to see how to import a certificate into Java Keystore and
 *                       https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_sg_server_certificate_Appendix.6.4.html
 *                       to see how to obtain a valid vCenter certificate
 * @param closeSession   Whether to use the flow session context to cache the Connection to the host or not. If set to
 *                       "false" it will close and remove any connection from the session context, otherwise the Connection
 *                       will be kept alive and not removed.
 *                       Valid values: "true", "false"
 *                       Default value: "true"
 * @param dataCenterName the data center name where the host system is - Example: 'DataCenter2'
 * @param hostname       the name of the target host to be queried to retrieve the supported guest OSes
 *                       - Example: 'host123.subdomain.example.com'
 * @param delimiter      the delimiter that will be used in response list - Default: ","
 * @return resultMap with String as key and value that contains returnCode of the operation, a list that contains all the
 * guest operating system descriptors supported by the host system or failure message and the exception if there is one
 */
@Action(name = "Get OS Descriptors",
        outputs = {
                @Output(Outputs.RETURN_CODE),
                @Output(Outputs.RETURN_RESULT),
                @Output(Outputs.EXCEPTION)
        },
        responses = {
                @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
                @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
        })
public Map<String, String> getOsDescriptors(@Param(value = HOST, required = true) String host,
                                            @Param(value = PORT) String port,
                                            @Param(value = PROTOCOL) String protocol,
                                            @Param(value = USERNAME, required = true) String username,
                                            @Param(value = PASSWORD, encrypted = true) String password,
                                            @Param(value = TRUST_EVERYONE) String trustEveryone,
                                            @Param(value = CLOSE_SESSION) String closeSession,

                                            @Param(value = DATA_CENTER_NAME, required = true) String dataCenterName,
                                            @Param(value = HOSTNAME, required = true) String hostname,

                                            @Param(value = DELIMITER) String delimiter,
                                            @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) {

    try {
        final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder()
                .withHost(host)
                .withPort(port)
                .withProtocol(protocol)
                .withUsername(username)
                .withPassword(password)
                .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE))
                .withCloseSession(defaultIfEmpty(closeSession, TRUE))
                .withGlobalSessionObject(globalSessionObject)
                .build();

        final VmInputs vmInputs = new VmInputs.VmInputsBuilder()
                .withDataCenterName(dataCenterName)
                .withHostname(hostname)
                .build();

        return new VmService().getOsDescriptors(httpInputs, vmInputs, delimiter);
    } catch (Exception ex) {
        return OutputUtilities.getFailureResultsMap(ex);
    }
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:76,代码来源:GetOSDescriptors.java

示例7: powerOffVM

import com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType; //导入依赖的package包/类
/**
 * Connects to a specified data center and powers off the virtual machine identified by the inputs provided.
 *
 * @param host               VMware host or IP - Example: "vc6.subdomain.example.com"
 * @param port               optional - the port to connect through - Examples: "443", "80" - Default: "443"
 * @param protocol           optional - the connection protocol - Valid: "http", "https" - Default: "https"
 * @param username           the VMware username use to connect
 * @param password           the password associated with "username" input
 * @param trustEveryone      optional - if "true" will allow connections from any host, if "false" the connection will
 *                           be allowed only using a valid vCenter certificate - Default: "true"
 *                           Check the: https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_java_development.4.3.html
 *                           to see how to import a certificate into Java Keystore and
 *                           https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_sg_server_certificate_Appendix.6.4.html
 *                           to see how to obtain a valid vCenter certificate
 * @param closeSession       Whether to use the flow session context to cache the Connection to the host or not. If set to
 *                           "false" it will close and remove any connection from the session context, otherwise the Connection
 *                           will be kept alive and not removed.
 *                           Valid values: "true", "false"
 *                           Default value: "true"
 * @param virtualMachineName the name of the virtual machine that will be powered off
 * @return resultMap with String as key and value that contains returnCode of the operation, success message with
 * task id of the execution or failure message and the exception if there is one
 */
@Action(name = "Power Off Virtual Machine",
        outputs = {
                @Output(Outputs.RETURN_CODE),
                @Output(Outputs.RETURN_RESULT),
                @Output(Outputs.EXCEPTION)
        },
        responses = {
                @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
                @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
        })
public Map<String, String> powerOffVM(@Param(value = HOST, required = true) String host,
                                      @Param(value = PORT) String port,
                                      @Param(value = PROTOCOL) String protocol,
                                      @Param(value = USERNAME, required = true) String username,
                                      @Param(value = PASSWORD, encrypted = true) String password,
                                      @Param(value = TRUST_EVERYONE) String trustEveryone,
                                      @Param(value = CLOSE_SESSION) String closeSession,

                                      @Param(value = VM_NAME, required = true) String virtualMachineName,
                                      @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) {

    try {
        final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder()
                .withHost(host)
                .withPort(port)
                .withProtocol(protocol)
                .withUsername(username)
                .withPassword(password)
                .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE))
                .withCloseSession(defaultIfEmpty(closeSession, TRUE))
                .withGlobalSessionObject(globalSessionObject)
                .build();

        final VmInputs vmInputs = new VmInputs.VmInputsBuilder()
                .withVirtualMachineName(virtualMachineName)
                .build();

        return new VmService().powerOffVM(httpInputs, vmInputs);
    } catch (Exception ex) {
        return OutputUtilities.getFailureResultsMap(ex);
    }
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:68,代码来源:PowerOffVM.java

示例8: powerOnVM

import com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType; //导入依赖的package包/类
/**
 * Connects to a specified data center and powers on the virtual machine identified by the inputs provided.
 *
 * @param host               VMware host or IP - Example: "vc6.subdomain.example.com"
 * @param port               optional - the port to connect through - Examples: "443", "80" - Default: "443"
 * @param protocol           optional - the connection protocol - Valid: "http", "https" - Default: "https"
 * @param username           the VMware username use to connect
 * @param password           the password associated with "username" input
 * @param trustEveryone      optional - if "true" will allow connections from any host, if "false" the connection will
 *                           be allowed only using a valid vCenter certificate - Default: "true"
 *                           Check the: https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_java_development.4.3.html
 *                           to see how to import a certificate into Java Keystore and
 *                           https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_sg_server_certificate_Appendix.6.4.html
 *                           to see how to obtain a valid vCenter certificate
 * @param closeSession       Whether to use the flow session context to cache the Connection to the host or not. If set to
 *                           "false" it will close and remove any connection from the session context, otherwise the Connection
 *                           will be kept alive and not removed.
 *                           Valid values: "true", "false"
 *                           Default value: "true"
 * @param virtualMachineName the name of the virtual machine that will be powered on
 * @return resultMap with String as key and value that contains returnCode of the operation, success message with
 * task id of the execution or failure message and the exception if there is one
 */
@Action(name = "Power On Virtual Machine",
        outputs = {
                @Output(Outputs.RETURN_CODE),
                @Output(Outputs.RETURN_RESULT),
                @Output(Outputs.EXCEPTION)
        },
        responses = {
                @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
                @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
        })
public Map<String, String> powerOnVM(@Param(value = HOST, required = true) String host,
                                     @Param(value = PORT) String port,
                                     @Param(value = PROTOCOL) String protocol,
                                     @Param(value = USERNAME, required = true) String username,
                                     @Param(value = PASSWORD, encrypted = true) String password,
                                     @Param(value = TRUST_EVERYONE) String trustEveryone,
                                     @Param(value = CLOSE_SESSION) String closeSession,

                                     @Param(value = VM_NAME, required = true) String virtualMachineName,
                                     @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) {

    try {
        final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder()
                .withHost(host)
                .withPort(port)
                .withProtocol(protocol)
                .withUsername(username)
                .withPassword(password)
                .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE))
                .withCloseSession(defaultIfEmpty(closeSession, TRUE))
                .withGlobalSessionObject(globalSessionObject)
                .build();

        final VmInputs vmInputs = new VmInputs.VmInputsBuilder()
                .withVirtualMachineName(virtualMachineName)
                .build();

        return new VmService().powerOnVM(httpInputs, vmInputs);
    } catch (Exception ex) {
        return OutputUtilities.getFailureResultsMap(ex);
    }
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:68,代码来源:PowerOnVM.java

示例9: getVMDetails

import com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType; //导入依赖的package包/类
/**
 * Connects to a specified data center and to retrieve details of a virtual machine identified by the inputs provided.
 *
 * @param host               VMware host or IP - Example: "vc6.subdomain.example.com"
 * @param port               optional - the port to connect through - Examples: "443", "80" - Default: "443"
 * @param protocol           optional - the connection protocol - Valid: "http", "https" - Default: "https"
 * @param username           the VMware username use to connect
 * @param password           the password associated with "username" input
 * @param trustEveryone      optional - if "true" will allow connections from any host, if "false" the connection will
 *                           be allowed only using a valid vCenter certificate - Default: "true"
 *                           Check the: https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_java_development.4.3.html
 *                           to see how to import a certificate into Java Keystore and
 *                           https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_sg_server_certificate_Appendix.6.4.html
 *                           to see how to obtain a valid vCenter certificate
 * @param closeSession       Whether to use the flow session context to cache the Connection to the host or not. If set to
 *                           "false" it will close and remove any connection from the session context, otherwise the Connection
 *                           will be kept alive and not removed.
 *                           Valid values: "true", "false"
 *                           Default value: "true"
 * @param virtualMachineName the name of the targeted virtual machine to retrieve the details for
 * @return resultMap with String as key and value that contains returnCode of the operation, a JSON formatted string
 * that contains details of the virtual machine or failure message and the exception if there is one
 */
@Action(name = "Get VM Details",
        outputs = {
                @Output(Outputs.RETURN_CODE),
                @Output(Outputs.RETURN_RESULT),
                @Output(Outputs.EXCEPTION)
        },
        responses = {
                @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
                @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
        })
public Map<String, String> getVMDetails(@Param(value = HOST, required = true) String host,
                                        @Param(value = PORT) String port,
                                        @Param(value = PROTOCOL) String protocol,
                                        @Param(value = USERNAME, required = true) String username,
                                        @Param(value = PASSWORD, encrypted = true) String password,
                                        @Param(value = TRUST_EVERYONE) String trustEveryone,
                                        @Param(value = CLOSE_SESSION) String closeSession,

                                        @Param(value = HOSTNAME, required = true) String hostname,
                                        @Param(value = VM_NAME, required = true) String virtualMachineName,
                                        @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) {


    try {
        final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder()
                .withHost(host)
                .withPort(port)
                .withProtocol(protocol)
                .withUsername(username)
                .withPassword(password)
                .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE))
                .withCloseSession(defaultIfEmpty(closeSession, TRUE))
                .withGlobalSessionObject(globalSessionObject)
                .build();

        final VmInputs vmInputs = new VmInputs.VmInputsBuilder()
                .withHostname(hostname)
                .withVirtualMachineName(virtualMachineName)
                .build();

        return new VmService().getVMDetails(httpInputs, vmInputs);
    } catch (Exception ex) {
        return OutputUtilities.getFailureResultsMap(ex);
    }
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:71,代码来源:GetVMDetails.java

示例10: mountTools

import com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType; //导入依赖的package包/类
/**
 * Connects to a specified data center to start [Install Tools] process on a specified virtual machine identified
 * by name
 *
 * @param host               VMware host or IP - Example: "vc6.subdomain.example.com"
 * @param port               optional - the port to connect through - Examples: "443", "80" - Default: "443"
 * @param protocol           optional - the connection protocol - Valid: "http", "https" - Default: "https"
 * @param username           the VMware username use to connect
 * @param password           the password associated with "username" input
 * @param trustEveryone      optional - if "true" will allow connections from any host, if "false" the connection will
 *                           be allowed only using a valid vCenter certificate - Default: "true"
 *                           Check the: https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_java_development.4.3.html
 *                           to see how to import a certificate into Java Keystore and
 *                           https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_sg_server_certificate_Appendix.6.4.html
 *                           to see how to obtain a valid vCenter certificate
 * @param closeSession       Whether to use the flow session context to cache the Connection to the host or not. If set to
 *                           "false" it will close and remove any connection from the session context, otherwise the Connection
 *                           will be kept alive and not removed.
 *                           Valid values: "true", "false"
 *                           Default value: "true"
 * @param virtualMachineName the name of the targeted virtual machine to mount tools for
 * @return resultMap with String as key and value that contains returnCode of the operation, success message or
 * failure message and the exception if there is one
 */
@Action(name = "Mount Tools",
        outputs = {
                @Output(Outputs.RETURN_CODE),
                @Output(Outputs.RETURN_RESULT),
                @Output(Outputs.EXCEPTION)
        },
        responses = {
                @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
                @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
        })
public Map<String, String> mountTools(@Param(value = HOST, required = true) String host,
                                      @Param(value = PORT) String port,
                                      @Param(value = PROTOCOL) String protocol,
                                      @Param(value = USERNAME, required = true) String username,
                                      @Param(value = PASSWORD, encrypted = true) String password,
                                      @Param(value = TRUST_EVERYONE) String trustEveryone,
                                      @Param(value = CLOSE_SESSION) String closeSession,

                                      @Param(value = VM_NAME, required = true) String virtualMachineName,
                                      @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) {


    try {
        final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder()
                .withHost(host)
                .withPort(port)
                .withProtocol(protocol)
                .withUsername(username)
                .withPassword(password)
                .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE))
                .withCloseSession(defaultIfEmpty(closeSession, TRUE))
                .withGlobalSessionObject(globalSessionObject)
                .build();

        final VmInputs vmInputs = new VmInputs.VmInputsBuilder()
                .withVirtualMachineName(virtualMachineName)
                .build();

        return new GuestService().mountTools(httpInputs, vmInputs);
    } catch (Exception ex) {
        return OutputUtilities.getFailureResultsMap(ex);
    }
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:70,代码来源:MountTools.java

示例11: modifyVmOverrides

import com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType; //导入依赖的package包/类
@Action(name = "Modify VM Overrides Priorities",
        outputs = {
                @Output(Outputs.RETURN_CODE),
                @Output(Outputs.RETURN_RESULT),
                @Output(Outputs.EXCEPTION)
        },
        responses = {
                @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
                @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
        })
public Map<String, String> modifyVmOverrides(@Param(value = HOST, required = true) String host,
                                             @Param(value = PORT) String port,
                                             @Param(value = PROTOCOL) String protocol,
                                             @Param(value = USERNAME, required = true) String username,
                                             @Param(value = PASSWORD, encrypted = true) String password,
                                             @Param(value = TRUST_EVERYONE) String trustEveryone,
                                             @Param(value = CLOSE_SESSION) String closeSession,
                                             @Param(value = HOSTNAME, required = true) String hostname,
                                             @Param(value = VM_NAME) String virtualMachineName,
                                             @Param(value = VM_ID) String virtualMachineId,
                                             @Param(value = CLUSTER_NAME, required = true) String clusterName,
                                             @Param(value = RESTART_PRIORITY, required = true) String restartPriority,
                                             @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) {
    try {
        final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder()
                .withHost(host)
                .withPort(port)
                .withProtocol(protocol)
                .withUsername(username)
                .withPassword(password)
                .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE))
                .withCloseSession(defaultIfEmpty(closeSession, TRUE))
                .withGlobalSessionObject(globalSessionObject)
                .build();

        InputUtils.checkMutuallyExclusiveInputs(virtualMachineName, virtualMachineId, PROVIDE_VM_NAME_OR_ID);

        final VmInputs vmInputs = new VmInputs.VmInputsBuilder()
                .withClusterName(clusterName)
                .withHostname(hostname)
                .withVirtualMachineName(virtualMachineName)
                .withVirtualMachineId(virtualMachineId)
                .build();

        return new ClusterComputeResourceService().updateOrAddVmOverride(httpInputs, vmInputs,
                validateRestartPriority(restartPriority));
    } catch (Exception ex) {
        return OutputUtilities.getFailureResultsMap(ex);
    }
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:53,代码来源:ModifyVmOverrides.java

示例12: createHostGroup

import com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType; //导入依赖的package包/类
/**
 * @param host          VMWare host or IP.
 *                      Example: "vc6.subdomain.example.com"
 * @param port          optional - The port to connect through.
 *                      Default Value: "443"
 *                      Examples: "443", "80"
 * @param protocol      optional - The connection protocol.
 *                      Default Value: "https"
 *                      Valid Values: "http", "https"
 * @param username      The VMware username used to connect.
 * @param password      The password associated with "username" input.
 * @param trustEveryone optional - If "true" will allow connections from any host, if "false" the connection will be allowed only using a valid vCenter certificate. Check the: https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_java_development.4.3.html to see how to import a certificate into Java Keystore and https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_sg_server_certificate_Appendix.6.4.html to see how to obtain a valid vCenter certificate
 *                      Default Value: "true"
 * @param closeSession  Whether to use the flow session context to cache the Connection to the host or not. If set to
 *                      "false" it will close and remove any connection from the session context, otherwise the Connection
 *                      will be kept alive and not removed.
 *                      Valid values: "true", "false"
 *                      Default value: "true"
 * @param clusterName   The name of the cluster for which we want to add the group.
 * @param hostGroupName The name of the host group.
 * @param hostList      The list which contains the names of the hosts that will be added in the host group.
 * @param delimiter     optional - A separator delimiting the list elements.
 *                      Default value: ","
 * @return
 */
@Action(name = "Create DRS Host Group",
        outputs = {
                @Output(Outputs.RETURN_CODE),
                @Output(Outputs.RETURN_RESULT),
                @Output(Outputs.EXCEPTION)
        },
        responses = {
                @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
                @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
        })
public Map<String, String> createHostGroup(@Param(value = HOST, required = true) String host,
                                           @Param(value = PORT) String port,
                                           @Param(value = PROTOCOL) String protocol,
                                           @Param(value = USERNAME, required = true) String username,
                                           @Param(value = PASSWORD, encrypted = true) String password,
                                           @Param(value = TRUST_EVERYONE) String trustEveryone,
                                           @Param(value = CLOSE_SESSION) String closeSession,
                                           @Param(value = CLUSTER_NAME, required = true) String clusterName,
                                           @Param(value = HOST_GROUP_NAME, required = true) String hostGroupName,
                                           @Param(value = HOST_LIST, required = true) String hostList,
                                           @Param(value = DELIMITER) String delimiter,
                                           @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) {
    try {
        final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder()
                .withHost(host)
                .withPort(port)
                .withProtocol(protocol)
                .withUsername(username)
                .withPassword(password)
                .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE))
                .withCloseSession(defaultIfEmpty(closeSession, TRUE))
                .withGlobalSessionObject(globalSessionObject)
                .build();

        final VmInputs vmInputs = new VmInputs.VmInputsBuilder()
                .withClusterName(clusterName)
                .withHostGroupName(hostGroupName)
                .build();

        return new ClusterComputeResourceService()
                .createHostGroup(httpInputs, vmInputs, CollectionUtilities.toList(hostList, InputUtils.getDefaultDelimiter(delimiter, COMMA_DELIMITER)));
    } catch (Exception ex) {
        return OutputUtilities.getFailureResultsMap(ex);
    }
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:73,代码来源:CreateHostGroup.java

示例13: createVmGroup

import com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType; //导入依赖的package包/类
/**
 * @param host          VMware host or IP.
 *                      Example: "vc6.subdomain.example.com"
 * @param port          optional - The port to connect through.
 *                      Default Value: "443"
 *                      Examples: "443", "80"
 * @param protocol      optional - The connection protocol.
 *                      Default Value: "https"
 *                      Valid Values: "http", "https"
 * @param username      The VMware username used to connect.
 * @param password      The password associated with "username" input.
 * @param trustEveryone optional - If "true" will allow connections from any host, if "false" the connection will be allowed only using a valid vCenter certificate. Check the: https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_java_development.4.3.html to see how to import a certificate into Java Keystore and https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_sg_server_certificate_Appendix.6.4.html to see how to obtain a valid vCenter certificate
 *                      Default Value: "true"
 * @param closeSession  Whether to use the flow session context to cache the Connection to the host or not. If set to
 *                      "false" it will close and remove any connection from the session context, otherwise the Connection
 *                      will be kept alive and not removed.
 *                      Valid values: "true", "false"
 *                      Default value: "true"
 * @param clusterName   The name of the cluster on which the VM group will be created.
 * @param vmGroupName   The name of the VM group.
 * @param vmList        The list which contains the names of the VMs that will be added in the VM group.
 * @param delimiter     optional - A separator delimiting the list elements.
 *                      Default value: ","
 * @return
 */
@Action(name = "Create DRS VM Group",
        outputs = {
                @Output(Outputs.RETURN_CODE),
                @Output(Outputs.RETURN_RESULT),
                @Output(Outputs.EXCEPTION)
        },
        responses = {
                @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
                @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
        })
public Map<String, String> createVmGroup(@Param(value = HOST, required = true) String host,
                                         @Param(value = PORT) String port,
                                         @Param(value = PROTOCOL) String protocol,
                                         @Param(value = USERNAME, required = true) String username,
                                         @Param(value = PASSWORD, encrypted = true) String password,
                                         @Param(value = TRUST_EVERYONE) String trustEveryone,
                                         @Param(value = CLOSE_SESSION) String closeSession,
                                         @Param(value = VM_GROUP_NAME, required = true) String vmGroupName,
                                         @Param(value = CLUSTER_NAME, required = true) String clusterName,
                                         @Param(value = VM_LIST, required = true) String vmList,
                                         @Param(value = DELIMITER) String delimiter,
                                         @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) {
    try {
        final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder()
                .withHost(host)
                .withPort(port)
                .withProtocol(protocol)
                .withUsername(username)
                .withPassword(password)
                .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE))
                .withCloseSession(defaultIfEmpty(closeSession, TRUE))
                .withGlobalSessionObject(globalSessionObject)
                .build();

        final VmInputs vmInputs = new VmInputs.VmInputsBuilder()
                .withClusterName(clusterName)
                .withVmGroupName(vmGroupName)
                .build();

        return new ClusterComputeResourceService()
                .createVmGroup(httpInputs, vmInputs, CollectionUtilities.toList(vmList, InputUtils.getDefaultDelimiter(delimiter, COMMA_DELIMITER)));
    } catch (Exception ex) {
        return OutputUtilities.getFailureResultsMap(ex);
    }
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:73,代码来源:CreateVmGroup.java

示例14: deleteClusterRule

import com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType; //导入依赖的package包/类
/**
 * @param host          VMware host or IP.
 *                      Example: "vc6.subdomain.example.com"
 * @param port          optional - The port to connect through.
 *                      Default Value: "443"
 *                      Examples: "443", "80"
 * @param protocol      optional - The connection protocol.
 *                      Default Value: "https"
 *                      Valid Values: "http", "https"
 * @param username      The VMware username used to connect.
 * @param password      The password associated with "username" input.
 * @param trustEveryone optional - If "true" will allow connections from any host, if "false" the connection will be allowed only using a valid vCenter certificate. Check the: https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_java_development.4.3.html to see how to import a certificate into Java Keystore and https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_sg_server_certificate_Appendix.6.4.html to see how to obtain a valid vCenter certificate
 *                      Default Value: "true"
 * @param closeSession  Whether to use the flow session context to cache the Connection to the host or not. If set to
 *                      "false" it will close and remove any connection from the session context, otherwise the Connection
 *                      will be kept alive and not removed.
 *                      Valid values: "true", "false"
 *                      Default value: "true"
 * @param clusterName   The name of the cluster.
 * @param ruleName      The name of the cluster rule.
 * @return
 */
@Action(name = "Delete Cluster Rule",
        outputs = {
                @Output(Outputs.RETURN_CODE),
                @Output(Outputs.RETURN_RESULT),
                @Output(Outputs.EXCEPTION)
        },
        responses = {
                @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
                @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
        })
public Map<String, String> deleteClusterRule(@Param(value = HOST, required = true) String host,
                                             @Param(value = PORT) String port,
                                             @Param(value = PROTOCOL) String protocol,
                                             @Param(value = USERNAME, required = true) String username,
                                             @Param(value = PASSWORD, encrypted = true) String password,
                                             @Param(value = TRUST_EVERYONE) String trustEveryone,
                                             @Param(value = CLOSE_SESSION) String closeSession,
                                             @Param(value = CLUSTER_NAME, required = true) String clusterName,
                                             @Param(value = RULE_NAME, required = true) String ruleName,
                                             @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) {
    try {
        final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder()
                .withHost(host)
                .withPort(port)
                .withProtocol(protocol)
                .withUsername(username)
                .withPassword(password)
                .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE))
                .withCloseSession(defaultIfEmpty(closeSession, TRUE))
                .withGlobalSessionObject(globalSessionObject)
                .build();

        final VmInputs vmInputs = new VmInputs.VmInputsBuilder()
                .withClusterName(clusterName)
                .withRuleName(ruleName)
                .build();
        return new ClusterComputeResourceService().deleteClusterRule(httpInputs, vmInputs);
    } catch (Exception ex) {
        return OutputUtilities.getFailureResultsMap(ex);
    }
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:66,代码来源:DeleteClusterRule.java

示例15: listHostGroups

import com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType; //导入依赖的package包/类
/**
 * @param host          VMware host or IP.
 *                      Example: "vc6.subdomain.example.com"
 * @param port          optional - The port to connect through.
 *                      Default Value: "443"
 *                      Examples: "443", "80"
 * @param protocol      optional - The connection protocol.
 *                      Default Value: "https"
 *                      Valid Values: "http", "https"
 * @param username      The VMware username used to connect.
 * @param password      The password associated with "username" input.
 * @param trustEveryone optional - If "true" will allow connections from any host, if "false" the connection will be allowed only using a valid vCenter certificate. Check the: https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_java_development.4.3.html to see how to import a certificate into Java Keystore and https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.dsg.doc_50%2Fsdk_sg_server_certificate_Appendix.6.4.html to see how to obtain a valid vCenter certificate
 *                      Default Value: "true"
 * @param closeSession  Whether to use the flow session context to cache the Connection to the host or not. If set to
 *                      "false" it will close and remove any connection from the session context, otherwise the Connection
 *                      will be kept alive and not removed.
 *                      Valid values: "true", "false"
 *                      Default value: "true"
 * @param clusterName   The name of the cluster.
 * @param delimiter     optional - A separator delimiting the list elements.
 *                      Default value: ","
 * @return
 */
@Action(name = "List DRS Host Groups",
        outputs = {
                @Output(Outputs.RETURN_CODE),
                @Output(Outputs.RETURN_RESULT),
                @Output(Outputs.EXCEPTION)
        },
        responses = {
                @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
                @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE,
                        matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
        })
public Map<String, String> listHostGroups(@Param(value = HOST, required = true) String host,
                                          @Param(value = PORT) String port,
                                          @Param(value = PROTOCOL) String protocol,
                                          @Param(value = USERNAME, required = true) String username,
                                          @Param(value = PASSWORD, encrypted = true) String password,
                                          @Param(value = TRUST_EVERYONE) String trustEveryone,
                                          @Param(value = CLOSE_SESSION) String closeSession,
                                          @Param(value = CLUSTER_NAME, required = true) String clusterName,
                                          @Param(value = DELIMITER) String delimiter,
                                          @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) {
    try {
        final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder()
                .withHost(host)
                .withPort(port)
                .withProtocol(protocol)
                .withUsername(username)
                .withPassword(password)
                .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE))
                .withCloseSession(defaultIfEmpty(closeSession, TRUE))
                .withGlobalSessionObject(globalSessionObject)
                .build();

        return OutputUtilities.getSuccessResultsMap(
                new ClusterComputeResourceService()
                        .listGroups(httpInputs, clusterName, InputUtils.getDefaultDelimiter(delimiter, COMMA_DELIMITER), ClusterHostGroup.class));
    } catch (Exception ex) {
        return OutputUtilities.getFailureResultsMap(ex);
    }
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:65,代码来源:ListHostGroups.java


注:本文中的com.hp.oo.sdk.content.plugin.ActionMetadata.ResponseType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。