Skip to content

Instantly share code, notes, and snippets.

@ypcode
Created March 7, 2020 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ypcode/5bf5826691f818bb48001e6a73a12196 to your computer and use it in GitHub Desktop.
Save ypcode/5bf5826691f818bb48001e6a73a12196 to your computer and use it in GitHub Desktop.
import { Logger } from "@azure/functions";
import { createSubscription } from "./subscriptions-helper";
import { getExpirationDateTimeISOString } from "./date-helper";
import { SETUP_RESOURCE, SETUP_CHANGE_TYPE, SETUP_NOTIFICATION_URL } from "./configure";
export const setupNewSubscription = async function(log: Logger) {
log("Let's create a new subscription...");
const created = await createSubscription({
resource: SETUP_RESOURCE,
changeType: SETUP_CHANGE_TYPE,
notificationUrl: SETUP_NOTIFICATION_URL,
expirationDateTime: getExpirationDateTimeISOString(3)
}, log);
log(`A new subscription has been created with id ${created.id}`);
log("Please update the configuration accordingly...");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment