@groovy.transform.CompileStatic class CentralPortalClient extends WsClient
HTTP client for interacting with the Central Portal API. This class is configuration cache compatible - it only stores serializable values.
| Type | Name and description |
|---|---|
static java.lang.String |
CENTRAL_PORTAL_URL |
org.gradle.api.logging.Logger |
log |
java.lang.String |
password |
java.lang.String |
publishUrl |
java.lang.String |
userName |
| Properties inherited from class | Properties |
|---|---|
class WsClient |
APPLICATION_JSON, BODY, HEADERS, RESPONSE_CODE |
| Constructor and description |
|---|
CentralPortalClient(org.gradle.api.logging.Logger logger, java.lang.String nexusUrl, java.lang.String userName, java.lang.String password) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
java.lang.String |
auth(java.lang.String username, java.lang.String password) |
|
java.util.Map<java.lang.String, java.lang.Object> |
get(java.lang.String endpoint, java.lang.String username, java.lang.String password) |
|
java.lang.String |
getDeploymentState(java.util.Map<java.lang.String, java.lang.Object> status) |
|
java.util.Map<java.lang.String, java.lang.Object> |
getDeploymentStatus(java.lang.String deploymentId)Gets the status of a deployment by its ID |
|
java.lang.String |
upload(java.io.File file)Uploads the given file to Central portal |
| Methods inherited from class | Name |
|---|---|
class WsClient |
auth, get, post, postMultipart |
Gets the status of a deployment by its ID. $ curl --request POST \ --verbose \ --header 'Authorization: Bearer ZXhhbXBsZV91c2VybmFtZTpleGFtcGxlX3Bhca3N3b3JkCg==' \ 'https://central.sonatype.com/api/v1/publisher/status?id=28570f16-da32-4c14-bd2e-c1acc0782365' Response: { "deploymentId": "28570f16-da32-4c14-bd2e-c1acc0782365", "deploymentName": "central-bundle.zip", "deploymentState": "PUBLISHED", "purls": [ "pkg:maven/com.sonatype.central.example/example_java_project@0.0.7" ] }
deploymentId - The ID of the deployment.Uploads the given file to Central portal. $ curl --request POST \ --verbose \ --header 'Authorization: Bearer ZXhhbXBsZV91c2VybmFtZTpleGFtcGxlX3Bhc3N3b3Jk' \ --form bundle=@central-bundle.zip \ https://central.sonatype.com/api/v1/publisher/upload?publishingType=AUTOMATIC
file - The file to upload.Groovy Documentation