Class CodesignClient

java.lang.Object
org.eclipse.csi.codesign.CodesignClient
All Implemented Interfaces:
AutoCloseable

public class CodesignClient extends Object implements AutoCloseable
HTTP client for all SignPath API operations: submit, poll status, and download.
  • Constructor Details

    • CodesignClient

      public CodesignClient(CodesignClient.Config config)
      Creates a new client from the given configuration.
      Parameters:
      config - the client configuration
  • Method Details

    • submit

      public SigningRequest submit(String projectId, String signingPolicy, String artifactConfiguration, String description, Map<String,String> parameters, Path artifactPath) throws CodesignException, IOException
      Submits an artifact for signing.
      Parameters:
      projectId - the SignPath project slug
      signingPolicy - the signing policy slug
      artifactConfiguration - optional artifact configuration slug, may be null
      description - optional signing request description, may be null
      parameters - optional custom key/value parameters, may be null
      artifactPath - path to the artifact file to sign
      Returns:
      a SigningRequest containing the status polling URL
      Throws:
      CodesignException - if the API returns a non-201 response
      IOException - on transport-level failures
    • getStatus

      public SigningRequestStatus getStatus(SigningRequest signingRequest) throws CodesignException, IOException
      Polls the status of a signing request.
      Parameters:
      signingRequest - the signing request to poll
      Returns:
      the current SigningRequestStatus
      Throws:
      CodesignException - if the API returns an unsuccessful response
      IOException - on transport-level failures
    • downloadSignedArtifact

      public void downloadSignedArtifact(SigningRequestStatus status, Path outputPath) throws CodesignException, IOException
      Downloads the signed artifact to the given output path.
      Parameters:
      status - the final signing request status containing the artifact download link
      outputPath - the local path where the signed artifact will be written
      Throws:
      CodesignException - if no signed artifact link is available or the API returns an error
      IOException - on transport-level or I/O failures
    • close

      public void close()
      Releases HTTP resources held by this client.
      Specified by:
      close in interface AutoCloseable