Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
digitalocean
Advanced tools
npm install digitalocean
var Api = require('digitalocean').Api;
var api = new Api('CLIENT_ID', 'API_KEY');
/*
This method returns all active droplets that are currently running in your account.
REST equivalent: GET /droplets
*/
api.droplets.all(function(list) {
// get all droplets
console.log(list);
});
/*
This method returns full information for a specific droplet ID
REST equivalent: GET /droplets/12345
*/
api.droplets.get(12345, function(droplet) {
// get droplet #12345
console.log(droplet);
/* REST equivalent: GET /droplets/12345/destroy */
droplet.destroy(function() {
// destroyed
});
});
/*
This method allows you to add a new public SSH key to your account.
REST equivalent: GET /ssh_keys/new
*/
api.ssh_keys.new(
{
name: "New SSH key"
ssh_pub_key: "ssh-rsa ..................... user@host"
},
function(newSshKey) {
console.log(newSshKey);
}
);
Complete API documentation can be found at https://api.digitalocean.com/
/droplets
Api.droplets.all(onSuccess)
- get all active dropletsApi.droplets.get(id, onSuccess)
- get droplet by idApi.droplets.new({name: "Name", size_id: 1, image_id: 1, region_id: 1, ssh_key_ids: [1]}, onSuccess)
- create new dropletDroplet.id
Droplet.backups_active
Droplet.image_id
Droplet.name
Droplet.region_id
Droplet.size_id
Droplet.status
Droplet.reboot(onSuccess)
Droplet.power_cycle(onSuccess)
Droplet.shutdown(onSuccess)
Droplet.power_off(onSuccess)
Droplet.power_on(onSuccess)
Droplet.password_reset(onSuccess)
Droplet.resize({size_id: 1}, onSuccess)
Droplet.snapshot({name: "Name"}, onSuccess)
Droplet.restore({image_id: 1}, onSuccess)
Droplet.rebuild({image_id: 1}, onSuccess)
Droplet.enable_backups(onSuccess)
Droplet.disable_backups(onSuccess)
Droplet.rename({name: "New name"}, onSuccess)
Droplet.destroy(onSuccess)
/images
Api.images.all(onSuccess)
- get all available images (global and my own)Api.images.global(onSuccess)
- get all available global imagesApi.images.my(onSuccess)
- get all my own imagesApi.images.get(id, onSuccess)
- get image by idImage.id
Image.name
Image.distribution
Image.transfer({region_id: 1}, onSuccess)
Image.destroy(onSuccess)
/ssh_keys
Api.ssh_keys.all(onSuccess)
- get short info about my SSH keysApi.ssh_keys.get(id, onSuccess)
- get full info about specified SSH keyApi.ssh_keys.new({name: "My new key", ssh_pub_key: "ssh-rsa ... user@host"}, onSuccess)
- register new SSH keySshKey.id
SshKey.name
SshKey.ssh_pub_key
- available only in full infoSshKey.edit({ssh_pub_key: "ssh-rsa ... user@host"}, onSuccess)
SshKey.destroy(onSuccess)
/sizes
Api.sizes.all(onSuccess)
- get short info about all available instance typesApi.sizes.get(id, onSuccess)
- get full info about specified instance typeSize.id
Size.name
Size.slug
Size.cpu
- number of CPUs, available only in full infoSize.memory
- memory amount (in Mb), available only in full infoSize.cost_per_hour
- price per hour (in dollars), available only in full infoSize.disk
- disk space (in Gb), available only in full info/regions
Api.regions.all(onSuccess)
- get all available regionsApi.regions.get(id, onSuccess)
- get region by idRegion.id
Region.name
Region.slug
/domains
Api.domains.all(onSuccess)
- get all domainsApi.domains.get(id, onSuccess)
- get domain by idApi.domains.new({name: 'example.com', ip_address: '8.8.8.8'}, onSuccess)
- create new domainDomain.id
Domain.name
Domain.ttl
Domain.live_zone_file
Domain.error
Domain.zone_file_with_error
Domain.records
- see "Domain Records" sectionDomain.destroy(onSuccess)
/domains/[id]/records
Domain.records.all(onSuccess)
Domain.records.get(id, onSuccess)
Domain.records.new({domain_id: 1, data: '@', record_type: 'A', name: 'ya.ru'}, onSuccess)
DomainRecord.id
DomainRecord.domain_id
DomainRecord.record_type
DomainRecord.name
DomainRecord.data
DomainRecord.priority
DomainRecord.port
DomainRecord.weight
DomainRecord.edit({}, onSuccess)
DomainRecord.destroy(onSuccess)
By default all error will asynchronously throw an error. To catch them
you need to handle 'error'
event:
api.images.get(12345, function() {
/* ... */
}).on('error', function(error) {
console.error(error);
});
FAQs
nodejs wrapper for digitalocean v2 api
The npm package digitalocean receives a total of 25,851 weekly downloads. As such, digitalocean popularity was classified as popular.
We found that digitalocean 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
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.