1.2.1 • Published 2 years ago
@noodl/cloudservices-sdk v1.2.1
CloudServices SDK
CloudServices SDK is a model driven SDK where you can interact with our hosting solution.
Getting Started
// You need to have a HTTP Client which will handle the API Token
const client = new HostingWorkspace(...);
// Returns all the environments with the passed filter.
const environments = await client.environments({ projectId: 'pid' });
// Get access to all the environments from the query:
// environments.items;
// Returns a specific environment by id
const environment = await client.environment('environment-id');
if (environment.isValid()) {
// Check if we have access to the resource
}
// Returns all the frontends from a environment
const frontends = await environment.frontends();
if (frontends.items.length > 0) {
// frontends.items[0].name;
// Returns the frontend domain status
const frontendStatus = await frontends.items[0].status();
}
// Create a deploy task for a frontend
const deployTask = await frontends[0].deploy();
// Mark that the frontend has been updated.
// this is currently the same as calling:
// frontends[0].invalidate();
deployTask.completed();
// Returns a specific frontend
const frontend = await environment.frontend('frontend-id');
if (frontend.isValid()) {
// Deletes the frontend
await frontend.delete();
}
Running tests
These env variables have to be set to run against PROD environment.
$env:TEST_ENDPOINT = "https://admin.noodl.cloud"
$env:TEST_HOSTNAME = "huff.getnoodling.com"
$env:TEST_TOKEN_W1_P1_TOKEN = ""
$env:TEST_TOKEN_W2_P1_TOKEN = ""
$env:TEST_TOKEN_W1_P1_PROJECT_ID = ""
$env:TEST_TOKEN_W1_P2_PROJECT_ID = ""
$env:TEST_TOKEN_W2_P1_PROJECT_ID = ""