How to use the azure-storage.QueueUtilities function in azure-storage

To help you get started, we’ve selected a few azure-storage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DFEAGILEDEVOPS / MTC / _spikes-poc / sas / server / generate-sas-token.js View on Github external
'use strict'

require('dotenv').config()
const azure = require('azure-storage')

const storageConnection = process.env.AZURE_STORAGE_CONNECTION_STRING
if (!storageConnection) {
  process.exitCode = -1
  console.error('env var $AZURE_STORAGE_CONNECTION_STRING is required')
}

const queueName = process.env.QUEUE_NAME || 'completed-checks'
const permissions = azure.QueueUtilities.SharedAccessPermissions.ADD

var queueService = azure.createQueueService(storageConnection)
// setCors(queueService)

const generateSasToken = () => {
  // Create a SAS token that expires in an hour
  // Set start time to five minutes ago to avoid clock skew.
  var startDate = new Date()
  startDate.setMinutes(startDate.getMinutes() - 5)
  var expiryDate = new Date(startDate)
  expiryDate.setMinutes(startDate.getMinutes() + 60)

  var sharedAccessPolicy = {
    AccessPolicy: {
      Permissions: permissions,
      Start: startDate,
github DFEAGILEDEVOPS / MTC / admin / services / sas-token.service.js View on Github external
'use strict'

const azure = require('azure-storage')
const moment = require('moment')
const logger = require('./log.service').getLogger()
const config = require('../config')

const addPermissions = azure.QueueUtilities.SharedAccessPermissions.ADD
let azureQueueService

const sasTokenService = {
  /**
   *
   * @param queueName
   * @param {Moment} expiryDate
   * @param {Object} serviceImplementation
   * @return {{token: string, url: string, queueName: string}}
   */
  generateSasToken: function (queueName, expiryDate, serviceImplementation) {
    if (!serviceImplementation) {
      if (!azureQueueService) {
        if (!config.AZURE_STORAGE_CONNECTION_STRING) {
          throw new Error('An AZURE_STORAGE_CONNECTION_STRING is a required environment variable.')
        }
github DFEAGILEDEVOPS / MTC / func-complete-check / lib / sas-token-service.ts View on Github external
'use strict'

import * as azure from 'azure-storage'
import moment = require('moment')

const addPermissions = azure.QueueUtilities.SharedAccessPermissions.ADD

export interface IQueueService {
  generateSharedAccessSignature (queueName: string, sharedAccessPolicy: azure.common.SharedAccessPolicy): string
  getUrl (queue: string, sasToken?: string | undefined, primary?: boolean | undefined): string
}

export class SasToken {
  constructor (token: string, url: string) {
    this.token = token
    this.url = url
  }
  token: string
  url: string
}

export class SasTokenService {