Package org.eclipse.csi.codesign
Class CodesignClient
java.lang.Object
org.eclipse.csi.codesign.CodesignClient
- All Implemented Interfaces:
AutoCloseable
HTTP client for all SignPath API operations: submit, poll status, and download.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordConfiguration for the codesign client. -
Constructor Summary
ConstructorsConstructorDescriptionCodesignClient(CodesignClient.Config config) Creates a new client from the given configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Releases HTTP resources held by this client.voiddownloadSignedArtifact(SigningRequestStatus status, Path outputPath) Downloads the signed artifact to the given output path.getStatus(SigningRequest signingRequest) Polls the status of a signing request.submit(String projectId, String signingPolicy, String artifactConfiguration, String description, Map<String, String> parameters, Path artifactPath) Submits an artifact for signing.
-
Constructor Details
-
CodesignClient
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, IOExceptionSubmits an artifact for signing.- Parameters:
projectId- the SignPath project slugsigningPolicy- the signing policy slugartifactConfiguration- optional artifact configuration slug, may benulldescription- optional signing request description, may benullparameters- optional custom key/value parameters, may benullartifactPath- path to the artifact file to sign- Returns:
- a
SigningRequestcontaining the status polling URL - Throws:
CodesignException- if the API returns a non-201 responseIOException- 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 responseIOException- 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 linkoutputPath- the local path where the signed artifact will be written- Throws:
CodesignException- if no signed artifact link is available or the API returns an errorIOException- on transport-level or I/O failures
-
close
public void close()Releases HTTP resources held by this client.- Specified by:
closein interfaceAutoCloseable
-