Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
fastly-domains
Advanced tools
Client to list all the domains for a particular Fastly account
The Fastly API doesn't provide an endpoint to fetch all the domains associated with an account. It only provides an endpoint which lists all the domains for a particular service and version and another one which lists all the domains for the active version of a service.
The solution is to perform a request to GET /service first in order to fetch all services of a Fastly account before you send a request for each service to GET /service/service_id/version/version/domain in order to fetch all of the domains of a service.
That's exactly what the fastly-domains
library does. Let's say you have 10 services then it needs to perform eleven requests (1 + 10) to the Fastly API in order to fetch all domains associated with an account.
You'll need a Fastly API Token in order to use the fastly-domains
library. Your token must have at least global:read access.
This is a Node.js module available through the npm registry. The fastly-domains
library can be used locally in your scripts or globally in your Terminal
or Command Prompt
. Installation is done using the npm install
command:
$ npm install --global fastly-domains
$ npm install --save fastly-domains
$ fastly-domains --token <your_fastly_api_token>
Or by using the alias:
$ fastly-domains -t <your_fastly_api_token>
const fastlyDomains = require('fastly-domains');
function handler() {
fastlyDomains('<your_fastly_api_token>')
.then(res => {
res.domains.forEach(domain => console.log(domain.name));
})
.catch(err => {
console.log(err.message);
});
}
const fastlyDomains = require('fastly-domains');
async function handler() {
try {
const res = await fastlyDomains('<your_fastly_api_token>');
res.domains.forEach(domain => console.log(domain.name));
} catch (err) {
console.log(err.message);
}
}
{
// a list of all domains associated with a fastly account
domains: [
{
version: 2,
name: 'fastly-domains.com',
service_id: '20Esr3c2mP2IO4661htKVo'
},
{
version: 2,
name: 'www.fastly-domains.com',
service_id: '20Esr3c2mP2IO4661htKVo'
}
],
// the total number of all domains associated to a fastly account
number_of_domains: 2,
// the total number of all services associated to a fastly account
number_of_services: 1
}
fastly-domains [options]
Options | Alias | Type | Description |
---|---|---|---|
--token | -t | string | Fastly API token |
--help | -h | - | Show help |
--version | -v | - | Show version number |
To run the test suite, first install the dependencies, then run the npm test
command:
$ npm install
$ npm test
PRs accepted. I am open to suggestions in improving this library. Commit by:
$ npm run commit
Licensed under the MIT License © 2017 Philipp Schulte
FAQs
Client to list all the domains for a particular Fastly account
The npm package fastly-domains receives a total of 1 weekly downloads. As such, fastly-domains popularity was classified as not popular.
We found that fastly-domains demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.