-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Releasing version 1.2.2 of the Java SDK for Oracle Bare Metal Cloud S…
…ervices.
- Loading branch information
Showing
358 changed files
with
1,695 additions
and
916 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
57
bmc-audit/src/main/java/com/oracle/bmc/audit/AuditAsync.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
135
bmc-audit/src/main/java/com/oracle/bmc/audit/AuditAsyncClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
Oops, something went wrong.