Skip to content

Commit

Permalink
Releasing version 1.2.2 of the Java SDK for Oracle Bare Metal Cloud S…
Browse files Browse the repository at this point in the history
…ervices.
  • Loading branch information
priteshkp committed Feb 23, 2017
1 parent f4f5b36 commit 21d8903
Show file tree
Hide file tree
Showing 358 changed files with 1,695 additions and 916 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/).

## Unreleased
### Fixed
- N/A

### Changed
- N/A

### Added
- N/A

## 1.2.2 - 2016-02-23
### Fixed
- Bugs in config file parsing

### Changed
- Updated APIs for VCN for stateless security lists
- Updated APIs for Compute for ipxe script support

### Added
- Support for Audit service
- BOM module for SDK
- More examples

## 1.2.0 - 2016-12-16
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

bmcs-java-sdk provides a Java SDK for managing your Oracle Bare Metal Cloud Services resources.

The project is open source and maintained by Oracle Corp. The home page for the project is [here](https://docs.us-phoenix-1.oraclecloud.com/tools/java/latest/).
The project is open source and maintained by Oracle Corp. The home page for the project is [here](https://docs.us-phoenix-1.oraclecloud.com/Content/API/SDKDocs/javasdk.htm).

## Installation

Expand Down
25 changes: 25 additions & 0 deletions bmc-audit/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.oracle.bmc.sdk</groupId>
<artifactId>oracle-bmc-java-sdk</artifactId>
<version>1.2.2</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>oracle-bmc-java-sdk-audit</artifactId>
<name>Oracle Bare Metal Cloud Services SDK - Audit</name>
<description>This project contains the SDK used for Oracle Bare Metal Cloud Audit Service</description>
<url>https://docs.us-phoenix-1.oraclecloud.com/Content/API/SDKDocs/javasdk.htm</url>

<dependencies>
<dependency>
<groupId>com.oracle.bmc.sdk</groupId>
<artifactId>oracle-bmc-java-sdk-common</artifactId>
<version>1.2.2</version>
</dependency>
</dependencies>

</project>
49 changes: 49 additions & 0 deletions bmc-audit/src/main/java/com/oracle/bmc/audit/Audit.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Copyright (c) 2016-2017 Oracle and/or its affiliates. All rights reserved.
*/
package com.oracle.bmc.audit;

import com.oracle.bmc.audit.requests.*;
import com.oracle.bmc.audit.responses.*;

import com.oracle.bmc.*;

@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
public interface Audit extends AutoCloseable {

/**
* Sets the endpoint to call (ex, https://www.example.com).
* @param endpoint The endpoint of the service.
*/
void setEndpoint(String endpoint);

/**
* Sets the region to call (ex, Region.US_PHOENIX_1).
* <p>
* Note, this will call {@link #setEndpoint(String) setEndpoint} after resolving the endpoint. If the service is not available in this Region, however, an IllegalArgumentException will be raised.
* @param region The region of the service.
*/
void setRegion(Region region);

/**
* Sets the region to call (ex, 'us-phoenix-1').
* <p>
* Note, this will first try to map the region ID to a known Region and call
* {@link #setRegion(Region) setRegion}.
* <p>
* If no known Region could be determined, it will create an endpoint based on the
* default endpoint format ({@link Region#formatDefaultRegionEndpoint(Service, String)}
* and then call {@link #setEndpoint(String) setEndpoint}.
* @param regionId The public region ID.
*/
void setRegion(String regionId);

/**
* Returns all audit events for the specified compartment that were processed within the specified time range.
*
* @param request The request object containing the details to send
* @return A response object containing details about the completed operation
* @throws BmcException when an error occurs.
*/
ListEventsResponse listEvents(ListEventsRequest request);
}
57 changes: 57 additions & 0 deletions bmc-audit/src/main/java/com/oracle/bmc/audit/AuditAsync.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* Copyright (c) 2016-2017 Oracle and/or its affiliates. All rights reserved.
*/
package com.oracle.bmc.audit;

import com.oracle.bmc.responses.AsyncHandler;

import java.util.concurrent.Future;

import com.oracle.bmc.audit.requests.*;
import com.oracle.bmc.audit.responses.*;

import com.oracle.bmc.*;

@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
public interface AuditAsync extends AutoCloseable {

/**
* Sets the endpoint to call (ex, https://www.example.com).
* @param endpoint The endpoint of the serice.
*/
void setEndpoint(String endpoint);

/**
* Sets the region to call (ex, Region.US_PHOENIX_1).
* <p>
* Note, this will call {@link #setEndpoint(String) setEndpoint} after resolving the endpoint. If the service is not available in this region, however, an IllegalArgumentException will be raised.
* @param region The region of the service.
*/
void setRegion(Region region);

/**
* Sets the region to call (ex, 'us-phoenix-1').
* <p>
* Note, this will first try to map the region ID to a known Region and call
* {@link #setRegion(Region) setRegion}.
* <p>
* If no known Region could be determined, it will create an endpoint based on the
* default endpoint format ({@link Region#formatDefaultRegionEndpoint(Service, String)}
* and then call {@link #setEndpoint(String) setEndpoint}.
* @param regionId The public region ID.
*/
void setRegion(String regionId);

/**
* Returns all audit events for the specified compartment that were processed within the specified time range.
*
* @param request The request object containing the details to send
* @param handler The request handler to invoke upon completion, may be null.
* @return A Future that can be used to get the response if no AsyncHandler was
* provided. Note, if you provide an AsyncHandler and use the Future, some
* types of responses (like InputStream) may not be able to be read in
* both places as the underlying stream may only be consumed once.
*/
Future<ListEventsResponse> listEvents(
ListEventsRequest request, AsyncHandler<ListEventsRequest, ListEventsResponse> handler);
}
135 changes: 135 additions & 0 deletions bmc-audit/src/main/java/com/oracle/bmc/audit/AuditAsyncClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/**
* Copyright (c) 2016-2017 Oracle and/or its affiliates. All rights reserved.
*/
package com.oracle.bmc.audit;

import com.oracle.bmc.ClientConfiguration;
import com.oracle.bmc.auth.AuthenticationDetailsProvider;
import com.oracle.bmc.http.ClientConfigurator;
import com.oracle.bmc.http.internal.*;
import com.oracle.bmc.responses.*;
import com.oracle.bmc.util.internal.*;

import com.google.common.base.Function;
import com.google.common.base.Optional;

import java.util.concurrent.Future;

import javax.ws.rs.client.*;
import javax.ws.rs.core.*;

import com.oracle.bmc.audit.internal.http.*;
import com.oracle.bmc.audit.requests.*;
import com.oracle.bmc.audit.responses.*;

import com.oracle.bmc.*;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
@Slf4j
public class AuditAsyncClient implements AuditAsync {
/**
* Service instance for Audit.
*/
public static final Service SERVICE = Services.create("AUDIT", "audit");

@Getter(value = AccessLevel.PACKAGE)
private final RestClient client;

/**
* Creates a new service instance using the given authentication provider.
* @param authenticationProvider The authentication details provider, required.
*/
public AuditAsyncClient(AuthenticationDetailsProvider authenticationProvider) {
this.client = newClientBuilder().build().create(SERVICE, authenticationProvider);
}

/**
* Creates a new service instance using the given authentication provider and client configuration.
* @param authenticationProvider The authentication details provider, required.
* @param configuration The client configuration, optional.
*/
public AuditAsyncClient(
AuthenticationDetailsProvider authenticationProvider,
ClientConfiguration configuration) {
this.client =
newClientBuilder().build().create(SERVICE, authenticationProvider, configuration);
}

/**
* Creates a new service instance using the given authentication provider and client configuration. Additionally,
* a Consumer can be provided that will be invoked whenever a REST Client is created to allow for additional configuration/customization.
* @param authenticationProvider The authentication details provider, required.
* @param configuration The client configuration, optional.
* @param clientConfigurator ClientConfigurator that will be invoked for additional configuration of a REST client, optional.
*/
public AuditAsyncClient(
AuthenticationDetailsProvider authenticationProvider,
ClientConfiguration configuration,
ClientConfigurator clientConfigurator) {
this.client =
newClientBuilder()
.clientConfigurator(clientConfigurator)
.build()
.create(SERVICE, authenticationProvider, configuration);
}

private static RestClientFactoryBuilder newClientBuilder() {
RestClientFactoryBuilder builder = RestClientFactoryBuilder.builder();

return builder;
}

@Override
public void setEndpoint(String endpoint) {
LOG.info("Setting endpoint to {}", endpoint);
client.setEndpoint(endpoint);
}

@Override
public void setRegion(Region region) {
Optional<String> endpoint = region.getEndpoint(SERVICE);
if (endpoint.isPresent()) {
setEndpoint(endpoint.get());
} else {
throw new IllegalArgumentException(
"Endpoint for " + SERVICE + " is not known in region " + region);
}
}

@Override
public void setRegion(String regionId) {
regionId = regionId.toLowerCase();
try {
Region region = Region.fromRegionId(regionId);
setRegion(region);
} catch (IllegalArgumentException e) {
LOG.info("Unknown regionId '{}', falling back to default endpoint format", regionId);
String endpoint = Region.formatDefaultRegionEndpoint(SERVICE, regionId);
setEndpoint(endpoint);
}
}

@Override
public void close() {
client.close();
}

@Override
public Future<ListEventsResponse> listEvents(
ListEventsRequest request,
AsyncHandler<ListEventsRequest, ListEventsResponse> handler) {
LOG.trace("Called async listEvents");
Invocation.Builder ib = ListEventsConverter.fromRequest(client, request);
Function<Response, ListEventsResponse> transformer = ListEventsConverter.fromResponse();

Consumer<Response> onSuccess = new SuccessConsumer<>(handler, transformer, request);
Consumer<Throwable> onError = new ErrorConsumer<>(handler, request);

Future<Response> responseFuture = client.get(ib, request, onSuccess, onError);
return new TransformingFuture<>(responseFuture, transformer);
}
}
Loading

0 comments on commit 21d8903

Please sign in to comment.