Record Class S3Credentials
java.lang.Object
java.lang.Record
dev.hardwood.s3.S3Credentials
- Record Components:
accessKeyId- the AWS access key IDsecretAccessKey- the AWS secret access keysessionToken- the session token, ornullfor long-term credentials
public record S3Credentials(String accessKeyId, String secretAccessKey, String sessionToken)
extends Record
Long-term or temporary AWS credentials.
This is a plain record with no AWS SDK dependency. Use of(String, String)
for long-term credentials (access key + secret key) or the canonical
constructor to include a session token for temporary credentials
(STS AssumeRole, EC2/ECS instance profile, IRSA, etc.).
-
Constructor Summary
ConstructorsConstructorDescriptionS3Credentials(String accessKeyId, String secretAccessKey, String sessionToken) Creates an instance of aS3Credentialsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theaccessKeyIdrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static S3CredentialsCreates long-term credentials (no session token).Returns the value of thesecretAccessKeyrecord component.Returns the value of thesessionTokenrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
S3Credentials
Creates an instance of aS3Credentialsrecord class.- Parameters:
accessKeyId- the value for theaccessKeyIdrecord componentsecretAccessKey- the value for thesecretAccessKeyrecord componentsessionToken- the value for thesessionTokenrecord component
-
-
Method Details
-
of
Creates long-term credentials (no session token).- Parameters:
accessKeyId- the AWS access key IDsecretAccessKey- the AWS secret access key- Returns:
- credentials without a session token
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
accessKeyId
Returns the value of theaccessKeyIdrecord component.- Returns:
- the value of the
accessKeyIdrecord component
-
secretAccessKey
Returns the value of thesecretAccessKeyrecord component.- Returns:
- the value of the
secretAccessKeyrecord component
-
sessionToken
Returns the value of thesessionTokenrecord component.- Returns:
- the value of the
sessionTokenrecord component
-