How to use the aws-cdk-pure.use 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 / staticweb.ts View on Github external
"method.response.header.Content-Length": true,
          "method.response.header.Content-Type": true,
        },
        statusCode: '200',
      },
      {statusCode: '403'},
      {statusCode: '404'},
      {statusCode: '500'},
    ],
    requestParameters: {
      "method.request.path.key": true
    },
  }

  const segments = root.site.split('/').slice(1)
  return pure.use({ content: iaac(SiteContent), default: iaac(SiteDefault) })
    .effect(x => {
      const p = segments.reduce(
        (acc, seg) => acc.getResource(seg) || acc.addResource(seg), gw.root)
      p.addMethod('GET', x.default, spec)
      p.addResource('{key+}').addMethod('GET', x.content, spec)
    })
    .yield('content')
}
github fogfish / aws-cdk-pure / hoc / src / gateway.ts View on Github external
export function Api(props: GatewayProps): pure.IPure {
  const zone = hoc.HostedZone(props.domain) 

  return pure.use({ zone })
    .flatMap(x => ({ cert: hoc.Certificate(site(props), x.zone, props.tlsCertificate) }))
    .flatMap(x => ({ gateway: Gateway(props, x.cert) }))
    .flatMap(x => ({ dns: GatewayDNS(props, x.zone, x.gateway) }))
    .yield('gateway')
}
github fogfish / aws-cdk-pure / hoc / src / staticweb.ts View on Github external
export function Gateway(props: StaticSiteProps): pure.IPure {
  const zone = hoc.HostedZone(props.domain) 
  const origin = Origin(props, false)

  let gateway = pure.use({ zone, origin })
    .flatMap(x => ({ cert: hoc.Certificate(site(props), x.zone, props.tlsCertificate) }))
    .flatMap(x => ({ role: OriginAccessPolicy(x.origin) }))
    .flatMap(x => ({ gateway: SiteGateway(props, x.cert) }))
    .flatMap(x => ({ dns: GatewayDNS(props, x.zone, x.gateway) }))

  if (props.sites) {
    props.sites.forEach(spec =>
      gateway = gateway.flatMap(
        x => ({[spec.origin]: StaticContent(x.origin, x.role, x.gateway, spec)})
      )
    )
  }

  return gateway.yield('gateway')
}
github fogfish / aws-cdk-pure / hoc / src / staticweb.ts View on Github external
export function CloudFront(props: StaticSiteProps): pure.IPure {
  const zone = hoc.HostedZone(props.domain) 
  const origin = Origin(props)

  return pure.use({ zone, origin })
    .flatMap(x => ({ cert: hoc.Certificate(site(props), x.zone, props.tlsCertificate) }))
    .flatMap(x => ({ cdn: CDN(props, x.cert.certificateArn, x.origin) }))
    .flatMap(x => ({ dns: CloudFrontDNS(props, x.zone, x.cdn) }))
    .yield('cdn')
}

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