Skip to content

Commit

Permalink
Release 2.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
seamus-mcgrath committed Feb 26, 2019
1 parent ae87ea0 commit ee624b3
Show file tree
Hide file tree
Showing 19 changed files with 318 additions and 347 deletions.
21 changes: 6 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

# 2.4.3
## Content
### Defect Fixes
* AWS Patches aligned to version 1.11.492 of the AWS Java SDK

# 2.4.2
## Content
### Defect Fixes
Expand All @@ -15,48 +20,40 @@
## Content
### Features
* Immutable Object Storage
### Defect Fixes

# 2.3.2
## Content
### Features
### Defect Fixes
* COSSDK-37669: https://github.ibm.com/objectstore/objectstorage-issues/issues/344
### Defect Fixes

# 2.3.1
## Content
### Features
### Defect Fixes
* Documentation updates

# 2.3.0
## Content
### Features
* Aspera High-Speed Transfer Support
### Defect Fixes

# 2.2.0
## Content
### Features
* Archive Tier Support
### Defect Fixes

# 2.1.3
## Content
### Features
### Defect Fixes
* 38356: null Token causes NPE
* Bug fixes

# 2.1.2
## Content
### Features
### Defect Fixes
* 38813: Bug fixes

# 2.1.1
## Content
### Features
### Defect Fixes
* Bug fixes

Expand All @@ -69,13 +66,11 @@

# 2.0.2
## Content
### Features
### Defect Fixes
* Documentation updates

# 2.0.1
## Content
### Features
### Defect Fixes
* Bug fixes
* Documentation updates
Expand All @@ -96,11 +91,9 @@
## Content
### Features
* Added Key Protect support
### Defect Fixes

# 1.0.2
## Content
### Features
### Defect Fixes
* Add support for additional JVM platforms
* Bug fixes
Expand All @@ -110,11 +103,9 @@
## Content
### Features
* Host generated API docs
### Defect Fixes

# 1.0.0
## Content
### Features
* Initial release
* IAM support
### Defect Fixes
120 changes: 6 additions & 114 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ Cloud Object Storage](https://cloud.ibm.com/docs/services/cloud-object-storage/a
## Documentation

* [Core documentation for IBM COS](https://cloud.ibm.com/docs/services/cloud-object-storage/getting-started.html)
* [Code Examples](https://cloud.ibm.com/docs/services/cloud-object-storage?topic=cloud-object-storage-using-java#examples)
* [Java API reference documentation](https://ibm.github.io/ibm-cos-sdk-java)
* [REST API reference documentation](https://cloud.ibm.com/docs/services/cloud-object-storage/api-reference/about-api.html)

Changes to the SDK are tracked in the [CHANGELOG.md][changes-file] file.

* [Example code](#example-code)
* [Building from source](#building-from-source)
* [Getting help](#getting-help)

Expand Down Expand Up @@ -39,117 +39,6 @@ The recommended way to use the IBM COS SDK for Java in your project is to consum
</dependencies>
```

## Example code (Version 2.x)

```java

package com.cos;

import java.sql.Timestamp;
import java.util.List;


// version 1.x of the library uses 'com.amazonaws' for namespacing

import com.ibm.cloud.objectstorage.ClientConfiguration;
import com.ibm.cloud.objectstorage.SDKGlobalConfiguration;
import com.ibm.cloud.objectstorage.auth.AWSCredentials;
import com.ibm.cloud.objectstorage.auth.AWSStaticCredentialsProvider;
import com.ibm.cloud.objectstorage.auth.BasicAWSCredentials;
import com.ibm.cloud.objectstorage.client.builder.AwsClientBuilder.EndpointConfiguration;
import com.ibm.cloud.objectstorage.services.s3.AmazonS3;
import com.ibm.cloud.objectstorage.services.s3.AmazonS3ClientBuilder;
import com.ibm.cloud.objectstorage.services.s3.model.Bucket;
import com.ibm.cloud.objectstorage.services.s3.model.ListObjectsRequest;
import com.ibm.cloud.objectstorage.services.s3.model.ObjectListing;
import com.ibm.cloud.objectstorage.services.s3.model.S3ObjectSummary;
import com.ibm.cloud.objectstorage.oauth.BasicIBMOAuthCredentials;

public class CosExample
{

private static AmazonS3 _cos;

/**
* @param args
*/
public static void main(String[] args)
{

SDKGlobalConfiguration.IAM_ENDPOINT = "https://iam.bluemix.net/oidc/token";

String bucketName = "<bucketName>";
String api_key = "<apiKey>";
String service_instance_id = "<resourceInstanceId>";
String endpoint_url = "https://s3-api.us-geo.objectstorage.softlayer.net";
String location = "us";

System.out.println("Current time: " + new Timestamp(System.currentTimeMillis()).toString());
_cos = createClient(api_key, service_instance_id, endpoint_url, location);
listObjects(bucketName, _cos);
listBuckets(_cos);
}

/**
* @param bucketName
* @param clientNum
* @param api_key
* (or access key)
* @param service_instance_id
* (or secret key)
* @param endpoint_url
* @param location
* @return AmazonS3
*/
public static AmazonS3 createClient(String api_key, String service_instance_id, String endpoint_url, String location)
{
AWSCredentials credentials;
if (endpoint_url.contains("objectstorage.softlayer.net")) {
credentials = new BasicIBMOAuthCredentials(api_key, service_instance_id);
} else {
String access_key = api_key;
String secret_key = service_instance_id;
credentials = new BasicAWSCredentials(access_key, secret_key);
}
ClientConfiguration clientConfig = new ClientConfiguration().withRequestTimeout(5000);
clientConfig.setUseTcpKeepAlive(true);

AmazonS3 cos = AmazonS3ClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(credentials))
.withEndpointConfiguration(new EndpointConfiguration(endpoint_url, location)).withPathStyleAccessEnabled(true)
.withClientConfiguration(clientConfig).build();
return cos;
}

/**
* @param bucketName
* @param cos
*/
public static void listObjects(String bucketName, AmazonS3 cos)
{
System.out.println("Listing objects in bucket " + bucketName);
ObjectListing objectListing = cos.listObjects(new ListObjectsRequest().withBucketName(bucketName));
for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) {
System.out.println(" - " + objectSummary.getKey() + " " + "(size = " + objectSummary.getSize() + ")");
}
System.out.println();
}

/**
* @param cos
*/
public static void listBuckets(AmazonS3 cos)
{
System.out.println("Listing buckets");
final List<Bucket> bucketList = cos.listBuckets();
for (final Bucket bucket : bucketList) {
System.out.println(bucket.getName());
}
System.out.println();
}

}
```

## Building from source

Once you check out the code from GitHub, you can build it using Maven:
Expand Down Expand Up @@ -194,7 +83,7 @@ Feel free to use GitHub issues for tracking bugs and feature requests, but for h
[changes-file]: ./CHANGELOG.md
[bluemix-docs]: https://cloud.ibm.com/docs/services/cloud-object-storage/libraries/java.html#java
[stack-overflow]: http://stackoverflow.com/questions/tagged/object-storage+ibm
[ibm-bluemix-support]: https://support.ng.bluemix.net/gethelp/
[ibm-bluemix-support]: https://cloud.ibm.com/unifiedsupport/supportcenter
[open-an-issue]: https://github.com/ibm/ibm-cos-sdk-java/issues/new
[immutable-storage-docs]: https://cloud.ibm.com/docs/services/cloud-object-storage/basics/immutable.html

Expand Down Expand Up @@ -227,4 +116,7 @@ The 2.0 release of the SDK introduces a namespacing change that allows an applic

This SDK is distributed under the
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0),
see LICENSE.txt and NOTICE.txt for more information.
see [LICENSE.txt][LICENSE.txt] and [NOTICE.txt][NOTICE.txt] for more information.

[LICENSE.txt]: ./LICENSE.txt
[NOTICE.txt]: ./NOTICE.txt
2 changes: 1 addition & 1 deletion ibm-cos-java-sdk-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.ibm.cos</groupId>
<artifactId>ibm-cos-java-sdk-pom</artifactId>
<version>2.4.3-SNAPSHOT</version>
<version>2.4.3</version>
</parent>
<groupId>com.ibm.cos</groupId>
<artifactId>ibm-cos-java-sdk-bom</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion ibm-cos-java-sdk-bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.ibm.cos</groupId>
<artifactId>ibm-cos-java-sdk-pom</artifactId>
<version>2.4.3-SNAPSHOT</version>
<version>2.4.3</version>
</parent>
<groupId>com.ibm.cos</groupId>
<artifactId>ibm-cos-java-sdk-bundle</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion ibm-cos-java-sdk-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.ibm.cos</groupId>
<artifactId>ibm-cos-java-sdk-pom</artifactId>
<version>2.4.3-SNAPSHOT</version>
<version>2.4.3</version>
</parent>
<groupId>com.ibm.cos</groupId>
<artifactId>ibm-cos-java-sdk-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion ibm-cos-java-sdk-kms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.ibm.cos</groupId>
<artifactId>ibm-cos-java-sdk-pom</artifactId>
<version>2.4.3-SNAPSHOT</version>
<version>2.4.3</version>
</parent>
<groupId>com.ibm.cos</groupId>
<artifactId>ibm-cos-java-sdk-kms</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion ibm-cos-java-sdk-s3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.ibm.cos</groupId>
<artifactId>ibm-cos-java-sdk-pom</artifactId>
<version>2.4.3-SNAPSHOT</version>
<version>2.4.3</version>
</parent>
<groupId>com.ibm.cos</groupId>
<artifactId>ibm-cos-java-sdk-s3</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2011-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://aws.amazon.com/apache2.0
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and
* limitations under the License.
*/
package com.ibm.cloud.objectstorage.services.s3.internal;

import com.ibm.cloud.objectstorage.annotation.SdkInternalApi;
import com.ibm.cloud.objectstorage.services.s3.model.GetObjectMetadataRequest;
import com.ibm.cloud.objectstorage.services.s3.model.GetObjectRequest;

@SdkInternalApi
public class RequestCopyUtils {

/**
* Creates a #GetObjectMetadataRequest by copying values for common members
* from the input #GetObjectRequest.
*/
public static GetObjectMetadataRequest createGetObjectMetadataRequestFrom(GetObjectRequest getObjectRequest) {
return new GetObjectMetadataRequest(getObjectRequest.getBucketName(), getObjectRequest.getKey())
.withVersionId(getObjectRequest.getVersionId())
.withRequesterPays(getObjectRequest.isRequesterPays())
.withSSECustomerKey(getObjectRequest.getSSECustomerKey())
.withPartNumber(getObjectRequest.getPartNumber());
}
}
Loading

0 comments on commit ee624b3

Please sign in to comment.