How to use the @mapbox/cloudfriend.merge function in @mapbox/cloudfriend

To help you get started, we’ve selected a few @mapbox/cloudfriend 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 mapbox / ecs-watchbot / test / template.validation.js View on Github external
test('[template validation] defaults', async (assert) => {
  const builtWithDefaults = cf.merge(template({
    service: 'example',
    serviceVersion: '1',
    command: 'echo hello world',
    cluster: 'processing',
    notificationEmail: 'hello@mapbox.pagerduty.com'
  }));

  const tmp = path.join(os.tmpdir(), crypto.randomBytes(8).toString('hex'));
  fs.writeFileSync(tmp, JSON.stringify(builtWithDefaults));

  try {
    await cf.validate(tmp);
    assert.pass('template is valid');
  } catch (err) {
    assert.ifError(err, 'template is not valid');
  }
github mapbox / ecs-watchbot / test / template.spec.js View on Github external
test('[template]', () => {
  assert.throws(
    () => template(),
    /options.service is required/,
    'throws when missing required options'
  );

  const builtWithDefaults = cf.merge(template({
    service: 'example',
    serviceVersion: '1',
    command: 'echo hello world',
    cluster: 'processing',
    notificationEmail: 'hello@mapbox.pagerduty.com'
  }));

  expect(builtWithDefaults).toMatchSnapshot('defaults');

  const setsAllOptions = cf.merge(template({
    service: 'example',
    serviceVersion: '1',
    command: 'echo hello world',
    cluster: 'processing',
    permissions: [
      {
github mapbox / ecs-watchbot / test / template.validation.js View on Github external
test('[template validation] options set', async (assert) => {
  const setsAllOptions = cf.merge(template({
    service: 'example',
    serviceVersion: '1',
    command: 'echo hello world',
    cluster: 'processing',
    permissions: [
      {
        Effect: 'Allow',
        Action: 's3:GetObject',
        Resource: 'arn:aws:s3:::bucket/*'
      }
    ],
    env: {
      MyKey: 'MyValue'
    },
    prefix: 'Soup',
    family: 'abc-123',
github mapbox / ecs-watchbot / test / template.validation.js View on Github external
test('[template validation] fifo queue', async (assert) => {
  const fifo = cf.merge(template({
    service: 'example',
    serviceVersion: '1',
    command: 'echo hello world',
    cluster: 'processing',
    notificationEmail: 'hello@mapbox.pagerduty.com',
    fifo: true
  }));

  const tmp = path.join(os.tmpdir(), crypto.randomBytes(8).toString('hex'));
  fs.writeFileSync(tmp, JSON.stringify(fifo));

  try {
    await cf.validate(tmp);
    assert.pass('template is valid');
  } catch (err) {
    assert.ifError(err, 'template is not valid');
github mapbox / ecs-watchbot / test / template.spec.js View on Github external
expect(setsAllLowCPU).toMatchSnapshot('all-properties-low-CPU');


  const fifo = cf.merge(template({
    service: 'example',
    serviceVersion: '1',
    command: 'echo hello world',
    cluster: 'processing',
    notificationEmail: 'hello@mapbox.pagerduty.com',
    fifo: true
  }));

  expect(fifo).toMatchSnapshot('fifo');

  const fifoMaxSize = cf.merge(template({
    service: 'example',
    serviceVersion: '1',
    command: 'echo hello world',
    cluster: 'processing',
    notificationEmail: 'hello@mapbox.pagerduty.com',
    fifo: true,
    maxSize: 50
  }));

  expect(fifoMaxSize).toMatchSnapshot('fifoMaxSize');
});
github mapbox / ecs-watchbot / test / template.spec.js View on Github external
memory: 512,
      softMemory: 128,
      cpu: 0
    },
    privileged: true,
    reduce: true,
    messageTimeout: 300,
    messageRetention: 1096,
    deadletterThreshold: 50,
    notificationEmail: 'hello@mapbox.pagerduty.com'
  }));

  expect(setsAllLowCPU).toMatchSnapshot('all-properties-low-CPU');


  const fifo = cf.merge(template({
    service: 'example',
    serviceVersion: '1',
    command: 'echo hello world',
    cluster: 'processing',
    notificationEmail: 'hello@mapbox.pagerduty.com',
    fifo: true
  }));

  expect(fifo).toMatchSnapshot('fifo');

  const fifoMaxSize = cf.merge(template({
    service: 'example',
    serviceVersion: '1',
    command: 'echo hello world',
    cluster: 'processing',
    notificationEmail: 'hello@mapbox.pagerduty.com',
github mapbox / ecs-watchbot / test / template.spec.js View on Github external
() => template(),
    /options.service is required/,
    'throws when missing required options'
  );

  const builtWithDefaults = cf.merge(template({
    service: 'example',
    serviceVersion: '1',
    command: 'echo hello world',
    cluster: 'processing',
    notificationEmail: 'hello@mapbox.pagerduty.com'
  }));

  expect(builtWithDefaults).toMatchSnapshot('defaults');

  const setsAllOptions = cf.merge(template({
    service: 'example',
    serviceVersion: '1',
    command: 'echo hello world',
    cluster: 'processing',
    permissions: [
      {
        Effect: 'Allow',
        Action: 's3:GetObject',
        Resource: 'arn:aws:s3:::bucket/*'
      }
    ],
    env: {
      MyKey: 'MyValue'
    },
    prefix: 'Soup',
    family: 'abc-123',
github mapbox / ecs-watchbot / test / template.spec.js View on Github external
memory: 512,
      softMemory: 128,
      cpu: cf.ref('Gitsha')
    },
    privileged: true,
    reduce: true,
    messageTimeout: 300,
    messageRetention: 1096,
    deadletterThreshold: 50,
    deadletterAlarm: true,
    notificationEmail: 'hello@mapbox.pagerduty.com'
  }));

  expect(setsAllOptions).toMatchSnapshot('all-properties');

  const setsAllCPUNumber = cf.merge(template({
    service: 'example',
    serviceVersion: '1',
    command: 'echo hello world',
    cluster: 'processing',
    permissions: [
      {
        Effect: 'Allow',
        Action: 's3:GetObject',
        Resource: 'arn:aws:s3:::bucket/*'
      }
    ],
    env: {
      MyKey: 'MyValue'
    },
    prefix: 'Soup',
    family: 'abc-123',
github mapbox / ecs-watchbot / cloudformation / ecs-watchbot-generate-binaries.template.js View on Github external
},
              InputArtifacts: [
                { Name: 'Source' }
              ],
              Configuration: {
                ProjectName: cf.ref('AlpineBundler')
              }
            }
          ]
        }
      ]
    }
  }
};

module.exports = cf.merge({ Parameters, Resources });
github mapbox / stork / cloudformation / stork.template.js View on Github external
{ Name: 'FunctionName', Value: cf.ref('GatekeeperLambda') }
      ],
      MetricName: 'Errors',
      AlarmActions: [cf.ref('AlarmSNSTopic')]
    }
  }
};

const Outputs = {
  GithubAppInstallationId: { Value: cf.ref('GithubAppInstallationId') },
  GatekeeperLambda: { Value: cf.ref('GatekeeperLambda') }
};

const webhook = hookshot.github('TriggerLambda');

module.exports = cf.merge({ Parameters, Resources, Outputs }, webhook);