@Component public class StorageHelper extends Object
| Constructor and Description |
|---|
StorageHelper() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
getBooleanStorageAttributeValueByName(String attributeName,
StorageEntity storageEntity,
boolean attributeRequired,
boolean attributeValueRequiredIfExists)
Gets attribute value by name from the storage entity and returns it as a boolean.
|
S3FileTransferRequestParamsDto |
getS3BucketAccessParams(StorageEntity storageEntity)
Returns a new instance of S3FileTransferRequestParamsDto populated with all parameters, required to access an S3 bucket.
|
S3FileCopyRequestParamsDto |
getS3FileCopyRequestParamsDto()
Returns a new
org.finra.herd.model.dto.S3FileCopyRequestParamsDto with proxy host and port populated from the configuration. |
S3FileTransferRequestParamsDto |
getS3FileTransferRequestParamsDto()
Returns a new
S3FileTransferRequestParamsDto with proxy host and port populated from the configuration. |
S3FileTransferRequestParamsDto |
getS3FileTransferRequestParamsDtoByRole(String roleArn,
String sessionName)
Returns a new
S3FileTransferRequestParamsDto with temporary credentials as per specified AWS role and session name. |
Integer |
getStorageAttributeIntegerValueByName(String attributeName,
StorageEntity storageEntity,
boolean attributeRequired,
boolean attributeValueRequiredIfExists)
Gets a storage attribute value by name.
|
Integer |
getStorageAttributeIntegerValueByName(String attributeName,
StorageEntity storageEntity,
Integer defaultValue)
Gets a storage attribute value by name.
|
String |
getStorageAttributeValueByName(String attributeName,
Storage storage,
Boolean required)
Gets attribute value by name from the storage object instance.
|
String |
getStorageAttributeValueByName(String attributeName,
StorageEntity storageEntity,
boolean attributeValueRequired)
Gets attribute value by name from the storage entity while specifying whether the attribute value is required (i.e.
|
String |
getStorageAttributeValueByName(String attributeName,
StorageEntity storageEntity,
boolean attributeRequired,
boolean attributeValueRequiredIfExists)
Gets attribute value by name from the storage entity while specifying whether the attribute is required and whether the attribute value is required.
|
String |
getStorageBucketName(StorageEntity storageEntity)
Gets the storage's bucket name.
|
String |
getStorageKmsKeyId(StorageEntity storageEntity)
Gets the storage's KMS key ID.
|
@Autowired protected StsDao stsDao
public boolean getBooleanStorageAttributeValueByName(String attributeName, StorageEntity storageEntity, boolean attributeRequired, boolean attributeValueRequiredIfExists) throws IllegalStateException
attributeName - the attribute name (case insensitive)storageEntity - the storage entityattributeRequired - specifies whether the attribute is mandatory (i.e. whether it has a value or not).attributeValueRequiredIfExists - specifies whether the attribute value is mandatory (i.e. the attribute must exist and its value must also contain a
value).IllegalStateException - if an invalid storage attribute boolean value was configured.public S3FileTransferRequestParamsDto getS3BucketAccessParams(StorageEntity storageEntity)
storageEntity - the storage entity that contains attributes to access an S3 bucketpublic S3FileCopyRequestParamsDto getS3FileCopyRequestParamsDto()
org.finra.herd.model.dto.S3FileCopyRequestParamsDto with proxy host and port populated from the configuration.org.finra.herd.model.dto.S3FileCopyRequestParamsDto with proxy host and port.public S3FileTransferRequestParamsDto getS3FileTransferRequestParamsDto()
S3FileTransferRequestParamsDto with proxy host and port populated from the configuration.S3FileTransferRequestParamsDto objectpublic S3FileTransferRequestParamsDto getS3FileTransferRequestParamsDtoByRole(String roleArn, String sessionName)
S3FileTransferRequestParamsDto with temporary credentials as per specified AWS role and session name.roleArn - the ARN of the rolesessionName - the session nameS3FileTransferRequestParamsDto objectpublic Integer getStorageAttributeIntegerValueByName(String attributeName, StorageEntity storageEntity, Integer defaultValue)
attributeName - The name of attributestorageEntity - The storage entitydefaultValue - The default valuepublic Integer getStorageAttributeIntegerValueByName(String attributeName, StorageEntity storageEntity, boolean attributeRequired, boolean attributeValueRequiredIfExists) throws IllegalStateException
attributeName - the attribute name (case insensitive)storageEntity - the storage entityattributeRequired - specifies whether the attribute is mandatory (i.e. whether it has a value or not).attributeValueRequiredIfExists - specifies whether the attribute value is mandatory (i.e. the attribute must exist and its value must also contain a
value).IllegalStateException - if the attribute is mandatory and this storage contains no attribute with this attribute name or the value is blank. This
will produce a 500 HTTP status code error. If storage attributes are able to be updated by a REST invocation in the future, we might want to consider
making this a 400 instead since the user has the ability to fix the issue on their own. Also throws when the value exists, but is not a valid integer.public String getStorageAttributeValueByName(String attributeName, Storage storage, Boolean required)
attributeName - the attribute name (case insensitive)storage - the storagerequired - specifies whether the attribute value is mandatorynull if this list contains no attribute with this attribute namepublic String getStorageAttributeValueByName(String attributeName, StorageEntity storageEntity, boolean attributeValueRequired) throws IllegalArgumentException
attributeName - the attribute name (case insensitive)storageEntity - the storage entityattributeValueRequired - specifies whether the attribute value is mandatoryIllegalArgumentException - if the attribute is mandatory and this storage contains no attribute with this attribute namepublic String getStorageAttributeValueByName(String attributeName, StorageEntity storageEntity, boolean attributeRequired, boolean attributeValueRequiredIfExists) throws IllegalStateException
attributeName - the attribute name (case insensitive)storageEntity - the storage entityattributeRequired - specifies whether the attribute is mandatory (i.e. whether it has a value or not).attributeValueRequiredIfExists - specifies whether the attribute value is mandatory (i.e. the attribute must exist and its value must also contain a
value).IllegalStateException - if the attribute is mandatory and this storage contains no attribute with this attribute name or the value is blank.This
will produce a 500 HTTP status code error. If storage attributes are able to be updated by a REST invocation in the future, we might want to consider
making this a 400 instead since the user has the ability to fix the issue on their own.public String getStorageBucketName(StorageEntity storageEntity)
storageEntity - the storage entitypublic String getStorageKmsKeyId(StorageEntity storageEntity)
storageEntity - the storage entityCopyright © 2021. All rights reserved.