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

com.oracle.bmc.cloudmigrations.MigrationWaiters Maven / Gradle / Ivy

Go to download

This project contains the SDK distribution used for Oracle Cloud Infrastructure, and all the dependencies that can be shaded. It also has Maven dependencies that cannot be shaded. Therefore, use this module to depend on the shaded distribution via Maven -- it will shade everything that can be shaded, and automatically pull in the other dependencies.

There is a newer version: 3.55.2
Show newest version
/**
 * Copyright (c) 2016, 2024, 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.cloudmigrations;

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

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

The default configuration used is defined by {@link * com.oracle.bmc.waiter.Waiters.Waiters#DEFAULT_POLLING_WAITER}. */ @jakarta.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20220919") public class MigrationWaiters { private final java.util.concurrent.ExecutorService executorService; private final Migration client; public MigrationWaiters( java.util.concurrent.ExecutorService executorService, Migration client) { this.executorService = executorService; this.client = client; } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the default configuration. * * @param request the request to send * @param targetStates 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 Waiter} instance */ public com.oracle.bmc.waiter.Waiter forMigration( GetMigrationRequest request, com.oracle.bmc.cloudmigrations.model.Migration.LifecycleState... targetStates) { com.oracle.bmc.util.internal.Validate.notEmpty( targetStates, "At least one targetState must be provided"); com.oracle.bmc.util.internal.Validate.noNullElements( targetStates, "Null targetState values are not permitted"); return forMigration( 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 forMigration( GetMigrationRequest request, com.oracle.bmc.cloudmigrations.model.Migration.LifecycleState targetState, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy) { com.oracle.bmc.util.internal.Validate.notNull( targetState, "The targetState cannot be null"); return forMigration( 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 com.oracle.bmc.waiter.Waiter} instance */ public com.oracle.bmc.waiter.Waiter forMigration( GetMigrationRequest request, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy, com.oracle.bmc.cloudmigrations.model.Migration.LifecycleState... targetStates) { com.oracle.bmc.util.internal.Validate.notEmpty( targetStates, "At least one target state must be provided"); com.oracle.bmc.util.internal.Validate.noNullElements( targetStates, "Null target states are not permitted"); return forMigration( com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), request, targetStates); } // Helper method to create a new Waiter for Migration. private com.oracle.bmc.waiter.Waiter forMigration( com.oracle.bmc.waiter.BmcGenericWaiter waiter, final GetMigrationRequest request, final com.oracle.bmc.cloudmigrations.model.Migration.LifecycleState... 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( () -> request, new java.util.function.Function< GetMigrationRequest, GetMigrationResponse>() { @Override public GetMigrationResponse apply(GetMigrationRequest request) { return client.getMigration(request); } }, new java.util.function.Predicate() { @Override public boolean test(GetMigrationResponse response) { return targetStatesSet.contains( response.getMigration().getLifecycleState()); } }, targetStatesSet.contains( com.oracle.bmc.cloudmigrations.model.Migration.LifecycleState .Deleted)), request); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the default configuration. * * @param request the request to send * @param targetStates 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 Waiter} instance */ public com.oracle.bmc.waiter.Waiter forMigrationAsset( GetMigrationAssetRequest request, com.oracle.bmc.cloudmigrations.model.MigrationAsset.LifecycleState... targetStates) { com.oracle.bmc.util.internal.Validate.notEmpty( targetStates, "At least one targetState must be provided"); com.oracle.bmc.util.internal.Validate.noNullElements( targetStates, "Null targetState values are not permitted"); return forMigrationAsset( 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 forMigrationAsset( GetMigrationAssetRequest request, com.oracle.bmc.cloudmigrations.model.MigrationAsset.LifecycleState targetState, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy) { com.oracle.bmc.util.internal.Validate.notNull( targetState, "The targetState cannot be null"); return forMigrationAsset( 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 com.oracle.bmc.waiter.Waiter} instance */ public com.oracle.bmc.waiter.Waiter forMigrationAsset( GetMigrationAssetRequest request, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy, com.oracle.bmc.cloudmigrations.model.MigrationAsset.LifecycleState... targetStates) { com.oracle.bmc.util.internal.Validate.notEmpty( targetStates, "At least one target state must be provided"); com.oracle.bmc.util.internal.Validate.noNullElements( targetStates, "Null target states are not permitted"); return forMigrationAsset( com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), request, targetStates); } // Helper method to create a new Waiter for MigrationAsset. private com.oracle.bmc.waiter.Waiter forMigrationAsset( com.oracle.bmc.waiter.BmcGenericWaiter waiter, final GetMigrationAssetRequest request, final com.oracle.bmc.cloudmigrations.model.MigrationAsset.LifecycleState... 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( () -> request, new java.util.function.Function< GetMigrationAssetRequest, GetMigrationAssetResponse>() { @Override public GetMigrationAssetResponse apply( GetMigrationAssetRequest request) { return client.getMigrationAsset(request); } }, new java.util.function.Predicate() { @Override public boolean test(GetMigrationAssetResponse response) { return targetStatesSet.contains( response.getMigrationAsset().getLifecycleState()); } }, targetStatesSet.contains( com.oracle.bmc.cloudmigrations.model.MigrationAsset.LifecycleState .Deleted)), request); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the default configuration. * * @param request the request to send * @param targetStates 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 Waiter} instance */ public com.oracle.bmc.waiter.Waiter forMigrationPlan( GetMigrationPlanRequest request, com.oracle.bmc.cloudmigrations.model.MigrationPlan.LifecycleState... targetStates) { com.oracle.bmc.util.internal.Validate.notEmpty( targetStates, "At least one targetState must be provided"); com.oracle.bmc.util.internal.Validate.noNullElements( targetStates, "Null targetState values are not permitted"); return forMigrationPlan( 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 forMigrationPlan( GetMigrationPlanRequest request, com.oracle.bmc.cloudmigrations.model.MigrationPlan.LifecycleState targetState, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy) { com.oracle.bmc.util.internal.Validate.notNull( targetState, "The targetState cannot be null"); return forMigrationPlan( 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 com.oracle.bmc.waiter.Waiter} instance */ public com.oracle.bmc.waiter.Waiter forMigrationPlan( GetMigrationPlanRequest request, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy, com.oracle.bmc.cloudmigrations.model.MigrationPlan.LifecycleState... targetStates) { com.oracle.bmc.util.internal.Validate.notEmpty( targetStates, "At least one target state must be provided"); com.oracle.bmc.util.internal.Validate.noNullElements( targetStates, "Null target states are not permitted"); return forMigrationPlan( com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), request, targetStates); } // Helper method to create a new Waiter for MigrationPlan. private com.oracle.bmc.waiter.Waiter forMigrationPlan( com.oracle.bmc.waiter.BmcGenericWaiter waiter, final GetMigrationPlanRequest request, final com.oracle.bmc.cloudmigrations.model.MigrationPlan.LifecycleState... 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( () -> request, new java.util.function.Function< GetMigrationPlanRequest, GetMigrationPlanResponse>() { @Override public GetMigrationPlanResponse apply(GetMigrationPlanRequest request) { return client.getMigrationPlan(request); } }, new java.util.function.Predicate() { @Override public boolean test(GetMigrationPlanResponse response) { return targetStatesSet.contains( response.getMigrationPlan().getLifecycleState()); } }, targetStatesSet.contains( com.oracle.bmc.cloudmigrations.model.MigrationPlan.LifecycleState .Deleted)), request); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the default configuration. * * @param request the request to send * @param targetStates 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 Waiter} instance */ public com.oracle.bmc.waiter.Waiter< GetReplicationScheduleRequest, GetReplicationScheduleResponse> forReplicationSchedule( GetReplicationScheduleRequest request, com.oracle.bmc.cloudmigrations.model.ReplicationSchedule.LifecycleState... targetStates) { com.oracle.bmc.util.internal.Validate.notEmpty( targetStates, "At least one targetState must be provided"); com.oracle.bmc.util.internal.Validate.noNullElements( targetStates, "Null targetState values are not permitted"); return forReplicationSchedule( 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< GetReplicationScheduleRequest, GetReplicationScheduleResponse> forReplicationSchedule( GetReplicationScheduleRequest request, com.oracle.bmc.cloudmigrations.model.ReplicationSchedule.LifecycleState targetState, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy) { com.oracle.bmc.util.internal.Validate.notNull( targetState, "The targetState cannot be null"); return forReplicationSchedule( 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 com.oracle.bmc.waiter.Waiter} instance */ public com.oracle.bmc.waiter.Waiter< GetReplicationScheduleRequest, GetReplicationScheduleResponse> forReplicationSchedule( GetReplicationScheduleRequest request, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy, com.oracle.bmc.cloudmigrations.model.ReplicationSchedule.LifecycleState... targetStates) { com.oracle.bmc.util.internal.Validate.notEmpty( targetStates, "At least one target state must be provided"); com.oracle.bmc.util.internal.Validate.noNullElements( targetStates, "Null target states are not permitted"); return forReplicationSchedule( com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), request, targetStates); } // Helper method to create a new Waiter for ReplicationSchedule. private com.oracle.bmc.waiter.Waiter< GetReplicationScheduleRequest, GetReplicationScheduleResponse> forReplicationSchedule( com.oracle.bmc.waiter.BmcGenericWaiter waiter, final GetReplicationScheduleRequest request, final com.oracle.bmc.cloudmigrations.model.ReplicationSchedule.LifecycleState... 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( () -> request, new java.util.function.Function< GetReplicationScheduleRequest, GetReplicationScheduleResponse>() { @Override public GetReplicationScheduleResponse apply( GetReplicationScheduleRequest request) { return client.getReplicationSchedule(request); } }, new java.util.function.Predicate() { @Override public boolean test(GetReplicationScheduleResponse response) { return targetStatesSet.contains( response.getReplicationSchedule().getLifecycleState()); } }, targetStatesSet.contains( com.oracle.bmc.cloudmigrations.model.ReplicationSchedule .LifecycleState.Deleted)), request); } /** * Creates a new {@link com.oracle.bmc.waiter.Waiter} using the default configuration. * * @param request the request to send * @param targetStates 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 Waiter} instance */ public com.oracle.bmc.waiter.Waiter forTargetAsset( GetTargetAssetRequest request, com.oracle.bmc.cloudmigrations.model.TargetAsset.LifecycleState... targetStates) { com.oracle.bmc.util.internal.Validate.notEmpty( targetStates, "At least one targetState must be provided"); com.oracle.bmc.util.internal.Validate.noNullElements( targetStates, "Null targetState values are not permitted"); return forTargetAsset( 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 forTargetAsset( GetTargetAssetRequest request, com.oracle.bmc.cloudmigrations.model.TargetAsset.LifecycleState targetState, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy) { com.oracle.bmc.util.internal.Validate.notNull( targetState, "The targetState cannot be null"); return forTargetAsset( 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 com.oracle.bmc.waiter.Waiter} instance */ public com.oracle.bmc.waiter.Waiter forTargetAsset( GetTargetAssetRequest request, com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, com.oracle.bmc.waiter.DelayStrategy delayStrategy, com.oracle.bmc.cloudmigrations.model.TargetAsset.LifecycleState... targetStates) { com.oracle.bmc.util.internal.Validate.notEmpty( targetStates, "At least one target state must be provided"); com.oracle.bmc.util.internal.Validate.noNullElements( targetStates, "Null target states are not permitted"); return forTargetAsset( com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), request, targetStates); } // Helper method to create a new Waiter for TargetAsset. private com.oracle.bmc.waiter.Waiter forTargetAsset( com.oracle.bmc.waiter.BmcGenericWaiter waiter, final GetTargetAssetRequest request, final com.oracle.bmc.cloudmigrations.model.TargetAsset.LifecycleState... 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( () -> request, new java.util.function.Function< GetTargetAssetRequest, GetTargetAssetResponse>() { @Override public GetTargetAssetResponse apply(GetTargetAssetRequest request) { return client.getTargetAsset(request); } }, new java.util.function.Predicate() { @Override public boolean test(GetTargetAssetResponse response) { return targetStatesSet.contains( response.getTargetAsset().getLifecycleState()); } }, targetStatesSet.contains( com.oracle.bmc.cloudmigrations.model.TargetAsset.LifecycleState .Deleted)), 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( () -> request, new java.util.function.Function< GetWorkRequestRequest, GetWorkRequestResponse>() { @Override public GetWorkRequestResponse apply(GetWorkRequestRequest request) { return client.getWorkRequest(request); } }, new java.util.function.Predicate() { @Override public boolean test(GetWorkRequestResponse response) { // work requests are complete once the time finished is available return response.getWorkRequest().getTimeFinished() != null; } }, false), request); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy