Class CortexCliApi
java.lang.Object
org.jenkinsci.plugins.cortexcloud.api.CortexCliApi
Thin REST client for the Cortex tenant API.
It is responsible for the one platform endpoint the plugin needs at build
time: the unified-CLI download-link lookup (CortexConstants.DOWNLOAD_LINK_PATH).
That endpoint both (a) proves the base URL and credentials are valid (used by
the global config's Test Connection) and (b) yields the signed URL + checksum
used to provision the cortexcli binary onto an agent.
Authentication uses the same credentials the CLI consumes, sent as HTTP headers:
-
Authorization: <api key>
- x-xdr-auth-id: <api key id>
HTTP requests use HttpClient configured via
ProxyConfiguration.newHttpClientBuilder() to honour the Jenkins
global proxy configuration.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classResponse body of CortexConstants.DOWNLOAD_LINK_PATH. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetDownloadLink(String os, String arch) Requests a signed download link + checksum for the cortexcli binary matching the given OS and architecture.voidVerifies connectivity and credentials by requesting a download link for the current platform.
-
Constructor Details
-
CortexCliApi
- Parameters:
baseUrl- tenant API base URL (trailing slash optional)apiKey- API key (secret)apiKeyId- API key ID (maps to the x-xdr-auth-id header)
-
-
Method Details
-
testConnection
Verifies connectivity and credentials by requesting a download link for the current platform. A 2xx response with a usable signed URL means the tenant is reachable and the credentials are accepted.- Throws:
IOException- if the request fails or the tenant rejects the credentials
-
getDownloadLink
Requests a signed download link + checksum for the cortexcli binary matching the given OS and architecture.- Parameters:
os- one of CortexConstants.OS_LINUX, OS_DARWIN, OS_WINDOWSarch- one of CortexConstants.ARCH_AMD64, ARCH_ARM64- Returns:
- the parsed download link metadata
- Throws:
IOException- on transport error or non-2xx response
-