amplify-category-notifications
Advanced tools
Comparing version 0.1.13 to 0.1.14-unstable.1
@@ -6,2 +6,18 @@ # Change Log | ||
<a name="0.1.14-unstable.1"></a> | ||
## [0.1.14-unstable.1](https://github.com/aws-amplify/amplify-cli/compare/amplify-category-notifications@0.1.14-unstable.0...amplify-category-notifications@0.1.14-unstable.1) (2018-08-28) | ||
**Note:** Version bump only for package amplify-category-notifications | ||
<a name="0.1.14-unstable.0"></a> | ||
## [0.1.14-unstable.0](https://github.com/aws-amplify/amplify-cli/compare/amplify-category-notifications@0.1.13...amplify-category-notifications@0.1.14-unstable.0) (2018-08-28) | ||
**Note:** Version bump only for package amplify-category-notifications | ||
<a name="0.1.13"></a> | ||
@@ -8,0 +24,0 @@ ## [0.1.13](https://github.com/aws-amplify/amplify-cli/compare/amplify-category-notifications@0.1.12...amplify-category-notifications@0.1.13) (2018-08-23) |
@@ -27,8 +27,8 @@ const featureName = 'notifications'; | ||
{ | ||
name: 'configure', | ||
description: 'Configures a notification channel', | ||
name: 'update', | ||
description: 'Updates the configuration of a notification channel', | ||
}, | ||
{ | ||
name: 'status', | ||
description: 'Lists the enabled/disabled status of the available notification channels', | ||
description: 'Lists the enabled/disabled statuses of the available notification channels', | ||
}, | ||
@@ -35,0 +35,0 @@ { |
@@ -7,2 +7,3 @@ const inquirer = require('inquirer'); | ||
name: 'configure', | ||
alias: 'update', | ||
run: async (context) => { | ||
@@ -9,0 +10,0 @@ context.exeInfo = context.amplify.getProjectDetails(); |
@@ -5,3 +5,4 @@ const inquirer = require('inquirer'); | ||
const pinpointApp = 'The Pinpoint application'; | ||
const PinpointApp = 'The Pinpoint application'; | ||
const Cancel = 'Cancel'; | ||
@@ -16,3 +17,4 @@ module.exports = { | ||
enabledChannels.push(pinpointApp); | ||
enabledChannels.push(PinpointApp); | ||
enabledChannels.push(Cancel); | ||
@@ -35,25 +37,22 @@ let channelName = context.parameters.first; | ||
if (channelName) { | ||
if (channelName !== pinpointApp) { | ||
if (channelName && channelName !== Cancel) { | ||
if (channelName !== PinpointApp) { | ||
await pinpointHelper.checkPinpointApp(context); | ||
await notificationManager.disableChannel(context, channelName); | ||
notificationManager.updateaServiceMeta(context); | ||
} else if (pinpointHelper.isAnalyticsAdded(context)) { | ||
context.print.error('Execution aborted.'); | ||
context.print.info('You have an analytics resource in your backend tied to the Amazon Pinpoint resource'); | ||
context.print.info('The Analytics resource must be removed before Amazon Pinpoint can be deleted from the cloud'); | ||
} else { | ||
if(pinpointHelper.isAnalyticsAdded(context)) { | ||
context.print.error('You have added the analytics to your backend'); | ||
context.print.error('Analytics is also managed by the Amazon Pinpoint application'); | ||
context.print.info('Analytics must be removed before Amazon Pinpoint can be deleted'); | ||
context.print.info('Execution aborted.'); | ||
}else{ | ||
const answer = await inquirer.prompt({ | ||
name: 'deletePinpointApp', | ||
type: 'confirm', | ||
message: 'Confirm that you want to delete the associated AWS Pinpoint application', | ||
default: false, | ||
}); | ||
if (answer.deletePinpointApp) { | ||
await pinpointHelper.deletePinpointApp(context); | ||
context.print.info('The Pinpoint application has been successfully deleted.'); | ||
notificationManager.updateaServiceMeta(context); | ||
} | ||
const answer = await inquirer.prompt({ | ||
name: 'deletePinpointApp', | ||
type: 'confirm', | ||
message: 'Confirm that you want to delete the associated Amazon Pinpoint application', | ||
default: false, | ||
}); | ||
if (answer.deletePinpointApp) { | ||
await pinpointHelper.deletePinpointApp(context); | ||
context.print.info('The Pinpoint application has been successfully deleted.'); | ||
notificationManager.updateaServiceMeta(context); | ||
} | ||
@@ -60,0 +59,0 @@ } |
@@ -62,6 +62,11 @@ const inquirer = require('inquirer'); | ||
if (APNSChannelRequest.DefaultAuthenticationMethod === 'Key') { | ||
keyConfig = await configureKey.run(); | ||
} else { | ||
certificateConfig = await configureCertificate.run(); | ||
try { | ||
if (APNSChannelRequest.DefaultAuthenticationMethod === 'Key') { | ||
keyConfig = await configureKey.run(); | ||
} else { | ||
certificateConfig = await configureCertificate.run(); | ||
} | ||
} catch (err) { | ||
context.print.error(err.message); | ||
process.exit(1); | ||
} | ||
@@ -68,0 +73,0 @@ |
@@ -91,2 +91,4 @@ const fs = require('fs-extra'); | ||
fs.writeFileSync(currentAmplifyMetaFilePath, jsonString, 'utf8'); | ||
context.amplify.onCategoryOutputsChange(context); | ||
} | ||
@@ -93,0 +95,0 @@ |
@@ -10,3 +10,19 @@ const fs = require('fs-extra'); | ||
const Certificate = getCertificate(pemFileContent); | ||
const PrivateKey = getPrivateKey(pemFileContent); | ||
let PrivateKey = getPrivateKey(pemFileContent); | ||
if (!PrivateKey) { | ||
PrivateKey = getRSAPrivateKey(pemFileContent); | ||
} | ||
if (!PrivateKey) { | ||
PrivateKey = getEncryptedPrivateKey(pemFileContent); | ||
} | ||
if (!Certificate) { | ||
const errorMessage = 'Openssl can not extract the Certificate from the p12 file'; | ||
throw new Error(errorMessage); | ||
} | ||
if (!PrivateKey) { | ||
const errorMessage = 'Openssl can not extract the Private Key from the p12 file'; | ||
throw new Error(errorMessage); | ||
} | ||
return { | ||
@@ -57,4 +73,34 @@ Certificate, | ||
function getRSAPrivateKey(pemFileContent) { | ||
let privateKey; | ||
const beginMark = '-----BEGIN RSA PRIVATE KEY-----'; | ||
const beginIndex = pemFileContent.indexOf(beginMark) + beginMark.length; | ||
if (beginIndex > -1) { | ||
const endMark = '-----END RSA PRIVATE KEY-----'; | ||
const endIndex = pemFileContent.indexOf(endMark, beginIndex); | ||
if (endIndex > -1) { | ||
privateKey = pemFileContent.slice(beginIndex, endIndex).replace(/\s/g, ''); | ||
privateKey = beginMark + os.EOL + privateKey + os.EOL + endMark; | ||
} | ||
} | ||
return privateKey; | ||
} | ||
function getEncryptedPrivateKey(pemFileContent) { | ||
let privateKey; | ||
const beginMark = '-----BEGIN ENCRYPTED PRIVATE KEY-----'; | ||
const beginIndex = pemFileContent.indexOf(beginMark) + beginMark.length; | ||
if (beginIndex > -1) { | ||
const endMark = '-----END ENCRYPTED PRIVATE KEY-----'; | ||
const endIndex = pemFileContent.indexOf(endMark, beginIndex); | ||
if (endIndex > -1) { | ||
privateKey = pemFileContent.slice(beginIndex, endIndex).replace(/\s/g, ''); | ||
privateKey = beginMark + os.EOL + privateKey + os.EOL + endMark; | ||
} | ||
} | ||
return privateKey; | ||
} | ||
module.exports = { | ||
run, | ||
}; |
@@ -24,2 +24,3 @@ const opn = require('opn'); | ||
Id: pinpointApp.Id, | ||
Region: 'us-east-1', | ||
}, | ||
@@ -162,2 +163,3 @@ }; | ||
const aws = await provider.getConfiguredAWSClient(context); | ||
aws.config.update({ region: 'us-east-1' }); | ||
return new aws.Pinpoint(); | ||
@@ -164,0 +166,0 @@ } |
{ | ||
"name": "amplify-category-notifications", | ||
"version": "0.1.13", | ||
"version": "0.1.14-unstable.1", | ||
"description": "amplify-cli notifications plugin", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -9,7 +9,7 @@ # Amplify CLI Notifications Plugin | ||
| --- | --- | | ||
| amplify notifications add | Adds a notification channel. | | ||
| amplify notifications configure | Configures a notification channel. | | ||
| amplify notifications status | List the enabled/disabled status of the available notification channels. | | ||
| amplify notifications console | Opens the Amazon Pinpoint console displaying the current channel settings. | | ||
| amplify notifications remove | Removes a notification channel . | | ||
| amplify notifications add | Adds a notification channel. | | ||
| amplify notifications remove | Removes a notification channel. | | ||
| amplify notifications update | Configures a notification channel. | | ||
| amplify notifications status | Lists the enabled/disabled statuses of the available notification channels. | | ||
| amplify notifications console | Opens the Amazon Pinpoint console displaying the current channel settings. | | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38046
1015