Skip to content

Commit 21d8903

Browse files
committed
Releasing version 1.2.2 of the Java SDK for Oracle Bare Metal Cloud Services.
1 parent f4f5b36 commit 21d8903

File tree

358 files changed

+1695
-916
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

358 files changed

+1695
-916
lines changed

CHANGELOG.md

+21
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/).
55

66
## Unreleased
7+
### Fixed
8+
- N/A
9+
10+
### Changed
11+
- N/A
12+
13+
### Added
14+
- N/A
15+
16+
## 1.2.2 - 2016-02-23
17+
### Fixed
18+
- Bugs in config file parsing
19+
20+
### Changed
21+
- Updated APIs for VCN for stateless security lists
22+
- Updated APIs for Compute for ipxe script support
23+
24+
### Added
25+
- Support for Audit service
26+
- BOM module for SDK
27+
- More examples
728

829
## 1.2.0 - 2016-12-16
930
### Fixed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

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

7-
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/).
7+
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).
88

99
## Installation
1010

bmc-audit/pom.xml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>com.oracle.bmc.sdk</groupId>
7+
<artifactId>oracle-bmc-java-sdk</artifactId>
8+
<version>1.2.2</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
12+
<artifactId>oracle-bmc-java-sdk-audit</artifactId>
13+
<name>Oracle Bare Metal Cloud Services SDK - Audit</name>
14+
<description>This project contains the SDK used for Oracle Bare Metal Cloud Audit Service</description>
15+
<url>https://docs.us-phoenix-1.oraclecloud.com/Content/API/SDKDocs/javasdk.htm</url>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>com.oracle.bmc.sdk</groupId>
20+
<artifactId>oracle-bmc-java-sdk-common</artifactId>
21+
<version>1.2.2</version>
22+
</dependency>
23+
</dependencies>
24+
25+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* Copyright (c) 2016-2017 Oracle and/or its affiliates. All rights reserved.
3+
*/
4+
package com.oracle.bmc.audit;
5+
6+
import com.oracle.bmc.audit.requests.*;
7+
import com.oracle.bmc.audit.responses.*;
8+
9+
import com.oracle.bmc.*;
10+
11+
@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
12+
public interface Audit extends AutoCloseable {
13+
14+
/**
15+
* Sets the endpoint to call (ex, https://www.example.com).
16+
* @param endpoint The endpoint of the service.
17+
*/
18+
void setEndpoint(String endpoint);
19+
20+
/**
21+
* Sets the region to call (ex, Region.US_PHOENIX_1).
22+
* <p>
23+
* 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.
24+
* @param region The region of the service.
25+
*/
26+
void setRegion(Region region);
27+
28+
/**
29+
* Sets the region to call (ex, 'us-phoenix-1').
30+
* <p>
31+
* Note, this will first try to map the region ID to a known Region and call
32+
* {@link #setRegion(Region) setRegion}.
33+
* <p>
34+
* If no known Region could be determined, it will create an endpoint based on the
35+
* default endpoint format ({@link Region#formatDefaultRegionEndpoint(Service, String)}
36+
* and then call {@link #setEndpoint(String) setEndpoint}.
37+
* @param regionId The public region ID.
38+
*/
39+
void setRegion(String regionId);
40+
41+
/**
42+
* Returns all audit events for the specified compartment that were processed within the specified time range.
43+
*
44+
* @param request The request object containing the details to send
45+
* @return A response object containing details about the completed operation
46+
* @throws BmcException when an error occurs.
47+
*/
48+
ListEventsResponse listEvents(ListEventsRequest request);
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/**
2+
* Copyright (c) 2016-2017 Oracle and/or its affiliates. All rights reserved.
3+
*/
4+
package com.oracle.bmc.audit;
5+
6+
import com.oracle.bmc.responses.AsyncHandler;
7+
8+
import java.util.concurrent.Future;
9+
10+
import com.oracle.bmc.audit.requests.*;
11+
import com.oracle.bmc.audit.responses.*;
12+
13+
import com.oracle.bmc.*;
14+
15+
@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
16+
public interface AuditAsync extends AutoCloseable {
17+
18+
/**
19+
* Sets the endpoint to call (ex, https://www.example.com).
20+
* @param endpoint The endpoint of the serice.
21+
*/
22+
void setEndpoint(String endpoint);
23+
24+
/**
25+
* Sets the region to call (ex, Region.US_PHOENIX_1).
26+
* <p>
27+
* 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.
28+
* @param region The region of the service.
29+
*/
30+
void setRegion(Region region);
31+
32+
/**
33+
* Sets the region to call (ex, 'us-phoenix-1').
34+
* <p>
35+
* Note, this will first try to map the region ID to a known Region and call
36+
* {@link #setRegion(Region) setRegion}.
37+
* <p>
38+
* If no known Region could be determined, it will create an endpoint based on the
39+
* default endpoint format ({@link Region#formatDefaultRegionEndpoint(Service, String)}
40+
* and then call {@link #setEndpoint(String) setEndpoint}.
41+
* @param regionId The public region ID.
42+
*/
43+
void setRegion(String regionId);
44+
45+
/**
46+
* Returns all audit events for the specified compartment that were processed within the specified time range.
47+
*
48+
* @param request The request object containing the details to send
49+
* @param handler The request handler to invoke upon completion, may be null.
50+
* @return A Future that can be used to get the response if no AsyncHandler was
51+
* provided. Note, if you provide an AsyncHandler and use the Future, some
52+
* types of responses (like InputStream) may not be able to be read in
53+
* both places as the underlying stream may only be consumed once.
54+
*/
55+
Future<ListEventsResponse> listEvents(
56+
ListEventsRequest request, AsyncHandler<ListEventsRequest, ListEventsResponse> handler);
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
/**
2+
* Copyright (c) 2016-2017 Oracle and/or its affiliates. All rights reserved.
3+
*/
4+
package com.oracle.bmc.audit;
5+
6+
import com.oracle.bmc.ClientConfiguration;
7+
import com.oracle.bmc.auth.AuthenticationDetailsProvider;
8+
import com.oracle.bmc.http.ClientConfigurator;
9+
import com.oracle.bmc.http.internal.*;
10+
import com.oracle.bmc.responses.*;
11+
import com.oracle.bmc.util.internal.*;
12+
13+
import com.google.common.base.Function;
14+
import com.google.common.base.Optional;
15+
16+
import java.util.concurrent.Future;
17+
18+
import javax.ws.rs.client.*;
19+
import javax.ws.rs.core.*;
20+
21+
import com.oracle.bmc.audit.internal.http.*;
22+
import com.oracle.bmc.audit.requests.*;
23+
import com.oracle.bmc.audit.responses.*;
24+
25+
import com.oracle.bmc.*;
26+
27+
import lombok.AccessLevel;
28+
import lombok.Getter;
29+
import lombok.extern.slf4j.Slf4j;
30+
31+
@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
32+
@Slf4j
33+
public class AuditAsyncClient implements AuditAsync {
34+
/**
35+
* Service instance for Audit.
36+
*/
37+
public static final Service SERVICE = Services.create("AUDIT", "audit");
38+
39+
@Getter(value = AccessLevel.PACKAGE)
40+
private final RestClient client;
41+
42+
/**
43+
* Creates a new service instance using the given authentication provider.
44+
* @param authenticationProvider The authentication details provider, required.
45+
*/
46+
public AuditAsyncClient(AuthenticationDetailsProvider authenticationProvider) {
47+
this.client = newClientBuilder().build().create(SERVICE, authenticationProvider);
48+
}
49+
50+
/**
51+
* Creates a new service instance using the given authentication provider and client configuration.
52+
* @param authenticationProvider The authentication details provider, required.
53+
* @param configuration The client configuration, optional.
54+
*/
55+
public AuditAsyncClient(
56+
AuthenticationDetailsProvider authenticationProvider,
57+
ClientConfiguration configuration) {
58+
this.client =
59+
newClientBuilder().build().create(SERVICE, authenticationProvider, configuration);
60+
}
61+
62+
/**
63+
* Creates a new service instance using the given authentication provider and client configuration. Additionally,
64+
* a Consumer can be provided that will be invoked whenever a REST Client is created to allow for additional configuration/customization.
65+
* @param authenticationProvider The authentication details provider, required.
66+
* @param configuration The client configuration, optional.
67+
* @param clientConfigurator ClientConfigurator that will be invoked for additional configuration of a REST client, optional.
68+
*/
69+
public AuditAsyncClient(
70+
AuthenticationDetailsProvider authenticationProvider,
71+
ClientConfiguration configuration,
72+
ClientConfigurator clientConfigurator) {
73+
this.client =
74+
newClientBuilder()
75+
.clientConfigurator(clientConfigurator)
76+
.build()
77+
.create(SERVICE, authenticationProvider, configuration);
78+
}
79+
80+
private static RestClientFactoryBuilder newClientBuilder() {
81+
RestClientFactoryBuilder builder = RestClientFactoryBuilder.builder();
82+
83+
return builder;
84+
}
85+
86+
@Override
87+
public void setEndpoint(String endpoint) {
88+
LOG.info("Setting endpoint to {}", endpoint);
89+
client.setEndpoint(endpoint);
90+
}
91+
92+
@Override
93+
public void setRegion(Region region) {
94+
Optional<String> endpoint = region.getEndpoint(SERVICE);
95+
if (endpoint.isPresent()) {
96+
setEndpoint(endpoint.get());
97+
} else {
98+
throw new IllegalArgumentException(
99+
"Endpoint for " + SERVICE + " is not known in region " + region);
100+
}
101+
}
102+
103+
@Override
104+
public void setRegion(String regionId) {
105+
regionId = regionId.toLowerCase();
106+
try {
107+
Region region = Region.fromRegionId(regionId);
108+
setRegion(region);
109+
} catch (IllegalArgumentException e) {
110+
LOG.info("Unknown regionId '{}', falling back to default endpoint format", regionId);
111+
String endpoint = Region.formatDefaultRegionEndpoint(SERVICE, regionId);
112+
setEndpoint(endpoint);
113+
}
114+
}
115+
116+
@Override
117+
public void close() {
118+
client.close();
119+
}
120+
121+
@Override
122+
public Future<ListEventsResponse> listEvents(
123+
ListEventsRequest request,
124+
AsyncHandler<ListEventsRequest, ListEventsResponse> handler) {
125+
LOG.trace("Called async listEvents");
126+
Invocation.Builder ib = ListEventsConverter.fromRequest(client, request);
127+
Function<Response, ListEventsResponse> transformer = ListEventsConverter.fromResponse();
128+
129+
Consumer<Response> onSuccess = new SuccessConsumer<>(handler, transformer, request);
130+
Consumer<Throwable> onError = new ErrorConsumer<>(handler, request);
131+
132+
Future<Response> responseFuture = client.get(ib, request, onSuccess, onError);
133+
return new TransformingFuture<>(responseFuture, transformer);
134+
}
135+
}

0 commit comments

Comments
 (0)