All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.oracle.bmc.logging.LoggingManagementWaiters Maven / Gradle / Ivy

There is a newer version: 3.49.0
Show newest version
/**
 * Copyright (c) 2016, 2021, Oracle and/or its affiliates.  All rights reserved.
 * This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
 */
package com.oracle.bmc.logging;

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

/**
 * Collection of helper methods to produce {@link com.oracle.bmc.waiter.Waiter}s for different
 * resources of LoggingManagement.
 * 

* The default configuration used is defined by {@link com.oracle.bmc.waiter.Waiters.Waiters#DEFAULT_POLLING_WAITER}. */ @javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20200531") @lombok.RequiredArgsConstructor public class LoggingManagementWaiters { private final java.util.concurrent.ExecutorService executorService; private final LoggingManagement client; /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the default configuration. * * @param request the request to send * @param targetState the desired states to wait for. If multiple states are provided then the waiter will return once the resource reaches any of the provided states * @return a new {@code com.oracle.bmc.waiter.Waiter} instance */ public com.oracle.bmc.waiter.Waiter forLog( GetLogRequest request, com.oracle.bmc.logging.model.LogLifecycleState... targetStates) { org.apache.commons.lang3.Validate.notEmpty( targetStates, "At least one targetState must be provided"); org.apache.commons.lang3.Validate.noNullElements( targetStates, "Null targetState values are not permitted"); return forLog(com.oracle.bmc.waiter.Waiters.DEFAULT_POLLING_WAITER, request, targetStates); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the provided configuration. * * @param request the request to send * @param targetState the desired state to wait for * @param terminationStrategy the {@link com.oracle.bmc.waiter.TerminationStrategy} to use * @param delayStrategy the {@link com.oracle.bmc.waiter.DelayStrategy} to use * @return a new {@code com.oracle.bmc.waiter.Waiter} instance */ public com.oracle.bmc.waiter.Waiter forLog( GetLogRequest request, com.oracle.bmc.logging.model.LogLifecycleState targetState, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy) { org.apache.commons.lang3.Validate.notNull(targetState, "The targetState cannot be null"); return forLog( com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), request, targetState); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the provided configuration. * * @param request the request to send * @param terminationStrategy the {@link com.oracle.bmc.waiter.TerminationStrategy} to use * @param delayStrategy the {@link com.oracle.bmc.waiter.DelayStrategy} to use * @param targetStates the desired states to wait for. The waiter will return once the resource reaches any of the provided states * @return a new {@code Waiter} instance */ public com.oracle.bmc.waiter.Waiter forLog( GetLogRequest request, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy, com.oracle.bmc.logging.model.LogLifecycleState... targetStates) { org.apache.commons.lang3.Validate.notEmpty( targetStates, "At least one targetState must be provided"); org.apache.commons.lang3.Validate.noNullElements( targetStates, "Null targetState values are not permitted"); return forLog( com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), request, targetStates); } // Helper method to create a new Waiter for Log. private com.oracle.bmc.waiter.Waiter forLog( com.oracle.bmc.waiter.BmcGenericWaiter waiter, final GetLogRequest request, final com.oracle.bmc.logging.model.LogLifecycleState... targetStates) { final java.util.Set targetStatesSet = new java.util.HashSet<>(java.util.Arrays.asList(targetStates)); return new com.oracle.bmc.waiter.internal.SimpleWaiterImpl<>( executorService, waiter.toCallable( com.google.common.base.Suppliers.ofInstance(request), new com.google.common.base.Function() { @Override public GetLogResponse apply(GetLogRequest request) { return client.getLog(request); } }, new com.google.common.base.Predicate() { @Override public boolean apply(GetLogResponse response) { return targetStatesSet.contains( response.getLog().getLifecycleState()); } }, false), request); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the default configuration. * * @param request the request to send * @param targetState the desired states to wait for. If multiple states are provided then the waiter will return once the resource reaches any of the provided states * @return a new {@code com.oracle.bmc.waiter.Waiter} instance */ public com.oracle.bmc.waiter.Waiter forLogGroup( GetLogGroupRequest request, com.oracle.bmc.logging.model.LogGroupLifecycleState... targetStates) { org.apache.commons.lang3.Validate.notEmpty( targetStates, "At least one targetState must be provided"); org.apache.commons.lang3.Validate.noNullElements( targetStates, "Null targetState values are not permitted"); return forLogGroup( com.oracle.bmc.waiter.Waiters.DEFAULT_POLLING_WAITER, request, targetStates); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the provided configuration. * * @param request the request to send * @param targetState the desired state to wait for * @param terminationStrategy the {@link com.oracle.bmc.waiter.TerminationStrategy} to use * @param delayStrategy the {@link com.oracle.bmc.waiter.DelayStrategy} to use * @return a new {@code com.oracle.bmc.waiter.Waiter} instance */ public com.oracle.bmc.waiter.Waiter forLogGroup( GetLogGroupRequest request, com.oracle.bmc.logging.model.LogGroupLifecycleState targetState, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy) { org.apache.commons.lang3.Validate.notNull(targetState, "The targetState cannot be null"); return forLogGroup( com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), request, targetState); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the provided configuration. * * @param request the request to send * @param terminationStrategy the {@link com.oracle.bmc.waiter.TerminationStrategy} to use * @param delayStrategy the {@link com.oracle.bmc.waiter.DelayStrategy} to use * @param targetStates the desired states to wait for. The waiter will return once the resource reaches any of the provided states * @return a new {@code Waiter} instance */ public com.oracle.bmc.waiter.Waiter forLogGroup( GetLogGroupRequest request, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy, com.oracle.bmc.logging.model.LogGroupLifecycleState... targetStates) { org.apache.commons.lang3.Validate.notEmpty( targetStates, "At least one targetState must be provided"); org.apache.commons.lang3.Validate.noNullElements( targetStates, "Null targetState values are not permitted"); return forLogGroup( com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), request, targetStates); } // Helper method to create a new Waiter for LogGroup. private com.oracle.bmc.waiter.Waiter forLogGroup( com.oracle.bmc.waiter.BmcGenericWaiter waiter, final GetLogGroupRequest request, final com.oracle.bmc.logging.model.LogGroupLifecycleState... targetStates) { final java.util.Set targetStatesSet = new java.util.HashSet<>(java.util.Arrays.asList(targetStates)); return new com.oracle.bmc.waiter.internal.SimpleWaiterImpl<>( executorService, waiter.toCallable( com.google.common.base.Suppliers.ofInstance(request), new com.google.common.base.Function< GetLogGroupRequest, GetLogGroupResponse>() { @Override public GetLogGroupResponse apply(GetLogGroupRequest request) { return client.getLogGroup(request); } }, new com.google.common.base.Predicate() { @Override public boolean apply(GetLogGroupResponse response) { return targetStatesSet.contains( response.getLogGroup().getLifecycleState()); } }, false), request); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the default configuration. * * @param request the request to send * @param targetState the desired states to wait for. If multiple states are provided then the waiter will return once the resource reaches any of the provided states * @return a new {@code com.oracle.bmc.waiter.Waiter} instance */ public com.oracle.bmc.waiter.Waiter forLogSavedSearch( GetLogSavedSearchRequest request, com.oracle.bmc.logging.model.LogSavedSearchLifecycleState... targetStates) { org.apache.commons.lang3.Validate.notEmpty( targetStates, "At least one targetState must be provided"); org.apache.commons.lang3.Validate.noNullElements( targetStates, "Null targetState values are not permitted"); return forLogSavedSearch( com.oracle.bmc.waiter.Waiters.DEFAULT_POLLING_WAITER, request, targetStates); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the provided configuration. * * @param request the request to send * @param targetState the desired state to wait for * @param terminationStrategy the {@link com.oracle.bmc.waiter.TerminationStrategy} to use * @param delayStrategy the {@link com.oracle.bmc.waiter.DelayStrategy} to use * @return a new {@code com.oracle.bmc.waiter.Waiter} instance */ public com.oracle.bmc.waiter.Waiter forLogSavedSearch( GetLogSavedSearchRequest request, com.oracle.bmc.logging.model.LogSavedSearchLifecycleState targetState, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy) { org.apache.commons.lang3.Validate.notNull(targetState, "The targetState cannot be null"); return forLogSavedSearch( com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), request, targetState); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the provided configuration. * * @param request the request to send * @param terminationStrategy the {@link com.oracle.bmc.waiter.TerminationStrategy} to use * @param delayStrategy the {@link com.oracle.bmc.waiter.DelayStrategy} to use * @param targetStates the desired states to wait for. The waiter will return once the resource reaches any of the provided states * @return a new {@code Waiter} instance */ public com.oracle.bmc.waiter.Waiter forLogSavedSearch( GetLogSavedSearchRequest request, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy, com.oracle.bmc.logging.model.LogSavedSearchLifecycleState... targetStates) { org.apache.commons.lang3.Validate.notEmpty( targetStates, "At least one targetState must be provided"); org.apache.commons.lang3.Validate.noNullElements( targetStates, "Null targetState values are not permitted"); return forLogSavedSearch( com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), request, targetStates); } // Helper method to create a new Waiter for LogSavedSearch. private com.oracle.bmc.waiter.Waiter forLogSavedSearch( com.oracle.bmc.waiter.BmcGenericWaiter waiter, final GetLogSavedSearchRequest request, final com.oracle.bmc.logging.model.LogSavedSearchLifecycleState... targetStates) { final java.util.Set targetStatesSet = new java.util.HashSet<>(java.util.Arrays.asList(targetStates)); return new com.oracle.bmc.waiter.internal.SimpleWaiterImpl<>( executorService, waiter.toCallable( com.google.common.base.Suppliers.ofInstance(request), new com.google.common.base.Function< GetLogSavedSearchRequest, GetLogSavedSearchResponse>() { @Override public GetLogSavedSearchResponse apply( GetLogSavedSearchRequest request) { return client.getLogSavedSearch(request); } }, new com.google.common.base.Predicate() { @Override public boolean apply(GetLogSavedSearchResponse response) { return targetStatesSet.contains( response.getLogSavedSearch().getLifecycleState()); } }, false), request); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the default configuration. * * @param request the request to send * @param targetState the desired states to wait for. If multiple states are provided then the waiter will return once the resource reaches any of the provided states * @return a new {@code com.oracle.bmc.waiter.Waiter} instance */ public com.oracle.bmc.waiter.Waiter< GetUnifiedAgentConfigurationRequest, GetUnifiedAgentConfigurationResponse> forUnifiedAgentConfiguration( GetUnifiedAgentConfigurationRequest request, com.oracle.bmc.logging.model.LogLifecycleState... targetStates) { org.apache.commons.lang3.Validate.notEmpty( targetStates, "At least one targetState must be provided"); org.apache.commons.lang3.Validate.noNullElements( targetStates, "Null targetState values are not permitted"); return forUnifiedAgentConfiguration( com.oracle.bmc.waiter.Waiters.DEFAULT_POLLING_WAITER, request, targetStates); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the provided configuration. * * @param request the request to send * @param targetState the desired state to wait for * @param terminationStrategy the {@link com.oracle.bmc.waiter.TerminationStrategy} to use * @param delayStrategy the {@link com.oracle.bmc.waiter.DelayStrategy} to use * @return a new {@code com.oracle.bmc.waiter.Waiter} instance */ public com.oracle.bmc.waiter.Waiter< GetUnifiedAgentConfigurationRequest, GetUnifiedAgentConfigurationResponse> forUnifiedAgentConfiguration( GetUnifiedAgentConfigurationRequest request, com.oracle.bmc.logging.model.LogLifecycleState targetState, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy) { org.apache.commons.lang3.Validate.notNull(targetState, "The targetState cannot be null"); return forUnifiedAgentConfiguration( com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), request, targetState); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the provided configuration. * * @param request the request to send * @param terminationStrategy the {@link com.oracle.bmc.waiter.TerminationStrategy} to use * @param delayStrategy the {@link com.oracle.bmc.waiter.DelayStrategy} to use * @param targetStates the desired states to wait for. The waiter will return once the resource reaches any of the provided states * @return a new {@code Waiter} instance */ public com.oracle.bmc.waiter.Waiter< GetUnifiedAgentConfigurationRequest, GetUnifiedAgentConfigurationResponse> forUnifiedAgentConfiguration( GetUnifiedAgentConfigurationRequest request, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy, com.oracle.bmc.logging.model.LogLifecycleState... targetStates) { org.apache.commons.lang3.Validate.notEmpty( targetStates, "At least one targetState must be provided"); org.apache.commons.lang3.Validate.noNullElements( targetStates, "Null targetState values are not permitted"); return forUnifiedAgentConfiguration( com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), request, targetStates); } // Helper method to create a new Waiter for UnifiedAgentConfiguration. private com.oracle.bmc.waiter.Waiter< GetUnifiedAgentConfigurationRequest, GetUnifiedAgentConfigurationResponse> forUnifiedAgentConfiguration( com.oracle.bmc.waiter.BmcGenericWaiter waiter, final GetUnifiedAgentConfigurationRequest request, final com.oracle.bmc.logging.model.LogLifecycleState... targetStates) { final java.util.Set targetStatesSet = new java.util.HashSet<>(java.util.Arrays.asList(targetStates)); return new com.oracle.bmc.waiter.internal.SimpleWaiterImpl<>( executorService, waiter.toCallable( com.google.common.base.Suppliers.ofInstance(request), new com.google.common.base.Function< GetUnifiedAgentConfigurationRequest, GetUnifiedAgentConfigurationResponse>() { @Override public GetUnifiedAgentConfigurationResponse apply( GetUnifiedAgentConfigurationRequest request) { return client.getUnifiedAgentConfiguration(request); } }, new com.google.common.base.Predicate< GetUnifiedAgentConfigurationResponse>() { @Override public boolean apply(GetUnifiedAgentConfigurationResponse response) { return targetStatesSet.contains( response.getUnifiedAgentConfiguration() .getLifecycleState()); } }, false), request); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using default configuration. * * @param request the request to send * @return a new {@code Waiter} instance */ public com.oracle.bmc.waiter.Waiter forWorkRequest(GetWorkRequestRequest request) { return forWorkRequest(com.oracle.bmc.waiter.Waiters.DEFAULT_POLLING_WAITER, request); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the provided configuration. * * @param request the request to send * @param terminationStrategy the {@link com.oracle.bmc.waiter.TerminationStrategy} to use * @param delayStrategy the {@linkcom.oracle.bmc.waiter. DelayStrategy} to use * @return a new {@code com.oracle.bmc.waiter.Waiter} instance */ public com.oracle.bmc.waiter.Waiter forWorkRequest( GetWorkRequestRequest request, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy) { return forWorkRequest( com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), request); } // Helper method to create a new Waiter for WorkRequest. private com.oracle.bmc.waiter.Waiter forWorkRequest( com.oracle.bmc.waiter.BmcGenericWaiter waiter, final GetWorkRequestRequest request) { return new com.oracle.bmc.waiter.internal.SimpleWaiterImpl<>( executorService, waiter.toCallable( com.google.common.base.Suppliers.ofInstance(request), new com.google.common.base.Function< GetWorkRequestRequest, GetWorkRequestResponse>() { @Override public GetWorkRequestResponse apply(GetWorkRequestRequest request) { return client.getWorkRequest(request); } }, new com.google.common.base.Predicate() { @Override public boolean apply(GetWorkRequestResponse response) { // work requests are complete once the time finished is available return response.getWorkRequest().getTimeFinished() != null; } }, false), request); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy