Package org.metricshub.winrm.service
Class WinRMEndpoint
java.lang.Object
org.metricshub.winrm.service.WinRMEndpoint
-
Constructor Summary
ConstructorsConstructorDescriptionWinRMEndpoint(WinRMHttpProtocolEnum protocol, String hostname, Integer port, String username, char[] password, String namespace) Constructor of the endpoint and credentials for WinRM. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildEndpointUrl(WinRMHttpProtocolEnum protocol, String hostname, Integer port) Build the endpoint URL.static StringbuildNamespace(String namespace) Get the namespace and replace '\' by '/' if necessary default: "ROOT\\CIMV2" if nullbooleanGet the domain from the raw usernameGet the endpoint in the form of http(s)://host:port/wsmanstatic intgetEndpointPort(WinRMHttpProtocolEnum protocol, Integer port) Get the endpoint port: The port if provided 5986 if the protocol is HTTPS 5985 otherwiseGet the hostnameGet the namespacechar[]Get the passwordintgetPort()Get the resolved endpoint port (the port provided to the constructor, or the protocol default).Get the protocolGet the username exactly as supplied in the constructor (could be in domain\\user form, and may contain the whitespace the caller typed).Get the username part of the raw usernameinthashCode()toString()
-
Constructor Details
-
WinRMEndpoint
public WinRMEndpoint(WinRMHttpProtocolEnum protocol, String hostname, Integer port, String username, char[] password, String namespace) Constructor of the endpoint and credentials for WinRM.- Parameters:
protocol- The protocolhostname- The host name (mandatory)port- The portusername- The user name (mandatory)password- The password (mandatory)namespace- The namespace default value: "ROOT\\CIMV2"
-
-
Method Details
-
getHostname
Get the hostname -
getEndpoint
Get the endpoint in the form of http(s)://host:port/wsman -
getDomain
Get the domain from the raw username -
getRawUsername
Get the username exactly as supplied in the constructor (could be in domain\\user form, and may contain the whitespace the caller typed). ThegetDomain()/getUsername()parts are the whitespace-normalized split of this value, which is what the protocols send. -
getUsername
Get the username part of the raw username -
getPassword
public char[] getPassword()Get the password -
getNamespace
Get the namespace -
getProtocol
Get the protocol -
getPort
public int getPort()Get the resolved endpoint port (the port provided to the constructor, or the protocol default). -
buildEndpointUrl
public static String buildEndpointUrl(WinRMHttpProtocolEnum protocol, String hostname, Integer port) Build the endpoint URL.- Parameters:
protocol- The HTTP protocolhostname- The host nameport- The port- Returns:
- the endpoint URL in form of protocol://hostname:port (with protocol in HTTP or HTTPS).
-
getEndpointPort
Get the endpoint port:- The port if provided
- 5986 if the protocol is HTTPS
- 5985 otherwise
- Parameters:
protocol- The HTTP protocolport- The port- Returns:
- The endpoint port
-
buildNamespace
Get the namespace and replace '\' by '/' if necessary default: "ROOT\\CIMV2" if null- Parameters:
namespace- the provided namespace- Returns:
-
hashCode
public int hashCode() -
equals
-
toString
-