DROP JAVA SOURCE APPS."ExpdAwsS3Utils";
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED APPS."ExpdAwsS3Utils"
as import java.io.*;
public class ExpdAwsS3Utils {
public static final String SUCCESS = "SUCCESS";
public static final String MISSING_FILE_PATH = "File/Path does not exists";
private static final String MISSING_BUCKET_PATH = "Bucket Path can not be Empty";
public static final String INVALID_FILE = "Invalid File.";
public static final String INVALID_DIR = "Invalid Directory Path.";
private static final String INVALID_OBJECT = "Invalid Object";
private static final String INVALID_BUCKET_PATH = "Invalid Bucket Path";
private static final String INVALID_PROFILE = "Invalid/Null Profile";
/**
* Get the output of given Input Stream
*
* @param in Input Stream to be read
* @return String builder
* @throws IOException
*/
private static StringBuilder getCommandOutput(InputStream in) throws IOException {
StringBuilder output = new StringBuilder();
BufferedReader stdInput = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = stdInput.readLine()) != null) {
output.append(line).append(System.getProperty("line.separator"));
}
return output;
}
/**
* Execute a given command and return the Process created for it
*
* @param cmd Command to be executed
* @return Process which executed the command
* @throws IOException
* @throws InterruptedException
*/
private static Process executeProcess(String cmd) throws IOException, InterruptedException {
Process process = Runtime.getRuntime().exec(cmd);
process.waitFor();
System.out.println("cmd = " + cmd);
return process;
}
/**
* Return the Sectret Access Key, User Id and Token
*
* @param profile
* @return
*/
public static String getCredentials(String profile) throws InterruptedException {
String secretAccessId = null, accessKey = null, secretToken = null;
StringBuilder output = new StringBuilder("");
try {
System.out.println("Getting credentials");
String cmd = String.format("aws cognito-identity get-credentials-for-identity --identity-id us-west-2:%s --region us-west-2 >$APPLCSF/log/cred.tmp\n", profile);
Process process = executeProcess(cmd);
int retVal = process.exitValue();
if (retVal == 0) {
output = getCommandOutput(process.getInputStream());
} else {
output = getCommandOutput(process.getErrorStream());
}
/*System.out.println("Getting Access ID");
process = Runtime.getRuntime().exec(String.format("cat $APPLCSF/log/cred.tmp | grep AccessKeyId | awk -F '\"' '{print $4}'"));
process.waitFor();
secretAccessId = output;
process = Runtime.getRuntime().exec(String.format("cat $APPLCSF/log/cred.tmp | grep SecretKey | awk -F '\"' '{print $4}'"));
process.waitFor();
stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
while ((output = stdInput.readLine()) != null) {
System.out.println(output);
}
accessKey = output;
process = Runtime.getRuntime().exec(String.format("cat $APPLCSF/log/cred.tmp | grep SessionToken | awk -F '\"' '{print $4}'"));
process.waitFor();
stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
while ((output = stdInput.readLine()) != null) {
System.out.println(output);
}
secretToken = output;*/
} catch (Exception e) {
output = new StringBuilder(e.getMessage());
}
return output.toString();
}
/**
* List Object(s) and its details in the given bucket path
*
* @param profile AWS Profile Name
* @param bucketPath Bucket Name or Path where Objects are placed
* @return List of Objects
*/
public static String listObjects(String profile, String bucketPath) {
// Get credentials
StringBuilder output = new StringBuilder("");
String cmd = String.format("aws --profile %s s3 ls s3://%s", profile, bucketPath);
// Execute the command
try {
Process process = executeProcess(cmd);
int retVal = process.exitValue();
// Object does not exist
if (retVal == 0) {
output.append(getCommandOutput(process.getInputStream()));
} else if (retVal == 1) {
return bucketPath + " : " + INVALID_BUCKET_PATH;
} else {
output.append(retVal).append(System.getProperty("line.separator"));
output.append(cmd).append(System.getProperty("line.separator"));
output.append(process.getErrorStream());
}
} catch (Exception e) {
e.printStackTrace();
output.append(e.getMessage());
}
return output.toString();
}
/**
* Check if given Object exists
*
* @param profile Profile Name
* @param objectFullPath Full path of the S3 Object
* @return True/False based on status
*/
private static boolean objectExists(String profile, String objectFullPath) {
StringBuilder output = new StringBuilder("");
String cmd = String.format("aws --profile %s s3 ls s3://%s", profile, objectFullPath);
// Execute the command
try {
Process process = executeProcess(cmd);
int retVal = process.exitValue();
if (retVal != 0) {
output.append(retVal).append(System.getProperty("line.separator"));
output.append(cmd).append(System.getProperty("line.separator"));
output.append(getCommandOutput(process.getErrorStream()).toString());
System.out.println(output.toString());
return false;
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
/**
* Delete the Object from S3 bucket in the given Bucket Path, if Bucket Path is a directory and all all of its
* contents are to be deleted use isDirectory parameter as 'N'
*
* @param profile AWS Profile Name
* @param objectPath Object path in the S3 Bucket path
* @param isDirectory Pass Y if objectPath is a directory and all objects inside it are to be deleted
* @return SUCCESS if object delete successfully else error message
*/
public static String deleteObject(String profile, String objectPath, String isDirectory) {
// Get credentials
// Check if object exists
if (!objectExists(profile, objectPath)) {
return objectPath + " : " + INVALID_OBJECT;
}
StringBuilder output = new StringBuilder("");
// Check if Object does exists
String cmd = String.format("aws --profile %s s3 rm s3://%s", profile, objectPath);
if ("Y".equals(isDirectory.toUpperCase())) {
cmd = cmd + " --recursive";
}
// Execute the command
try {
Process process = executeProcess(cmd);
int retVal = process.exitValue();
if (retVal != 0) {
output.append(retVal).append(System.getProperty("line.separator"));
output.append(cmd).append(System.getProperty("line.separator"));
output.append(getCommandOutput(process.getErrorStream()).toString());
return output.toString();
}
} catch (Exception e) {
return e.getMessage();
}
return SUCCESS;
}
/**
* Move the given S3 Object to a new Path in the bucket
*
* @param profile AWS Profile Name
* @param objectPath Object path in the S3 Bucket path
* @return SUCCESS if object delete successfully else error message
*/
public static String moveObject(String profile, String objectPath, String newBucketPath) {
// Get credentials
// Check if object exists
if (!objectExists(profile, objectPath)) {
return objectPath + " : " + INVALID_OBJECT;
}
// Check if object exists
if (!objectExists(profile, newBucketPath)) {
return objectPath + " : " + INVALID_OBJECT;
}
StringBuilder output = new StringBuilder("");
// Check if Object does exists
String cmd = String.format("aws --profile %s s3 mv s3://%s %s", profile, objectPath, newBucketPath);
// Execute the command
try {
Process process = executeProcess(cmd);
int retVal = process.exitValue();
if (retVal != 0) {
output.append(retVal).append(System.getProperty("line.separator"));
output.append(cmd).append(System.getProperty("line.separator"));
output.append(getCommandOutput(process.getErrorStream()).toString());
return output.toString();
}
} catch (Exception e) {
return e.getMessage();
}
return SUCCESS;
}
/**
* Upload a local file as S3 Object in the given Bucket Path
*
* @param profile AWS Profile Name
* @param bucketPath Bucket Name
* @param localFilePath Local file Absoloute Path
* @param objectName Object name against local file, default will same as file name
* @return SUCCESS if object uploaded successfully
* <p>
* Below example will upload file large_file.txt to S3 Bucket Path "fsp-phoenix-test/archive/" as "small_file.dat"
* uploadObject("oradev_aws_user", "fsp-phoenix-test/archive/", "/home/s-oraclddev/amaindola/large_file.txt", "small_file.dat");
* <p>
* Below example will upload file to S3 Bucket Path "fsp-phoenix-test/archive/" as large_file.txt
* uploadObject("oradev_aws_user", "fsp-phoenix-test/archive/", "/home/s-oraclddev/amaindola/large_file.txt", null);
* <p>
*/
public static String uploadObject(String profile, String bucketPath, String localFilePath, String objectName) {
// Get credentials
File localFile = new File(localFilePath);
// Check if file exists
if (!localFile.exists()) return localFilePath + " : " + MISSING_FILE_PATH;
// Check if file is of Type file
if (!localFile.isFile()) return localFilePath + " : Object should be a file.";
// Check if Bucket path ends with slash
if (!bucketPath.endsWith("/")) bucketPath = bucketPath.concat("/");
StringBuilder output = new StringBuilder("");
String cmd = String.format("aws --profile %s s3 cp %s s3://%s", profile, localFilePath, bucketPath);
if (objectName != null) cmd = cmd + objectName;
// Execute the command
try {
Process process = executeProcess(cmd);
int retVal = process.exitValue();
if (retVal != 0) {
output.append(retVal).append(System.getProperty("line.separator"));
output.append(cmd).append(System.getProperty("line.separator"));
output.append(getCommandOutput(process.getErrorStream()).toString());
return output.toString();
}
} catch (Exception e) {
return e.getMessage();
}
return SUCCESS;
}
/**
* Upload contents of the given Local Path to S3 Bucket Path
*
* @param profile AWS Profile Name
* @param bucketPath Bucket Name
* @param localDirPath Local Directory Absolute Path
* @param recursive Give Y if all sub-directories of the folder also to be uploaded
* @return SUCCESS else failure message
*
* <p></p>
* <p>Below example will upload folder archive's content to bucket path "fsp-phoenix-test/archive/", archive folder will be created if not present</p>
* <pre>
* {@code uploadDirectory("oradev_aws_user", "fsp-phoenix-test/archive/", "/u04/oracle/R12/ORADEV/XXEXPD/12.0.0/data/inbound/temp/archive", "N");}
* </pre>
*
* <p></p>
* <p>Below example will upload folder archive's content and all sub-folders to bucket path "fsp-phoenix-test/archive/" in recursive manner. archive folder will be created in S3 if not exists</p>
* <pre>
* {@code uploadDirectory("oradev_aws_user", "fsp-phoenix-test/archive/", "/u04/oracle/R12/ORADEV/XXEXPD/12.0.0/data/inbound/temp/archive", "Y", null);}
* </pre>
*
*/
public static String uploadDirectory(String profile, String bucketPath, String localDirPath, String recursive) {
// Get credentials
// Check if file exists
File path = new File(localDirPath);
if (profile == null) return INVALID_PROFILE;
if (bucketPath == null) return MISSING_BUCKET_PATH;
if (!path.exists()) return localDirPath + " : " + MISSING_FILE_PATH;
if (!path.isDirectory()) return localDirPath + " : " + INVALID_DIR;
// If bucket directory prefix is missing / add to the same to preserve directory structure
if (!bucketPath.endsWith("/")) {
bucketPath = bucketPath.concat("/");
}
// Check if Bucket exists
if (!objectExists(profile, bucketPath.substring(0,bucketPath.indexOf("/")))) return bucketPath + " : " + INVALID_OBJECT;
StringBuilder output = new StringBuilder("");
// Check if all files and folders to be uploaded
if (recursive != null && "Y".equals(recursive.toUpperCase())) {
String cmd = String.format("aws --profile %s s3 cp %s s3://%s --recursive", profile, localDirPath, bucketPath);
// Execute the command
try {
Process process = executeProcess(cmd);
int retVal = process.exitValue();
if (retVal != 0) {
output.append(retVal).append(System.getProperty("line.separator"));
output.append(cmd).append(System.getProperty("line.separator"));
output.append(getCommandOutput(process.getErrorStream()).toString());
return output.toString();
}
} catch (Exception e) {
return (e.getMessage());
}
} else {
for (File file : path.listFiles()) {
if (file.isFile()) {
System.out.println(file.getAbsolutePath().replace(" ", "\\ "));
String cmd = String.format("aws --profile %s s3 cp %s s3://%s", profile,
file.getAbsolutePath().replace(" ", "\\ "), bucketPath);
// Execute the command
try {
Process process = executeProcess(cmd);
int retVal = process.exitValue();
if (retVal != 0) {
output.append(retVal).append(System.getProperty("line.separator"));
output.append(cmd).append(System.getProperty("line.separator"));
output.append(getCommandOutput(process.getErrorStream()).toString());
return output.toString();
}
} catch (Exception e) {
return (e.getMessage());
}
}
}
}
// Return the mesage
return SUCCESS;
}
/**
* Synchronizes the contents of an Amazon S3 folder named path in <bucketPath> with the <localDirPath> working directory
*
* @param profile Profile Name
* @param bucketPath Bucket Path
* @param localDirPath Local Directory Path
* @param deleteMissing Delete Objects in the bucket which are not present in the localDirpath
* @return SUCCESS or failure message
* <p>Below example will Sync folder archive's content to bucket path "fsp-phoenix-test/archive/test/" which are
* not present in there.<p>
* <pre>
* {@code syncDirectory("oradev_aws_user", "fsp-phoenix-test/archive/", "/u04/oracle/R12/ORADEV/XXEXPD/12.0.0/data/inbound/temp/archive", "N");}
* </pre>
*
* <p>Below example will Sync folder archive's content to bucket path "fsp-phoenix-test/archive/test/" which are
* not present in there, removing files in bucket which are not present in the local directory.<p>
* <pre>
* {@code syncDirectory("oradev_aws_user", "fsp-phoenix-test/archive/", "/u04/oracle/R12/ORADEV/XXEXPD/12.0.0/data/inbound/temp/archive", "Y");}
* </pre>
*/
public static String syncDirectory(String profile, String bucketPath, String localDirPath, String deleteMissing) {
// Check if file exists
File object = new File(localDirPath);
if (!object.exists()) {
return localDirPath + " : " + MISSING_FILE_PATH;
}
StringBuilder output = new StringBuilder("");
String cmd = String.format("aws --profile %s s3 sync %s s3://%s", profile, localDirPath, bucketPath);
// Check if option provided to delete missing
if ("Y".equals(deleteMissing.toUpperCase())) {
cmd = cmd + " --delete";
}
// Execute the command
try {
Process process = Runtime.getRuntime().exec(cmd);
process.waitFor();
int retVal = process.exitValue();
if (retVal != 0) {
output.append(retVal).append(System.getProperty("line.separator"));
output.append(cmd).append(System.getProperty("line.separator"));
output.append(getCommandOutput(process.getErrorStream()).toString());
}
} catch (Exception e) {
return e.getMessage();
}
return SUCCESS;
}
};
/
PL/SQL Code
PL/SQL Code
CREATE OR REPLACE PACKAGE BODY APPS.xxexpd_aws_s3_utility_pkg
IS
--
#############################################################################
-- # Copyright (c)
2020 Expedia
-- # All rights
reserved
-- #
--
############################################################################
-- #
--
# Application : apps
-- # File Name: :
XXEXPD_AWS_S3_UTILITY_PKG.pkb
-- # Exec Method :
PL/SQL Stored - Procedure
-- # Description :
Package used for various File Utility actions
-- #
-- # Change History
-- # -----------------------------------------------------------------------
-- # Version
Date Author Remarks
-- # =======
=========== =============
============================
-- # 1.0
02-Mar-2020 Amit Maindola Initial Version
-- # 1.1
23-Mar-2020 Ranjit P Delete Bucket
--
############################################################################
-- Declare Global Variables
g_sysdate DATE := SYSDATE;
g_delimiter VARCHAR2 (30) := ' ';
g_err_length_limit NUMBER := 1500;
g_package_name CONSTANT VARCHAR2 (30) := 'XXEXPD_AWS_S3_UTILITY_PKG';
g_proc_name VARCHAR2 (100) := NULL;
excp_custom EXCEPTION;
-- Declare User Global Types
------------------------------------------------------------------------------------------------
-- PROCEDURE :
PRINTLOG
-- Description :
This procedure is used to print log messages
------------------------------------------------------------------------------------------------
PROCEDURE printlog (p_message IN VARCHAR2, p_indent_level IN NUMBER DEFAULT 0)
IS
l_message VARCHAR2 (16000) := NULL;
BEGIN
l_message :=
LPAD (' '
, 4 * p_indent_level
, g_delimiter)
|| p_message;
DBMS_OUTPUT.put_line
(l_message);
END printlog;
-- Form the error message for when others
FUNCTION get_errmsg (p_message IN VARCHAR2 DEFAULT NULL)
RETURN VARCHAR2
IS
BEGIN
RETURN 'Error
occured in '
|| g_package_name
|| '.'
|| g_proc_name
|| '. '
|| NVL (p_message, '')
|| ' Error : '
|| SQLERRM
|| ' '
|| DBMS_UTILITY.format_error_backtrace;
EXCEPTION --Exception Block
WHEN OTHERS THEN
printlog ('Error while forming messgage.
Error : ' || SQLERRM);
RETURN NULL;
END;
------------------------------------------------------------------------------------------------
-- Function
: LIST_OBJECTS
-- Description
: List Object(s) and its details in the given bucket path
-- EXAMPLE
: select xxexpd_aws_s3_utility_pkg.list_objects ('oradev_aws_user',
'fsp-phoenix-test') from dual
-- -----------------------------------------------
-- P_PROFILE
: AWS Profile name
-- P_BUCKET_PATH
: AWS S3 Bucket path
-- -----------------------------------------------
-- RETURNS
: G_SUCCESS else Error details
------------------------------------------------------------------------------------------------
FUNCTION list_objects (p_profile IN VARCHAR2, p_bucket_path IN VARCHAR2)
RETURN VARCHAR2
AS
LANGUAGE JAVA
NAME 'ExpdAwsS3Utils.listObjects(java.lang.String,
java.lang.String) return java.lang.String' ;
------------------------------------------------------------------------------------------------
-- Function
: DELETE_OBJECT
-- Description : Delete the Object from S3 bucket in the
given Bucket Path, if Bucket Path is a directory and all all of its
--
contents are to be deleted use isDirectory parameter as 'N'
-- EXAMPLE
: select xxexpd_aws_s3_utility_pkg.delete_object
('oradev_aws_user','fsp-phoenix-test/Ranjit','Y') from dual;
-- -----------------------------------------------
-- P_PROFILE
: AWS Profile name
-- P_OBJECT_PATH
: Full S3 Object Path
-- P_IS_DIRECTORY
: Pass Y if objectPath is a directory and all objects inside it are to
be deleted.
-- -----------------------------------------------
-- RETURNS
: G_SUCCESS else Error details
------------------------------------------------------------------------------------------------
FUNCTION delete_object (p_profile IN VARCHAR2
, p_object_path IN VARCHAR2
, p_is_directory IN VARCHAR2)
RETURN VARCHAR2
AS
LANGUAGE JAVA
NAME 'ExpdAwsS3Utils.deleteObject(java.lang.String,
java.lang.String, java.lang.String) return java.lang.String' ;
------------------------------------------------------------------------------------------------
-- Function
: DELETE_BUCKET
-- Description
: Delete the Object from S3 bucket in the given Bucket Path, if Bucket
Path is a directory and all all of its
--
contents are to be deleted use isDirectory parameter as 'N'
-- EXAMPLE
: select xxexpd_aws_s3_utility_pkg.delete_object
('oradev_aws_user','fsp-phoenix-test/Ranjit','Y') from dual;
-- -----------------------------------------------
-- P_PROFILE
: AWS Profile name
-- P_OBJECT_PATH
: Full S3 Object Path
-- P_IS_DIRECTORY
: Pass Y if objectPath is a directory and all objects inside it are to
be deleted.
-- -----------------------------------------------
-- RETURNS
: G_SUCCESS else Error details
------------------------------------------------------------------------------------------------
FUNCTION delete_bucket (p_profile IN VARCHAR2
, p_bucket_name IN VARCHAR2)
RETURN VARCHAR2
AS
LANGUAGE JAVA
NAME 'ExpdAwsS3Utils.deleteBucket(java.lang.String,
java.lang.String, java.lang.String) return java.lang.String' ;
------------------------------------------------------------------------------------------------
-- Function
: UPLOAD_OBJECT
-- Description
: Upload a local file as S3 Object in the given Bucket Path
-- EXAMPLE
: SELECT apps.xxexpd_aws_s3_utility_pkg.upload_object ('oradev_aws_user'
-- , 'fsp-phoenix-test'
--
, '/u04/oracle/R12/ORADEV/XXEXPD/12.0.0/data/inbound/temp/ctrip.xlsx'
--
, NULL) FROM DUAL
-- -----------------------------------------------
-- P_PROFILE
: AWS Profile name
-- P_BUCKET_PATH
: AWS S3 Bucket path
-- P_FILE_PATH
: Local file Absoloute path
-- P_OBJECT_NAME
: Optional, Object name against local file, default will same as file
name
-- -----------------------------------------------
-- RETURNS
: G_SUCCESS else Error details
------------------------------------------------------------------------------------------------
FUNCTION upload_object (p_profile IN VARCHAR2
, p_bucket_path IN VARCHAR2
, p_file_path IN VARCHAR2
, p_object_name IN VARCHAR2)
RETURN VARCHAR2
AS
LANGUAGE JAVA
NAME 'ExpdAwsS3Utils.uploadObject(java.lang.String,
java.lang.String, java.lang.String, java.lang.String) return java.lang.String' ;
------------------------------------------------------------------------------------------------
-- Function
: UPLOAD_DIRECTORY
-- Description
: Upload contents of the given Local Path to S3 Bucket Path
-- EXAMPLE
:
-- Below command will Uplaod contents of a local directory
to S3 Bucket, archive directory will be created in the Bucket path if not
exists
-- SELECT apps.xxexpd_aws_s3_utility_pkg.upload_directory
('oradev_aws_user'
--
, 'fsp-phoenix-test/archive'
--
, '/u04/oracle/R12/ORADEV/XXEXPD/12.0.0/data/inbound/temp/archive/')
FROM DUAL
-- Below command will Uplaod all contents of a local
directory(including sub-directories) to S3 Bucket, archive directory will be
created in the Bucket path if not exists
-- SELECT apps.xxexpd_aws_s3_utility_pkg.upload_directory
('oradev_aws_user'
--
, 'fsp-phoenix-test/archive'
--
, '/u04/oracle/R12/ORADEV/XXEXPD/12.0.0/data/inbound/temp/archive/')
FROM DUAL
-- Below command will Uplaod contents of a local directory
to S3 Bucket, all files in the local directory will be uploaded
-- SELECT apps.xxexpd_aws_s3_utility_pkg.upload_directory
('oradev_aws_user'
--
, 'fsp-phoenix-test'
-- ,
'/u04/oracle/R12/ORADEV/XXEXPD/12.0.0/data/inbound/temp/archive/') FROM DUAL
-- Below command will Uplaod all contents of a local
directory(including sub-directories) to S3 Bucket, all files along with
Sub-directories will be uploaded to Bucket
-- SELECT apps.xxexpd_aws_s3_utility_pkg.upload_directory
('oradev_aws_user'
--
, 'fsp-phoenix-test'
--
, '/u04/oracle/R12/ORADEV/XXEXPD/12.0.0/data/inbound/temp/archive/')
FROM DUAL
-- -----------------------------------------------
-- P_PROFILE
: AWS Profile name
-- P_BUCKET_PATH
: AWS S3 Bucket path
-- P_DIR_PATH
: Local Directory Absoloute path
-- RECURSIVE
: Give Y if all sub-directories and its content in the folder also to be
uploaded
-- -----------------------------------------------
-- RETURNS
: G_SUCCESS else Error details
------------------------------------------------------------------------------------------------
FUNCTION upload_directory (p_profile IN VARCHAR2
, p_bucket_path IN VARCHAR2
, p_dir_path IN VARCHAR2
, p_recursive IN VARCHAR2)
RETURN VARCHAR2
AS
LANGUAGE JAVA
NAME 'ExpdAwsS3Utils.uploadDirectory(java.lang.String,
java.lang.String, java.lang.String, java.lang.String) return java.lang.String' ;
------------------------------------------------------------------------------------------------
-- Function
: SYNC_DIRECTORY
-- Description
: Synchronizes the contents of an Amazon S3 folder named path in
<bucketPath> with the <localPDirPath> working directory
-- EXAMPLE
:
-- Below command will Sync a directory preserving Files
which are not present in local Directory
-- SELECT apps.xxexpd_aws_s3_utility_pkg.sync_directory
('oradev_aws_user'
-- , 'fsp-phoenix-test'
--
, '/u04/oracle/R12/ORADEV/XXEXPD/12.0.0/data/inbound/temp/archive/'
--
, 'N') FROM DUAL
-- Below command will Sync a directory deleting Files
which are not present in local Directory
-- SELECT apps.xxexpd_aws_s3_utility_pkg.sync_directory
('oradev_aws_user'
--
, 'fsp-phoenix-test'
--
, '/u04/oracle/R12/ORADEV/XXEXPD/12.0.0/data/inbound/temp/archive/'
--
, 'N') FROM DUAL
-- -----------------------------------------------
-- P_PROFILE
: AWS Profile name
-- P_BUCKET_PATH
: AWS S3 Bucket path
-- P_DIR_PATH
: Local Directory Absoloute path
-- P_DELETE_MISSING
: Delete Objects in the bucket which are not present in the localDirpath
-- -----------------------------------------------
-- RETURNS
: G_SUCCESS else Error details
------------------------------------------------------------------------------------------------
FUNCTION sync_directory (p_profile IN VARCHAR2
, p_bucket_path IN VARCHAR2
, p_dir_path IN VARCHAR2
, p_delete_missing IN VARCHAR2)
RETURN VARCHAR2
AS
LANGUAGE JAVA
NAME 'ExpdAwsS3Utils.syncDirectory(java.lang.String,
java.lang.String, java.lang.String, java.lang.String) return java.lang.String' ;
END xxexpd_aws_s3_utility_pkg;
/
No comments:
Post a Comment