github.com/jfrog/jfrog-cli-platform-services@v1.2.0/commands/templates/AFTER_CREATE.ts_template (about) 1 import { PlatformContext, AfterCreateRequest, AfterCreateResponse } from 'jfrog-workers'; 2 3 export default async (context: PlatformContext, data: AfterCreateRequest): Promise<AfterCreateResponse> => { 4 5 try { 6 // The HTTP client facilitates calls to the JFrog Platform REST APIs 7 //To call an external endpoint, use 'await context.clients.axios.get("https://foo.com")' 8 const res = await context.clients.platformHttp.get('/artifactory/api/v1/system/readiness'); 9 10 // You should reach this part if the HTTP request status is successful (HTTP Status 399 or lower) 11 if (res.status === 200) { 12 console.log("Artifactory ping success"); 13 } else { 14 console.warn(`Request was successful and returned status code : ${ res.status }`); 15 } 16 } catch(error) { 17 // The platformHttp client throws PlatformHttpClientError if the HTTP request status is 400 or higher 18 console.error(`Request failed with status code ${ error.status || '<none>' } caused by : ${ error.message }`) 19 } 20 21 return { 22 message: 'proceed', 23 } 24 }