Socket
Socket
Sign inDemoInstall

block-storage

Package Overview
Dependencies
50
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

18

lib/client.js

@@ -116,4 +116,22 @@ const request = require('request-promise')

resize(id, gigabytes, callback) {
const opts = {
method: 'POST',
uri: `${this.url}/${id}/actions`,
headers: {
'Authorization': `Bearer ${this.token}`
},
body: {
"type": "resize",
"size_gigabytes": gigabytes,
"region": "nyc1"
},
json: true
}
return Promise.resolve(request(opts)).asCallback(callback)
}
}
module.exports = Client

2

package.json
{
"name": "block-storage",
"version": "1.0.0",
"version": "1.1.0",
"description": "A simple way to connect to Digital Ocean's Volumes API",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -13,3 +13,2 @@ # block-storage

- [Table of Concepts](#table-of-concepts)
- [Installation](#installation)

@@ -25,2 +24,3 @@ - [Authentication: Bearer Token](#authentication-bearer-token)

- [volumes.delete()](#volumesdelete)
- [volumes.resize()](#volumesresize)
- [Ussage](#ussage)

@@ -150,2 +150,15 @@ - [Using callbacks](#using-callbacks)

#### volumes.resize()
Resizes a single volume.
```js
volumes.resize(volumeId, gigabytes, (err, obj) => {
if (err) console.log(err)
console.log(obj)
})
```
## Ussage

@@ -152,0 +165,0 @@

@@ -23,2 +23,3 @@ 'use strict'

t.is(typeof volumes.actions, 'function', 'actions is a function')
t.is(typeof volumes.resize, 'function', 'resize is a function')
})

@@ -97,1 +98,10 @@

})
test('Resize a single volume', async t => {
let volumes = t.context.volumes
let volumeId = config.test.id
let body = await volumes.resize(volumeId, 2)
t.is(body.action.type, 'resize_volume', 'The request has resised the selected volume')
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc