Record Class KnoluxS3ConnectionDetails
java.lang.Object
java.lang.Record
com.knolux.s3.KnoluxS3ConnectionDetails
public record KnoluxS3ConnectionDetails(String endpoint, String region, String accessKey, String secretKey, boolean forcePathStyle, boolean removePathPrefix, String pathPrefix, boolean trustSelfSigned)
extends Record
S3 連線參數的不可變值物件,作為
KnoluxS3ClientFactory 建立與快取 client 的鍵。
可從靜態 KnoluxS3Properties 建立,也可由 KnoluxS3OperationSpec.toConnectionDetails()
在執行期間從請求 payload 動態組裝。
快取鍵安全性
toCacheKey() 中的 accessKey 以 SHA-256 摘要取代明文,
secretKey 則完全不納入,防止憑證以明文出現在 heap 中的 Map key 字串、
日誌或 heap dump。
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theaccessKeyrecord component.endpoint()Returns the value of theendpointrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of theforcePathStylerecord component.final inthashCode()Returns a hash code value for this object.static KnoluxS3ConnectionDetailsof(KnoluxS3Properties props) 從靜態KnoluxS3Properties建立連線參數(靜態模式工廠方法)。Returns the value of thepathPrefixrecord component.region()Returns the value of theregionrecord component.booleanReturns the value of theremovePathPrefixrecord component.Returns the value of thesecretKeyrecord component.產生KnoluxS3ClientFactory使用的 client 快取鍵。final StringtoString()Returns a string representation of this record class.booleanReturns the value of thetrustSelfSignedrecord component.
-
Constructor Details
-
KnoluxS3ConnectionDetails
public KnoluxS3ConnectionDetails(String endpoint, String region, String accessKey, String secretKey, boolean forcePathStyle, boolean removePathPrefix, String pathPrefix, boolean trustSelfSigned) Creates an instance of aKnoluxS3ConnectionDetailsrecord class.- Parameters:
endpoint- the value for theendpointrecord componentregion- the value for theregionrecord componentaccessKey- the value for theaccessKeyrecord componentsecretKey- the value for thesecretKeyrecord componentforcePathStyle- the value for theforcePathStylerecord componentremovePathPrefix- the value for theremovePathPrefixrecord componentpathPrefix- the value for thepathPrefixrecord componenttrustSelfSigned- the value for thetrustSelfSignedrecord component
-
-
Method Details
-
of
從靜態KnoluxS3Properties建立連線參數(靜態模式工廠方法)。- Parameters:
props- 已綁定的設定屬性- Returns:
- 對應的連線參數
-
toCacheKey
產生KnoluxS3ClientFactory使用的 client 快取鍵。secretKey完全不納入,防止洩漏。accessKey以 SHA-256 摘要(hex)代替明文,避免憑證以字串形式存入 Map key。- 所有可為
null的String欄位以空字串代入, 防止不同欄位為 null 時產生相同 key。
- Returns:
- 長度固定、不含敏感明文的快取鍵字串
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
endpoint
Returns the value of theendpointrecord component.- Returns:
- the value of the
endpointrecord component
-
region
Returns the value of theregionrecord component.- Returns:
- the value of the
regionrecord component
-
accessKey
Returns the value of theaccessKeyrecord component.- Returns:
- the value of the
accessKeyrecord component
-
secretKey
Returns the value of thesecretKeyrecord component.- Returns:
- the value of the
secretKeyrecord component
-
forcePathStyle
public boolean forcePathStyle()Returns the value of theforcePathStylerecord component.- Returns:
- the value of the
forcePathStylerecord component
-
removePathPrefix
public boolean removePathPrefix()Returns the value of theremovePathPrefixrecord component.- Returns:
- the value of the
removePathPrefixrecord component
-
pathPrefix
Returns the value of thepathPrefixrecord component.- Returns:
- the value of the
pathPrefixrecord component
-
trustSelfSigned
public boolean trustSelfSigned()Returns the value of thetrustSelfSignedrecord component.- Returns:
- the value of the
trustSelfSignedrecord component
-