Package com.cloudforgeci.api.core
Class SystemContext
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
com.cloudforgeci.api.core.SystemContext
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
public final class SystemContext
extends software.constructs.Construct
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordContainer for domain and SSL factories.static final recordContainer for infrastructure factories created by the orchestration layer.static final recordContainer for complete Jenkins deployment.static final recordContainer for Jenkins-specific factories.static final recordContainer for complete S3 + CloudFront deployment.static final recordContainer for S3 and CloudFront factories.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default, software.constructs.IConstruct.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Slot<software.amazon.awscdk.services.elasticloadbalancingv2.ApplicationLoadBalancer> final Slot<software.amazon.awscdk.services.ec2.SecurityGroup> final Slot<software.amazon.awscdk.services.elasticloadbalancingv2.ApplicationTargetGroup> final Slot<software.amazon.awscdk.services.efs.AccessPoint> final Slot<software.constructs.IConstruct> final Slot<OidcConfiguration> final Slot<ApplicationSpec> final Slot<software.amazon.awscdk.services.autoscaling.AutoScalingGroup> final Slot<software.amazon.awscdk.services.certificatemanager.ICertificate> final DeploymentContextfinal Slot<software.constructs.IConstruct> final Slot<software.amazon.awscdk.services.cognito.IUserPool> final Slot<software.amazon.awscdk.services.cognito.IUserPoolClient> final Slot<software.amazon.awscdk.services.cognito.IUserPoolDomain> final Slot<software.amazon.awscdk.services.ecs.ContainerDefinition> final Slot<software.amazon.awscdk.services.secretsmanager.Secret> final Slot<software.amazon.awscdk.services.ssm.StringParameter> final Slot<software.amazon.awscdk.services.ec2.SecurityGroup> final Slot<software.amazon.awscdk.services.cloudfront.Distribution> final Slot<software.amazon.awscdk.services.ec2.Instance> final Slot<software.amazon.awscdk.services.iam.Role> final Slot<software.amazon.awscdk.services.efs.FileSystem> final Slot<software.amazon.awscdk.services.ec2.SecurityGroup> final Slot<software.amazon.awscdk.services.iam.Role> final Slot<software.amazon.awscdk.services.ecs.FargateService> final Slot<software.amazon.awscdk.services.ec2.SecurityGroup> final Slot<software.amazon.awscdk.services.ecs.TaskDefinition> final Slot<software.amazon.awscdk.services.iam.Role> final Slot<software.amazon.awscdk.services.ec2.FlowLogOptions> final Slot<software.amazon.awscdk.services.elasticloadbalancingv2.ApplicationListener> final Slot<software.amazon.awscdk.services.elasticloadbalancingv2.ApplicationListener> final IAMProfilefinal Slot<software.amazon.awscdk.CustomResource> final Slot<software.amazon.awscdk.services.ec2.SecurityGroup> final Slot<software.amazon.awscdk.services.logs.LogGroup> final Slot<software.amazon.awscdk.services.acmpca.CfnCertificateAuthority> final Slot<software.amazon.awscdk.services.rds.DatabaseInstance> final RuntimeTypefinal SecurityProfilefinal Slot<SecurityProfileConfiguration> final Stringfinal TopologyTypefinal Slot<software.amazon.awscdk.services.ec2.Vpc> final Slot<software.amazon.awscdk.services.wafv2.CfnWebACL> final Slot<software.amazon.awscdk.services.s3.Bucket> final Slot<software.amazon.awscdk.services.route53.IHostedZone> -
Method Summary
Modifier and TypeMethodDescriptioncreateAlbFactory(software.constructs.Construct scope, String idPrefix) Creates an ALB factory with proper context injection.createEfsFactory(software.constructs.Construct scope, String idPrefix) Creates an EFS factory with proper context injection.voidcreateGuardDutyFactory(software.constructs.Construct scope, String idPrefix) Creates GuardDuty threat detection factory.createInfrastructureFactories(software.constructs.Construct scope, String idPrefix) Creates infrastructure factories in the correct order with proper context injection.software.amazon.awscdk.services.ec2.SecurityGroupcreateInstanceSecurityGroup(software.constructs.Construct scope, String idPrefix) Creates instance security group for EC2 deployments.createJenkinsDeployment(software.constructs.Construct scope, String id) Creates a complete Jenkins deployment with infrastructure and Jenkins-specific resources.createLoggingFactory(software.constructs.Construct scope, String idPrefix) Creates a logging factory with proper context injection.createS3CloudFrontDeployment(software.constructs.Construct scope, String id) Creates a complete S3 + CloudFront deployment for static web applications.voidcreateSecurityFactories(software.constructs.Construct scope, String idPrefix) Creates security-related factories (Certificate, OIDC, Identity Center).voidcreateTargetGroups(software.constructs.Construct scope, String idPrefix) Creates target groups orchestrated by SystemContext.createVpcFactory(software.constructs.Construct scope, String idPrefix) Creates a VPC factory with proper context injection.debugPath(software.constructs.Construct scope) voidExecute all deferred actions.Get all required AWS Config rules collected from factories.static SystemContextof(software.constructs.Construct scope) Fetch the already-started context anywhere down the tree.booleanGuard to register a wiring block only once per Stack.voidRegister an AWS Config rule as required for this deployment.voidRegister all AWS Config rules for a specific security control.static SystemContextstart(software.constructs.Construct scope, TopologyType topology, RuntimeType runtime, SecurityProfile security, IAMProfile iamProfile, DeploymentContext cfc) Start once at the entry point; installs runtime + topology + security + iam rules and wiring.Methods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
topology
-
runtime
-
security
-
iamProfile
-
cfc
-
stackName
-
securityProfileConfig
-
applicationSpec
-
vpc
-
alb
public final Slot<software.amazon.awscdk.services.elasticloadbalancingv2.ApplicationLoadBalancer> alb -
asg
-
ec2Instance
-
efs
-
logs
-
zone
-
instanceSg
-
albTargetGroup
public final Slot<software.amazon.awscdk.services.elasticloadbalancingv2.ApplicationTargetGroup> albTargetGroup -
httpsTargetsAdded
-
wired
-
dnsRecordsCreated
-
dnsRecordsCallbackRegistered
-
asgAddedToTargetGroup
-
scalingPoliciesApplied
-
fargateAutoscalingConfigured
-
fargateAutoscalingCallbackRegistered
-
ec2AutoscalingCallbackRegistered
-
albSg
-
http
-
efsSg
-
ap
-
fargateService
-
fargateServiceSg
-
fargateTaskDef
-
container
-
https
-
cert
-
privateCa
-
identityCenter
-
cognitoIssuer
-
cognitoAuthorizationEndpoint
-
cognitoTokenEndpoint
-
cognitoUserInfoEndpoint
-
cognitoLogoutEndpoint
-
cognitoClientId
-
cognitoClientSecretName
-
cognitoUserPoolId
-
cognitoDomainPrefix
-
cognitoUserPool
-
cognitoUserPoolClient
-
cognitoUserPoolDomain
-
rdsDatabase
-
dbCredentials
-
dbConnection
-
dbSecurityGroup
-
dbConnectionStringComponents
-
dbDatasourceParameter
-
cognitoClientSecretResourceInternal
-
applicationOidcConfig
-
applicationOidcClientSecretResource
-
keycloakDeployed
-
keycloakServiceUrl
-
sslEnabled
-
httpRedirectEnabled
-
networkMode
-
wafEnabled
-
cloudfront
-
lbType
-
minInstanceCapacity
-
maxInstanceCapacity
-
cpuTargetUtilization
-
cpu
-
memory
-
authMode
-
ssoInstanceArn
-
ssoGroupId
-
ssoTargetAccountId
-
samlSiteUrl
-
samlAcsUrl
-
samlIdpMetadataUrl
-
samlIdpSsoUrl
-
samlIdpEntityId
-
samlIdpLogoutUrl
-
samlProviderType
-
samlConfigSecretArn
-
artifactsBucket
-
artifactsPrefix
-
enableFlowlogs
-
domain
-
subdomain
-
fqdn
-
websiteBucket
-
distribution
-
flowlogs
-
wafWebAcl
-
ec2InstanceRole
-
fargateExecutionRole
-
fargateTaskRole
-
-
Method Details
-
start
public static SystemContext start(software.constructs.Construct scope, TopologyType topology, RuntimeType runtime, SecurityProfile security, IAMProfile iamProfile, DeploymentContext cfc) Start once at the entry point; installs runtime + topology + security + iam rules and wiring. -
of
Fetch the already-started context anywhere down the tree. -
once
Guard to register a wiring block only once per Stack. -
executeDeferredActions
public void executeDeferredActions()Execute all deferred actions. Call this after all factories are created. -
requireConfigRule
Register an AWS Config rule as required for this deployment. Factories call this method where they create the infrastructure being monitored. Duplicate rules are automatically deduplicated via Set.- Parameters:
rule- The AWS Config rule to require
-
requireConfigRulesForControl
Register all AWS Config rules for a specific security control. Use this when enabling a security control (e.g., ENCRYPTION_AT_REST) to automatically include all related Config rules.- Parameters:
control- The security control to get rules for
-
getRequiredConfigRules
Get all required AWS Config rules collected from factories. Called by ComplianceFactory to deploy the rules.- Returns:
- Unmodifiable set of required Config rules
-
debugPath
-
presentSlots
-
createInfrastructureFactories
public SystemContext.InfrastructureFactories createInfrastructureFactories(software.constructs.Construct scope, String idPrefix) Creates infrastructure factories in the correct order with proper context injection. This orchestration layer ensures that infrastructure factories are created consistently and can be reused across different application factories.- Parameters:
scope- The CDK construct scopeidPrefix- Prefix for factory IDs (e.g., "Jenkins", "MyApp")- Returns:
- InfrastructureFactories containing references to created factories
-
createVpcFactory
Creates a VPC factory with proper context injection. -
createAlbFactory
Creates an ALB factory with proper context injection. -
createEfsFactory
Creates an EFS factory with proper context injection. -
createLoggingFactory
Creates a logging factory with proper context injection. -
createGuardDutyFactory
Creates GuardDuty threat detection factory. Conditionally enabled based on security profile or explicit configuration. -
createSecurityFactories
Creates security-related factories (Certificate, OIDC, Identity Center). These factories are conditionally created based on context configuration. IMPORTANT: Certificate is created LAST to ensure proper CloudFormation deletion order. When deleting a stack, CloudFormation deletes resources in reverse creation order. By creating the certificate last, it will be deleted first, before the ALB HTTPS listener, preventing "Certificate in use" deletion errors. -
createTargetGroups
Creates target groups orchestrated by SystemContext. This centralizes target group management and prevents duplicates. For HTTPS_STRICT mode (PCI-DSS compliance), target group creation is deferred to Ec2RuntimeConfiguration which creates them after the HTTPS listener exists. -
createInstanceSecurityGroup
public software.amazon.awscdk.services.ec2.SecurityGroup createInstanceSecurityGroup(software.constructs.Construct scope, String idPrefix) Creates instance security group for EC2 deployments. This is infrastructure-specific but not a full factory. -
createJenkinsDeployment
public SystemContext.JenkinsDeployment createJenkinsDeployment(software.constructs.Construct scope, String id) Creates a complete Jenkins deployment with infrastructure and Jenkins-specific resources. Supports both Fargate and EC2 runtimes with optional domain and SSL.- Parameters:
scope- The CDK construct scopeid- Unique identifier for the Jenkins deployment- Returns:
- JenkinsDeployment containing all created resources
-
createS3CloudFrontDeployment
public SystemContext.S3CloudFrontDeployment createS3CloudFrontDeployment(software.constructs.Construct scope, String id) Creates a complete S3 + CloudFront deployment for static web applications. Supports Angular, React, or any static site with optional domain.- Parameters:
scope- The CDK construct scopeid- Unique identifier for the S3 deployment- Returns:
- S3CloudFrontDeployment containing all created resources
-