Sha256: 8198818ccbe661b588b7273c767bf4b59a549c728264c6648bbf0294a309945b

Contents?: true

Size: 1.36 KB

Versions: 13

Compression:

Stored size: 1.36 KB

Contents

var cert_region = request.ResourceProperties.RegionOverride || request.ResourceProperties.Region;

var acm = new aws.ACM({region: cert_region});

var arn = request.ResourceProperties.Certificate;

function wait_for_approval(on_success, on_fail)
{
  var params = {
    CertificateArn: arn
  };

  acm.describeCertificate(params, function(err, cert_data) {
    console.log('describe certificate data');
    console.log(cert_data);;
    if (err)
    {
      on_fail(err);
    }
    else
    {
      if (cert_data.Certificate.DomainValidationOptions[0].ValidationStatus === "SUCCESS")
      {
        on_success();
      }
      else if (cert_data.Certificate.DomainValidationOptions[0].ValidationStatus === "FAILED")
      {
        on_fail("Verification Failed");
      }
      else
      {
        setTimeout(function()
        {
          wait_for_approval(on_success, on_fail);
        }, 3000);
      }
    }
  });
}

function fail(err)
{
  console.log('Errored.');
  console.log(err);
  Cloudformation.send(request, context, Cloudformation.FAILED, {}, "Error: " + err);
}

function success()
{
  Cloudformation.send(request, context, Cloudformation.SUCCESS, {}, "Success");
}

if (request.RequestType == "Create")
{
  wait_for_approval(success, fail);
}

if (request.RequestType == "Update")
{
  wait_for_approval(success, fail);
}

if (request.RequestType == "Delete")
{
  success();
}

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
sumomo-0.10.8 data/sumomo/custom_resources/ACMCertificateWaiter.js
sumomo-0.10.4 data/sumomo/custom_resources/ACMCertificateWaiter.js
sumomo-0.10.3 data/sumomo/custom_resources/ACMCertificateWaiter.js
sumomo-0.10.2 data/sumomo/custom_resources/ACMCertificateWaiter.js
sumomo-0.10.1 data/sumomo/custom_resources/ACMCertificateWaiter.js
sumomo-0.10.0 data/sumomo/custom_resources/ACMCertificateWaiter.js
sumomo-0.9.0 data/sumomo/custom_resources/ACMCertificateWaiter.js
sumomo-0.8.22 data/sumomo/custom_resources/ACMCertificateWaiter.js
sumomo-0.8.21 data/sumomo/custom_resources/ACMCertificateWaiter.js
sumomo-0.8.20 data/sumomo/custom_resources/ACMCertificateWaiter.js
sumomo-0.8.17 data/sumomo/custom_resources/ACMCertificateWaiter.js
sumomo-0.8.16 data/sumomo/custom_resources/ACMCertificateWaiter.js
sumomo-0.8.15 data/sumomo/custom_resources/ACMCertificateWaiter.js