-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathECR.js
48 lines (45 loc) · 926 Bytes
/
ECR.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require('rubico/global')
const AWSECR = require('aws-sdk/clients/ecr')
/**
* @name ECR
*
* @synopsis
* ```coffeescript [specscript]
* new ECR(options {
* ...({
* accessKeyId: string,
* secretAccessKey: string,
* region: string,
* })|({
* endpoint: string,
* region: string,
* })
* }) -> ECR
* ```
*/
const ECR = function (options) {
this.awsEcr = new AWSECR({
apiVersion: '2015-09-21',
...pick([
'accessKeyId',
'secretAccessKey',
'region',
'endpoint',
])(options),
})
return this
}
/**
* @name ECR.prototype.getAuthorizationToken
*
* @synopsis
* ```coffeescript [specscript]
* new ECR(...).getAuthorizationToken() -> Promise<{
* }>
* ```
*/
ECR.prototype.getAuthorizationToken = function getAuthorizationToken() {
return this.awsEcr.getAuthorizationToken()
.promise().then(get('authorizationData[0]'))
}
module.exports = ECR