/**
 * Copyright (c) 2020, 2021 Oracle and/or its affiliates.  All rights reserved.
 * This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
 */ import common = require ( "oci-common" ) ; import { ObjectStorageClient , requests } from "oci-objectstorage" ; const provider = new common . ConfigFileAuthenticationDetailsProvider ( ) ; const args = process . argv . slice ( 2 ) ; console . log ( args ) ; if ( args . length !== 3 ) { console . error ( "Unexpected number of arguments received. Please pass absloute directory path to read files from" ) ; process . exit ( - 1 ) ; } const fileName = args [ 0 ] ; const namespaceName = args [ 1 ] ; const bucketName = args [ 2 ] ; const client = new ObjectStorageClient ( { authenticationDetailsProvider : provider } ) ; ( async ( ) => { try { const deleteObjectRequest = { bucketName : bucketName , namespaceName : namespaceName , objectName : fileName } ; const resp = await client . deleteObject ( deleteObjectRequest ) ; console . log ( resp ) ; console . log ( `Deleted ${ fileName }.` ) ; } catch ( ex ) { console . error ( `Failed due to ${ ex }` ) ; } } ) ( ) ;