org.springframework.cloud.dataflow.shell

## Class Target

- java.lang.Object
- - org.springframework.cloud.dataflow.shell.Target

-     public class Target
      extends Object

  Encapsulates various data points related to the Data Flow Server Target, such as target URI, success/error state, exception messages that may have occurred.
  Since:
    1.0
  Author:
    Gunnar Hillert

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Target.TargetStatus`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_CLIENT_REGISTRATION_ID`
    `static String` | `DEFAULT_CREDENTIALS_PROVIDER_COMMAND`
    `static String` | `DEFAULT_HOST`
    `static int` | `DEFAULT_PORT`
    `static String` | `DEFAULT_PROXY_SPECIFIED_PASSWORD`
    `static String` | `DEFAULT_PROXY_UNSPECIFIED_PASSWORD`
    `static String` | `DEFAULT_PROXY_URI`
    `static String` | `DEFAULT_PROXY_USERNAME`
    `static String` | `DEFAULT_SCHEME`
    `static String` | `DEFAULT_SPECIFIED_PASSWORD`
    `static String` | `DEFAULT_SPECIFIED_SKIP_SSL_VALIDATION`
    `static String` | `DEFAULT_TARGET`
    `static String` | `DEFAULT_UNSPECIFIED_PASSWORD`
    `static String` | `DEFAULT_UNSPECIFIED_SKIP_SSL_VALIDATION`
    `static String` | `DEFAULT_USERNAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Target(String targetUriAsString)` Construct a new Target.
    `Target(String targetUriAsString, String targetUsername, String targetPassword, boolean skipSslValidation)` Construct a new Target.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Target.TargetStatus` | `getStatus()` Return the target status, which is either Success or Error.
    `TargetCredentials` | `getTargetCredentials()` Returns the target credentials
    `Exception` | `getTargetException()` If during targeting an error occurred, the resulting `Exception` is made available for further introspection.
    `String` | `getTargetResultMessage()` Provides a result message indicating whether the provide `getTargetUri()` was successfully targeted or not.
    `URI` | `getTargetUri()`
    `String` | `getTargetUriAsString()` Returns the target URI as a String.
    `boolean` | `isAuthenticated()`
    `boolean` | `isAuthenticationEnabled()` Indicates whether authentication is enabled for this target.
    `boolean` | `isSkipSslValidation()` Returns if sslValidation should be skipped
    `void` | `setAuthenticated(boolean authenticated)`
    `void` | `setAuthenticationEnabled(boolean authenticationEnabled)`
    `void` | `setTargetCredentials(TargetCredentials targetCredentials)`
    `void` | `setTargetException(Exception targetException)` Sets the exception in case an error occurred during targeting.
    `void` | `setTargetResultMessage(String targetResultMessage)` Set the result messages indicating the success or failure while targeting the Spring Cloud Data Flow Server.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_SCHEME

          public static final String DEFAULT_SCHEME

      See Also:
        Constant Field Values

    - #### DEFAULT_HOST

          public static final String DEFAULT_HOST

      See Also:
        Constant Field Values

    - #### DEFAULT_PORT

          public static final int DEFAULT_PORT

      See Also:
        Constant Field Values

    - #### DEFAULT_USERNAME

          public static final String DEFAULT_USERNAME

      See Also:
        Constant Field Values

    - #### DEFAULT_SPECIFIED_PASSWORD

          public static final String DEFAULT_SPECIFIED_PASSWORD

      See Also:
        Constant Field Values

    - #### DEFAULT_UNSPECIFIED_PASSWORD

          public static final String DEFAULT_UNSPECIFIED_PASSWORD

      See Also:
        Constant Field Values

    - #### DEFAULT_CLIENT_REGISTRATION_ID

          public static final String DEFAULT_CLIENT_REGISTRATION_ID

      See Also:
        Constant Field Values

    - #### DEFAULT_SPECIFIED_SKIP_SSL_VALIDATION

          public static final String DEFAULT_SPECIFIED_SKIP_SSL_VALIDATION

      See Also:
        Constant Field Values

    - #### DEFAULT_UNSPECIFIED_SKIP_SSL_VALIDATION

          public static final String DEFAULT_UNSPECIFIED_SKIP_SSL_VALIDATION

      See Also:
        Constant Field Values

    - #### DEFAULT_CREDENTIALS_PROVIDER_COMMAND

          public static final String DEFAULT_CREDENTIALS_PROVIDER_COMMAND

      See Also:
        Constant Field Values

    - #### DEFAULT_TARGET

          public static final String DEFAULT_TARGET

      See Also:
        Constant Field Values

    - #### DEFAULT_PROXY_USERNAME

          public static final String DEFAULT_PROXY_USERNAME

      See Also:
        Constant Field Values

    - #### DEFAULT_PROXY_SPECIFIED_PASSWORD

          public static final String DEFAULT_PROXY_SPECIFIED_PASSWORD

      See Also:
        Constant Field Values

    - #### DEFAULT_PROXY_UNSPECIFIED_PASSWORD

          public static final String DEFAULT_PROXY_UNSPECIFIED_PASSWORD

      See Also:
        Constant Field Values

    - #### DEFAULT_PROXY_URI

          public static final String DEFAULT_PROXY_URI

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Target

          public Target(String targetUriAsString,
                        String targetUsername,
                        String targetPassword,
                        boolean skipSslValidation)

      Construct a new Target. The passed in `targetUriAsString` String parameter will be converted to a `URI`. This method allows for providing a username and password for authentication.
      Parameters:
        `targetUriAsString` - the data flow server URI, must not be empty
        `targetUsername` - the username, may be empty, if access is unauthenticated
        `targetPassword` - the password, may be empty
        `skipSslValidation` - whether or not we skip SSL validation.
      Throws:
        `IllegalArgumentException` - if the given URI string violates RFC 2396.

    - #### Target

          public Target(String targetUriAsString)

      Construct a new Target. The passed in `targetUriAsString` String parameter will be converted to a `URI`.
      Parameters:
        `targetUriAsString` - Must not be empty
      Throws:
        `IllegalArgumentException` - if the given string violates RFC 2396

  - ### Method Detail

    - #### getStatus

          public Target.TargetStatus getStatus()

      Return the target status, which is either Success or Error.
      Returns:
        The `Target.TargetStatus`. May be null.

    - #### getTargetException

          public Exception getTargetException()

      If during targeting an error occurred, the resulting `Exception` is made available for further introspection.
      Returns:
        If present, returns the Exception, otherwise null is returned.

    - #### setTargetException

          public void setTargetException(Exception targetException)

      Sets the exception in case an error occurred during targeting. Will also set the respective `Target.TargetStatus` to `Target.TargetStatus.ERROR`.
      Parameters:
        `targetException` - Must not be null.

    - #### getTargetResultMessage

          public String getTargetResultMessage()

      Provides a result message indicating whether the provide `getTargetUri()` was successfully targeted or not.
      Returns:
        The formatted result message.

    - #### setTargetResultMessage

          public void setTargetResultMessage(String targetResultMessage)

      Set the result messages indicating the success or failure while targeting the Spring Cloud Data Flow Server.
      Parameters:
        `targetResultMessage` - Must not be empty.

    - #### getTargetUri

          public URI getTargetUri()

      Returns:
        The Target Uri. Will never be null.

    - #### getTargetUriAsString

          public String getTargetUriAsString()

      Returns the target URI as a String.
      Returns:
        Never null and will always return a valid URI value

    - #### isSkipSslValidation

          public boolean isSkipSslValidation()

      Returns if sslValidation should be skipped
      Returns:
        Return whether or not we skip SSL validation.

    - #### getTargetCredentials

          public TargetCredentials getTargetCredentials()

      Returns the target credentials
      Returns:
        The target credentials. May be null if there is no authentication

    - #### setTargetCredentials

          public void setTargetCredentials(TargetCredentials targetCredentials)

    - #### isAuthenticationEnabled

          public boolean isAuthenticationEnabled()

      Indicates whether authentication is enabled for this target.
      Returns:
        True if authentication is enabled, false otherwise

    - #### setAuthenticationEnabled

          public void setAuthenticationEnabled(boolean authenticationEnabled)

      Parameters:
        `authenticationEnabled` - False by default

    - #### isAuthenticated

          public boolean isAuthenticated()

      Returns:
        True if the user is successfully authenticated with this Target

    - #### setAuthenticated

          public void setAuthenticated(boolean authenticated)

      Parameters:
        `authenticated` - whether a user is successfully authenticated with the Target

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2021 Pivotal Software, Inc.. All rights reserved.