Search in sources :

Example 71 with Action

use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.

the class CustomizeLinuxGuest method customizeLinuxGuest.

/**
 * Connects to specified data center and customize an existing linux OS based 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 name of Windows OS based virtual machine that will be customized
 * @param computerName:      the network host name of the (Windows) virtual machine
 * @param domain:            optional - the fully qualified domain name - Default: ""
 * @param ipAddress:         optional - the static ip address - Default: ""
 * @param subnetMask:        optional - the subnet mask for the virtual network adapter - Default: ""
 * @param defaultGateway:    optional - the default gateway for network adapter with a static IP address - Default: ""
 * @param hwClockUTC:        optional - the MAC address for network adapter with a static IP address - Default: ""
 * @param timeZone:          optional - the time zone for the new virtual machine according with
 *                           https://technet.microsoft.com/en-us/library/ms145276%28v=sql.90%29.aspx
 *                           - Default: "360"
 * @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 = "Customize Linux Guest", 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> customizeLinuxGuest(@Param(value = Inputs.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 = COMPUTER_NAME, required = true) String computerName, @Param(value = DOMAIN) String domain, @Param(value = IP_ADDRESS) String ipAddress, @Param(value = SUBNET_MASK) String subnetMask, @Param(value = DEFAULT_GATEWAY) String defaultGateway, @Param(value = UTC_CLOCK) String hwClockUTC, @Param(value = TIME_ZONE) String timeZone, @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();
        final GuestInputs guestInputs = new GuestInputs.GuestInputsBuilder().withComputerName(computerName).withDomain(domain).withIpAddress(ipAddress).withSubnetMask(subnetMask).withDefaultGateway(defaultGateway).withHwClockUTC(hwClockUTC).withTimeZone(timeZone).build();
        return new GuestService().customizeVM(httpInputs, vmInputs, guestInputs, false);
    } catch (Exception ex) {
        return OutputUtilities.getFailureResultsMap(ex);
    }
}
Also used : VmInputs(io.cloudslang.content.vmware.entities.VmInputs) HttpInputs(io.cloudslang.content.vmware.entities.http.HttpInputs) GuestService(io.cloudslang.content.vmware.services.GuestService) GuestInputs(io.cloudslang.content.vmware.entities.GuestInputs) Action(com.hp.oo.sdk.content.annotations.Action)

Example 72 with Action

use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.

the class CustomizeWindowsGuest method customizeWindowsGuest.

/**
 * Connects to specified data center and customize an existing Windows OS based 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 name of Windows OS based virtual machine that will be customized
 * @param rebootOption       specifies whether to shutdown, reboot or not the machine in the customization process
 *                           - Valid: "noreboot", "reboot", "shutdown" - Default: "reboot"
 * @param computerName:      the network host name of the (Windows) virtual machine
 * @param computerPassword   the new password for the (Windows) virtual machine
 * @param ownerName          the user's full name
 * @param ownerOrganization: the user's organization
 * @param productKey:        optional - a valid serial number to be included in the answer file - Default: ""
 * @param domainUsername:    optional - the domain user account used for authentication if the virtual machine is
 *                           joining a domain. The user must have the privileges required to add computers to the domain
 *                           - Default: ""
 * @param domainPassword:    optional - the password for the domain user account used for authentication if the virtual
 *                           machine is joining a domain - Default: ""
 * @param domain:            optional - the fully qualified domain name - Default: ""
 * @param workgroup:         optional - the workgroup that the virtual machine should join. If this is supplied, then
 *                           the domain name and authentication fields should not be supplied (mutually exclusive)
 *                           - Default: ""
 * @param licenseDataMode:   the type of the windows license. "perServer" indicates that a client access license has
 *                           been purchased for each computer that accesses the VirtualCenter server. "perSeat" indicates
 *                           that client access licenses have been purchased for the server, allowing a certain number
 *                           of concurrent connections to the VirtualCenter server - Valid: "perServer", "perSeat"
 *                           - Default: "perServer"
 * @param dnsServer:         optional - the server IP address to use for DNS lookup in a Windows guest operating system
 *                           - Default: ""
 * @param ipAddress:         optional - the static ip address - Default: ""
 * @param subnetMask:        optional - the subnet mask for the virtual network adapter - Default: ""
 * @param defaultGateway:    optional - the default gateway for network adapter with a static IP address - Default: ""
 * @param macAddress:        optional - the MAC address for network adapter with a static IP address - Default: ""
 * @param autoLogon:         optional - specifies whether or not the machine automatically logs on as Administrator
 *                           - Valid: "true", "false" - Default: "false"
 * @param deleteAccounts:    optional - specifies whether if all user accounts will be removed from the system as part
 *                           of the customization or not. This input can be use only for older than API 2.5 versions.
 *                           Since API 2.5 this value is ignored and removing user accounts during customization is
 *                           no longer supported. For older API versions: if deleteAccounts is true, then all user
 *                           accounts are removed from the system as part of the customization. Mini-setup creates a
 *                           new Administrator account with a blank password - Default: ""
 * @param changeSID:         specifies whether the customization process should modify or not the machine's security
 *                           identifier (SID). For Vista OS, SID will always be modified - Valid: "true", "false"
 *                           - Default: "true"
 * @param autoLogonCount:    optional - if the AutoLogon flag is set, then the AutoLogonCount property specifies the
 *                           number of times the machine should automatically log on as Administrator. Generally it
 *                           should be 1, but if your setup requires a number of reboots, you may want to increase it
 *                           - Default: "1"
 * @param autoUsers:         optional - this key is valid only if license_data_mode input is set 'perServer', otherwise
 *                           is ignored. The integer value indicates the number of client licenses purchased for the
 *                           VirtualCenter server being installed - Default: ""
 * @param timeZone:          optional - the time zone for the new virtual machine according with
 *                           https://technet.microsoft.com/en-us/library/ms145276%28v=sql.90%29.aspx
 *                           - Default: "360"
 * @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 = "Customize Windows Guest", 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> customizeWindowsGuest(@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 = REBOOT_OPTION, required = true) String rebootOption, @Param(value = COMPUTER_NAME, required = true) String computerName, @Param(value = COMPUTER_PASSWORD, required = true) String computerPassword, @Param(value = OWNER_NAME, required = true) String ownerName, @Param(value = OWNER_ORGANIZATION, required = true) String ownerOrganization, @Param(value = PRODUCT_KEY) String productKey, @Param(value = DOMAIN_USERNAME) String domainUsername, @Param(value = DOMAIN_PASSWORD) String domainPassword, @Param(value = DOMAIN) String domain, @Param(value = WORKGROUP) String workgroup, @Param(value = LICENSE_DATA_MODE, required = true) String licenseDataMode, @Param(value = DNS_SERVER) String dnsServer, @Param(value = IP_ADDRESS) String ipAddress, @Param(value = SUBNET_MASK) String subnetMask, @Param(value = DEFAULT_GATEWAY) String defaultGateway, @Param(value = MAC_ADDRESS) String macAddress, @Param(value = AUTO_LOGON) String autoLogon, @Param(value = DELETE_ACCOUNTS) String deleteAccounts, @Param(value = CHANGE_SID, required = true) String changeSID, @Param(value = AUTO_LOGON_COUNT) String autoLogonCount, @Param(value = AUTO_USERS) String autoUsers, @Param(value = TIME_ZONE) String timeZone, @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();
        final GuestInputs guestInputs = new GuestInputs.GuestInputsBuilder().withRebootOption(rebootOption).withComputerName(computerName).withComputerPassword(computerPassword).withOwnerName(ownerName).withOwnerOrganization(ownerOrganization).withProductKey(productKey).withDomainUsername(domainUsername).withDomainPassword(domainPassword).withDomain(domain).withWorkgroup(workgroup).withLicenseDataMode(licenseDataMode).withDnsServer(dnsServer).withIpAddress(ipAddress).withSubnetMask(subnetMask).withDefaultGateway(defaultGateway).withMacAddress(macAddress).withAutoLogon(autoLogon).withDeleteAccounts(deleteAccounts).withChangeSID(changeSID).withAutoLogonCount(autoLogonCount).withAutoUsers(autoUsers).withTimeZone(timeZone).build();
        return new GuestService().customizeVM(httpInputs, vmInputs, guestInputs, true);
    } catch (Exception ex) {
        return OutputUtilities.getFailureResultsMap(ex);
    }
}
Also used : VmInputs(io.cloudslang.content.vmware.entities.VmInputs) HttpInputs(io.cloudslang.content.vmware.entities.http.HttpInputs) GuestService(io.cloudslang.content.vmware.services.GuestService) GuestInputs(io.cloudslang.content.vmware.entities.GuestInputs) Action(com.hp.oo.sdk.content.annotations.Action)

Example 73 with Action

use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.

the class MountTools method mountTools.

/**
 * 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);
    }
}
Also used : VmInputs(io.cloudslang.content.vmware.entities.VmInputs) HttpInputs(io.cloudslang.content.vmware.entities.http.HttpInputs) GuestService(io.cloudslang.content.vmware.services.GuestService) Action(com.hp.oo.sdk.content.annotations.Action)

Example 74 with Action

use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.

the class CreateAffinityRule method createAffinityRule.

/**
 * @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 affinity rule.
 * @param affineHostGroupName     optional - the name of the affine host group. The affine host group represents the
 *                                host group on which the virtual machines in the specified VM group must run.
 * @param antiAffineHostGroupName optional - the name of the anti-affine host group. The anti-affine host group
 *                                represents the host group on which the virtual machines in the specified VM group
 *                                must not run.
 *                                Note: Only one of the affineHostGroupName and antiAffineHostGroupName should be
 *                                provided. If the affineHostGroupName is provided, there will be created an affinity
 *                                rule between the VM group and the host Group, otherwise an anti-affinity rule will
 *                                be created.
 * @param vmGroupName             the name of the VM group for which the affinity rule will be applied.
 * @return
 */
@Action(name = "Create Affinity 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> createAffinityRule(@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 = AFFINE_HOST_GROUP_NAME) String affineHostGroupName, @Param(value = ANTI_AFFINE_HOST_GROUP_NAME) String antiAffineHostGroupName, @Param(value = VM_GROUP_NAME, required = true) String vmGroupName, @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) {
    try {
        InputUtils.checkMutuallyExclusiveInputs(affineHostGroupName, antiAffineHostGroupName, PROVIDE_AFFINE_OR_ANTI_AFFINE_HOST_GROUP);
        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).withRuleName(ruleName).build();
        return new ClusterComputeResourceService().createAffinityRule(httpInputs, vmInputs, affineHostGroupName, antiAffineHostGroupName);
    } catch (Exception ex) {
        return OutputUtilities.getFailureResultsMap(ex);
    }
}
Also used : VmInputs(io.cloudslang.content.vmware.entities.VmInputs) HttpInputs(io.cloudslang.content.vmware.entities.http.HttpInputs) ClusterComputeResourceService(io.cloudslang.content.vmware.services.ClusterComputeResourceService) Action(com.hp.oo.sdk.content.annotations.Action)

Example 75 with Action

use of com.hp.oo.sdk.content.annotations.Action in project cs-actions by CloudSlang.

the class CreateHostGroup method createHostGroup.

/**
 * @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);
    }
}
Also used : VmInputs(io.cloudslang.content.vmware.entities.VmInputs) HttpInputs(io.cloudslang.content.vmware.entities.http.HttpInputs) ClusterComputeResourceService(io.cloudslang.content.vmware.services.ClusterComputeResourceService) Action(com.hp.oo.sdk.content.annotations.Action)

Aggregations

Action (com.hp.oo.sdk.content.annotations.Action)230 CommonInputs (io.cloudslang.content.amazon.entities.inputs.CommonInputs)48 QueryApiExecutor (io.cloudslang.content.amazon.execute.QueryApiExecutor)47 CustomInputs (io.cloudslang.content.amazon.entities.inputs.CustomInputs)32 HttpClientInputs (io.cloudslang.content.httpclient.entities.HttpClientInputs)29 HashMap (java.util.HashMap)22 VmInputs (io.cloudslang.content.vmware.entities.VmInputs)21 HttpInputs (io.cloudslang.content.vmware.entities.http.HttpInputs)21 CommonInputs (io.cloudslang.content.couchbase.entities.inputs.CommonInputs)15 CouchbaseService (io.cloudslang.content.couchbase.execute.CouchbaseService)15 InputsUtil.getHttpClientInputs (io.cloudslang.content.couchbase.utils.InputsUtil.getHttpClientInputs)15 NetworkInputs (io.cloudslang.content.amazon.entities.inputs.NetworkInputs)11 Map (java.util.Map)11 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)10 CommonInputs (io.cloudslang.content.amazon.entities.constants.Inputs.CommonInputs)9 InstanceInputs (io.cloudslang.content.amazon.entities.inputs.InstanceInputs)9 JsonNode (com.fasterxml.jackson.databind.JsonNode)8 JsonParser (com.google.gson.JsonParser)8 SFTPService (io.cloudslang.content.rft.services.SFTPService)8 ClusterComputeResourceService (io.cloudslang.content.vmware.services.ClusterComputeResourceService)8