Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
api: process.env.launchpad_api,
passphrase: process.env.launchpad_passphrase,
certificate: process.env.launchpad_certificate
};
const token = await launchpad.getLaunchpadToken(config);
params.token = token;
} else {
const secret = await commonAws.secretsManager().getSecretValue({
SecretId: process.env.cmr_password_secret_name
}).promise();
params.username = process.env.cmr_username;
params.password = secret.SecretString;
}
const cmr = new CMR(params);
const metadata = await cmrjs.getMetadata(granule.cmrLink);
// Use granule UR to delete from CMR
await cmr.deleteGranule(metadata.title, granule.collectionId);
await this.update({ granuleId: granule.granuleId }, { published: false }, ['cmrLink']);
}
async function publish2CMR(cmrPublishObject, creds) {
const cmrClient = new CMR(creds);
// choose xml or json and do the things.
if (isECHO10File(cmrPublishObject.filename)) {
return publishECHO10XML2CMR(cmrPublishObject, cmrClient);
}
if (isUMMGFile(cmrPublishObject.filename)) {
return publishUMMGJSON2CMR(cmrPublishObject, cmrClient);
}
throw new Error(`invalid cmrPublishObject passed to publis2CMR ${JSON.stringify(cmrPublishObject)}`);
}
constructor(provider, clientId, username, password) {
deprecate('@cmrjs/CMR', '1.11.3');
this.provider = provider;
this.cmrClient = new cmrClient.CMR({
provider,
clientId,
username,
password
});
}
constructor(provider, clientId, type, searchParams, format) {
deprecate('@cmrjs/CMRSearchConceptQueue', '1.11.3');
this.cmrClientSearchConceptQueue = new cmrClient.CMRSearchConceptQueue({
provider,
clientId,
type,
searchParams,
format
});
}
json: true,
body: ummMetadata,
headers: {
Accept: 'application/json',
'Content-type': `application/vnd.nasa.cmr.umm+json;version=${version}`
}
});
if (result.statusCode === 200) {
return true;
}
} catch (e) {
result = e.response;
}
throw new ValidationError(
`Validation was not successful. UMM metadata Object: ${JSON.stringify(ummMetadata)}`
);
}