Software

How to Delete Object Metadata in OCI Object Storage Classic

OpenStack Swift API w/ Java

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;

public class OciClassicSample {

  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();

    client.target("https://host/v1/sampleService-sampleIdentityDomain/sampleBucket/sampleObject").request().header("X-Auth-Token", ...).header("X-Remove-Object-Meta-Sample-Key", "").post(Entity.entity("", MediaType.WILDCARD_TYPE));

    client.close();
  }

}

OpenStack Swift API w/ Go

package main

import "gopkg.in/resty.v1"

func main() {
  resty.R().SetHeader("X-Auth-Token", ...).SetHeader("X-Remove-Object-Meta-Sample-Key", "").Post("https://host/v1/sampleService-sampleIdentityDomain/sampleBucket/sampleObject")
}

OpenStack Swift API w/ Node.js

const https = require('https')

var req = https.request({ headers: { 'x-auth-token': ..., 'x-remove-object-meta-sample-key': '' }, hostname: 'host', method: 'POST', path: '/v1/sampleService-sampleIdentityDomain/sampleBucket/sampleObject' })

req.end()

OpenStack Swift API w/ Python

import requests

requests.post('https://host/v1/sampleService-sampleIdentityDomain/sampleBucket/sampleObject', headers = { 'X-Auth-Token': ..., 'X-Remove-Object-Meta-Sample-Key': '' })

OpenStack Swift API w/ Ruby

require 'rest-client'

RestClient.post 'https://host/v1/sampleService-sampleIdentityDomain/sampleBucket/sampleObject', '', :x_auth_token => ..., :x_remove_object_meta_sample_key => ''

OpenStack Swift CLI

1) Configure the CLI:

export ST_AUTH=https://host/auth/v1.0
export ST_USER=sampleservice-sampleidentitydomain:sampleuser
export ST_KEY=samplepassword

2) Run the following command:

swift post samplebucket sampleobject -H "X-Remove-Object-Meta-Sample-Key:"

OpenStack Swift Client

from swiftclient.service import SwiftService

service = SwiftService({ 'auth': 'https://host/auth/v1.0', 'user': 'sampleService-sampleIdentityDomain:sampleUser', 'key': 'samplePassword' })

for res in service.post('sampleBucket', [ 'sampleObject' ], { 'header': [ 'X-Remove-Object-Meta-Sample-Key:' ] }):
  print res

OCI Classic FTM API

import java.util.HashMap;
import java.util.Map;

import oracle.cloudstorage.ftm.FileTransferAuth;
import oracle.cloudstorage.ftm.FileTransferManager;

public class OciClassicSample {

  public static void main(String[] args) {
    FileTransferManager ftm = FileTransferManager.getDefaultFileTransferManager(new FileTransferAuth("sampleUser", "samplePassword", "sampleService", "https://host/", "sampleIdentityDomain"));

    Map<String, String> metadata = new HashMap<String, String>();

    metadata.put("Sample-Key", "");

    ftm.setObjectMetadata("sampleBucket", "sampleObject", metadata, null);

    ftm.shutdown();
  }

}

OCI Classic FTM CLI

Not supported.

OCI Classic Java SDK

import oracle.cloud.storage.CloudStorage;
import oracle.cloud.storage.CloudStorageConfig;
import oracle.cloud.storage.CloudStorageFactory;

public class OciClassicSample {

  public static void main(String[] args) throws Exception {
    CloudStorage storage = CloudStorageFactory.getStorage(new CloudStorageConfig().setServiceName("sampleService-sampleIdentityDomain").setServiceUrl("https://host/").setUsername("sampleUser").setPassword("samplePassword"));

    storage.deleteObjectMetadata("sampleBucket", "sampleObject", "Sample-Key"); // omit the "X-Object-Meta" prefix
   }

}

AWS CLI

Not supported.

Terraform OCI Classic Provider

Not supported.

Terraform OpenStack Provider

1) Configure the provider:

export OS_SWAUTH=true
export OS_AUTH_URL=https://host/
export OS_USERNAME=sampleservice-sampleidentitydomain:sampleuser
export OS_PASSWORD=samplepassword

2) Delete the metadata values from the object configuration.

3) Apply the change.

Terraform AWS Provider

Not supported.

s3cmd

Not supported.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.