How to use the aws-cdk-pure.include function in aws-cdk-pure

To help you get started, we’ve selected a few aws-cdk-pure 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 fogfish / aws-cdk-pure / hoc / src / hoc.ts View on Github external
export function HostedZone(domainName: string): pure.IPure {
  const awscdkIssue4592 = (parent: cdk.Construct, id: string, props: dns.HostedZoneProviderProps): dns.IHostedZone => (
    dns.HostedZone.fromLookup(parent, id, props)
  )
  const iaac = pure.include(awscdkIssue4592) // dns.HostedZone.fromLookup
  const SiteHostedZone = (): dns.HostedZoneProviderProps => ({ domainName })
  return iaac(SiteHostedZone)
}
github fogfish / aws-cdk-pure / hoc / src / config.ts View on Github external
//
// Copyright (C) 2019 Dmitry Kolesnikov
//
// This file may be modified and distributed under the terms
// of the MIT license.  See the LICENSE file for details.
// https://github.com/fogfish/aws-cdk-pure
//
// Config/Secret Management HoC
//
import * as secret from '@aws-cdk/aws-secretsmanager'
import { IaaC, include, IPure } from 'aws-cdk-pure'

const defaultBucket = process.env.AWS_IAAC_CONFIG || 'undefined'
const vault = include(secret.Secret.fromSecretAttributes)

/**
 * returns a configuration as string value for given key as it is stored by AWS Secret Manager 
 *   
 * @param key name of the key
 * @param bucket AWS Secret Manager bucket, the value of AWS_IAAC_CONFIG env var is used as default bucket,
 */
export function String(key: string, bucket: string = defaultBucket): IPure {
  return vault(Config(bucket)).map(x => x.secretValueFromJson(key).toString())
}

function Config(secretArn: string): IaaC {
  const Secret = () => ({ secretArn })
  return Secret
}
github fogfish / aws-cdk-pure / hoc / src / hoc.ts View on Github external
export function Certificate(site: string, hostedZone: dns.IHostedZone, arn?: string): pure.IPure {
  if (arn) {
    const wrap = pure.include(acm.Certificate.fromCertificateArn)
    const SiteCA = (): string => arn
    return wrap(SiteCA)
  } else {
    const iaac = pure.iaac(acm.DnsValidatedCertificate)
    const SiteCA = (): acm.DnsValidatedCertificateProps => ({ domainName: site, hostedZone })
    return iaac(SiteCA)
  }
}

aws-cdk-pure

Purely Functional Cloud Components with AWS CDK

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis