Class APISession

java.lang.Object
hudson.scm.api.session.APISession
All Implemented Interfaces:
ISession, AutoCloseable

public class APISession extends Object implements ISession
This class represents an Integration Point to a server. It also contains a Session object
  • Field Details

  • Method Details

    • create

      public static ISession create(IntegrityConfigurable settings)
      Creates an authenticated API Session against the Integrity Server
      Returns:
      An authenticated API Session
    • createLocalIntegrationPoint

      public static ISession createLocalIntegrationPoint(IntegrityConfigurable settings)
      Creates a local integration point
      Parameters:
      settings -
      Returns:
    • findOAuthCredentialById

      public OAuth2ClientCredentials findOAuthCredentialById(String credentialsId)
    • ping

      public void ping() throws com.mks.api.response.APIException
      Specified by:
      ping in interface ISession
      Throws:
      com.mks.api.response.APIException
    • runCommand

      public com.mks.api.response.Response runCommand(com.mks.api.Command cmd) throws com.mks.api.response.APIException
      This function executes a generic API/CLI Command
      Specified by:
      runCommand in interface ISession
      Parameters:
      cmd - Integrity API Command Object representing a CLI command
      Returns:
      Integrity API Response Object
      Throws:
      com.mks.api.response.APIException
    • runCommandWithInterim

      public com.mks.api.response.Response runCommandWithInterim(com.mks.api.Command cmd) throws com.mks.api.response.APIException
      This function executes a generic API/CLI Command with interim
      Specified by:
      runCommandWithInterim in interface ISession
      Parameters:
      cmd - Integrity API Command Object representing a CLI command
      Returns:
      Integrity API Response Object
      Throws:
      com.mks.api.response.APIException
    • runCommandAs

      public com.mks.api.response.Response runCommandAs(com.mks.api.Command cmd, String impersonateUser) throws com.mks.api.response.APIException
      This function executes a generic API/CLI Command impersonating another user
      Parameters:
      cmd - Integrity API Command Object representing a CLI command
      impersonateUser - The user to impersonate
      Returns:
      Integrity API Response Object
      Throws:
      com.mks.api.response.APIException
    • refreshAPISession

      public void refreshAPISession() throws com.mks.api.response.APIException
      Specified by:
      refreshAPISession in interface ISession
      Throws:
      com.mks.api.response.APIException
    • terminate

      public boolean terminate()
      Terminate the API Session and Integration Point
      Specified by:
      terminate in interface ISession
    • getUserName

      public String getUserName()
      Returns the Integrity User for this APISession
      Specified by:
      getUserName in interface ISession
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • checkifAlive

      public void checkifAlive() throws com.mks.api.response.APIException
      Specified by:
      checkifAlive in interface ISession
      Throws:
      com.mks.api.response.APIException