From a3fe700405b0ef02f4a8960f082e70964a0b3bdd Mon Sep 17 00:00:00 2001 From: dshelbyo Date: Thu, 31 Jan 2019 17:20:56 +0000 Subject: [PATCH] Releasing version 1.3.6 --- CHANGELOG.md | 4 + .../bmc-apache-connector-provider/pom.xml | 4 +- .../bmc-resteasy-client-configurator/pom.xml | 4 +- bmc-addons/pom.xml | 2 +- bmc-announcementsservice/pom.xml | 22 + .../announcementsservice/Announcement.java | 76 +++ .../AnnouncementAsync.java | 106 +++ .../AnnouncementAsyncClient.java | 621 ++++++++++++++++++ .../AnnouncementClient.java | 410 ++++++++++++ .../http/GetAnnouncementConverter.java | 95 +++ .../GetAnnouncementUserStatusConverter.java | 101 +++ .../http/ListAnnouncementsConverter.java | 181 +++++ ...UpdateAnnouncementUserStatusConverter.java | 110 ++++ .../model/AffectedResource.java | 101 +++ .../model/Announcement.java | 320 +++++++++ .../model/AnnouncementSummary.java | 249 +++++++ .../model/AnnouncementUserStatusDetails.java | 107 +++ .../model/AnnouncementsCollection.java | 85 +++ .../model/BaseAnnouncement.java | 209 ++++++ .../model/NotificationFollowupDetails.java | 85 +++ .../requests/GetAnnouncementRequest.java | 68 ++ .../GetAnnouncementUserStatusRequest.java | 68 ++ .../requests/ListAnnouncementsRequest.java | 234 +++++++ .../UpdateAnnouncementUserStatusRequest.java | 80 +++ .../responses/GetAnnouncementResponse.java | 35 + .../GetAnnouncementUserStatusResponse.java | 35 + .../responses/ListAnnouncementsResponse.java | 41 ++ .../UpdateAnnouncementUserStatusResponse.java | 35 + bmc-audit/pom.xml | 4 +- bmc-bom/pom.xml | 40 +- bmc-common/pom.xml | 2 +- bmc-containerengine/pom.xml | 4 +- bmc-core/pom.xml | 4 +- bmc-database/pom.xml | 4 +- bmc-dns/pom.xml | 4 +- bmc-email/pom.xml | 4 +- bmc-examples/pom.xml | 8 +- .../java/AnnouncementsServiceExample.java | 132 ++++ bmc-filestorage/pom.xml | 4 +- bmc-full/pom.xml | 10 +- bmc-identity/pom.xml | 4 +- bmc-keymanagement/pom.xml | 4 +- bmc-loadbalancer/pom.xml | 4 +- .../bmc-objectstorage-combined/pom.xml | 6 +- .../bmc-objectstorage-extensions/pom.xml | 6 +- .../bmc-objectstorage-generated/pom.xml | 4 +- bmc-objectstorage/pom.xml | 2 +- bmc-resourcesearch/pom.xml | 4 +- bmc-shaded/bmc-shaded-full/pom.xml | 2 +- bmc-shaded/pom.xml | 2 +- pom.xml | 5 +- 51 files changed, 3688 insertions(+), 63 deletions(-) create mode 100644 bmc-announcementsservice/pom.xml create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/Announcement.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/AnnouncementAsync.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/AnnouncementAsyncClient.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/AnnouncementClient.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/GetAnnouncementConverter.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/GetAnnouncementUserStatusConverter.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/ListAnnouncementsConverter.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/UpdateAnnouncementUserStatusConverter.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AffectedResource.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/Announcement.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AnnouncementSummary.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AnnouncementUserStatusDetails.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AnnouncementsCollection.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/BaseAnnouncement.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/NotificationFollowupDetails.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/GetAnnouncementRequest.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/GetAnnouncementUserStatusRequest.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/ListAnnouncementsRequest.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/UpdateAnnouncementUserStatusRequest.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/GetAnnouncementResponse.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/GetAnnouncementUserStatusResponse.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/ListAnnouncementsResponse.java create mode 100644 bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/UpdateAnnouncementUserStatusResponse.java create mode 100644 bmc-examples/src/main/java/AnnouncementsServiceExample.java diff --git a/CHANGELOG.md b/CHANGELOG.md index bc1609e6e51..03ef3c7131e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). ### Added - N/A +## 1.3.6 - 2018-01-31 +### Added +- Support for the Announcements service + ## 1.3.5 - 2018-01-24 ### Added - Support for renaming databases during restore-from-backup operations in the Database service diff --git a/bmc-addons/bmc-apache-connector-provider/pom.xml b/bmc-addons/bmc-apache-connector-provider/pom.xml index f88d1f2460f..98b6233b9b4 100644 --- a/bmc-addons/bmc-apache-connector-provider/pom.xml +++ b/bmc-addons/bmc-apache-connector-provider/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk-addons - 1.3.5 + 1.3.6 ../pom.xml @@ -43,7 +43,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 diff --git a/bmc-addons/bmc-resteasy-client-configurator/pom.xml b/bmc-addons/bmc-resteasy-client-configurator/pom.xml index 26518685c9b..dffdc2a78a5 100644 --- a/bmc-addons/bmc-resteasy-client-configurator/pom.xml +++ b/bmc-addons/bmc-resteasy-client-configurator/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk-addons - 1.3.5 + 1.3.6 ../pom.xml @@ -38,7 +38,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 diff --git a/bmc-addons/pom.xml b/bmc-addons/pom.xml index 83044ad7c5f..6050941b80d 100644 --- a/bmc-addons/pom.xml +++ b/bmc-addons/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml diff --git a/bmc-announcementsservice/pom.xml b/bmc-announcementsservice/pom.xml new file mode 100644 index 00000000000..7d0899d741f --- /dev/null +++ b/bmc-announcementsservice/pom.xml @@ -0,0 +1,22 @@ + + + 4.0.0 + + com.oracle.oci.sdk + oci-java-sdk + 1.3.6 + ../pom.xml + + oci-java-sdk-announcementsservice + Oracle Cloud Infrastructure SDK - Announcements Service + This project contains the SDK used for Oracle Cloud Infrastructure Announcements Service + https://docs.us-phoenix-1.oraclecloud.com/Content/API/SDKDocs/javasdk.htm + + + + com.oracle.oci.sdk + oci-java-sdk-common + 1.3.6 + + + \ No newline at end of file diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/Announcement.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/Announcement.java new file mode 100644 index 00000000000..f9249110be8 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/Announcement.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice; + +import com.oracle.bmc.announcementsservice.requests.*; +import com.oracle.bmc.announcementsservice.responses.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +public interface Announcement 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). + *

+ * 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(com.oracle.bmc.Region region); + + /** + * Sets the region to call (ex, 'us-phoenix-1'). + *

+ * Note, this will first try to map the region ID to a known Region and call + * {@link #setRegion(Region) setRegion}. + *

+ * If no known Region could be determined, it will create an endpoint based on the + * default endpoint format ({@link com.oracle.bmc.Region#formatDefaultRegionEndpoint(Service, String)} + * and then call {@link #setEndpoint(String) setEndpoint}. + * @param regionId The public region ID. + */ + void setRegion(String regionId); + + /** + * Gets details about single `Announcement` object + * + * @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. + */ + GetAnnouncementResponse getAnnouncement(GetAnnouncementRequest request); + + /** + * Get user status of specified announcement + * + * @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. + */ + GetAnnouncementUserStatusResponse getAnnouncementUserStatus( + GetAnnouncementUserStatusRequest request); + + /** + * Gets a list of `Announcement` objects for the current tenancy + * + * @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. + */ + ListAnnouncementsResponse listAnnouncements(ListAnnouncementsRequest request); + + /** + * Update `Announcement` status with whether user has seen or supressed the announcement + * + * @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. + */ + UpdateAnnouncementUserStatusResponse updateAnnouncementUserStatus( + UpdateAnnouncementUserStatusRequest request); +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/AnnouncementAsync.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/AnnouncementAsync.java new file mode 100644 index 00000000000..6b320f0d09b --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/AnnouncementAsync.java @@ -0,0 +1,106 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice; + +import com.oracle.bmc.announcementsservice.requests.*; +import com.oracle.bmc.announcementsservice.responses.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +public interface AnnouncementAsync 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). + *

+ * 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(com.oracle.bmc.Region region); + + /** + * Sets the region to call (ex, 'us-phoenix-1'). + *

+ * Note, this will first try to map the region ID to a known Region and call + * {@link #setRegion(Region) setRegion}. + *

+ * If no known Region could be determined, it will create an endpoint based on the + * default endpoint format ({@link com.oracle.bmc.Region#formatDefaultRegionEndpoint(Service, String)} + * and then call {@link #setEndpoint(String) setEndpoint}. + * @param regionId The public region ID. + */ + void setRegion(String regionId); + + /** + * Gets details about single `Announcement` object + * + * + * @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 java.io.InputStream) may not be able to be read in + * both places as the underlying stream may only be consumed once. + */ + java.util.concurrent.Future getAnnouncement( + GetAnnouncementRequest request, + com.oracle.bmc.responses.AsyncHandler + handler); + + /** + * Get user status of specified announcement + * + * + * @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 java.io.InputStream) may not be able to be read in + * both places as the underlying stream may only be consumed once. + */ + java.util.concurrent.Future getAnnouncementUserStatus( + GetAnnouncementUserStatusRequest request, + com.oracle.bmc.responses.AsyncHandler< + GetAnnouncementUserStatusRequest, GetAnnouncementUserStatusResponse> + handler); + + /** + * Gets a list of `Announcement` objects for the current tenancy + * + * + * @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 java.io.InputStream) may not be able to be read in + * both places as the underlying stream may only be consumed once. + */ + java.util.concurrent.Future listAnnouncements( + ListAnnouncementsRequest request, + com.oracle.bmc.responses.AsyncHandler< + ListAnnouncementsRequest, ListAnnouncementsResponse> + handler); + + /** + * Update `Announcement` status with whether user has seen or supressed the announcement + * + * + * @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 java.io.InputStream) may not be able to be read in + * both places as the underlying stream may only be consumed once. + */ + java.util.concurrent.Future updateAnnouncementUserStatus( + UpdateAnnouncementUserStatusRequest request, + com.oracle.bmc.responses.AsyncHandler< + UpdateAnnouncementUserStatusRequest, + UpdateAnnouncementUserStatusResponse> + handler); +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/AnnouncementAsyncClient.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/AnnouncementAsyncClient.java new file mode 100644 index 00000000000..fd93ffead7a --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/AnnouncementAsyncClient.java @@ -0,0 +1,621 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice; + +import java.util.Locale; +import com.oracle.bmc.announcementsservice.internal.http.*; +import com.oracle.bmc.announcementsservice.requests.*; +import com.oracle.bmc.announcementsservice.responses.*; + +/** + * Async client implementation for Announcement service.
+ * There are two ways to use async client: + * 1. Use AsyncHandler: using AsyncHandler, if the response to the call is an {@link java.io.InputStream}, like + * getObject Api in object storage service, developers need to process the stream in AsyncHandler, and not anywhere else, + * because the stream will be closed right after the AsyncHandler is invoked.
+ * 2. Use Java Future: using Java Future, developers need to close the stream after they are done with the Java Future.
+ * Accessing the result should be done in a mutually exclusive manner, either through the Future or the AsyncHandler, + * but not both. If the Future is used, the caller should pass in null as the AsyncHandler. If the AsyncHandler + * is used, it is still safe to use the Future to determine whether or not the request was completed via + * Future.isDone/isCancelled.
+ * Please refer to https://github.com/oracle/oci-java-sdk/blob/master/bmc-examples/src/main/java/ResteasyClientWithObjectStorageExample.java + */ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.extern.slf4j.Slf4j +public class AnnouncementAsyncClient implements AnnouncementAsync { + /** + * Service instance for Announcement. + */ + public static final com.oracle.bmc.Service SERVICE = + com.oracle.bmc.Services.serviceBuilder() + .serviceName("ANNOUNCEMENT") + .serviceEndpointPrefix("announcements") + .build(); + + @lombok.Getter(value = lombok.AccessLevel.PACKAGE) + private final com.oracle.bmc.http.internal.RestClient client; + + private final com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider + authenticationDetailsProvider; + + /** + * Creates a new service instance using the given authentication provider. + * @param authenticationDetailsProvider The authentication details provider, required. + */ + public AnnouncementAsyncClient( + com.oracle.bmc.auth.BasicAuthenticationDetailsProvider authenticationDetailsProvider) { + this(authenticationDetailsProvider, null); + } + + /** + * Creates a new service instance using the given authentication provider and client configuration. + * @param authenticationDetailsProvider The authentication details provider, required. + * @param configuration The client configuration, optional. + */ + public AnnouncementAsyncClient( + com.oracle.bmc.auth.BasicAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration) { + this(authenticationDetailsProvider, configuration, null); + } + + /** + * 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 authenticationDetailsProvider 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 AnnouncementAsyncClient( + com.oracle.bmc.auth.BasicAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( + com.oracle.bmc.http.signing.SigningStrategy.STANDARD)); + } + + /** + * 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. + *

+ * This is an advanced constructor for clients that want to take control over how requests are signed. + * @param authenticationDetailsProvider 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. + * @param defaultRequestSignerFactory The request signer factory used to create the request signer for this service. + */ + public AnnouncementAsyncClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory defaultRequestSignerFactory) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + defaultRequestSignerFactory, + new java.util.ArrayList()); + } + + /** + * 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. + *

+ * This is an advanced constructor for clients that want to take control over how requests are signed. + * @param authenticationDetailsProvider 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. + * @param defaultRequestSignerFactory The request signer factory used to create the request signer for this service. + * @param additionalClientConfigurators Additional client configurators to be run after the primary configurator. + */ + public AnnouncementAsyncClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory defaultRequestSignerFactory, + java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + defaultRequestSignerFactory, + additionalClientConfigurators, + null); + } + + /** + * 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. + *

+ * This is an advanced constructor for clients that want to take control over how requests are signed. + * @param authenticationDetailsProvider 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. + * @param defaultRequestSignerFactory The request signer factory used to create the request signer for this service. + * @param additionalClientConfigurators Additional client configurators to be run after the primary configurator. + * @param endpoint Endpoint, or null to leave unset (note, may be overridden by {@code authenticationDetailsProvider}) + */ + public AnnouncementAsyncClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory defaultRequestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + defaultRequestSignerFactory, + com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory + .createDefaultRequestSignerFactories(), + additionalClientConfigurators, + endpoint); + } + + /** + * 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. + *

+ * This is an advanced constructor for clients that want to take control over how requests are signed. + * @param authenticationDetailsProvider 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. + * @param defaultRequestSignerFactory The request signer factory used to create the request signer for this service. + * @param signingStrategyRequestSignerFactories The request signer factories for each signing strategy used to create the request signer + * @param additionalClientConfigurators Additional client configurators to be run after the primary configurator. + * @param endpoint Endpoint, or null to leave unset (note, may be overridden by {@code authenticationDetailsProvider}) + */ + public AnnouncementAsyncClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory defaultRequestSignerFactory, + java.util.Map< + com.oracle.bmc.http.signing.SigningStrategy, + com.oracle.bmc.http.signing.RequestSignerFactory> + signingStrategyRequestSignerFactories, + java.util.List additionalClientConfigurators, + String endpoint) { + this.authenticationDetailsProvider = authenticationDetailsProvider; + com.oracle.bmc.http.internal.RestClientFactory restClientFactory = + com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() + .clientConfigurator(clientConfigurator) + .additionalClientConfigurators(additionalClientConfigurators) + .build(); + com.oracle.bmc.http.signing.RequestSigner defaultRequestSigner = + defaultRequestSignerFactory.createRequestSigner( + SERVICE, this.authenticationDetailsProvider); + java.util.Map< + com.oracle.bmc.http.signing.SigningStrategy, + com.oracle.bmc.http.signing.RequestSigner> + requestSigners = new java.util.HashMap<>(); + if (this.authenticationDetailsProvider + instanceof com.oracle.bmc.auth.BasicAuthenticationDetailsProvider) { + for (com.oracle.bmc.http.signing.SigningStrategy s : + com.oracle.bmc.http.signing.SigningStrategy.values()) { + requestSigners.put( + s, + signingStrategyRequestSignerFactories + .get(s) + .createRequestSigner(SERVICE, authenticationDetailsProvider)); + } + } + this.client = restClientFactory.create(defaultRequestSigner, requestSigners, configuration); + + if (this.authenticationDetailsProvider instanceof com.oracle.bmc.auth.RegionProvider) { + com.oracle.bmc.auth.RegionProvider provider = + (com.oracle.bmc.auth.RegionProvider) this.authenticationDetailsProvider; + + if (provider.getRegion() != null) { + this.setRegion(provider.getRegion()); + if (endpoint != null) { + LOG.info( + "Authentication details provider configured for region '{}', but endpoint specifically set to '{}'. Using endpoint setting instead of region.", + provider.getRegion(), + endpoint); + } + } + } + if (endpoint != null) { + setEndpoint(endpoint); + } + } + + /** + * Create a builder for this client. + * @return builder + */ + public static Builder builder() { + return new Builder(SERVICE); + } + + /** + * Builder class for this client. The "authenticationDetailsProvider" is required and must be passed to the + * {@link #build(AbstractAuthenticationDetailsProvider)} method. + */ + public static class Builder + extends com.oracle.bmc.common.RegionalClientBuilder { + private Builder(com.oracle.bmc.Service service) { + super(service); + requestSignerFactory = + new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( + com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + } + + /** + * Build the client. + * @param authenticationDetailsProvider authentication details provider + * @return the client + */ + public AnnouncementAsyncClient build( + @lombok.NonNull + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider + authenticationDetailsProvider) { + return new AnnouncementAsyncClient( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + additionalClientConfigurators, + endpoint); + } + } + + @Override + public void setEndpoint(String endpoint) { + LOG.info("Setting endpoint to {}", endpoint); + client.setEndpoint(endpoint); + } + + @Override + public void setRegion(com.oracle.bmc.Region region) { + com.google.common.base.Optional 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(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + setRegion(region); + } catch (IllegalArgumentException e) { + LOG.info("Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + setEndpoint(endpoint); + } + } + + @Override + public void close() { + client.close(); + } + + @Override + public java.util.concurrent.Future getAnnouncement( + final GetAnnouncementRequest request, + final com.oracle.bmc.responses.AsyncHandler< + GetAnnouncementRequest, GetAnnouncementResponse> + handler) { + LOG.trace("Called async getAnnouncement"); + final GetAnnouncementRequest interceptedRequest = + GetAnnouncementConverter.interceptRequest(request); + final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + GetAnnouncementConverter.fromRequest(client, interceptedRequest); + final com.google.common.base.Function + transformer = GetAnnouncementConverter.fromResponse(); + + com.oracle.bmc.responses.AsyncHandler + handlerToUse = handler; + if (handler != null + && this.authenticationDetailsProvider + instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) { + handlerToUse = + new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler< + GetAnnouncementRequest, GetAnnouncementResponse>( + (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) + this.authenticationDetailsProvider, + handler) { + @Override + public void retryCall() { + final com.oracle.bmc.util.internal.Consumer + onSuccess = + new com.oracle.bmc.http.internal.SuccessConsumer<>( + this, transformer, interceptedRequest); + final com.oracle.bmc.util.internal.Consumer onError = + new com.oracle.bmc.http.internal.ErrorConsumer<>( + this, interceptedRequest); + client.get(ib, interceptedRequest, onSuccess, onError); + } + }; + } + + final com.oracle.bmc.util.internal.Consumer onSuccess = + (handler == null) + ? null + : new com.oracle.bmc.http.internal.SuccessConsumer<>( + handlerToUse, transformer, interceptedRequest); + final com.oracle.bmc.util.internal.Consumer onError = + (handler == null) + ? null + : new com.oracle.bmc.http.internal.ErrorConsumer<>( + handlerToUse, interceptedRequest); + + java.util.concurrent.Future responseFuture = + client.get(ib, interceptedRequest, onSuccess, onError); + + if (this.authenticationDetailsProvider + instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) { + return new com.oracle.bmc.util.internal.RefreshAuthTokenTransformingFuture< + javax.ws.rs.core.Response, GetAnnouncementResponse>( + responseFuture, + transformer, + (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) + this.authenticationDetailsProvider, + new com.google.common.base.Supplier< + java.util.concurrent.Future>() { + @Override + public java.util.concurrent.Future get() { + return client.get(ib, interceptedRequest, onSuccess, onError); + } + }); + } else { + return new com.oracle.bmc.util.internal.TransformingFuture<>( + responseFuture, transformer); + } + } + + @Override + public java.util.concurrent.Future getAnnouncementUserStatus( + final GetAnnouncementUserStatusRequest request, + final com.oracle.bmc.responses.AsyncHandler< + GetAnnouncementUserStatusRequest, GetAnnouncementUserStatusResponse> + handler) { + LOG.trace("Called async getAnnouncementUserStatus"); + final GetAnnouncementUserStatusRequest interceptedRequest = + GetAnnouncementUserStatusConverter.interceptRequest(request); + final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + GetAnnouncementUserStatusConverter.fromRequest(client, interceptedRequest); + final com.google.common.base.Function< + javax.ws.rs.core.Response, GetAnnouncementUserStatusResponse> + transformer = GetAnnouncementUserStatusConverter.fromResponse(); + + com.oracle.bmc.responses.AsyncHandler< + GetAnnouncementUserStatusRequest, GetAnnouncementUserStatusResponse> + handlerToUse = handler; + if (handler != null + && this.authenticationDetailsProvider + instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) { + handlerToUse = + new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler< + GetAnnouncementUserStatusRequest, GetAnnouncementUserStatusResponse>( + (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) + this.authenticationDetailsProvider, + handler) { + @Override + public void retryCall() { + final com.oracle.bmc.util.internal.Consumer + onSuccess = + new com.oracle.bmc.http.internal.SuccessConsumer<>( + this, transformer, interceptedRequest); + final com.oracle.bmc.util.internal.Consumer onError = + new com.oracle.bmc.http.internal.ErrorConsumer<>( + this, interceptedRequest); + client.get(ib, interceptedRequest, onSuccess, onError); + } + }; + } + + final com.oracle.bmc.util.internal.Consumer onSuccess = + (handler == null) + ? null + : new com.oracle.bmc.http.internal.SuccessConsumer<>( + handlerToUse, transformer, interceptedRequest); + final com.oracle.bmc.util.internal.Consumer onError = + (handler == null) + ? null + : new com.oracle.bmc.http.internal.ErrorConsumer<>( + handlerToUse, interceptedRequest); + + java.util.concurrent.Future responseFuture = + client.get(ib, interceptedRequest, onSuccess, onError); + + if (this.authenticationDetailsProvider + instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) { + return new com.oracle.bmc.util.internal.RefreshAuthTokenTransformingFuture< + javax.ws.rs.core.Response, GetAnnouncementUserStatusResponse>( + responseFuture, + transformer, + (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) + this.authenticationDetailsProvider, + new com.google.common.base.Supplier< + java.util.concurrent.Future>() { + @Override + public java.util.concurrent.Future get() { + return client.get(ib, interceptedRequest, onSuccess, onError); + } + }); + } else { + return new com.oracle.bmc.util.internal.TransformingFuture<>( + responseFuture, transformer); + } + } + + @Override + public java.util.concurrent.Future listAnnouncements( + final ListAnnouncementsRequest request, + final com.oracle.bmc.responses.AsyncHandler< + ListAnnouncementsRequest, ListAnnouncementsResponse> + handler) { + LOG.trace("Called async listAnnouncements"); + final ListAnnouncementsRequest interceptedRequest = + ListAnnouncementsConverter.interceptRequest(request); + final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + ListAnnouncementsConverter.fromRequest(client, interceptedRequest); + final com.google.common.base.Function + transformer = ListAnnouncementsConverter.fromResponse(); + + com.oracle.bmc.responses.AsyncHandler + handlerToUse = handler; + if (handler != null + && this.authenticationDetailsProvider + instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) { + handlerToUse = + new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler< + ListAnnouncementsRequest, ListAnnouncementsResponse>( + (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) + this.authenticationDetailsProvider, + handler) { + @Override + public void retryCall() { + final com.oracle.bmc.util.internal.Consumer + onSuccess = + new com.oracle.bmc.http.internal.SuccessConsumer<>( + this, transformer, interceptedRequest); + final com.oracle.bmc.util.internal.Consumer onError = + new com.oracle.bmc.http.internal.ErrorConsumer<>( + this, interceptedRequest); + client.get(ib, interceptedRequest, onSuccess, onError); + } + }; + } + + final com.oracle.bmc.util.internal.Consumer onSuccess = + (handler == null) + ? null + : new com.oracle.bmc.http.internal.SuccessConsumer<>( + handlerToUse, transformer, interceptedRequest); + final com.oracle.bmc.util.internal.Consumer onError = + (handler == null) + ? null + : new com.oracle.bmc.http.internal.ErrorConsumer<>( + handlerToUse, interceptedRequest); + + java.util.concurrent.Future responseFuture = + client.get(ib, interceptedRequest, onSuccess, onError); + + if (this.authenticationDetailsProvider + instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) { + return new com.oracle.bmc.util.internal.RefreshAuthTokenTransformingFuture< + javax.ws.rs.core.Response, ListAnnouncementsResponse>( + responseFuture, + transformer, + (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) + this.authenticationDetailsProvider, + new com.google.common.base.Supplier< + java.util.concurrent.Future>() { + @Override + public java.util.concurrent.Future get() { + return client.get(ib, interceptedRequest, onSuccess, onError); + } + }); + } else { + return new com.oracle.bmc.util.internal.TransformingFuture<>( + responseFuture, transformer); + } + } + + @Override + public java.util.concurrent.Future + updateAnnouncementUserStatus( + final UpdateAnnouncementUserStatusRequest request, + final com.oracle.bmc.responses.AsyncHandler< + UpdateAnnouncementUserStatusRequest, + UpdateAnnouncementUserStatusResponse> + handler) { + LOG.trace("Called async updateAnnouncementUserStatus"); + final UpdateAnnouncementUserStatusRequest interceptedRequest = + UpdateAnnouncementUserStatusConverter.interceptRequest(request); + final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + UpdateAnnouncementUserStatusConverter.fromRequest(client, interceptedRequest); + final com.google.common.base.Function< + javax.ws.rs.core.Response, UpdateAnnouncementUserStatusResponse> + transformer = UpdateAnnouncementUserStatusConverter.fromResponse(); + + com.oracle.bmc.responses.AsyncHandler< + UpdateAnnouncementUserStatusRequest, UpdateAnnouncementUserStatusResponse> + handlerToUse = handler; + if (handler != null + && this.authenticationDetailsProvider + instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) { + handlerToUse = + new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler< + UpdateAnnouncementUserStatusRequest, + UpdateAnnouncementUserStatusResponse>( + (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) + this.authenticationDetailsProvider, + handler) { + @Override + public void retryCall() { + final com.oracle.bmc.util.internal.Consumer + onSuccess = + new com.oracle.bmc.http.internal.SuccessConsumer<>( + this, transformer, interceptedRequest); + final com.oracle.bmc.util.internal.Consumer onError = + new com.oracle.bmc.http.internal.ErrorConsumer<>( + this, interceptedRequest); + client.put( + ib, + interceptedRequest.getStatusDetails(), + interceptedRequest, + onSuccess, + onError); + } + }; + } + + final com.oracle.bmc.util.internal.Consumer onSuccess = + (handler == null) + ? null + : new com.oracle.bmc.http.internal.SuccessConsumer<>( + handlerToUse, transformer, interceptedRequest); + final com.oracle.bmc.util.internal.Consumer onError = + (handler == null) + ? null + : new com.oracle.bmc.http.internal.ErrorConsumer<>( + handlerToUse, interceptedRequest); + + java.util.concurrent.Future responseFuture = + client.put( + ib, + interceptedRequest.getStatusDetails(), + interceptedRequest, + onSuccess, + onError); + + if (this.authenticationDetailsProvider + instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) { + return new com.oracle.bmc.util.internal.RefreshAuthTokenTransformingFuture< + javax.ws.rs.core.Response, UpdateAnnouncementUserStatusResponse>( + responseFuture, + transformer, + (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) + this.authenticationDetailsProvider, + new com.google.common.base.Supplier< + java.util.concurrent.Future>() { + @Override + public java.util.concurrent.Future get() { + return client.put( + ib, + interceptedRequest.getStatusDetails(), + interceptedRequest, + onSuccess, + onError); + } + }); + } else { + return new com.oracle.bmc.util.internal.TransformingFuture<>( + responseFuture, transformer); + } + } +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/AnnouncementClient.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/AnnouncementClient.java new file mode 100644 index 00000000000..cd2cc9624f2 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/AnnouncementClient.java @@ -0,0 +1,410 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice; + +import java.util.Locale; +import com.oracle.bmc.announcementsservice.internal.http.*; +import com.oracle.bmc.announcementsservice.requests.*; +import com.oracle.bmc.announcementsservice.responses.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.extern.slf4j.Slf4j +public class AnnouncementClient implements Announcement { + /** + * Service instance for Announcement. + */ + public static final com.oracle.bmc.Service SERVICE = + com.oracle.bmc.Services.serviceBuilder() + .serviceName("ANNOUNCEMENT") + .serviceEndpointPrefix("announcements") + .build(); + // attempt twice if it's instance principals, immediately failures will try to refresh the token + private static final int MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS = 2; + + @lombok.Getter(value = lombok.AccessLevel.PACKAGE) + private final com.oracle.bmc.http.internal.RestClient client; + + private final com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider + authenticationDetailsProvider; + + /** + * Creates a new service instance using the given authentication provider. + * @param authenticationDetailsProvider The authentication details provider, required. + */ + public AnnouncementClient( + com.oracle.bmc.auth.BasicAuthenticationDetailsProvider authenticationDetailsProvider) { + this(authenticationDetailsProvider, null); + } + + /** + * Creates a new service instance using the given authentication provider and client configuration. + * @param authenticationDetailsProvider The authentication details provider, required. + * @param configuration The client configuration, optional. + */ + public AnnouncementClient( + com.oracle.bmc.auth.BasicAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration) { + this(authenticationDetailsProvider, configuration, null); + } + + /** + * 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 authenticationDetailsProvider 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 AnnouncementClient( + com.oracle.bmc.auth.BasicAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( + com.oracle.bmc.http.signing.SigningStrategy.STANDARD)); + } + + /** + * 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. + *

+ * This is an advanced constructor for clients that want to take control over how requests are signed. + * @param authenticationDetailsProvider 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. + * @param defaultRequestSignerFactory The request signer factory used to create the request signer for this service. + */ + public AnnouncementClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory defaultRequestSignerFactory) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + defaultRequestSignerFactory, + new java.util.ArrayList()); + } + + /** + * 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. + *

+ * This is an advanced constructor for clients that want to take control over how requests are signed. + * @param authenticationDetailsProvider 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. + * @param defaultRequestSignerFactory The request signer factory used to create the request signer for this service. + * @param additionalClientConfigurators Additional client configurators to be run after the primary configurator. + */ + public AnnouncementClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory defaultRequestSignerFactory, + java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + defaultRequestSignerFactory, + additionalClientConfigurators, + null); + } + + /** + * 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. + *

+ * This is an advanced constructor for clients that want to take control over how requests are signed. + * @param authenticationDetailsProvider 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. + * @param defaultRequestSignerFactory The request signer factory used to create the request signer for this service. + * @param additionalClientConfigurators Additional client configurators to be run after the primary configurator. + * @param endpoint Endpoint, or null to leave unset (note, may be overridden by {@code authenticationDetailsProvider}) + */ + public AnnouncementClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory defaultRequestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + defaultRequestSignerFactory, + com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory + .createDefaultRequestSignerFactories(), + additionalClientConfigurators, + endpoint); + } + + /** + * 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. + *

+ * This is an advanced constructor for clients that want to take control over how requests are signed. + * @param authenticationDetailsProvider 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. + * @param defaultRequestSignerFactory The request signer factory used to create the request signer for this service. + * @param signingStrategyRequestSignerFactories The request signer factories for each signing strategy used to create the request signer + * @param additionalClientConfigurators Additional client configurators to be run after the primary configurator. + * @param endpoint Endpoint, or null to leave unset (note, may be overridden by {@code authenticationDetailsProvider}) + */ + public AnnouncementClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory defaultRequestSignerFactory, + java.util.Map< + com.oracle.bmc.http.signing.SigningStrategy, + com.oracle.bmc.http.signing.RequestSignerFactory> + signingStrategyRequestSignerFactories, + java.util.List additionalClientConfigurators, + String endpoint) { + this.authenticationDetailsProvider = authenticationDetailsProvider; + com.oracle.bmc.http.internal.RestClientFactory restClientFactory = + com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() + .clientConfigurator(clientConfigurator) + .additionalClientConfigurators(additionalClientConfigurators) + .build(); + com.oracle.bmc.http.signing.RequestSigner defaultRequestSigner = + defaultRequestSignerFactory.createRequestSigner( + SERVICE, this.authenticationDetailsProvider); + java.util.Map< + com.oracle.bmc.http.signing.SigningStrategy, + com.oracle.bmc.http.signing.RequestSigner> + requestSigners = new java.util.HashMap<>(); + if (this.authenticationDetailsProvider + instanceof com.oracle.bmc.auth.BasicAuthenticationDetailsProvider) { + for (com.oracle.bmc.http.signing.SigningStrategy s : + com.oracle.bmc.http.signing.SigningStrategy.values()) { + requestSigners.put( + s, + signingStrategyRequestSignerFactories + .get(s) + .createRequestSigner(SERVICE, authenticationDetailsProvider)); + } + } + this.client = restClientFactory.create(defaultRequestSigner, requestSigners, configuration); + + if (this.authenticationDetailsProvider instanceof com.oracle.bmc.auth.RegionProvider) { + com.oracle.bmc.auth.RegionProvider provider = + (com.oracle.bmc.auth.RegionProvider) this.authenticationDetailsProvider; + + if (provider.getRegion() != null) { + this.setRegion(provider.getRegion()); + if (endpoint != null) { + LOG.info( + "Authentication details provider configured for region '{}', but endpoint specifically set to '{}'. Using endpoint setting instead of region.", + provider.getRegion(), + endpoint); + } + } + } + if (endpoint != null) { + setEndpoint(endpoint); + } + } + + /** + * Create a builder for this client. + * @return builder + */ + public static Builder builder() { + return new Builder(SERVICE); + } + + /** + * Builder class for this client. The "authenticationDetailsProvider" is required and must be passed to the + * {@link #build(AbstractAuthenticationDetailsProvider)} method. + */ + public static class Builder + extends com.oracle.bmc.common.RegionalClientBuilder { + private Builder(com.oracle.bmc.Service service) { + super(service); + requestSignerFactory = + new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( + com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + } + + /** + * Build the client. + * @param authenticationDetailsProvider authentication details provider + * @return the client + */ + public AnnouncementClient build( + @lombok.NonNull + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider + authenticationDetailsProvider) { + return new AnnouncementClient( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + signingStrategyRequestSignerFactories, + additionalClientConfigurators, + endpoint); + } + } + + @Override + public void setEndpoint(String endpoint) { + LOG.info("Setting endpoint to {}", endpoint); + client.setEndpoint(endpoint); + } + + @Override + public void setRegion(com.oracle.bmc.Region region) { + com.google.common.base.Optional 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(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + setRegion(region); + } catch (IllegalArgumentException e) { + LOG.info("Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + setEndpoint(endpoint); + } + } + + @Override + public void close() { + client.close(); + } + + @Override + public GetAnnouncementResponse getAnnouncement(GetAnnouncementRequest request) { + LOG.trace("Called getAnnouncement"); + request = GetAnnouncementConverter.interceptRequest(request); + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + GetAnnouncementConverter.fromRequest(client, request); + com.google.common.base.Function + transformer = GetAnnouncementConverter.fromResponse(); + + int attempts = 0; + while (true) { + try { + javax.ws.rs.core.Response response = client.get(ib, request); + return transformer.apply(response); + } catch (com.oracle.bmc.model.BmcException e) { + if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS + && canRetryRequestIfRefreshableAuthTokenUsed(e)) { + continue; + } else { + throw e; + } + } + } + } + + @Override + public GetAnnouncementUserStatusResponse getAnnouncementUserStatus( + GetAnnouncementUserStatusRequest request) { + LOG.trace("Called getAnnouncementUserStatus"); + request = GetAnnouncementUserStatusConverter.interceptRequest(request); + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + GetAnnouncementUserStatusConverter.fromRequest(client, request); + com.google.common.base.Function< + javax.ws.rs.core.Response, GetAnnouncementUserStatusResponse> + transformer = GetAnnouncementUserStatusConverter.fromResponse(); + + int attempts = 0; + while (true) { + try { + javax.ws.rs.core.Response response = client.get(ib, request); + return transformer.apply(response); + } catch (com.oracle.bmc.model.BmcException e) { + if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS + && canRetryRequestIfRefreshableAuthTokenUsed(e)) { + continue; + } else { + throw e; + } + } + } + } + + @Override + public ListAnnouncementsResponse listAnnouncements(ListAnnouncementsRequest request) { + LOG.trace("Called listAnnouncements"); + request = ListAnnouncementsConverter.interceptRequest(request); + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + ListAnnouncementsConverter.fromRequest(client, request); + com.google.common.base.Function + transformer = ListAnnouncementsConverter.fromResponse(); + + int attempts = 0; + while (true) { + try { + javax.ws.rs.core.Response response = client.get(ib, request); + return transformer.apply(response); + } catch (com.oracle.bmc.model.BmcException e) { + if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS + && canRetryRequestIfRefreshableAuthTokenUsed(e)) { + continue; + } else { + throw e; + } + } + } + } + + @Override + public UpdateAnnouncementUserStatusResponse updateAnnouncementUserStatus( + UpdateAnnouncementUserStatusRequest request) { + LOG.trace("Called updateAnnouncementUserStatus"); + request = UpdateAnnouncementUserStatusConverter.interceptRequest(request); + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + UpdateAnnouncementUserStatusConverter.fromRequest(client, request); + com.google.common.base.Function< + javax.ws.rs.core.Response, UpdateAnnouncementUserStatusResponse> + transformer = UpdateAnnouncementUserStatusConverter.fromResponse(); + + int attempts = 0; + while (true) { + try { + javax.ws.rs.core.Response response = + client.put(ib, request.getStatusDetails(), request); + return transformer.apply(response); + } catch (com.oracle.bmc.model.BmcException e) { + if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS + && canRetryRequestIfRefreshableAuthTokenUsed(e)) { + continue; + } else { + throw e; + } + } + } + } + + private boolean canRetryRequestIfRefreshableAuthTokenUsed(com.oracle.bmc.model.BmcException e) { + if (e.getStatusCode() == 401 + && this.authenticationDetailsProvider + instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) { + ((com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) + this.authenticationDetailsProvider) + .refresh(); + return true; + } + return false; + } +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/GetAnnouncementConverter.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/GetAnnouncementConverter.java new file mode 100644 index 00000000000..7208c7de2c6 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/GetAnnouncementConverter.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.internal.http; + +import com.oracle.bmc.announcementsservice.model.*; +import com.oracle.bmc.announcementsservice.requests.*; +import com.oracle.bmc.announcementsservice.responses.*; +import org.apache.commons.lang3.Validate; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.extern.slf4j.Slf4j +public class GetAnnouncementConverter { + private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory + RESPONSE_CONVERSION_FACTORY = + new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory(); + + public static GetAnnouncementRequest interceptRequest(GetAnnouncementRequest request) { + + return request; + } + + public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( + com.oracle.bmc.http.internal.RestClient client, GetAnnouncementRequest request) { + Validate.notNull(request, "request instance is required"); + Validate.notBlank(request.getAnnouncementId(), "announcementId must not be blank"); + + com.oracle.bmc.http.internal.WrappedWebTarget target = + client.getBaseTarget() + .path("/20180904") + .path("announcements") + .path( + com.oracle.bmc.util.internal.HttpUtils.encodePathSegment( + request.getAnnouncementId())); + + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request(); + + ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON); + + if (request.getOpcRequestId() != null) { + ib.header("opc-request-id", request.getOpcRequestId()); + } + + return ib; + } + + public static com.google.common.base.Function< + javax.ws.rs.core.Response, GetAnnouncementResponse> + fromResponse() { + final com.google.common.base.Function + transformer = + new com.google.common.base.Function< + javax.ws.rs.core.Response, GetAnnouncementResponse>() { + @Override + public GetAnnouncementResponse apply( + javax.ws.rs.core.Response rawResponse) { + LOG.trace("Transform function invoked for GetAnnouncementResponse"); + com.google.common.base.Function< + javax.ws.rs.core.Response, + com.oracle.bmc.http.internal.WithHeaders< + Announcement>> + responseFn = + RESPONSE_CONVERSION_FACTORY.create( + Announcement.class); + + com.oracle.bmc.http.internal.WithHeaders response = + responseFn.apply(rawResponse); + javax.ws.rs.core.MultivaluedMap headers = + response.getHeaders(); + + GetAnnouncementResponse.Builder builder = + GetAnnouncementResponse.builder(); + + builder.announcement(response.getItem()); + + com.google.common.base.Optional> + opcRequestIdHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "opc-request-id"); + if (opcRequestIdHeader.isPresent()) { + builder.opcRequestId( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "opc-request-id", + opcRequestIdHeader.get().get(0), + String.class)); + } + + GetAnnouncementResponse responseWrapper = builder.build(); + + return responseWrapper; + } + }; + return transformer; + } +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/GetAnnouncementUserStatusConverter.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/GetAnnouncementUserStatusConverter.java new file mode 100644 index 00000000000..265050828d2 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/GetAnnouncementUserStatusConverter.java @@ -0,0 +1,101 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.internal.http; + +import com.oracle.bmc.announcementsservice.model.*; +import com.oracle.bmc.announcementsservice.requests.*; +import com.oracle.bmc.announcementsservice.responses.*; +import org.apache.commons.lang3.Validate; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.extern.slf4j.Slf4j +public class GetAnnouncementUserStatusConverter { + private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory + RESPONSE_CONVERSION_FACTORY = + new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory(); + + public static GetAnnouncementUserStatusRequest interceptRequest( + GetAnnouncementUserStatusRequest request) { + + return request; + } + + public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( + com.oracle.bmc.http.internal.RestClient client, + GetAnnouncementUserStatusRequest request) { + Validate.notNull(request, "request instance is required"); + Validate.notBlank(request.getAnnouncementId(), "announcementId must not be blank"); + + com.oracle.bmc.http.internal.WrappedWebTarget target = + client.getBaseTarget() + .path("/20180904") + .path("announcements") + .path( + com.oracle.bmc.util.internal.HttpUtils.encodePathSegment( + request.getAnnouncementId())) + .path("userStatus"); + + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request(); + + ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON); + + if (request.getOpcRequestId() != null) { + ib.header("opc-request-id", request.getOpcRequestId()); + } + + return ib; + } + + public static com.google.common.base.Function< + javax.ws.rs.core.Response, GetAnnouncementUserStatusResponse> + fromResponse() { + final com.google.common.base.Function< + javax.ws.rs.core.Response, GetAnnouncementUserStatusResponse> + transformer = + new com.google.common.base.Function< + javax.ws.rs.core.Response, GetAnnouncementUserStatusResponse>() { + @Override + public GetAnnouncementUserStatusResponse apply( + javax.ws.rs.core.Response rawResponse) { + LOG.trace( + "Transform function invoked for GetAnnouncementUserStatusResponse"); + com.google.common.base.Function< + javax.ws.rs.core.Response, + com.oracle.bmc.http.internal.WithHeaders< + AnnouncementUserStatusDetails>> + responseFn = + RESPONSE_CONVERSION_FACTORY.create( + AnnouncementUserStatusDetails.class); + + com.oracle.bmc.http.internal.WithHeaders< + AnnouncementUserStatusDetails> + response = responseFn.apply(rawResponse); + javax.ws.rs.core.MultivaluedMap headers = + response.getHeaders(); + + GetAnnouncementUserStatusResponse.Builder builder = + GetAnnouncementUserStatusResponse.builder(); + + builder.announcementUserStatusDetails(response.getItem()); + + com.google.common.base.Optional> + opcRequestIdHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "opc-request-id"); + if (opcRequestIdHeader.isPresent()) { + builder.opcRequestId( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "opc-request-id", + opcRequestIdHeader.get().get(0), + String.class)); + } + + GetAnnouncementUserStatusResponse responseWrapper = builder.build(); + + return responseWrapper; + } + }; + return transformer; + } +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/ListAnnouncementsConverter.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/ListAnnouncementsConverter.java new file mode 100644 index 00000000000..91f9fe583de --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/ListAnnouncementsConverter.java @@ -0,0 +1,181 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.internal.http; + +import com.oracle.bmc.announcementsservice.model.*; +import com.oracle.bmc.announcementsservice.requests.*; +import com.oracle.bmc.announcementsservice.responses.*; +import org.apache.commons.lang3.Validate; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.extern.slf4j.Slf4j +public class ListAnnouncementsConverter { + private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory + RESPONSE_CONVERSION_FACTORY = + new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory(); + + public static ListAnnouncementsRequest interceptRequest(ListAnnouncementsRequest request) { + + return request; + } + + public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( + com.oracle.bmc.http.internal.RestClient client, ListAnnouncementsRequest request) { + Validate.notNull(request, "request instance is required"); + Validate.notNull(request.getCompartmentId(), "compartmentId is required"); + + com.oracle.bmc.http.internal.WrappedWebTarget target = + client.getBaseTarget().path("/20180904").path("announcements"); + + if (request.getLimit() != null) { + target = + target.queryParam( + "limit", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getLimit())); + } + + if (request.getPage() != null) { + target = + target.queryParam( + "page", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getPage())); + } + + target = + target.queryParam( + "compartmentId", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getCompartmentId())); + + if (request.getAnnouncementType() != null) { + target = + target.queryParam( + "announcementType", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getAnnouncementType())); + } + + if (request.getLifecycleState() != null) { + target = + target.queryParam( + "lifecycleState", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getLifecycleState().getValue())); + } + + if (request.getIsBanner() != null) { + target = + target.queryParam( + "isBanner", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getIsBanner())); + } + + if (request.getSortBy() != null) { + target = + target.queryParam( + "sortBy", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getSortBy().getValue())); + } + + if (request.getSortOrder() != null) { + target = + target.queryParam( + "sortOrder", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getSortOrder().getValue())); + } + + if (request.getTimeOneEarliestTime() != null) { + target = + target.queryParam( + "timeOneEarliestTime", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getTimeOneEarliestTime())); + } + + if (request.getTimeOneLatestTime() != null) { + target = + target.queryParam( + "timeOneLatestTime", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getTimeOneLatestTime())); + } + + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request(); + + ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON); + + if (request.getOpcRequestId() != null) { + ib.header("opc-request-id", request.getOpcRequestId()); + } + + return ib; + } + + public static com.google.common.base.Function< + javax.ws.rs.core.Response, ListAnnouncementsResponse> + fromResponse() { + final com.google.common.base.Function + transformer = + new com.google.common.base.Function< + javax.ws.rs.core.Response, ListAnnouncementsResponse>() { + @Override + public ListAnnouncementsResponse apply( + javax.ws.rs.core.Response rawResponse) { + LOG.trace( + "Transform function invoked for ListAnnouncementsResponse"); + com.google.common.base.Function< + javax.ws.rs.core.Response, + com.oracle.bmc.http.internal.WithHeaders< + AnnouncementsCollection>> + responseFn = + RESPONSE_CONVERSION_FACTORY.create( + AnnouncementsCollection.class); + + com.oracle.bmc.http.internal.WithHeaders + response = responseFn.apply(rawResponse); + javax.ws.rs.core.MultivaluedMap headers = + response.getHeaders(); + + ListAnnouncementsResponse.Builder builder = + ListAnnouncementsResponse.builder(); + + builder.announcementsCollection(response.getItem()); + + com.google.common.base.Optional> + opcNextPageHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "opc-next-page"); + if (opcNextPageHeader.isPresent()) { + builder.opcNextPage( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "opc-next-page", + opcNextPageHeader.get().get(0), + String.class)); + } + + com.google.common.base.Optional> + opcRequestIdHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "opc-request-id"); + if (opcRequestIdHeader.isPresent()) { + builder.opcRequestId( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "opc-request-id", + opcRequestIdHeader.get().get(0), + String.class)); + } + + ListAnnouncementsResponse responseWrapper = builder.build(); + + return responseWrapper; + } + }; + return transformer; + } +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/UpdateAnnouncementUserStatusConverter.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/UpdateAnnouncementUserStatusConverter.java new file mode 100644 index 00000000000..d74cb9c8daf --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/internal/http/UpdateAnnouncementUserStatusConverter.java @@ -0,0 +1,110 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.internal.http; + +import com.oracle.bmc.announcementsservice.model.*; +import com.oracle.bmc.announcementsservice.requests.*; +import com.oracle.bmc.announcementsservice.responses.*; +import org.apache.commons.lang3.Validate; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.extern.slf4j.Slf4j +public class UpdateAnnouncementUserStatusConverter { + private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory + RESPONSE_CONVERSION_FACTORY = + new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory(); + + public static UpdateAnnouncementUserStatusRequest interceptRequest( + UpdateAnnouncementUserStatusRequest request) { + + return request; + } + + public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( + com.oracle.bmc.http.internal.RestClient client, + UpdateAnnouncementUserStatusRequest request) { + Validate.notNull(request, "request instance is required"); + Validate.notBlank(request.getAnnouncementId(), "announcementId must not be blank"); + Validate.notNull(request.getStatusDetails(), "statusDetails is required"); + + com.oracle.bmc.http.internal.WrappedWebTarget target = + client.getBaseTarget() + .path("/20180904") + .path("announcements") + .path( + com.oracle.bmc.util.internal.HttpUtils.encodePathSegment( + request.getAnnouncementId())) + .path("userStatus"); + + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request(); + + ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON); + + if (request.getIfMatch() != null) { + ib.header("if-match", request.getIfMatch()); + } + + if (request.getOpcRequestId() != null) { + ib.header("opc-request-id", request.getOpcRequestId()); + } + + return ib; + } + + public static com.google.common.base.Function< + javax.ws.rs.core.Response, UpdateAnnouncementUserStatusResponse> + fromResponse() { + final com.google.common.base.Function< + javax.ws.rs.core.Response, UpdateAnnouncementUserStatusResponse> + transformer = + new com.google.common.base.Function< + javax.ws.rs.core.Response, UpdateAnnouncementUserStatusResponse>() { + @Override + public UpdateAnnouncementUserStatusResponse apply( + javax.ws.rs.core.Response rawResponse) { + LOG.trace( + "Transform function invoked for UpdateAnnouncementUserStatusResponse"); + com.google.common.base.Function< + javax.ws.rs.core.Response, + com.oracle.bmc.http.internal.WithHeaders> + responseFn = RESPONSE_CONVERSION_FACTORY.create(); + + com.oracle.bmc.http.internal.WithHeaders response = + responseFn.apply(rawResponse); + javax.ws.rs.core.MultivaluedMap headers = + response.getHeaders(); + + UpdateAnnouncementUserStatusResponse.Builder builder = + UpdateAnnouncementUserStatusResponse.builder(); + + com.google.common.base.Optional> + opcRequestIdHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "opc-request-id"); + if (opcRequestIdHeader.isPresent()) { + builder.opcRequestId( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "opc-request-id", + opcRequestIdHeader.get().get(0), + String.class)); + } + + com.google.common.base.Optional> etagHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "etag"); + if (etagHeader.isPresent()) { + builder.etag( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "etag", etagHeader.get().get(0), String.class)); + } + + UpdateAnnouncementUserStatusResponse responseWrapper = + builder.build(); + + return responseWrapper; + } + }; + return transformer; + } +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AffectedResource.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AffectedResource.java new file mode 100644 index 00000000000..6e45f71cebe --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AffectedResource.java @@ -0,0 +1,101 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.model; + +/** + * Descrption of a resource affected by the announcement + * + *
+ * Note: Objects should always be created or deserialized using the {@link Builder}. This model distinguishes fields + * that are {@code null} because they are unset from fields that are explicitly set to {@code null}. This is done in + * the setter methods of the {@link Builder}, which maintain a set of all explicitly set fields called + * {@link #__explicitlySet__}. The {@link #hashCode()} and {@link #equals(Object)} methods are implemented to take + * {@link #__explicitlySet__} into account. The constructor, on the other hand, does not set {@link #__explicitlySet__} + * (since the constructor cannot distinguish explicit {@code null} from unset {@code null}). + **/ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.AllArgsConstructor(onConstructor = @__({@Deprecated})) +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = AffectedResource.Builder.class) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class AffectedResource { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @com.fasterxml.jackson.annotation.JsonProperty("resourceId") + private String resourceId; + + public Builder resourceId(String resourceId) { + this.resourceId = resourceId; + this.__explicitlySet__.add("resourceId"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("resourceName") + private String resourceName; + + public Builder resourceName(String resourceName) { + this.resourceName = resourceName; + this.__explicitlySet__.add("resourceName"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("region") + private String region; + + public Builder region(String region) { + this.region = region; + this.__explicitlySet__.add("region"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public AffectedResource build() { + AffectedResource __instance__ = new AffectedResource(resourceId, resourceName, region); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(AffectedResource o) { + Builder copiedBuilder = + resourceId(o.getResourceId()) + .resourceName(o.getResourceName()) + .region(o.getRegion()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * The OCID of the resource + **/ + @com.fasterxml.jackson.annotation.JsonProperty("resourceId") + String resourceId; + + /** + * User-friendly name of the resource + **/ + @com.fasterxml.jackson.annotation.JsonProperty("resourceName") + String resourceName; + + /** + * Region where this resource belongs to + **/ + @com.fasterxml.jackson.annotation.JsonProperty("region") + String region; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/Announcement.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/Announcement.java new file mode 100644 index 00000000000..b543bbd7df2 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/Announcement.java @@ -0,0 +1,320 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.model; + +/** + * An announcement object which represents a message targetted to a specific tenant + * + *
+ * Note: Objects should always be created or deserialized using the {@link Builder}. This model distinguishes fields + * that are {@code null} because they are unset from fields that are explicitly set to {@code null}. This is done in + * the setter methods of the {@link Builder}, which maintain a set of all explicitly set fields called + * {@link #__explicitlySet__}. The {@link #hashCode()} and {@link #equals(Object)} methods are implemented to take + * {@link #__explicitlySet__} into account. The constructor, on the other hand, does not set {@link #__explicitlySet__} + * (since the constructor cannot distinguish explicit {@code null} from unset {@code null}). + **/ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = Announcement.Builder.class) +@lombok.ToString(callSuper = true) +@lombok.EqualsAndHashCode(callSuper = true) +@com.fasterxml.jackson.annotation.JsonTypeInfo( + use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, + include = com.fasterxml.jackson.annotation.JsonTypeInfo.As.PROPERTY, + property = "type" +) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class Announcement extends BaseAnnouncement { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @com.fasterxml.jackson.annotation.JsonProperty("id") + private String id; + + public Builder id(String id) { + this.id = id; + this.__explicitlySet__.add("id"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("referenceTicketNumber") + private String referenceTicketNumber; + + public Builder referenceTicketNumber(String referenceTicketNumber) { + this.referenceTicketNumber = referenceTicketNumber; + this.__explicitlySet__.add("referenceTicketNumber"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("summary") + private String summary; + + public Builder summary(String summary) { + this.summary = summary; + this.__explicitlySet__.add("summary"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("timeOneTitle") + private String timeOneTitle; + + public Builder timeOneTitle(String timeOneTitle) { + this.timeOneTitle = timeOneTitle; + this.__explicitlySet__.add("timeOneTitle"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("timeOneValue") + private java.util.Date timeOneValue; + + public Builder timeOneValue(java.util.Date timeOneValue) { + this.timeOneValue = timeOneValue; + this.__explicitlySet__.add("timeOneValue"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("timeTwoTitle") + private String timeTwoTitle; + + public Builder timeTwoTitle(String timeTwoTitle) { + this.timeTwoTitle = timeTwoTitle; + this.__explicitlySet__.add("timeTwoTitle"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("timeTwoValue") + private java.util.Date timeTwoValue; + + public Builder timeTwoValue(java.util.Date timeTwoValue) { + this.timeTwoValue = timeTwoValue; + this.__explicitlySet__.add("timeTwoValue"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("services") + private java.util.List services; + + public Builder services(java.util.List services) { + this.services = services; + this.__explicitlySet__.add("services"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("affectedRegions") + private java.util.List affectedRegions; + + public Builder affectedRegions(java.util.List affectedRegions) { + this.affectedRegions = affectedRegions; + this.__explicitlySet__.add("affectedRegions"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("announcementType") + private AnnouncementType announcementType; + + public Builder announcementType(AnnouncementType announcementType) { + this.announcementType = announcementType; + this.__explicitlySet__.add("announcementType"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("lifecycleState") + private LifecycleState lifecycleState; + + public Builder lifecycleState(LifecycleState lifecycleState) { + this.lifecycleState = lifecycleState; + this.__explicitlySet__.add("lifecycleState"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("isBanner") + private Boolean isBanner; + + public Builder isBanner(Boolean isBanner) { + this.isBanner = isBanner; + this.__explicitlySet__.add("isBanner"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("timeCreated") + private java.util.Date timeCreated; + + public Builder timeCreated(java.util.Date timeCreated) { + this.timeCreated = timeCreated; + this.__explicitlySet__.add("timeCreated"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("timeUpdated") + private java.util.Date timeUpdated; + + public Builder timeUpdated(java.util.Date timeUpdated) { + this.timeUpdated = timeUpdated; + this.__explicitlySet__.add("timeUpdated"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("description") + private String description; + + public Builder description(String description) { + this.description = description; + this.__explicitlySet__.add("description"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("additionalInformation") + private String additionalInformation; + + public Builder additionalInformation(String additionalInformation) { + this.additionalInformation = additionalInformation; + this.__explicitlySet__.add("additionalInformation"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("followups") + private java.util.List followups; + + public Builder followups(java.util.List followups) { + this.followups = followups; + this.__explicitlySet__.add("followups"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("affectedResources") + private java.util.List affectedResources; + + public Builder affectedResources(java.util.List affectedResources) { + this.affectedResources = affectedResources; + this.__explicitlySet__.add("affectedResources"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public Announcement build() { + Announcement __instance__ = + new Announcement( + id, + referenceTicketNumber, + summary, + timeOneTitle, + timeOneValue, + timeTwoTitle, + timeTwoValue, + services, + affectedRegions, + announcementType, + lifecycleState, + isBanner, + timeCreated, + timeUpdated, + description, + additionalInformation, + followups, + affectedResources); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(Announcement o) { + Builder copiedBuilder = + id(o.getId()) + .referenceTicketNumber(o.getReferenceTicketNumber()) + .summary(o.getSummary()) + .timeOneTitle(o.getTimeOneTitle()) + .timeOneValue(o.getTimeOneValue()) + .timeTwoTitle(o.getTimeTwoTitle()) + .timeTwoValue(o.getTimeTwoValue()) + .services(o.getServices()) + .affectedRegions(o.getAffectedRegions()) + .announcementType(o.getAnnouncementType()) + .lifecycleState(o.getLifecycleState()) + .isBanner(o.getIsBanner()) + .timeCreated(o.getTimeCreated()) + .timeUpdated(o.getTimeUpdated()) + .description(o.getDescription()) + .additionalInformation(o.getAdditionalInformation()) + .followups(o.getFollowups()) + .affectedResources(o.getAffectedResources()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + @Deprecated + public Announcement( + String id, + String referenceTicketNumber, + String summary, + String timeOneTitle, + java.util.Date timeOneValue, + String timeTwoTitle, + java.util.Date timeTwoValue, + java.util.List services, + java.util.List affectedRegions, + AnnouncementType announcementType, + LifecycleState lifecycleState, + Boolean isBanner, + java.util.Date timeCreated, + java.util.Date timeUpdated, + String description, + String additionalInformation, + java.util.List followups, + java.util.List affectedResources) { + super( + id, + referenceTicketNumber, + summary, + timeOneTitle, + timeOneValue, + timeTwoTitle, + timeTwoValue, + services, + affectedRegions, + announcementType, + lifecycleState, + isBanner, + timeCreated, + timeUpdated); + this.description = description; + this.additionalInformation = additionalInformation; + this.followups = followups; + this.affectedResources = affectedResources; + } + + /** + * A more detailed explanation of the notification. A markdown format input + **/ + @com.fasterxml.jackson.annotation.JsonProperty("description") + String description; + + /** + * A markdown format input that forms e.g. the FAQ section of a notification + **/ + @com.fasterxml.jackson.annotation.JsonProperty("additionalInformation") + String additionalInformation; + + @com.fasterxml.jackson.annotation.JsonProperty("followups") + java.util.List followups; + + /** + * List of resources (possibly empty) affected by this announcement + **/ + @com.fasterxml.jackson.annotation.JsonProperty("affectedResources") + java.util.List affectedResources; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AnnouncementSummary.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AnnouncementSummary.java new file mode 100644 index 00000000000..7ab4a5a7082 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AnnouncementSummary.java @@ -0,0 +1,249 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.model; + +/** + * An announcement summary object which is returned by List API + * + *
+ * Note: Objects should always be created or deserialized using the {@link Builder}. This model distinguishes fields + * that are {@code null} because they are unset from fields that are explicitly set to {@code null}. This is done in + * the setter methods of the {@link Builder}, which maintain a set of all explicitly set fields called + * {@link #__explicitlySet__}. The {@link #hashCode()} and {@link #equals(Object)} methods are implemented to take + * {@link #__explicitlySet__} into account. The constructor, on the other hand, does not set {@link #__explicitlySet__} + * (since the constructor cannot distinguish explicit {@code null} from unset {@code null}). + **/ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize( + builder = AnnouncementSummary.Builder.class +) +@lombok.ToString(callSuper = true) +@lombok.EqualsAndHashCode(callSuper = true) +@com.fasterxml.jackson.annotation.JsonTypeInfo( + use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, + include = com.fasterxml.jackson.annotation.JsonTypeInfo.As.PROPERTY, + property = "type" +) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class AnnouncementSummary extends BaseAnnouncement { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @com.fasterxml.jackson.annotation.JsonProperty("id") + private String id; + + public Builder id(String id) { + this.id = id; + this.__explicitlySet__.add("id"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("referenceTicketNumber") + private String referenceTicketNumber; + + public Builder referenceTicketNumber(String referenceTicketNumber) { + this.referenceTicketNumber = referenceTicketNumber; + this.__explicitlySet__.add("referenceTicketNumber"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("summary") + private String summary; + + public Builder summary(String summary) { + this.summary = summary; + this.__explicitlySet__.add("summary"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("timeOneTitle") + private String timeOneTitle; + + public Builder timeOneTitle(String timeOneTitle) { + this.timeOneTitle = timeOneTitle; + this.__explicitlySet__.add("timeOneTitle"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("timeOneValue") + private java.util.Date timeOneValue; + + public Builder timeOneValue(java.util.Date timeOneValue) { + this.timeOneValue = timeOneValue; + this.__explicitlySet__.add("timeOneValue"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("timeTwoTitle") + private String timeTwoTitle; + + public Builder timeTwoTitle(String timeTwoTitle) { + this.timeTwoTitle = timeTwoTitle; + this.__explicitlySet__.add("timeTwoTitle"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("timeTwoValue") + private java.util.Date timeTwoValue; + + public Builder timeTwoValue(java.util.Date timeTwoValue) { + this.timeTwoValue = timeTwoValue; + this.__explicitlySet__.add("timeTwoValue"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("services") + private java.util.List services; + + public Builder services(java.util.List services) { + this.services = services; + this.__explicitlySet__.add("services"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("affectedRegions") + private java.util.List affectedRegions; + + public Builder affectedRegions(java.util.List affectedRegions) { + this.affectedRegions = affectedRegions; + this.__explicitlySet__.add("affectedRegions"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("announcementType") + private AnnouncementType announcementType; + + public Builder announcementType(AnnouncementType announcementType) { + this.announcementType = announcementType; + this.__explicitlySet__.add("announcementType"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("lifecycleState") + private LifecycleState lifecycleState; + + public Builder lifecycleState(LifecycleState lifecycleState) { + this.lifecycleState = lifecycleState; + this.__explicitlySet__.add("lifecycleState"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("isBanner") + private Boolean isBanner; + + public Builder isBanner(Boolean isBanner) { + this.isBanner = isBanner; + this.__explicitlySet__.add("isBanner"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("timeCreated") + private java.util.Date timeCreated; + + public Builder timeCreated(java.util.Date timeCreated) { + this.timeCreated = timeCreated; + this.__explicitlySet__.add("timeCreated"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("timeUpdated") + private java.util.Date timeUpdated; + + public Builder timeUpdated(java.util.Date timeUpdated) { + this.timeUpdated = timeUpdated; + this.__explicitlySet__.add("timeUpdated"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public AnnouncementSummary build() { + AnnouncementSummary __instance__ = + new AnnouncementSummary( + id, + referenceTicketNumber, + summary, + timeOneTitle, + timeOneValue, + timeTwoTitle, + timeTwoValue, + services, + affectedRegions, + announcementType, + lifecycleState, + isBanner, + timeCreated, + timeUpdated); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(AnnouncementSummary o) { + Builder copiedBuilder = + id(o.getId()) + .referenceTicketNumber(o.getReferenceTicketNumber()) + .summary(o.getSummary()) + .timeOneTitle(o.getTimeOneTitle()) + .timeOneValue(o.getTimeOneValue()) + .timeTwoTitle(o.getTimeTwoTitle()) + .timeTwoValue(o.getTimeTwoValue()) + .services(o.getServices()) + .affectedRegions(o.getAffectedRegions()) + .announcementType(o.getAnnouncementType()) + .lifecycleState(o.getLifecycleState()) + .isBanner(o.getIsBanner()) + .timeCreated(o.getTimeCreated()) + .timeUpdated(o.getTimeUpdated()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + @Deprecated + public AnnouncementSummary( + String id, + String referenceTicketNumber, + String summary, + String timeOneTitle, + java.util.Date timeOneValue, + String timeTwoTitle, + java.util.Date timeTwoValue, + java.util.List services, + java.util.List affectedRegions, + AnnouncementType announcementType, + LifecycleState lifecycleState, + Boolean isBanner, + java.util.Date timeCreated, + java.util.Date timeUpdated) { + super( + id, + referenceTicketNumber, + summary, + timeOneTitle, + timeOneValue, + timeTwoTitle, + timeTwoValue, + services, + affectedRegions, + announcementType, + lifecycleState, + isBanner, + timeCreated, + timeUpdated); + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AnnouncementUserStatusDetails.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AnnouncementUserStatusDetails.java new file mode 100644 index 00000000000..801977a5300 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AnnouncementUserStatusDetails.java @@ -0,0 +1,107 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.model; + +/** + * An announcement status + * + *
+ * Note: Objects should always be created or deserialized using the {@link Builder}. This model distinguishes fields + * that are {@code null} because they are unset from fields that are explicitly set to {@code null}. This is done in + * the setter methods of the {@link Builder}, which maintain a set of all explicitly set fields called + * {@link #__explicitlySet__}. The {@link #hashCode()} and {@link #equals(Object)} methods are implemented to take + * {@link #__explicitlySet__} into account. The constructor, on the other hand, does not set {@link #__explicitlySet__} + * (since the constructor cannot distinguish explicit {@code null} from unset {@code null}). + **/ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.AllArgsConstructor(onConstructor = @__({@Deprecated})) +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize( + builder = AnnouncementUserStatusDetails.Builder.class +) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class AnnouncementUserStatusDetails { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @com.fasterxml.jackson.annotation.JsonProperty("userStatusAnnouncementId") + private String userStatusAnnouncementId; + + public Builder userStatusAnnouncementId(String userStatusAnnouncementId) { + this.userStatusAnnouncementId = userStatusAnnouncementId; + this.__explicitlySet__.add("userStatusAnnouncementId"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("userId") + private String userId; + + public Builder userId(String userId) { + this.userId = userId; + this.__explicitlySet__.add("userId"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("timeAcknowledged") + private java.util.Date timeAcknowledged; + + public Builder timeAcknowledged(java.util.Date timeAcknowledged) { + this.timeAcknowledged = timeAcknowledged; + this.__explicitlySet__.add("timeAcknowledged"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public AnnouncementUserStatusDetails build() { + AnnouncementUserStatusDetails __instance__ = + new AnnouncementUserStatusDetails( + userStatusAnnouncementId, userId, timeAcknowledged); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(AnnouncementUserStatusDetails o) { + Builder copiedBuilder = + userStatusAnnouncementId(o.getUserStatusAnnouncementId()) + .userId(o.getUserId()) + .timeAcknowledged(o.getTimeAcknowledged()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * The OCID of the announcement this status belongs to + **/ + @com.fasterxml.jackson.annotation.JsonProperty("userStatusAnnouncementId") + String userStatusAnnouncementId; + + /** + * The OCID of the user this status belongs to + **/ + @com.fasterxml.jackson.annotation.JsonProperty("userId") + String userId; + + /** + * The date and time the announcement was acknowledged, in the format defined by RFC3339 + * Example: `2016-07-22T17:43:01.389+0000` + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("timeAcknowledged") + java.util.Date timeAcknowledged; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AnnouncementsCollection.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AnnouncementsCollection.java new file mode 100644 index 00000000000..52308077b24 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/AnnouncementsCollection.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.model; + +/** + * Results of annoucements search. Contains both announcements, and user specific status of the announcments + * + *
+ * Note: Objects should always be created or deserialized using the {@link Builder}. This model distinguishes fields + * that are {@code null} because they are unset from fields that are explicitly set to {@code null}. This is done in + * the setter methods of the {@link Builder}, which maintain a set of all explicitly set fields called + * {@link #__explicitlySet__}. The {@link #hashCode()} and {@link #equals(Object)} methods are implemented to take + * {@link #__explicitlySet__} into account. The constructor, on the other hand, does not set {@link #__explicitlySet__} + * (since the constructor cannot distinguish explicit {@code null} from unset {@code null}). + **/ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.AllArgsConstructor(onConstructor = @__({@Deprecated})) +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize( + builder = AnnouncementsCollection.Builder.class +) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class AnnouncementsCollection { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @com.fasterxml.jackson.annotation.JsonProperty("items") + private java.util.List items; + + public Builder items(java.util.List items) { + this.items = items; + this.__explicitlySet__.add("items"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("userStatuses") + private java.util.List userStatuses; + + public Builder userStatuses(java.util.List userStatuses) { + this.userStatuses = userStatuses; + this.__explicitlySet__.add("userStatuses"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public AnnouncementsCollection build() { + AnnouncementsCollection __instance__ = new AnnouncementsCollection(items, userStatuses); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(AnnouncementsCollection o) { + Builder copiedBuilder = items(o.getItems()).userStatuses(o.getUserStatuses()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * collection of announcements + **/ + @com.fasterxml.jackson.annotation.JsonProperty("items") + java.util.List items; + + /** + * user specific status of found announcements + **/ + @com.fasterxml.jackson.annotation.JsonProperty("userStatuses") + java.util.List userStatuses; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/BaseAnnouncement.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/BaseAnnouncement.java new file mode 100644 index 00000000000..be33dc6a664 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/BaseAnnouncement.java @@ -0,0 +1,209 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.model; + +/** + * Base for announcements and incidents + *
+ * Note: Objects should always be created or deserialized using the {@link Builder}. This model distinguishes fields + * that are {@code null} because they are unset from fields that are explicitly set to {@code null}. This is done in + * the setter methods of the {@link Builder}, which maintain a set of all explicitly set fields called + * {@link #__explicitlySet__}. The {@link #hashCode()} and {@link #equals(Object)} methods are implemented to take + * {@link #__explicitlySet__} into account. The constructor, on the other hand, does not set {@link #__explicitlySet__} + * (since the constructor cannot distinguish explicit {@code null} from unset {@code null}). + **/ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.AllArgsConstructor( + onConstructor = @__({@Deprecated}), + access = lombok.AccessLevel.PROTECTED +) +@lombok.Value +@lombok.experimental.NonFinal +@com.fasterxml.jackson.annotation.JsonTypeInfo( + use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, + include = com.fasterxml.jackson.annotation.JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = BaseAnnouncement.class +) +@com.fasterxml.jackson.annotation.JsonSubTypes({ + @com.fasterxml.jackson.annotation.JsonSubTypes.Type( + value = AnnouncementSummary.class, + name = "AnnouncementSummary" + ), + @com.fasterxml.jackson.annotation.JsonSubTypes.Type( + value = Announcement.class, + name = "Announcement" + ) +}) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class BaseAnnouncement { + + /** + * The OCID of the announcement + **/ + @com.fasterxml.jackson.annotation.JsonProperty("id") + String id; + + /** + * The reference JIRA ticket number + **/ + @com.fasterxml.jackson.annotation.JsonProperty("referenceTicketNumber") + String referenceTicketNumber; + + /** + * Forms part of the email subject and/or the console representation (a banner or alike) + **/ + @com.fasterxml.jackson.annotation.JsonProperty("summary") + String summary; + + /** + * The title of the first time value, e.g. Time Started + **/ + @com.fasterxml.jackson.annotation.JsonProperty("timeOneTitle") + String timeOneTitle; + + /** + * The first time value, actual meaning depending on notification type + **/ + @com.fasterxml.jackson.annotation.JsonProperty("timeOneValue") + java.util.Date timeOneValue; + + /** + * The title of the second time value, e.g. Time Ended + **/ + @com.fasterxml.jackson.annotation.JsonProperty("timeTwoTitle") + String timeTwoTitle; + + /** + * The second time value, actual meaning depending on notification type + **/ + @com.fasterxml.jackson.annotation.JsonProperty("timeTwoValue") + java.util.Date timeTwoValue; + + /** + * Impacted services + **/ + @com.fasterxml.jackson.annotation.JsonProperty("services") + java.util.List services; + + /** + * Impacted regions + **/ + @com.fasterxml.jackson.annotation.JsonProperty("affectedRegions") + java.util.List affectedRegions; + /** + * The detailed description of an announcement + **/ + public enum AnnouncementType { + ActionRecommended("ACTION_RECOMMENDED"), + ActionRequired("ACTION_REQUIRED"), + EmergencyChange("EMERGENCY_CHANGE"), + EmergencyMaintenance("EMERGENCY_MAINTENANCE"), + EmergencyMaintenanceComplete("EMERGENCY_MAINTENANCE_COMPLETE"), + EmergencyMaintenanceExtended("EMERGENCY_MAINTENANCE_EXTENDED"), + EmergencyMaintenanceRescheduled("EMERGENCY_MAINTENANCE_RESCHEDULED"), + Information("INFORMATION"), + PlannedChange("PLANNED_CHANGE"), + PlannedChangeComplete("PLANNED_CHANGE_COMPLETE"), + PlannedChangeExtended("PLANNED_CHANGE_EXTENDED"), + PlannedChangeRescheduled("PLANNED_CHANGE_RESCHEDULED"), + ProductionEventNotification("PRODUCTION_EVENT_NOTIFICATION"), + ScheduledMaintenance("SCHEDULED_MAINTENANCE"), + ; + + private final String value; + private static java.util.Map map; + + static { + map = new java.util.HashMap<>(); + for (AnnouncementType v : AnnouncementType.values()) { + map.put(v.getValue(), v); + } + } + + AnnouncementType(String value) { + this.value = value; + } + + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { + return value; + } + + @com.fasterxml.jackson.annotation.JsonCreator + public static AnnouncementType create(String key) { + if (map.containsKey(key)) { + return map.get(key); + } + throw new RuntimeException("Invalid AnnouncementType: " + key); + } + }; + /** + * The detailed description of an announcement + **/ + @com.fasterxml.jackson.annotation.JsonProperty("announcementType") + AnnouncementType announcementType; + /** + * Lifecycle states of announcement + **/ + public enum LifecycleState { + Active("ACTIVE"), + Inactive("INACTIVE"), + ; + + private final String value; + private static java.util.Map map; + + static { + map = new java.util.HashMap<>(); + for (LifecycleState v : LifecycleState.values()) { + map.put(v.getValue(), v); + } + } + + LifecycleState(String value) { + this.value = value; + } + + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { + return value; + } + + @com.fasterxml.jackson.annotation.JsonCreator + public static LifecycleState create(String key) { + if (map.containsKey(key)) { + return map.get(key); + } + throw new RuntimeException("Invalid LifecycleState: " + key); + } + }; + /** + * Lifecycle states of announcement + **/ + @com.fasterxml.jackson.annotation.JsonProperty("lifecycleState") + LifecycleState lifecycleState; + + /** + * Show announcement as a banner + **/ + @com.fasterxml.jackson.annotation.JsonProperty("isBanner") + Boolean isBanner; + + /** + * The date and time the announcement was created, in the format defined by RFC3339 + * Example: `2016-07-22T17:43:01.389+0000` + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("timeCreated") + java.util.Date timeCreated; + + /** + * The date and time the announcement was last updated, in the format defined by RFC3339 + * Example: `2016-07-22T17:43:01.389+0000` + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("timeUpdated") + java.util.Date timeUpdated; +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/NotificationFollowupDetails.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/NotificationFollowupDetails.java new file mode 100644 index 00000000000..0bf76d4e4d8 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/model/NotificationFollowupDetails.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.model; + +/** + * Information represents a notification follow-up + *
+ * Note: Objects should always be created or deserialized using the {@link Builder}. This model distinguishes fields + * that are {@code null} because they are unset from fields that are explicitly set to {@code null}. This is done in + * the setter methods of the {@link Builder}, which maintain a set of all explicitly set fields called + * {@link #__explicitlySet__}. The {@link #hashCode()} and {@link #equals(Object)} methods are implemented to take + * {@link #__explicitlySet__} into account. The constructor, on the other hand, does not set {@link #__explicitlySet__} + * (since the constructor cannot distinguish explicit {@code null} from unset {@code null}). + **/ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.AllArgsConstructor(onConstructor = @__({@Deprecated})) +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize( + builder = NotificationFollowupDetails.Builder.class +) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class NotificationFollowupDetails { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @com.fasterxml.jackson.annotation.JsonProperty("message") + private String message; + + public Builder message(String message) { + this.message = message; + this.__explicitlySet__.add("message"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("timeCreated") + private java.util.Date timeCreated; + + public Builder timeCreated(java.util.Date timeCreated) { + this.timeCreated = timeCreated; + this.__explicitlySet__.add("timeCreated"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public NotificationFollowupDetails build() { + NotificationFollowupDetails __instance__ = + new NotificationFollowupDetails(message, timeCreated); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(NotificationFollowupDetails o) { + Builder copiedBuilder = message(o.getMessage()).timeCreated(o.getTimeCreated()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * The follow-up message, a markdown format input + **/ + @com.fasterxml.jackson.annotation.JsonProperty("message") + String message; + + /** + * When the update is made + **/ + @com.fasterxml.jackson.annotation.JsonProperty("timeCreated") + java.util.Date timeCreated; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/GetAnnouncementRequest.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/GetAnnouncementRequest.java new file mode 100644 index 00000000000..396efdf24ea --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/GetAnnouncementRequest.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.requests; + +import com.oracle.bmc.announcementsservice.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback") +@lombok.Getter +public class GetAnnouncementRequest extends com.oracle.bmc.requests.BmcRequest { + + /** + * The OCID of the announcement + */ + private String announcementId; + + /** + * Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + * a particular request, please provide the request ID. + * + */ + private String opcRequestId; + + public static class Builder { + private com.oracle.bmc.util.internal.Consumer + invocationCallback = null; + + /** + * Set the invocation callback for the request to be built. + * @param invocationCallback the invocation callback to be set for the request + * @return this builder instance + */ + public Builder invocationCallback( + com.oracle.bmc.util.internal.Consumer + invocationCallback) { + this.invocationCallback = invocationCallback; + return this; + } + + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(GetAnnouncementRequest o) { + announcementId(o.getAnnouncementId()); + opcRequestId(o.getOpcRequestId()); + invocationCallback(o.getInvocationCallback()); + return this; + } + + /** + * Build the instance of GetAnnouncementRequest as configured by this builder + * + * Note that this method takes calls to {@link Builder#invocationCallback(com.oracle.bmc.util.internal.Consumer)} into account, + * while the method {@link Builder#buildWithoutInvocationCallback} does not. + * + * This is the preferred method to build an instance. + * + * @return instance of GetAnnouncementRequest + */ + public GetAnnouncementRequest build() { + GetAnnouncementRequest request = buildWithoutInvocationCallback(); + request.setInvocationCallback(invocationCallback); + return request; + } + } +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/GetAnnouncementUserStatusRequest.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/GetAnnouncementUserStatusRequest.java new file mode 100644 index 00000000000..11add949e10 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/GetAnnouncementUserStatusRequest.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.requests; + +import com.oracle.bmc.announcementsservice.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback") +@lombok.Getter +public class GetAnnouncementUserStatusRequest extends com.oracle.bmc.requests.BmcRequest { + + /** + * The OCID of the announcement + */ + private String announcementId; + + /** + * Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + * a particular request, please provide the request ID. + * + */ + private String opcRequestId; + + public static class Builder { + private com.oracle.bmc.util.internal.Consumer + invocationCallback = null; + + /** + * Set the invocation callback for the request to be built. + * @param invocationCallback the invocation callback to be set for the request + * @return this builder instance + */ + public Builder invocationCallback( + com.oracle.bmc.util.internal.Consumer + invocationCallback) { + this.invocationCallback = invocationCallback; + return this; + } + + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(GetAnnouncementUserStatusRequest o) { + announcementId(o.getAnnouncementId()); + opcRequestId(o.getOpcRequestId()); + invocationCallback(o.getInvocationCallback()); + return this; + } + + /** + * Build the instance of GetAnnouncementUserStatusRequest as configured by this builder + * + * Note that this method takes calls to {@link Builder#invocationCallback(com.oracle.bmc.util.internal.Consumer)} into account, + * while the method {@link Builder#buildWithoutInvocationCallback} does not. + * + * This is the preferred method to build an instance. + * + * @return instance of GetAnnouncementUserStatusRequest + */ + public GetAnnouncementUserStatusRequest build() { + GetAnnouncementUserStatusRequest request = buildWithoutInvocationCallback(); + request.setInvocationCallback(invocationCallback); + return request; + } + } +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/ListAnnouncementsRequest.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/ListAnnouncementsRequest.java new file mode 100644 index 00000000000..b8f995b56ed --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/ListAnnouncementsRequest.java @@ -0,0 +1,234 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.requests; + +import com.oracle.bmc.announcementsservice.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback") +@lombok.Getter +public class ListAnnouncementsRequest extends com.oracle.bmc.requests.BmcRequest { + + /** + * OCID of the compartment where search is performed. Announcements are specific to tenancy, so this should an ID of the root compartment + */ + private String compartmentId; + + /** + * The maximum number of items to return in a paginated \"List\" call. + */ + private Integer limit; + + /** + * The value of the `opc-next-page` response header from the previous \"List\" call. + */ + private String page; + + /** + * Type of the announcements to show + */ + private String announcementType; + + /** + * Filters returned announcements basing on whether they are active now + */ + private LifecycleState lifecycleState; + + /** + * Filters returned announcements basing on whether they are active now + **/ + public enum LifecycleState { + Active("ACTIVE"), + Inactive("INACTIVE"), + ; + + private final String value; + private static java.util.Map map; + + static { + map = new java.util.HashMap<>(); + for (LifecycleState v : LifecycleState.values()) { + map.put(v.getValue(), v); + } + } + + LifecycleState(String value) { + this.value = value; + } + + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { + return value; + } + + @com.fasterxml.jackson.annotation.JsonCreator + public static LifecycleState create(String key) { + if (map.containsKey(key)) { + return map.get(key); + } + throw new RuntimeException("Invalid LifecycleState: " + key); + } + }; + + /** + * Filters returned announcements basing on whether they should be shown as a banner + */ + private Boolean isBanner; + + /** + * announcements sort order + */ + private SortBy sortBy; + + /** + * announcements sort order + **/ + public enum SortBy { + TimeOneValue("timeOneValue"), + TimeTwoValue("timeTwoValue"), + TimeCreated("timeCreated"), + ReferenceTicketNumber("referenceTicketNumber"), + Summary("summary"), + AnnouncementType("announcementType"), + ; + + private final String value; + private static java.util.Map map; + + static { + map = new java.util.HashMap<>(); + for (SortBy v : SortBy.values()) { + map.put(v.getValue(), v); + } + } + + SortBy(String value) { + this.value = value; + } + + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { + return value; + } + + @com.fasterxml.jackson.annotation.JsonCreator + public static SortBy create(String key) { + if (map.containsKey(key)) { + return map.get(key); + } + throw new RuntimeException("Invalid SortBy: " + key); + } + }; + + /** + * sort order + */ + private SortOrder sortOrder; + + /** + * sort order + **/ + public enum SortOrder { + Asc("ASC"), + Desc("DESC"), + ; + + private final String value; + private static java.util.Map map; + + static { + map = new java.util.HashMap<>(); + for (SortOrder v : SortOrder.values()) { + map.put(v.getValue(), v); + } + } + + SortOrder(String value) { + this.value = value; + } + + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { + return value; + } + + @com.fasterxml.jackson.annotation.JsonCreator + public static SortOrder create(String key) { + if (map.containsKey(key)) { + return map.get(key); + } + throw new RuntimeException("Invalid SortOrder: " + key); + } + }; + + /** + * The earliest timeOneValue to include + */ + private java.util.Date timeOneEarliestTime; + + /** + * The latest timeOneValue to include + */ + private java.util.Date timeOneLatestTime; + + /** + * Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + * a particular request, please provide the request ID. + * + */ + private String opcRequestId; + + public static class Builder { + private com.oracle.bmc.util.internal.Consumer + invocationCallback = null; + + /** + * Set the invocation callback for the request to be built. + * @param invocationCallback the invocation callback to be set for the request + * @return this builder instance + */ + public Builder invocationCallback( + com.oracle.bmc.util.internal.Consumer + invocationCallback) { + this.invocationCallback = invocationCallback; + return this; + } + + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(ListAnnouncementsRequest o) { + compartmentId(o.getCompartmentId()); + limit(o.getLimit()); + page(o.getPage()); + announcementType(o.getAnnouncementType()); + lifecycleState(o.getLifecycleState()); + isBanner(o.getIsBanner()); + sortBy(o.getSortBy()); + sortOrder(o.getSortOrder()); + timeOneEarliestTime(o.getTimeOneEarliestTime()); + timeOneLatestTime(o.getTimeOneLatestTime()); + opcRequestId(o.getOpcRequestId()); + invocationCallback(o.getInvocationCallback()); + return this; + } + + /** + * Build the instance of ListAnnouncementsRequest as configured by this builder + * + * Note that this method takes calls to {@link Builder#invocationCallback(com.oracle.bmc.util.internal.Consumer)} into account, + * while the method {@link Builder#buildWithoutInvocationCallback} does not. + * + * This is the preferred method to build an instance. + * + * @return instance of ListAnnouncementsRequest + */ + public ListAnnouncementsRequest build() { + ListAnnouncementsRequest request = buildWithoutInvocationCallback(); + request.setInvocationCallback(invocationCallback); + return request; + } + } +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/UpdateAnnouncementUserStatusRequest.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/UpdateAnnouncementUserStatusRequest.java new file mode 100644 index 00000000000..bad6a7bb8f6 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/requests/UpdateAnnouncementUserStatusRequest.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.requests; + +import com.oracle.bmc.announcementsservice.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback") +@lombok.Getter +public class UpdateAnnouncementUserStatusRequest extends com.oracle.bmc.requests.BmcRequest { + + /** + * The OCID of the announcement + */ + private String announcementId; + + /** + * Object for updating a user's status of announcement. + */ + private AnnouncementUserStatusDetails statusDetails; + + /** + * Optimistic locking version + */ + private String ifMatch; + + /** + * Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + * a particular request, please provide the request ID. + * + */ + private String opcRequestId; + + public static class Builder { + private com.oracle.bmc.util.internal.Consumer + invocationCallback = null; + + /** + * Set the invocation callback for the request to be built. + * @param invocationCallback the invocation callback to be set for the request + * @return this builder instance + */ + public Builder invocationCallback( + com.oracle.bmc.util.internal.Consumer + invocationCallback) { + this.invocationCallback = invocationCallback; + return this; + } + + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(UpdateAnnouncementUserStatusRequest o) { + announcementId(o.getAnnouncementId()); + statusDetails(o.getStatusDetails()); + ifMatch(o.getIfMatch()); + opcRequestId(o.getOpcRequestId()); + invocationCallback(o.getInvocationCallback()); + return this; + } + + /** + * Build the instance of UpdateAnnouncementUserStatusRequest as configured by this builder + * + * Note that this method takes calls to {@link Builder#invocationCallback(com.oracle.bmc.util.internal.Consumer)} into account, + * while the method {@link Builder#buildWithoutInvocationCallback} does not. + * + * This is the preferred method to build an instance. + * + * @return instance of UpdateAnnouncementUserStatusRequest + */ + public UpdateAnnouncementUserStatusRequest build() { + UpdateAnnouncementUserStatusRequest request = buildWithoutInvocationCallback(); + request.setInvocationCallback(invocationCallback); + return request; + } + } +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/GetAnnouncementResponse.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/GetAnnouncementResponse.java new file mode 100644 index 00000000000..bf23f0d3003 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/GetAnnouncementResponse.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.responses; + +import com.oracle.bmc.announcementsservice.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.Builder(builderClassName = "Builder") +@lombok.Getter +public class GetAnnouncementResponse { + + /** + * + */ + private String opcRequestId; + + /** + * The returned Announcement instance. + */ + private Announcement announcement; + + public static class Builder { + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(GetAnnouncementResponse o) { + opcRequestId(o.getOpcRequestId()); + announcement(o.getAnnouncement()); + + return this; + } + } +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/GetAnnouncementUserStatusResponse.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/GetAnnouncementUserStatusResponse.java new file mode 100644 index 00000000000..a16b4ea94a6 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/GetAnnouncementUserStatusResponse.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.responses; + +import com.oracle.bmc.announcementsservice.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.Builder(builderClassName = "Builder") +@lombok.Getter +public class GetAnnouncementUserStatusResponse { + + /** + * + */ + private String opcRequestId; + + /** + * The returned AnnouncementUserStatusDetails instance. + */ + private AnnouncementUserStatusDetails announcementUserStatusDetails; + + public static class Builder { + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(GetAnnouncementUserStatusResponse o) { + opcRequestId(o.getOpcRequestId()); + announcementUserStatusDetails(o.getAnnouncementUserStatusDetails()); + + return this; + } + } +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/ListAnnouncementsResponse.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/ListAnnouncementsResponse.java new file mode 100644 index 00000000000..0d9d509bcc1 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/ListAnnouncementsResponse.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.responses; + +import com.oracle.bmc.announcementsservice.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.Builder(builderClassName = "Builder") +@lombok.Getter +public class ListAnnouncementsResponse { + + /** + * + */ + private String opcNextPage; + + /** + * + */ + private String opcRequestId; + + /** + * The returned AnnouncementsCollection instance. + */ + private AnnouncementsCollection announcementsCollection; + + public static class Builder { + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(ListAnnouncementsResponse o) { + opcNextPage(o.getOpcNextPage()); + opcRequestId(o.getOpcRequestId()); + announcementsCollection(o.getAnnouncementsCollection()); + + return this; + } + } +} diff --git a/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/UpdateAnnouncementUserStatusResponse.java b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/UpdateAnnouncementUserStatusResponse.java new file mode 100644 index 00000000000..bb140939af5 --- /dev/null +++ b/bmc-announcementsservice/src/main/java/com/oracle/bmc/announcementsservice/responses/UpdateAnnouncementUserStatusResponse.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.announcementsservice.responses; + +import com.oracle.bmc.announcementsservice.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.1") +@lombok.Builder(builderClassName = "Builder") +@lombok.Getter +public class UpdateAnnouncementUserStatusResponse { + + /** + * + */ + private String opcRequestId; + + /** + * + */ + private String etag; + + public static class Builder { + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(UpdateAnnouncementUserStatusResponse o) { + opcRequestId(o.getOpcRequestId()); + etag(o.getEtag()); + + return this; + } + } +} diff --git a/bmc-audit/pom.xml b/bmc-audit/pom.xml index ace5c54f128..0513a985f9e 100644 --- a/bmc-audit/pom.xml +++ b/bmc-audit/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml @@ -19,7 +19,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 diff --git a/bmc-bom/pom.xml b/bmc-bom/pom.xml index d9800a1c020..453c82f2b24 100644 --- a/bmc-bom/pom.xml +++ b/bmc-bom/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml oci-java-sdk-bom @@ -19,93 +19,99 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 false com.oracle.oci.sdk oci-java-sdk-audit - 1.3.5 + 1.3.6 false com.oracle.oci.sdk oci-java-sdk-containerengine - 1.3.5 + 1.3.6 false com.oracle.oci.sdk oci-java-sdk-core - 1.3.5 + 1.3.6 false com.oracle.oci.sdk oci-java-sdk-database - 1.3.5 + 1.3.6 false com.oracle.oci.sdk oci-java-sdk-dns - 1.3.5 + 1.3.6 false com.oracle.oci.sdk oci-java-sdk-email - 1.3.5 + 1.3.6 false com.oracle.oci.sdk oci-java-sdk-filestorage - 1.3.5 + 1.3.6 false com.oracle.oci.sdk oci-java-sdk-identity - 1.3.5 + 1.3.6 false com.oracle.oci.sdk oci-java-sdk-loadbalancer - 1.3.5 + 1.3.6 false com.oracle.oci.sdk oci-java-sdk-objectstorage - 1.3.5 + 1.3.6 false com.oracle.oci.sdk oci-java-sdk-addons-resteasy-client-configurator - 1.3.5 + 1.3.6 com.oracle.oci.sdk oci-java-sdk-resourcesearch false - 1.3.5 + 1.3.6 com.oracle.oci.sdk false oci-java-sdk-addons-apache - 1.3.5 + 1.3.6 com.oracle.oci.sdk oci-java-sdk-keymanagement - 1.3.5 + 1.3.6 + false + + + com.oracle.oci.sdk + oci-java-sdk-announcementsservice + 1.3.6 false - + \ No newline at end of file diff --git a/bmc-common/pom.xml b/bmc-common/pom.xml index ca9ed2ddf03..2c061f13ffe 100644 --- a/bmc-common/pom.xml +++ b/bmc-common/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml diff --git a/bmc-containerengine/pom.xml b/bmc-containerengine/pom.xml index 2338136a8e0..3e1efedaf27 100644 --- a/bmc-containerengine/pom.xml +++ b/bmc-containerengine/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml @@ -19,7 +19,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 diff --git a/bmc-core/pom.xml b/bmc-core/pom.xml index 69bdd0e6166..d2c7db25830 100644 --- a/bmc-core/pom.xml +++ b/bmc-core/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml @@ -19,7 +19,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 diff --git a/bmc-database/pom.xml b/bmc-database/pom.xml index b7afbb02505..de8be2b31d8 100644 --- a/bmc-database/pom.xml +++ b/bmc-database/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml @@ -19,7 +19,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 diff --git a/bmc-dns/pom.xml b/bmc-dns/pom.xml index fb5e3b11a06..732f2fe2c85 100644 --- a/bmc-dns/pom.xml +++ b/bmc-dns/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml @@ -19,7 +19,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 diff --git a/bmc-email/pom.xml b/bmc-email/pom.xml index 54af1d1d8d4..50b80332499 100644 --- a/bmc-email/pom.xml +++ b/bmc-email/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 diff --git a/bmc-examples/pom.xml b/bmc-examples/pom.xml index 2a2645a7b1e..f0ead870c0d 100644 --- a/bmc-examples/pom.xml +++ b/bmc-examples/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml @@ -19,7 +19,7 @@ com.oracle.oci.sdk oci-java-sdk-bom - 1.3.5 + 1.3.6 pom import @@ -95,6 +95,10 @@ failsafe 0.9.2 + + com.oracle.oci.sdk + oci-java-sdk-announcementsservice + diff --git a/bmc-examples/src/main/java/AnnouncementsServiceExample.java b/bmc-examples/src/main/java/AnnouncementsServiceExample.java new file mode 100644 index 00000000000..a4ea7d56bb1 --- /dev/null +++ b/bmc-examples/src/main/java/AnnouncementsServiceExample.java @@ -0,0 +1,132 @@ +/** + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + */ +import com.oracle.bmc.ConfigFileReader; +import com.oracle.bmc.announcementsservice.Announcement; +import com.oracle.bmc.announcementsservice.AnnouncementClient; +import com.oracle.bmc.announcementsservice.model.AnnouncementUserStatusDetails; +import com.oracle.bmc.announcementsservice.model.BaseAnnouncement; +import com.oracle.bmc.announcementsservice.requests.GetAnnouncementRequest; +import com.oracle.bmc.announcementsservice.requests.GetAnnouncementUserStatusRequest; +import com.oracle.bmc.announcementsservice.requests.ListAnnouncementsRequest; +import com.oracle.bmc.announcementsservice.requests.UpdateAnnouncementUserStatusRequest; +import com.oracle.bmc.announcementsservice.responses.GetAnnouncementResponse; +import com.oracle.bmc.announcementsservice.responses.GetAnnouncementUserStatusResponse; +import com.oracle.bmc.announcementsservice.responses.ListAnnouncementsResponse; +import com.oracle.bmc.auth.AuthenticationDetailsProvider; +import com.oracle.bmc.auth.ConfigFileAuthenticationDetailsProvider; + +import java.util.Date; + +public class AnnouncementsServiceExample { + private static final String CONFIG_LOCATION = "~/.oci/config"; + private static final String CONFIG_PROFILE = "DEFAULT"; + + // Announcements Service doesn't expose a create api publicly, you will need to refer to an existing announcement to run the example + private static final String ANNOUNCEMENT_ID = ""; + + // The compartment id must be the tenancy id + private static final String COMPARTMENT_ID = ""; + + public static void main(String[] args) throws Exception { + + final ConfigFileReader.ConfigFile configFile = + ConfigFileReader.parse(CONFIG_LOCATION, CONFIG_PROFILE); + final AuthenticationDetailsProvider provider = + new ConfigFileAuthenticationDetailsProvider(configFile); + + Announcement client = new AnnouncementClient(provider); + + GetAnnouncementRequest getReq = + GetAnnouncementRequest.builder().announcementId(ANNOUNCEMENT_ID).build(); + GetAnnouncementResponse getResp = client.getAnnouncement(getReq); + + // List announcements + // Default page size of 100 + ListAnnouncementsRequest defaultReq = getBaseListReq().build(); + ListAnnouncementsResponse defaultResp = client.listAnnouncements(defaultReq); + + // Pagination + ListAnnouncementsRequest pageOneReq = getBaseListReq().limit(10).build(); + ListAnnouncementsResponse pageOneResp = client.listAnnouncements(pageOneReq); + ListAnnouncementsRequest pageTwoReq = + getBaseListReq().limit(10).page(pageOneResp.getOpcNextPage()).build(); + ListAnnouncementsResponse pageTwoResp = client.listAnnouncements(pageTwoReq); + + // Filter by action recommended announcement-type + ListAnnouncementsRequest typeFilterReq = + getBaseListReq() + .announcementType( + BaseAnnouncement.AnnouncementType.ActionRecommended.getValue()) + .build(); + ListAnnouncementsResponse typeFilterResp = client.listAnnouncements(typeFilterReq); + + // Filter by active lifecycle state + ListAnnouncementsRequest lifecycleFilterReq = + getBaseListReq() + .lifecycleState(ListAnnouncementsRequest.LifecycleState.Active) + .build(); + ListAnnouncementsResponse lifecycleFilterResp = + client.listAnnouncements(lifecycleFilterReq); + + // Filter by active banners + ListAnnouncementsRequest filterBannerReq = getBaseListReq().isBanner(true).build(); + ListAnnouncementsResponse filterBannerResp = client.listAnnouncements(filterBannerReq); + + // Sort by reference ticket number + ListAnnouncementsRequest sortByReq = + getBaseListReq() + .sortBy(ListAnnouncementsRequest.SortBy.ReferenceTicketNumber) + .build(); + ListAnnouncementsResponse sortByResp = client.listAnnouncements(sortByReq); + + // Sort by default order, time created, in descending order + ListAnnouncementsRequest sortOrderReq = + getBaseListReq().sortOrder(ListAnnouncementsRequest.SortOrder.Desc).build(); + ListAnnouncementsResponse sortOrderResp = client.listAnnouncements(sortOrderReq); + + // Filter time one to be at least the current time + ListAnnouncementsRequest timeOneMinReq = + getBaseListReq().timeOneEarliestTime(new Date()).build(); + ListAnnouncementsResponse timeOneMinResp = client.listAnnouncements(timeOneMinReq); + + // Filter time one to be at most the current time + ListAnnouncementsRequest timeOneMaxReq = + getBaseListReq().timeOneLatestTime(new Date()).build(); + ListAnnouncementsResponse timeOneMaxResp = client.listAnnouncements(timeOneMaxReq); + + getAnnouncementUserStatus(client, ANNOUNCEMENT_ID); + // Update user's announcement acknowledgement time to now + updateAnnouncementUserStatus(client, ANNOUNCEMENT_ID, new Date()); + getAnnouncementUserStatus(client, ANNOUNCEMENT_ID); + // Cleanup status + updateAnnouncementUserStatus(client, ANNOUNCEMENT_ID, null); + } + + private static ListAnnouncementsRequest.Builder getBaseListReq() { + return ListAnnouncementsRequest.builder().compartmentId(COMPARTMENT_ID); + } + + private static void getAnnouncementUserStatus(Announcement client, String announcementId) { + GetAnnouncementUserStatusRequest request = + GetAnnouncementUserStatusRequest.builder().announcementId(announcementId).build(); + GetAnnouncementUserStatusResponse response = client.getAnnouncementUserStatus(request); + } + + private static void updateAnnouncementUserStatus( + Announcement client, String annoucementId, Date timeAcknowledged) { + AnnouncementUserStatusDetails announcementUserStatusDetails = + AnnouncementUserStatusDetails.builder() + .userStatusAnnouncementId( + annoucementId) // The announcement id is redundantly specified here on purpose + .timeAcknowledged(timeAcknowledged) + .build(); + UpdateAnnouncementUserStatusRequest request = + UpdateAnnouncementUserStatusRequest.builder() + .announcementId(annoucementId) + .statusDetails(announcementUserStatusDetails) + .build(); + client.updateAnnouncementUserStatus(request); + // There is no response body, a 200 indicates success + } +} diff --git a/bmc-filestorage/pom.xml b/bmc-filestorage/pom.xml index 29da2d38db4..4cf2d6ed7f2 100644 --- a/bmc-filestorage/pom.xml +++ b/bmc-filestorage/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml @@ -19,7 +19,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 diff --git a/bmc-full/pom.xml b/bmc-full/pom.xml index 94d22ffdb81..acf52fa6f09 100644 --- a/bmc-full/pom.xml +++ b/bmc-full/pom.xml @@ -4,7 +4,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml oci-java-sdk-full @@ -16,7 +16,7 @@ com.oracle.oci.sdk oci-java-sdk-bom - 1.3.5 + 1.3.6 pom import @@ -75,5 +75,9 @@ com.oracle.oci.sdk oci-java-sdk-keymanagement + + com.oracle.oci.sdk + oci-java-sdk-announcementsservice + - + \ No newline at end of file diff --git a/bmc-identity/pom.xml b/bmc-identity/pom.xml index e7658bb3c78..dc549a016c3 100644 --- a/bmc-identity/pom.xml +++ b/bmc-identity/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml @@ -19,7 +19,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 diff --git a/bmc-keymanagement/pom.xml b/bmc-keymanagement/pom.xml index 093b861ed8a..ff5a26d3ce3 100644 --- a/bmc-keymanagement/pom.xml +++ b/bmc-keymanagement/pom.xml @@ -4,7 +4,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml oci-java-sdk-keymanagement @@ -17,7 +17,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 diff --git a/bmc-loadbalancer/pom.xml b/bmc-loadbalancer/pom.xml index 86f9be81772..40700b8caa9 100644 --- a/bmc-loadbalancer/pom.xml +++ b/bmc-loadbalancer/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml @@ -19,7 +19,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 diff --git a/bmc-objectstorage/bmc-objectstorage-combined/pom.xml b/bmc-objectstorage/bmc-objectstorage-combined/pom.xml index 1cd4eac7de7..c25ef17396c 100644 --- a/bmc-objectstorage/bmc-objectstorage-combined/pom.xml +++ b/bmc-objectstorage/bmc-objectstorage-combined/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk-objectstorage-parent - 1.3.5 + 1.3.6 ../pom.xml @@ -18,12 +18,12 @@ com.oracle.oci.sdk oci-java-sdk-objectstorage-generated - 1.3.5 + 1.3.6 com.oracle.oci.sdk oci-java-sdk-objectstorage-extensions - 1.3.5 + 1.3.6 diff --git a/bmc-objectstorage/bmc-objectstorage-extensions/pom.xml b/bmc-objectstorage/bmc-objectstorage-extensions/pom.xml index 8e55839853f..e2e608cd585 100644 --- a/bmc-objectstorage/bmc-objectstorage-extensions/pom.xml +++ b/bmc-objectstorage/bmc-objectstorage-extensions/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk-objectstorage-parent - 1.3.5 + 1.3.6 ../pom.xml @@ -19,12 +19,12 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 com.oracle.oci.sdk oci-java-sdk-objectstorage-generated - 1.3.5 + 1.3.6 diff --git a/bmc-objectstorage/bmc-objectstorage-generated/pom.xml b/bmc-objectstorage/bmc-objectstorage-generated/pom.xml index ab685c4130c..da823e041d7 100644 --- a/bmc-objectstorage/bmc-objectstorage-generated/pom.xml +++ b/bmc-objectstorage/bmc-objectstorage-generated/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk-objectstorage-parent - 1.3.5 + 1.3.6 ../pom.xml @@ -19,7 +19,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 diff --git a/bmc-objectstorage/pom.xml b/bmc-objectstorage/pom.xml index a5d9e21e567..f3c9a2992e2 100644 --- a/bmc-objectstorage/pom.xml +++ b/bmc-objectstorage/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml diff --git a/bmc-resourcesearch/pom.xml b/bmc-resourcesearch/pom.xml index 6bb523618c1..76d3be7882d 100644 --- a/bmc-resourcesearch/pom.xml +++ b/bmc-resourcesearch/pom.xml @@ -4,7 +4,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml oci-java-sdk-resourcesearch @@ -17,7 +17,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.3.5 + 1.3.6 diff --git a/bmc-shaded/bmc-shaded-full/pom.xml b/bmc-shaded/bmc-shaded-full/pom.xml index b858f6625da..8fc5718f940 100644 --- a/bmc-shaded/bmc-shaded-full/pom.xml +++ b/bmc-shaded/bmc-shaded-full/pom.xml @@ -4,7 +4,7 @@ com.oracle.oci.sdk oci-java-sdk-shaded - 1.3.5 + 1.3.6 ../pom.xml oci-java-sdk-shaded-full diff --git a/bmc-shaded/pom.xml b/bmc-shaded/pom.xml index 7620e8bac45..141c626e14c 100644 --- a/bmc-shaded/pom.xml +++ b/bmc-shaded/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 ../pom.xml diff --git a/pom.xml b/pom.xml index 5ef6752ad46..a63da89ec05 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.oracle.oci.sdk oci-java-sdk - 1.3.5 + 1.3.6 pom Oracle Cloud Infrastructure SDK This project contains the SDK used for Oracle Cloud Infrastructure @@ -620,7 +620,8 @@ bmc-resourcesearch bmc-addons bmc-keymanagement + bmc-announcementsservice bmc-full bmc-shaded - + \ No newline at end of file