@jameslnewell/buildkite-pipelines
Version:
Generate Buildkite pipelines from code.
120 lines (119 loc) • 3.51 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ECRPlugin", {
enumerable: true,
get: function() {
return ECRPlugin;
}
});
function _check_private_redeclaration(obj, privateCollection) {
if (privateCollection.has(obj)) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _class_apply_descriptor_get(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _class_extract_field_descriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _class_private_field_get(receiver, privateMap) {
var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get");
return _class_apply_descriptor_get(receiver, descriptor);
}
function _class_private_field_init(obj, privateMap, value) {
_check_private_redeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _define_property(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
var _accounts = /*#__PURE__*/ new WeakMap(), _options = /*#__PURE__*/ new WeakMap();
class ECRPlugin {
/**
* @deprecated Use .setLogin() instead
*/ login(login = true) {
return this.setLogin(login);
}
setLogin(login) {
_class_private_field_get(this, _options)['login'] = login;
return this;
}
/**
* @deprecated Use .setAccount() instead
*/ account(id) {
return this.setAccount(id);
}
setAccount(id) {
_class_private_field_get(this, _accounts).push(id);
return this;
}
/**
* @deprecated Use .setRegion() instead
*/ region(region) {
return this.setRegion(region);
}
setRegion(region) {
_class_private_field_get(this, _options)['region'] = region;
return this;
}
/**
* @deprecated Use .setRetries() instead
*/ retries(retries) {
return this.setRetries(retries);
}
setRetries(retries) {
_class_private_field_get(this, _options)['retries'] = retries;
return this;
}
setAssumeRole(roleArn, durationSeconds) {
_class_private_field_get(this, _options)['assume-role'] = {
'role-arn': roleArn,
...durationSeconds !== undefined ? {
'duration-seconds': durationSeconds
} : {}
};
return this;
}
build() {
const object = {
..._class_private_field_get(this, _options)
};
if (_class_private_field_get(this, _accounts).length) {
object['account-ids'] = _class_private_field_get(this, _accounts);
}
return {
[ECRPlugin.PLUGIN]: object
};
}
constructor(){
_class_private_field_init(this, _accounts, {
writable: true,
value: []
});
_class_private_field_init(this, _options, {
writable: true,
value: {}
});
}
}
_define_property(ECRPlugin, "PLUGIN", 'ecr#v2.9.0');
//# sourceMappingURL=ECRPlugin.js.map