Skip to content

Instantly share code, notes, and snippets.

@eedugon
Created July 20, 2022 09:41
Show Gist options
  • Save eedugon/66b8f7fce3d059faefe790bc5a7190be to your computer and use it in GitHub Desktop.
Save eedugon/66b8f7fce3d059faefe790bc5a7190be to your computer and use it in GitHub Desktop.
ui-driver-heztner modified to make use of disablePublic option of the 3.8.0 machine driver
"use strict";
define("nodes/components/driver-hetzner/component", ["exports", "shared/mixins/node-driver"], function (exports, _nodeDriver) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
return arr2;
}
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _defineProperty(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 LAYOUT = "PHNl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vZGl2Pg0KICB7ey9pZn19DQo8L3NlY3Rpb24+DQo=";
var computed = Ember.computed;
var get = Ember.get;
var set = Ember.set;
var alias = Ember.computed.alias;
var service = Ember.inject.service;
exports.default = Ember.Component.extend(_nodeDriver.default, {
driverName: 'hetzner',
needAPIToken: true,
config: alias('model.hetznerConfig'),
app: service(),
init: function init() {
var decodedLayout = window.atob(LAYOUT);
var template = Ember.HTMLBars.compile(decodedLayout, {
moduleName: 'nodes/components/driver-hetzner/template'
});
set(this, 'layout', template);
this._super.apply(this, arguments);
},
bootstrap: function bootstrap() {
var config = get(this, 'globalStore').createRecord({
type: 'hetznerConfig',
additionalKey: [],
serverType: 'cx21',
serverLocation: 'nbg1',
imageId: "168855",
userData: '',
networks: [],
firewalls: [],
usePrivateNetwork: false,
disablePublic: false,
serverLabel: [''],
placementGroup: ''
});
set(this, 'model.hetznerConfig', config);
},
validate: function validate() {
this._super();
if (!this.get('model.hetznerConfig.networks')) {
this.set('model.hetznerConfig.networks', []);
}
if (!this.get('model.hetznerConfig.firewalls')) {
this.set('model.hetznerConfig.firewalls', []);
}
if (!this.get('model.hetznerConfig.serverLabel')) {
this.set('model.hetznerConfig.serverLabel', []);
}
if (!this.get('model.hetznerConfig.additionalKey')) {
this.set('model.hetznerConfig.additionalKey', []);
}
var errors = get(this, 'errors') || [];
if (!get(this, 'model.name')) {
errors.push('Name is required');
}
if (get(errors, 'length')) {
set(this, 'errors', errors);
return false;
} else {
set(this, 'errors', null);
return true;
}
},
actions: {
getData: function getData() {
this.set('gettingData', true);
var that = this;
Promise.all([this.apiRequest('/v1/locations'), this.apiRequest('/v1/images'), this.apiRequest('/v1/server_types'), this.apiRequest('/v1/networks'), this.apiRequest('/v1/ssh_keys'), this.apiRequest('/v1/firewalls'), this.apiRequest('/v1/placement_groups')]).then(function (responses) {
that.setProperties({
errors: [],
needAPIToken: false,
gettingData: false,
regionChoices: responses[0].locations,
imageChoices: responses[1].images.map(function (image) {
return _objectSpread({}, image, {
id: image.id.toString()
});
}),
sizeChoices: responses[2].server_types,
networkChoices: responses[3].networks.map(function (network) {
return _objectSpread({}, network, {
id: network.id.toString()
});
}),
keyChoices: responses[4].ssh_keys.map(function (key) {
return _objectSpread({}, key, {
id: key.id.toString()
});
}),
firewallChoices: responses[5].firewalls.map(function (firewall) {
return _objectSpread({}, firewall, {
id: firewall.id.toString()
});
}),
placementGroupChoices: responses[6].placement_groups
});
}).catch(function (err) {
err.then(function (msg) {
that.setProperties({
errors: ['Error received from Hetzner Cloud: ' + msg.error.message],
gettingData: false
});
});
});
},
modifyNetworks: function modifyNetworks(select) {
var options = _toConsumableArray(select.target.options).filter(function (o) {
return o.selected;
}).map(function (o) {
return o.value;
});
this.set('model.hetznerConfig.networks', options);
},
modifyFirewalls: function modifyFirewalls(select) {
var options = _toConsumableArray(select.target.options).filter(function (o) {
return o.selected;
}).map(function (o) {
return o.value;
});
this.set('model.hetznerConfig.firewalls', options);
},
setLabels: function setLabels(labels) {
var labels_list = labels.map(function (l) {
return l.key + "=" + l.value;
});
this.set('model.hetznerConfig.serverLabel', labels_list);
this._super(labels);
},
modifyKeys: function modifyKeys(select) {
var _this = this;
var options = _toConsumableArray(select.target.options).filter(function (o) {
return o.selected;
}).map(function (o) {
return _this.keyChoices.find(function (keyChoice) {
return keyChoice.id == o.value;
})["public_key"];
});
this.set('model.hetznerConfig.additionalKey', options);
}
},
apiRequest: function apiRequest(path) {
return fetch('https://api.hetzner.cloud' + path, {
headers: {
'Authorization': 'Bearer ' + this.get('model.hetznerConfig.apiToken')
}
}).then(function (res) {
return res.ok ? res.json() : Promise.reject(res.json());
});
}
});
});;
"use strict";
define("ui/components/driver-hetzner/component", ["exports", "nodes/components/driver-hetzner/component"], function (exports, _component) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function () {
return _component.default;
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment