Deleting Files From Amazon S3Last Updated: 07/19/2016 Introduced in Verision: 2.0 |
Amazon Web Services S3 offers cloud-based storage that can be integrated with your system. Users can view, monitor and delete files stored in the cloud.
To allow a user to delete the files in your Amazon S3 account, first set up your Amazon WebServices Settings in the portal. Next, in the Flow Designer, modify a flow containing a form. In the Form Designer, add a button to the form, and allow the user to select a file in the form’s data grid. Finally, configure the flow in the Flow Designer by dragging a DeleteFileFromS3 component to the workspace, and mapping its strings in the Mapping Editor.
Example
Our example flow will use a form to list the files stored in an Amazon S3 bucket. The user can select a file from this list and click a button to delete the file from storage.
This example assumes that Amazon WebServices Settings have already been configured. The flow that will open the form has been created but has not been completed, and the form which will display the files – FileList – has already been created, but not designed.
We’ll begin our example in the Flow Designer. [Form] FileList has already been placed in the workspace and its outcome path – OK – is connected to the End Step.
First, we will edit the FileList form by selecting the form in the workspace and clicking the Edit Form link under the Properties panel.
We will drag a Button component to the workspace. It can be found in the Components panel, under the category Actions.
In the Properties panel, under the Data section, we will enter the button name in the Outcome Name field. The name is automatically copied to the Text field.
The form’s data grid had been configured to display information. To allow a user to select a file for deletion, we will change the grid mode.
With the data grid selected in the workspace, we will change its properties in the Properties panel. In the Output Data section, we will select SingleSelect from the Grid Mode drop-down list.
When we select the SingleSelect option, additional options appear in the Output Data section.
To assign a data name to the file that the user will select in the form, in the Data Name field, we will enter SelectedFile.
The flow associated with this form has two outcome paths: Delete Selected File and OK. The SelectedFile is required in the Delete Selected File path and is optional in the OK path.
In the Required Outcome scenarios list, we will select the Delete Selected File path checkbox.
In the Optional Outcome scenarios list, we will select the OK checkbox.
The form has been configured, so we will save it and close the Form Designer.
Back in the Flow Designer, we will delete the OK path.
We will then add the component to the flow that will run the Delete action.
From the Components panel, under the category Internal Services > AmazonS3Service, we will drag a DeleteFileFromS3 component to the workspace.
Next, we will connect the outcome paths in the flow.
We connect the Delete Selected File outcome path to the Delete File From S3 step, then connect that step to the End Step.
We connect the OK outcome path to the End step, ending the flow without deleting any files.
Now we will configure the Delete File From S3 step with a bucket name and a file key.
In the workspace, we will select the Delete File From S3 step and click the Show Mapping Editor option in the menu.
in the Mapping Editor, Under the FormFileList_SelectedFile object, we will connect the BucketName and Key strings to their corresponding paths.
The flow is now complete, so we’ll debug it to test it.
When the flow runs, the form displays.
When the user selects the file name in the form and clicks the Delete Selected File button. . .