Class Ec2ContextImpl
java.lang.Object
com.cloudforgeci.api.core.Ec2ContextImpl
- All Implemented Interfaces:
Ec2Context
Implementation of Ec2Context providing runtime information for UserData configuration.
-
Constructor Summary
ConstructorsConstructorDescriptionEc2ContextImpl(String stackName, String runtimeType, String securityProfile, boolean hasEfs, String efsId, String accessPointId) Ec2ContextImpl(String stackName, String runtimeType, String securityProfile, boolean hasEfs, String efsId, String accessPointId, String authMode, String fqdn, boolean sslEnabled) Ec2ContextImpl(String stackName, String runtimeType, String securityProfile, boolean hasEfs, String efsId, String accessPointId, String authMode, String fqdn, boolean sslEnabled, String autoAdminPasswordSecretArn) -
Method Summary
Modifier and TypeMethodDescriptionReturns the EFS access point ID if EFS is available.authMode()Returns the configured authentication mode ("none","alb-oidc", or"application-oidc") — the same valueApplicationSpec.containerEnvironmentVariablesreceives for Fargate/ECS, so EC2 UserData can reach auth/env parity with the ECS task definition.The ARN of the initial-admin-password secretApplicationFactoryprovisions whenApplicationSpec.autoAdminPasswordEnvVar()is non-null, ornullif that method returnsnull(no such secret exists for this application) or the secret hasn't been provisioned yet at the pointconfigureUserDataruns.efsId()Returns the EFS filesystem ID if EFS is available.fqdn()Returns the fully-qualified domain name for this deployment, if a domain is configured.booleanhasEfs()Returns whether EFS is available in this deployment.Returns the runtime type as a string.Returns the security profile as a string.booleanReturns whether TLS/SSL is enabled for this deployment (affects the scheme used when building a public URL for the application, e.g.Returns the CloudFormation stack name.
-
Constructor Details
-
Ec2ContextImpl
-
Ec2ContextImpl
-
Ec2ContextImpl
-
-
Method Details
-
stackName
Description copied from interface:Ec2ContextReturns the CloudFormation stack name. Used for resource naming and CloudWatch log group names.- Specified by:
stackNamein interfaceEc2Context- Returns:
- stack name (e.g., "jenkins-prod")
-
runtimeType
Description copied from interface:Ec2ContextReturns the runtime type as a string. Typically "EC2" or "FARGATE".- Specified by:
runtimeTypein interfaceEc2Context- Returns:
- runtime type in lowercase (e.g., "ec2")
-
securityProfile
Description copied from interface:Ec2ContextReturns the security profile as a string. Used for compliance-aware logging and configuration.- Specified by:
securityProfilein interfaceEc2Context- Returns:
- security profile in lowercase (e.g., "dev", "staging", "production")
-
hasEfs
public boolean hasEfs()Description copied from interface:Ec2ContextReturns whether EFS is available in this deployment. If true, applications should use EFS for storage. If false, applications should use EBS for storage.- Specified by:
hasEfsin interfaceEc2Context- Returns:
- true if EFS is configured and available
-
efsId
Description copied from interface:Ec2ContextReturns the EFS filesystem ID if EFS is available.- Specified by:
efsIdin interfaceEc2Context- Returns:
- EFS filesystem ID (e.g., "fs-12345678"), or empty if EFS is not available
-
accessPointId
Description copied from interface:Ec2ContextReturns the EFS access point ID if EFS is available.- Specified by:
accessPointIdin interfaceEc2Context- Returns:
- EFS access point ID (e.g., "fsap-12345678"), or empty if EFS is not available
-
authMode
Description copied from interface:Ec2ContextReturns the configured authentication mode ("none","alb-oidc", or"application-oidc") — the same valueApplicationSpec.containerEnvironmentVariablesreceives for Fargate/ECS, so EC2 UserData can reach auth/env parity with the ECS task definition.Default
"none"for implementations predating this method (source compatibility).- Specified by:
authModein interfaceEc2Context- Returns:
- auth mode string, e.g. "none"
-
fqdn
Description copied from interface:Ec2ContextReturns the fully-qualified domain name for this deployment, if a domain is configured.- Specified by:
fqdnin interfaceEc2Context- Returns:
- FQDN (e.g., "manager.example.com"), or
nullif no domain is configured
-
sslEnabled
public boolean sslEnabled()Description copied from interface:Ec2ContextReturns whether TLS/SSL is enabled for this deployment (affects the scheme used when building a public URL for the application, e.g.https://vshttp://).- Specified by:
sslEnabledin interfaceEc2Context- Returns:
- true if SSL is enabled
-
autoAdminPasswordSecretArn
Description copied from interface:Ec2ContextThe ARN of the initial-admin-password secretApplicationFactoryprovisions whenApplicationSpec.autoAdminPasswordEnvVar()is non-null, ornullif that method returnsnull(no such secret exists for this application) or the secret hasn't been provisioned yet at the pointconfigureUserDataruns.UserData scripts that need this app's own generated admin password should fetch it via
aws secretsmanager get-secret-value --secret-id <this ARN>using the EC2 instance role's own IAM permissions (granted automatically byEc2Factorywhenever this is non-null) — not a guessed secret name/path, which will not match the provisioned secret.- Specified by:
autoAdminPasswordSecretArnin interfaceEc2Context- Returns:
- the secret ARN, or
null
-