public class S3UploadAction extends io.inversion.Action<S3UploadAction>
Bean property config can be set directly on the handler in your inversion.properties files but you should really consider this to be a service singleton where the properties can be passed in via Action config allowing a single handler instance to upload files to multiple buckets based on request path.
So instead of config-ing something like
handler.dynamicBasePath=yyyy/MM/dd or handler.bucket=somebucket
do this
action.config=dynamicBasePath=yyyy/MM/dd@amp;bucket=somebucket
While accessKey/secreKey/awsRegion CAN be set either on the Handler or on the Action in this way, if you control the host environment and are uploading everyting to your own AWS account, you should consider using IAM roles to authenticate. Than way you don't need to config the credentials at all.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
allowedCharactersRegex |
protected long |
maxUploadLength |
protected java.lang.String |
s3AccessKey |
protected java.lang.String |
s3AwsRegion |
protected java.lang.String |
s3BasePath |
protected java.lang.String |
s3Bucket |
protected com.amazonaws.services.s3.AmazonS3 |
s3Client |
protected java.lang.String |
s3DatePath |
protected java.lang.String |
s3SecretKey |
| Constructor and Description |
|---|
S3UploadAction() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
byteToHexString(byte[] input) |
com.amazonaws.services.s3.AmazonS3 |
getS3Client() |
protected boolean |
isValidPath(io.inversion.utils.Path path) |
protected void |
onFileUploaded(io.inversion.Request req,
io.inversion.Response resp,
io.inversion.Upload upload,
io.inversion.s3.S3UploadAction.S3File file) |
void |
run(io.inversion.Request req,
io.inversion.Response res) |
protected io.inversion.s3.S3UploadAction.S3File |
saveFile(io.inversion.Request req,
io.inversion.Upload upload) |
protected io.inversion.s3.S3UploadAction.S3File |
uploadFile(java.lang.String bucket,
java.lang.String key,
java.io.InputStream in,
long size) |
protected io.inversion.s3.S3UploadAction.S3File |
uploadFile(java.lang.String bucket,
java.lang.String key,
java.io.InputStream in,
long size,
java.util.Map<java.lang.String,java.lang.String> metadataProps,
java.util.Map<java.lang.String,java.lang.String> tags) |
S3UploadAction |
withS3Client(com.amazonaws.services.s3.AmazonS3 s3Client) |
configureOp, doDelete, doGet, doPatch, doPost, doPut, getFullIncludePaths, getIncludePaths, isDecoration, joinPaths, joinPaths0, run0, withDecorationafterWiringComplete, checkLazyConfig, compareTo, doLazyConfig, getAllExcludePaths, getAllIncludeMethods, getAllIncludePaths, getDefaultIncludeMatchers, getDescription, getExcludeMatchers, getIncludeMatchers, getName, getOrder, getParams, match, match, matches, matches, toString, withDescription, withExcludeOn, withExcludeOn, withIncludeOn, withIncludeOn, withName, withOrder, withParam, withParamsclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddResponse, addResponse, beautifyTag, buildOperation, documentOpDelete, documentOperationSchema, documentOpFind, documentOpGet, documentOpPatch, documentOpPost, documentOpPut, documentOpRelated, documentParam, documentQueryParams, documentRequestSchema, documentResourceSchema, documentResponseSchema, findOp, getDescription, getSchemaRef, hasParam, hook_documentOp, newComponentRefSchema, newHrefSchema, newTypeSchema, removeReadOnlyPropertiesprotected java.lang.String s3AccessKey
protected java.lang.String s3SecretKey
protected java.lang.String s3AwsRegion
protected java.lang.String s3Bucket
protected java.lang.String s3BasePath
protected java.lang.String s3DatePath
protected long maxUploadLength
protected com.amazonaws.services.s3.AmazonS3 s3Client
protected java.lang.String allowedCharactersRegex
public void run(io.inversion.Request req,
io.inversion.Response res)
throws io.inversion.ApiException
run in class io.inversion.Action<S3UploadAction>io.inversion.ApiExceptionprotected void onFileUploaded(io.inversion.Request req,
io.inversion.Response resp,
io.inversion.Upload upload,
io.inversion.s3.S3UploadAction.S3File file)
protected io.inversion.s3.S3UploadAction.S3File saveFile(io.inversion.Request req,
io.inversion.Upload upload)
throws io.inversion.ApiException
io.inversion.ApiExceptionprotected io.inversion.s3.S3UploadAction.S3File uploadFile(java.lang.String bucket,
java.lang.String key,
java.io.InputStream in,
long size)
throws io.inversion.ApiException
io.inversion.ApiExceptionprotected io.inversion.s3.S3UploadAction.S3File uploadFile(java.lang.String bucket,
java.lang.String key,
java.io.InputStream in,
long size,
java.util.Map<java.lang.String,java.lang.String> metadataProps,
java.util.Map<java.lang.String,java.lang.String> tags)
throws io.inversion.ApiException
io.inversion.ApiExceptionpublic java.lang.String byteToHexString(byte[] input)
protected boolean isValidPath(io.inversion.utils.Path path)
public com.amazonaws.services.s3.AmazonS3 getS3Client()
public S3UploadAction withS3Client(com.amazonaws.services.s3.AmazonS3 s3Client)
Copyright © 2023 Rocket Partners, LLC. All rights reserved.