Name
sn_cmp.AWSV1DiscoUpgradeUtil
Description
No description available
Script
var AWSV1DiscoUpgradeUtil = Class.create();
AWSV1DiscoUpgradeUtil.prototype = Object.extendsObject(CloudV1DiscoUpgradeUtil, {
initialize: function() {
CloudV1DiscoUpgradeUtil.prototype.initialize.call(this);
this.accountType = 'aws_account_admin';
this.accountIdField = 'account_id';
this.regionType = 'aws_region';
this.instanceType = 'cmdb_ci_ec2_instance';
this.ldcType = 'cmdb_ci_aws_datacenter';
},
getAccountId: function(gr) {
return '' + gr.account_id;
},
getV1Account: function(accountId) {
var v1AccountGr = new GlideRecord('aws_account_admin');
if (v1AccountGr.get('account_id', accountId))
return v1AccountGr;
gs.info('ERROR: Account ID not found in aws_account_admin: ' + accountId);
return null;
},
getCred: function(oldAcct) {
if (!gs.nil(oldAcct.primary)) {
gs.info('Using primary credential: ' + oldAcct.primary.name);
return '' + oldAcct.primary.sys_id;
} else { // Just pick one
var credGr = new GlideRecord('aws_credentials');
credGr.addQuery('aws_account.sys_id', oldAcct.sys_id);
credGr.query();
if (credGr.next()) {
gs.info('Picking credential: ' + credGr.name);
return '' + credGr.sys_id;
}
}
gs.info('No credentials found for account with sys_id: ' + oldAcct.sys_id);
return '';
},
type: 'AWSV1DiscoUpgradeUtil'
});
Sys ID
b70dc1d79fb13200ef3c1f80a57fcfdf