Making vCloud Director Object Storage Extension API Requests
Any client application that can send HTTP requests is an appropriate tool for developing REST applications with the vCloud Director Object Storage Extension S3 API.
Making API Requests Using Postman
You can use the Postman API Client to issue vCloud Director Object Storage Extension S3 API requests and view responses.
Make sure that you use AWS Signature type of authentication.
For more information, go to https://www.getpostman.com/.
Making API Requests Using cURL
If you use cURL to make vCloud Director Object Storage Extension S3 API requests, you must calculate the signature for each request. For more information about authenticating S3 API requests and signature calculations, see https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html.
curl -X GET https://vcloud-object-storace.example.com:8443/api/v1/s3 -H 'Authorization: AWS4-HMAC-SHA256 Credential={{Access_Key}}/20190820/{{Region}}/s3/aws4_request, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=2916a7fe150115bdb3c93ac3f87d26de6eca59f64a7e15fd698fb61b7a1cefd7' -H 'Content-Type: application/x-www-form-urlencoded' -H 'X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' -H 'X-Amz-Date: 20190820T013058Z'
Making API Requests Using AWS SDK for Java
If you are developing an application with Java, to integrate the vCloud Director Object Storage Extension S3 API, use the AWS SDK for Java. See https://aws.amazon.com/sdk-for-java/.
package com.vmware.voss.client; import com.amazonaws.SDKGlobalConfiguration; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.client.builder.AwsClientBuilder; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; import org.junit.Test; import static com.amazonaws.SDKGlobalConfiguration.DISABLE_CERT_CHECKING_SYSTEM_PROPERTY; public class AWSSDKTest { @Test public void testWithAWSSDK() { String accessKey = "security-credentials-access-key"; String secretKey = "security-credentials-secret-key"; String endpoint = "https://vcloud-object-storace.example.com:8443/api/v1/s3"; AwsClientBuilder.EndpointConfiguration endpointConfig = new AwsClientBuilder.EndpointConfiguration(endpoint, null); AWSCredentials s3Credential = new BasicAWSCredentials(accessKey, secretKey); AmazonS3 client = AmazonS3ClientBuilder.standard() .withPathStyleAccessEnabled(true) .withCredentials(new AWSStaticCredentialsProvider(s3Credential)) .withEndpointConfiguration(endpointConfig) .build(); client.listBuckets(); } }
Making API Requests Using AWS SDK for Python
For developers using Python, to integrate the vCloud Director Object Storage Extension S3 API, use the AWS SDK for Python (Boto3). See https://aws.amazon.com/sdk-for-python/.
import boto3 import botocore import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)-8s %(message)s', datefmt='%a, %d %b % %H:%M:%S') ENDPOINT="https://vcloud-object-storace.example.com:8443/api/v1/s3" client = boto3.client('s3', aws_access_key_id="security-credentials-access-key", aws_secret_access_key="security-credentials-secret-key", endpoint_url=ENDPOINT) client.list_buckets()
Making API Requests Using AWS SDK for Go
If you are developing an application with Go, to integrate the vCloud Director Object Storage Extension S3 API, use the AWS SDK for Go. See https://aws.amazon.com/sdk-for-go/.
sess := session.Must(session.NewSessionWithOptions(session.Options{ SharedConfigState: session.SharedConfigEnable, })) creds := credentials.NewSharedCredentials(“./credentials”, “test-account”) DisableSSL := true awsConfig := aws.Config{ Region: aws.String(“us-west-1”), Credentials: creds, Endpoint: "https://vcloud-object-storace.example.com:8443/api/v1/s3", //disable SSL only for test purposes DisableSSL: &DisableSSL, } sess, err = session.NewSession(&awsConfig) sess.Config.HTTPClient.Transport = &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } s3ForcePathStyle := true svc := s3.New(sess, &aws.Config{ S3ForcePathStyle: &s3ForcePathStyle, })