示例#1
0
        public FrontendStack(Construct scope, string name, string url, StackProps props = null) : base(scope, $"frontend-{name}", props)
        {
            // pricing - hosted zone
            // 0,50 USD por zona hospedada/mês para as primeiras 25 zonas hospedadas
            // 0,10 USD por zona hospedada/mês para zonas hospedadas adicionais
            // Consultas padrão
            // 0,40 USD por milhão de consultas – primeiro 1 bilhão de consultas/mês
            // 0,20 USD por milhão de consultas – mais de 1 bilhão de consultas/mês
            // Consultas de roteamento baseado em latência
            // 0,60 USD por milhão de consultas – primeiro 1 bilhão de consultas/mês
            // 0,30 USD por milhão de consultas – mais de 1 bilhão de consultas/mês
            // Consultas de Geo DNS e geoproximidade
            // 0,70 USD por milhão de consultas -- primeiro 1 bilhão de consultas/mês
            // 0,35 USD por milhão de consultas -- mais de 1 bilhão de consultas/mês

            _bucket = new Bucket(this, $"frontend-{name}-bucket", new BucketProps()
            {
                BucketName           = name + "72b302bf297a228a75730123efef7c41",
                WebsiteIndexDocument = "index.html",
                PublicReadAccess     = true,
                RemovalPolicy        = RemovalPolicy.DESTROY
            });

            _bucketDeployment = new BucketDeployment(this, $"frontend-{name}-deployment", new BucketDeploymentProps()
            {
                Sources           = new[] { Source.Asset("../tools/frontend/") },
                DestinationBucket = _bucket,
                RetainOnDelete    = false
            });

            _hostedZone = new HostedZone(this, $"frontend-{name}-hostedzone", new HostedZoneProps
            {
                ZoneName = url
            });

            _certificate = new Certificate(this, $"frontend-{name}-certificate", new CertificateProps
            {
                DomainName = url,
                Validation = CertificateValidation.FromDns(_hostedZone)
            });

            _distribution = new Distribution(this, $"frontend-{name}-distribution", new DistributionProps
            {
                DefaultBehavior = new BehaviorOptions
                {
                    Origin = new S3Origin(_bucket),
                    ViewerProtocolPolicy = ViewerProtocolPolicy.REDIRECT_TO_HTTPS
                },
                DomainNames       = new[] { url },
                Certificate       = _certificate,
                DefaultRootObject = "index.html"
            });

            _aRecord = new ARecord(this, $"frontend-{name}-arecord", new ARecordProps
            {
                Zone       = _hostedZone,
                RecordName = url,
                Target     = RecordTarget.FromAlias(new CloudFrontTarget(_distribution))
            });
        }
        private RecordTarget CreateRecordTarget()
        {
            RecordTarget recordTargetBean = new RecordTarget();

            recordTargetBean.PatientRole = CreatePatientRole();
            return(recordTargetBean);
        }
        public StaticSiteOnS3WithCloudFront(Stack scope, string id, StaticSiteConstructProps props) : base(scope, id)
        {
            var fullDomain = $"{props.SiteSubDomain}.{props.DomainName}";

            var siteBucket = new Bucket(this, $"SiteBucket_{id}", new BucketProps
            {
                BucketName           = $"static-content-{fullDomain}",
                WebsiteIndexDocument = props.WebsiteIndexDocument,
                WebsiteErrorDocument = "error.html",
                PublicReadAccess     = true,
                RemovalPolicy        = RemovalPolicy.DESTROY
            });


            var distribution = new CloudFrontWebDistribution(this, $"SiteDistribution_{id}", new CloudFrontWebDistributionProps
            {
                AliasConfiguration = new AliasConfiguration()
                {
                    Names          = new string[] { fullDomain },
                    AcmCertRef     = props.CertificateArn,
                    SecurityPolicy = SecurityPolicyProtocol.TLS_V1_2_2019
                },

                //ViewerCertificate = ViewerCertificate.FromAcmCertificate(certificate), // this syntax doesn't seem to be quite ready for use yet
                OriginConfigs = new ISourceConfiguration[]
                {
                    new SourceConfiguration
                    {
                        S3OriginSource = new S3OriginConfig {
                            S3BucketSource = siteBucket
                        },
                        Behaviors = new Behavior[] { new Behavior()
                                                     {
                                                         IsDefaultBehavior = true
                                                     } }
                    }
                }
            });

            new ARecord(this, $"SiteAliasRecord_{id}", new ARecordProps
            {
                RecordName = fullDomain,
                Target     = RecordTarget.FromAlias(new CloudFrontTarget(distribution)),
                Zone       = props.Zone
            });

            new BucketDeployment(this, $"DeployWithInvalidation_{id}", new BucketDeploymentProps
            {
                Sources           = new ISource[] { Source.Asset(props.WebsiteFilesPath) },
                DestinationBucket = siteBucket,
                Distribution      = distribution,
                DistributionPaths = new string[] { "/*" }
            });

            scope.Log($"CloudFrontSite_{props.DomainName}", $"https://{fullDomain}");

            scope.Log($"StaticWebsiteBucket_{props.DomainName}", siteBucket.BucketName);
        }
示例#4
0
        public DotNetLambdaWithApiGetway(Stack scope, string id, DotNetLambdaWithApiGetwayProps props) : base(scope, id)
        {
            // domain and certificate have been created manually on AWS Console for security purposes

            var snsTopic = new Topic(this, "WorkSplitRequest", new TopicProps()
            {
                TopicName   = "work-split-request",
                DisplayName = "Work Split Request"
            });

            snsTopic.AddSubscription(new EmailSubscription("*****@*****.**", new EmailSubscriptionProps()));

            var queue = new Queue(this, "QueueProcessor", new QueueProps()
            {
                RetentionPeriod = Duration.Days(2)
            });

            snsTopic.AddSubscription(new SqsSubscription(queue));

            var dotnetWebApiLambda = new Function(this, "WebLambda", new FunctionProps
            {
                Runtime = Runtime.DOTNET_CORE_3_1,
                Code    = props.Code,
                Handler = "Web::Web.LambdaEntryPoint::FunctionHandlerAsync"
            });

            dotnetWebApiLambda.AddEnvironment("Region", scope.Region);
            dotnetWebApiLambda.AddEnvironment("SnsTopic", snsTopic.TopicArn);
            snsTopic.GrantPublish(dotnetWebApiLambda);

            var fullDomain = $"{props.SiteSubDomain}.{props.DomainName}";

            var apiGetway = new LambdaRestApi(this, fullDomain, new LambdaRestApiProps()
            {
                Handler = dotnetWebApiLambda
            });

            var apiDomain = apiGetway.AddDomainName("customDomain", new DomainNameOptions()
            {
                DomainName     = fullDomain,
                Certificate    = props.Certificate,
                SecurityPolicy = SecurityPolicy.TLS_1_2,
                EndpointType   = EndpointType.EDGE
            });

            new ARecord(this, "ApiGateway-ARecord", new ARecordProps()
            {
                Zone       = props.Zone,
                RecordName = fullDomain,
                Target     = RecordTarget.FromAlias(new ApiGateway(apiGetway)),
            });


            scope.Log($"ApiGateway Url {id}", apiGetway.Url);
            scope.Log($"ApiGateway public domain {id}", apiDomain.DomainNameAliasDomainName);
        }
示例#5
0
 private ARecord AddRoute53Alias(string hostedZoneUrl, string applicationUrl, DomainName domainName)
 {
     return(new ARecord(stack, "Route53Alias", new ARecordProps {
         Zone = HostedZone.FromLookup(stack, "HostedZone", new HostedZoneProviderProps {
             DomainName = hostedZoneUrl
         }),
         RecordName = applicationUrl,
         Target = RecordTarget.FromAlias(new ApiGatewayv2Domain(domainName))
     }));
 }
示例#6
0
        public IvrStack(Construct scope, string stackId, StackProps stackProps, IvrSiteSchema schema, IEnumerable <SecurityGroupRule> securityGroupRules) : base(scope, stackId, stackProps)
        {
            IVpc vpc             = null;
            var  MaxIpsPerSubnet = IvrVpcProps.MaxIpsPerSubnet;

            if (!string.IsNullOrWhiteSpace(schema.VpcName))
            {
                vpc = Vpc.FromLookup(this, "$VPC", new VpcLookupOptions {
                    VpcName = schema.VpcName,
                });                                                                                     // will error if not found
                //MaxIpsPerSubnet = ???;
            }
            else if (!string.IsNullOrWhiteSpace(schema.VpcId))
            {
                vpc = Vpc.FromLookup(this, "$VPC", new VpcLookupOptions {
                    VpcId = schema.VpcId,
                });                                                                                 // will error if not found
                //MaxIpsPerSubnet = ???;
            }
            else if (null != schema.VpcProps)
            {
                // use provided props to create brand new VPC
                vpc = new IvrVpc(this, $"VPC", schema.VpcProps);
            }

            if (schema.AddVpcS3Gateway)
            {
                var s3gw = new GatewayVpcEndpoint(this, $"S3GW", new GatewayVpcEndpointProps
                {
                    Vpc     = vpc,
                    Service = GatewayVpcEndpointAwsService.S3,
                    Subnets = new SubnetSelection[] { new SubnetSelection {
                                                          SubnetType = SubnetType.PUBLIC,
                                                      } },
                });
            }

            var role = new Role(this, "IVR", new RoleProps
            {
                AssumedBy      = new ServicePrincipal("ec2.amazonaws.com"),
                InlinePolicies = new IvrInlinePolicies(stackProps.Env.Account, stackId, schema),
            });

            // Configure inbound security for RDP (and more?)
            var securityGroup = new SecurityGroup(this, $"Ingress", new SecurityGroupProps
            {
                Vpc = vpc,
                AllowAllOutbound = schema.AllowAllOutbound,
            });

            securityGroupRules.ForEach(rule => securityGroup.WithSecurityGroupRule(rule));
            if (schema.AllowAllIntranet)
            {
                securityGroup.WithSecurityGroupRule(new IngressRule(Peer.Ipv4($"{vpc.VpcCidrBlock}"), Port.AllTraffic()).WithDescription($"All intranet traffic"));
            }

            // Finally - create our instances!
            var hosts = new List <HostInstance>();

            for (var subnetIndex = 0; ++subnetIndex <= Math.Min(vpc.PublicSubnets.Length, schema.MaxSubnets);)
            {
                var hostIndexInSubnet = 0;
                foreach (var group in schema.HostGroups)
                {
                    var numberOfHosts = Math.Min(group.HostCount, MaxIpsPerSubnet);
                    if (numberOfHosts != group.HostCount)
                    {
                        Console.WriteLine($"Group({group.Name}) host count changed from {group.HostCount} to {numberOfHosts}");
                        group.HostCount = numberOfHosts;
                    }
                    var instanceProps = IvrInstanceProps.InstanceProps(vpc, vpc.PublicSubnets[subnetIndex - 1], role, securityGroup, group.InstanceProps);
                    for (var hostCount = 0; ++hostCount <= numberOfHosts; ++hostIndexInSubnet)
                    {
                        var hostName         = $"{schema.HostNamePrefix}{subnetIndex}{hostIndexInSubnet:00}";
                        var hostPrimingProps = new HostPrimingProps
                        {
                            HostName           = hostName.AsWindowsComputerName(), // must fit into 15 chars
                            WorkingFolder      = $"{stackId}".AsWindowsFolder(),
                            AwsAccount         = stackProps.Env.Account,
                            AwsRoleName        = role.RoleName,
                            RdpProps           = schema.RdpProps,
                            EC2Users           = schema.EC2Users,
                            DownloadAndInstall = group.DownloadAndInstall,
                            S3iArgs            = $"{group.InstallS3i} --verbose",
                        };
                        var hostCommands = HostPriming.PrimeForS3i(hostPrimingProps)
                                           .WithFirewallAllowInbound($"{vpc.VpcCidrBlock}");
                        hostCommands.WithRenameAndRestart(hostPrimingProps.HostName);
                        instanceProps.KeyName  = schema.KeyPairName;
                        instanceProps.UserData = hostCommands.UserData;
                        hosts.Add(new HostInstance
                        {
                            Group    = group,
                            Instance = new Instance_(this, hostName.AsCloudFormationId(), instanceProps),
                        });
                    }
                }
            }
            // associate pre-allocated EIPs
            var preAllocatedEIPs    = schema.PreAllocatedElasticIPs?.SelectMany(s => s.Csv()).ToList() ?? new List <string> {
            };
            var hostsThatRequireEIP = hosts.Where(h => h.Group.UsePreAllocatedElasticIPs).ToList();

            if (preAllocatedEIPs.Count < hostsThatRequireEIP.Count)
            {
                throw new ArgumentException($"Pre-Allocated Elastic IPs needed: {hostsThatRequireEIP.Count()}, but only {preAllocatedEIPs.Count()} configured in schema.{nameof(IvrSiteSchema.PreAllocatedElasticIPs)}");
            }
            var elasticIPAssociations = hostsThatRequireEIP.Zip(preAllocatedEIPs, (h, a) =>
            {
                return(new CfnEIPAssociation(this, $"EIPA{h.Instance.InstancePrivateIp}".AsCloudFormationId(), new CfnEIPAssociationProps
                {
                    AllocationId = a,
                    InstanceId = h.Instance.InstanceId,
                }));
            }).ToList();    // execute LINQ now

            // We have schema.Domain registered in advance
            if (!string.IsNullOrWhiteSpace(schema.HostedZoneDomain))
            {
                var theZone = HostedZone.FromLookup(this, $"{stackId}_Zone_", new HostedZoneProviderProps
                {
                    DomainName = schema.HostedZoneDomain,
                    //Comment = "HostedZone created by Route53 Registrar",
                });
                // assign new Elastic IPs as needed
                if (!string.IsNullOrWhiteSpace(schema.SubdomainEIPs))
                {
                    var newElasticIPs = hosts.Where(h => h.Group.AllocateNewElasticIPs).Select(h =>
                    {
                        return(new CfnEIP(this, $"EIP{h.Instance.InstancePrivateIp}".AsCloudFormationId(), new CfnEIPProps
                        {
                            // 'standard' or 'vpc': https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html#cfn-ec2-eip-domain
                            Domain = "vpc",
                            InstanceId = h.Instance.InstanceId,
                        }));
                    }).ToList();   // collect them now to prevent LINQ side effects
                    if (newElasticIPs.Any())
                    {
                        // Register public Elastic IPs
                        var arNewPublic = new ARecord(this, $"ARecord_Public_NewAlloc".AsCloudFormationId(), new ARecordProps
                        {
                            Zone       = theZone,
                            RecordName = $"{schema.SubdomainEIPs}.{theZone.ZoneName}",
                            Target     = RecordTarget.FromValues(newElasticIPs.Select(eip => eip.Ref).ToArray()),
                            Ttl        = Duration.Seconds(300),
                        });
                    }
                    else if (elasticIPAssociations.Any())
                    {
                        // Register public Elastic IPs

                        /*
                         * var arPrePublic = new ARecord(this, $"ARecord_Public_PreAlloc".AsCloudFormationId(), new ARecordProps
                         * {
                         *  Zone = theZone,
                         *  RecordName = $"{schema.SubdomainEIPs}.{theZone.ZoneName}",
                         *  Target = RecordTarget.FromValues(elasticIPAssociations.Select(eipa => eipa.Ref).ToArray()), // ***** how to do that?
                         *  Ttl = Duration.Seconds(300),
                         * });
                         */
                        foreach (var a in elasticIPAssociations)
                        {
                            Console.WriteLine($"Pre-Allocated Elastic IP Associations: {a.AllocationId}/{a.InstanceId}, {a.Eip}/{a.PrivateIpAddress}, {a.Ref} - please put it to {schema.SubdomainEIPs}.{theZone.ZoneName} ARecord manually");
                        }
                    }
                }
                if (0 < hosts.Count && !string.IsNullOrWhiteSpace(schema.SubdomainHosts))
                {
                    // Register private IPs (never changing, as opposed to public - which change on stop/start) addresses of all hosts
                    var arPrivate = new ARecord(this, $"ARecord_Private_".AsCloudFormationId(), new ARecordProps
                    {
                        Zone       = theZone,
                        RecordName = $"{schema.SubdomainHosts}.{theZone.ZoneName}",
                        Target     = RecordTarget.FromIpAddresses(hosts.Select(h => h.Instance.InstancePrivateIp).ToArray()),
                        Ttl        = Duration.Seconds(300),
                    });
                }
                //throw new Exception();
            }
        }
示例#7
0
 /// <summary>
 /// Ctor for all elements
 /// </summary>
 public PLClinicalDocument(II id, CE <string> code, ST title, TS effectiveTime, CE <x_BasicConfidentialityKind> confidentialityCode, CS <string> languageCode, II setId, INT versionNumber, TS copyTime, RecordTarget recordTarget, Author author, DataEnterer dataEnterer, Informant12 informant, Custodian custodian, InformationRecipient informationRecipient, LegalAuthenticator legalAuthenticator, Authenticator authenticator, Participant1 participant, InFulfillmentOf inFulfillmentOf, DocumentationOf documentationOf, RelatedDocument relatedDocument, Authorization authorization, Component1 componentOf, Component2 component)
     : base(id, code, title, effectiveTime, confidentialityCode, languageCode, setId, versionNumber, copyTime, recordTarget, author, dataEnterer, informant, custodian, informationRecipient, legalAuthenticator, authenticator, participant, inFulfillmentOf, documentationOf, relatedDocument, authorization, componentOf, component)
 {
     this.PertinentInformation = new List <PertinentInformation>();
 }
示例#8
0
 /// <summary>
 /// Ctor for required elements
 /// </summary>
 public PLClinicalDocument(II id, CE <string> code, TS effectiveTime, CE <x_BasicConfidentialityKind> confidentialityCode, RecordTarget recordTarget, Author author, Custodian custodian, Component2 component) :
     base(id, code, effectiveTime, confidentialityCode, recordTarget, author, custodian, component)
 {
     this.PertinentInformation = new List <PertinentInformation>();
 }
示例#9
0
        private static ClinicalDocument CreateCDA(LIST <II> templateIds, CE <String> code, ST title, TS docDate, PatientData recordTarget, PatientData motherOfRCT, PatientData fatherOfRCT, PhysicianData author, params Section[] sections)
        {
            // First, we need to create a clinical document
            ClinicalDocument doc = new ClinicalDocument()
            {
                TemplateId          = templateIds,                                                                                  // Identifiers
                Id                  = Guid.NewGuid(),                                                                               // A unique id for the document
                Code                = code,                                                                                         // The code for the document
                Title               = title,                                                                                        //
                TypeId              = new II("2.16.840.1.113883.1.3", "POCD_HD000040"),                                             // This value is static and identifies the HL7 type
                RealmCode           = SET <CS <BindingRealm> > .CreateSET(BindingRealm.UniversalRealmOrContextUsedInEveryInstance), // This is UV some profiles require US
                EffectiveTime       = docDate,
                ConfidentialityCode = x_BasicConfidentialityKind.Normal,                                                            // Confidentiality of data within the CDA
                LanguageCode        = "en-US",                                                                                      // Language of the CDA
            };

            // Next we need to append the RecordTarget to the CDA
            RecordTarget rctPatient = new RecordTarget()
            {
                ContextControlCode = ContextControl.OverridingPropagating,
                PatientRole        = new PatientRole()
                {
                    Id      = CreateIdList(recordTarget.OtherIds),                                                                                                                    // These are "other MRNs" we know about in the CDA
                    Addr    = SET <AD> .CreateSET(AD.FromSimpleAddress(PostalAddressUse.HomeAddress, recordTarget.Address, null, recordTarget.City, recordTarget.State, "CA", null)), // We create the address from parts
                    Patient = new Patient()
                    {
                        Name = SET <PN> .CreateSET(PN.FromFamilyGiven(EntityNameUse.Legal, recordTarget.FamilyName, recordTarget.GivenName)), // PAtient name
                        AdministrativeGenderCode = recordTarget.Gender,                                                                       // GEnder
                        BirthTime = new TS(recordTarget.DateOfBirth, DatePrecision.Day)                                                       // Day of birth
                    }
                }
            };

            // WE also need to add our local identifier (example: from our database/MRN) to the CDA
            // You will need to use your own OID
            rctPatient.PatientRole.Id.Add(new II("1.2.3.4.5.6", recordTarget.Id));

            doc.RecordTarget.Add(rctPatient);

            // We now want to create an author
            Author docAuthor = new Author()
            {
                ContextControlCode = ContextControl.AdditivePropagating,
                Time           = docDate, // When the document was created
                AssignedAuthor = new AssignedAuthor()
                {
                    Id   = SET <II> .CreateSET(new II("1.2.3.4.5.6.1", author.PhysicianId)), // Physician's identifiers (or how we know the physician)
                    Addr = new SET <AD>()
                    {
                        AD.FromSimpleAddress(PostalAddressUse.PhysicalVisit, author.AddressLine, null, author.City, "ON", "CA", author.Postal)
                    },                                                                                                                       // The author's address
                    AssignedAuthorChoice = AuthorChoice.CreatePerson(
                        SET <PN> .CreateSET(PN.FromFamilyGiven(EntityNameUse.Legal, author.PhysicianName[0], author.PhysicianName[1]))       // The author's name
                        ),
                    RepresentedOrganization = new Organization()
                    {
                        Id   = new SET <II>(new II("1.2.3.4.5.6.2", author.OrgId)),                          // Organization the physician represents
                        Name = SET <ON> .CreateSET(new ON(null, new ENXP[] { new ENXP(author.OrgName[0]) })) // The name of the organization
                    }
                }
            };

            doc.Author.Add(docAuthor);


            // The document custodian is the source of truth for the document, i.e. the organization
            // that is responsible for storing/maintaining the document.
            Custodian docCustodian = new Custodian(
                new AssignedCustodian(
                    new CustodianOrganization(
                        SET <II> .CreateSET(new II("2.3.4.5.6.7", "304930-3")),
                        new ON(null, new ENXP[] { new ENXP("ACME Medical Centres") }),
                        null,
                        AD.FromSimpleAddress(PostalAddressUse.PhysicalVisit, "123 Main St.", null, "Hamilton", "ON", "CA", "L0R2A0")
                        )
                    )
                );

            doc.Custodian = docCustodian;


            // If the "mother" of the patient is provided, let's add the mother's data
            if (motherOfRCT != null)
            {
                doc.Participant.Add(new Participant1(ParticipationType.IND, ContextControl.OverridingNonpropagating, null, new IVL <TS>(new TS(recordTarget.DateOfBirth, DatePrecision.Year)), null)
                {
                    AssociatedEntity = new AssociatedEntity(RoleClassAssociative.NextOfKin,
                                                            CreateIdList(motherOfRCT.OtherIds),
                                                            new CE <string>("MTH", "2.16.840.1.113883.5.111", null, null, "Mother", null),
                                                            SET <AD> .CreateSET(AD.FromSimpleAddress(PostalAddressUse.HomeAddress, motherOfRCT.Address, null, motherOfRCT.City, motherOfRCT.State, "CA", null)),
                                                            SET <TEL> .CreateSET(new TEL()
                    {
                        NullFlavor = NullFlavor.NoInformation
                    }),
                                                            new Person(SET <PN> .CreateSET(PN.FromFamilyGiven(EntityNameUse.Legal, motherOfRCT.FamilyName, motherOfRCT.GivenName))),
                                                            null)
                });
            }

            if (fatherOfRCT != null)
            {
                doc.Participant.Add(new Participant1(ParticipationType.IND, ContextControl.OverridingNonpropagating, null, new IVL <TS>(new TS(recordTarget.DateOfBirth, DatePrecision.Year)), null)
                {
                    AssociatedEntity = new AssociatedEntity(RoleClassAssociative.NextOfKin,
                                                            CreateIdList(fatherOfRCT.OtherIds),
                                                            new CE <string>("FTH", "2.16.840.1.113883.5.111", null, null, "Father", null),
                                                            SET <AD> .CreateSET(AD.FromSimpleAddress(PostalAddressUse.HomeAddress, fatherOfRCT.Address, null, fatherOfRCT.City, fatherOfRCT.State, "CA", null)),
                                                            SET <TEL> .CreateSET(new TEL()
                    {
                        NullFlavor = NullFlavor.NoInformation
                    }),
                                                            new Person(SET <PN> .CreateSET(PN.FromFamilyGiven(EntityNameUse.Legal, fatherOfRCT.FamilyName, fatherOfRCT.GivenName))),
                                                            null)
                });
            }


            // Next we want to setup the body of the document
            doc.Component = new Component2(
                ActRelationshipHasComponent.HasComponent,
                true,
                new StructuredBody() // This document will be structured document
                );

            // Now we add the sections passed to us
            foreach (var sct in sections)
            {
                doc.Component.GetBodyChoiceIfStructuredBody().Component.Add(new Component3(
                                                                                ActRelationshipHasComponent.HasComponent,
                                                                                true,
                                                                                sct));
            }

            return(doc);
        }
        // A simple construct that contains a collection of AWS S3 buckets.
        public StaticSiteConstruct(Construct scope, string id, StaticSiteConstructProps props) : base(scope, id)
        {
            var zone = HostedZone.FromLookup(this, "Zone", new HostedZoneProviderProps
            {
                DomainName = props.DomainName
            });

            var siteDomain = (string)($"{props.SiteSubDomain}.{props.DomainName}");

            new CfnOutput(this, "Site", new CfnOutputProps
            {
                Value = $"https://{siteDomain}"
            });

            var siteBucket = new Bucket(this, "SiteBucket", new BucketProps
            {
                BucketName           = siteDomain,
                WebsiteIndexDocument = "index.html",
                WebsiteErrorDocument = "error.html",
                PublicReadAccess     = true,

                // The default removal policy is RETAIN, which means that cdk destroy will not attempt to delete
                // the new bucket, and it will remain in your account until manually deleted. By setting the policy to
                // DESTROY, cdk destroy will attempt to delete the bucket, but will error if the bucket is not empty.
                RemovalPolicy = RemovalPolicy.DESTROY // NOT recommended for production code
            });

            new CfnOutput(this, "Bucket", new CfnOutputProps
            {
                Value = siteBucket.BucketName
            });

            var certificateArn = new DnsValidatedCertificate(this, "SiteCertificate", new DnsValidatedCertificateProps
            {
                DomainName = siteDomain,
                HostedZone = zone
            }).CertificateArn;

            new CfnOutput(this, "Certificate", new CfnOutputProps {
                Value = certificateArn
            });

            var behavior = new Behavior();

            behavior.IsDefaultBehavior = true;

            var distribution = new CloudFrontWebDistribution(this, "SiteDistribution", new CloudFrontWebDistributionProps
            {
                AliasConfiguration = new AliasConfiguration
                {
                    AcmCertRef     = certificateArn,
                    Names          = new string[] { siteDomain },
                    SslMethod      = SSLMethod.SNI,
                    SecurityPolicy = SecurityPolicyProtocol.TLS_V1_2016
                },
                OriginConfigs = new ISourceConfiguration[]
                {
                    new SourceConfiguration
                    {
                        S3OriginSource = new S3OriginConfig
                        {
                            S3BucketSource = siteBucket
                        },
                        Behaviors = new Behavior[] { behavior }
                    }
                }
            });

            new CfnOutput(this, "DistributionId", new CfnOutputProps
            {
                Value = distribution.DistributionId
            });

            new ARecord(this, "SiteAliasRecord", new ARecordProps
            {
                RecordName = siteDomain,
                Target     = RecordTarget.FromAlias(new CloudFrontTarget(distribution)),
                Zone       = zone
            });

            new BucketDeployment(this, "DeployWithInvalidation", new BucketDeploymentProps
            {
                Sources           = new ISource[] { Source.Asset("./site-contents") },
                DestinationBucket = siteBucket,
                Distribution      = distribution,
                DistributionPaths = new string[] { "/*" }
            });
        }
示例#11
0
        private static void MakeRecordTargetNode(ClinicalDocument ccda)
        {
            //CONF 5266 - Record Target
            RecordTarget rt = new RecordTarget();
            rt.ContextControlCode = ContextControl.OverridingPropagating;

            //CONF 5267
            MakePatientRoleNode(rt);

            ccda.RecordTarget.Add(rt);
        }
示例#12
0
        private static void MakePatientRoleNode(RecordTarget rt)
        {
            PatientRole pr = new PatientRole();

            //CONF 5268
            pr.Id = new SET<II>(new II(
                "2.16.840.1.113883.4.1",
                //Patient SSN recorded as an ID
                "123-456-7890"));

            //CONF 5271
            pr.Addr = new SET<AD>(
                new AD(new CS<PostalAddressUse>(PostalAddressUse.PrimaryHome),
                    new ADXP[]{
                            new ADXP("100 Marshall Lane", AddressPartType.StreetAddressLine),
                            new ADXP("Springfield", AddressPartType.City),
                            new ADXP("VA", AddressPartType.State),
                            new ADXP("22153", AddressPartType.PostalCode),
                            new ADXP("US", AddressPartType.Country)}));

            //CONF 5280
            pr.Telecom = new SET<TEL>(
                new TEL(
                    "tel:+1(571)555-0189",
                    TelecommunicationAddressUse.PrimaryHome));

            //CONF 5283
            MakePatientNode(pr);

            rt.PatientRole = pr;
        }