/**
 * Core Services API
 * Use the Core Services API to manage resources such as virtual cloud networks (VCNs),
compute instances, and block storage volumes. For more information, see the console
documentation for the [Networking](/iaas/Content/Network/Concepts/overview.htm),
[Compute](/iaas/Content/Compute/Concepts/computeoverview.htm), and
[Block Volume](/iaas/Content/Block/Concepts/overview.htm) services.

 * OpenAPI spec version: 20160918
 *
 *
 * NOTE: This class is auto generated by OracleSDKGenerator.
 * Do not edit the class manually.
 *
 * Copyright (c) 2020, 2022, 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.
 */ import * as serviceRequests from "./request" ; import * as serviceResponses from "./response" ; import * as models from "./model" ; import { ComputeClient } from "./client" ; import { genericWaiter , genericTerminalConditionWaiter , WaiterConfiguration } from "oci-common" ; import { waitForWorkRequest , WorkRequestClient , responses } from "oci-workrequests" ; export class ComputeWaiter { public constructor ( private client , private workRequestClient , private readonly config ? ) { } param request return public async forChangeComputeCapacityReservationCompartment ( request ) { const changeComputeCapacityReservationCompartmentResponse = await this . client . changeComputeCapacityReservationCompartment ( request ) ; const getWorkRequestResponse = await waitForWorkRequest ( this . config , this . workRequestClient , changeComputeCapacityReservationCompartmentResponse . opcWorkRequestId ) ; return { response : changeComputeCapacityReservationCompartmentResponse , workRequestResponse : getWorkRequestResponse } ; } param request return public async forChangeDedicatedVmHostCompartment ( request ) { const changeDedicatedVmHostCompartmentResponse = await this . client . changeDedicatedVmHostCompartment ( request ) ; const getWorkRequestResponse = await waitForWorkRequest ( this . config , this . workRequestClient , changeDedicatedVmHostCompartmentResponse . opcWorkRequestId ) ; return { response : changeDedicatedVmHostCompartmentResponse , workRequestResponse : getWorkRequestResponse } ; } param request return public async forChangeInstanceCompartment ( request ) { const changeInstanceCompartmentResponse = await this . client . changeInstanceCompartment ( request ) ; const getWorkRequestResponse = await waitForWorkRequest ( this . config , this . workRequestClient , changeInstanceCompartmentResponse . opcWorkRequestId ) ; return { response : changeInstanceCompartmentResponse , workRequestResponse : getWorkRequestResponse } ; } param request return public async forCreateComputeCapacityReservation ( request ) { const createComputeCapacityReservationResponse = await this . client . createComputeCapacityReservation ( request ) ; const getWorkRequestResponse = await waitForWorkRequest ( this . config , this . workRequestClient , createComputeCapacityReservationResponse . opcWorkRequestId ) ; return { response : createComputeCapacityReservationResponse , workRequestResponse : getWorkRequestResponse } ; } param request return public async forCreateDedicatedVmHost ( request ) { const createDedicatedVmHostResponse = await this . client . createDedicatedVmHost ( request ) ; const getWorkRequestResponse = await waitForWorkRequest ( this . config , this . workRequestClient , createDedicatedVmHostResponse . opcWorkRequestId ) ; return { response : createDedicatedVmHostResponse , workRequestResponse : getWorkRequestResponse } ; } param request return public async forCreateImage ( request ) { const createImageResponse = await this . client . createImage ( request ) ; const getWorkRequestResponse = await waitForWorkRequest ( this . config , this . workRequestClient , createImageResponse . opcWorkRequestId ) ; return { response : createImageResponse , workRequestResponse : getWorkRequestResponse } ; } param request return public async forDeleteComputeCapacityReservation ( request ) { const deleteComputeCapacityReservationResponse = await this . client . deleteComputeCapacityReservation ( request ) ; const getWorkRequestResponse = await waitForWorkRequest ( this . config , this . workRequestClient , deleteComputeCapacityReservationResponse . opcWorkRequestId ) ; return { response : deleteComputeCapacityReservationResponse , workRequestResponse : getWorkRequestResponse } ; } param request return public async forDeleteDedicatedVmHost ( request ) { const deleteDedicatedVmHostResponse = await this . client . deleteDedicatedVmHost ( request ) ; const getWorkRequestResponse = await waitForWorkRequest ( this . config , this . workRequestClient , deleteDedicatedVmHostResponse . opcWorkRequestId ) ; return { response : deleteDedicatedVmHostResponse , workRequestResponse : getWorkRequestResponse } ; } param request return public async forExportImage ( request ) { const exportImageResponse = await this . client . exportImage ( request ) ; const getWorkRequestResponse = await waitForWorkRequest ( this . config , this . workRequestClient , exportImageResponse . opcWorkRequestId ) ; return { response : exportImageResponse , workRequestResponse : getWorkRequestResponse } ; } param request param targetStates return public async forBootVolumeAttachment ( request , ... targetStates ) { return genericWaiter ( this . config , ( ) => this . client . getBootVolumeAttachment ( request ) , response => targetStates . includes ( response . bootVolumeAttachment . lifecycleState ! ) ) ; } param request param targetStates return public async forComputeCapacityReservation ( request , ... targetStates ) { return genericTerminalConditionWaiter ( this . config , ( ) => this . client . getComputeCapacityReservation ( request ) , response => targetStates . includes ( response . computeCapacityReservation . lifecycleState ! ) , targetStates . includes ( models . ComputeCapacityReservation . LifecycleState . Deleted ) ) ; } param request param targetStates return public async forConsoleHistory ( request , ... targetStates ) { return genericWaiter ( this . config , ( ) => this . client . getConsoleHistory ( request ) , response => targetStates . includes ( response . consoleHistory . lifecycleState ! ) ) ; } param request param targetStates return public async forDedicatedVmHost ( request , ... targetStates ) { return genericTerminalConditionWaiter ( this . config , ( ) => this . client . getDedicatedVmHost ( request ) , response => targetStates . includes ( response . dedicatedVmHost . lifecycleState ! ) , targetStates . includes ( models . DedicatedVmHost . LifecycleState . Deleted ) ) ; } param request param targetStates return public async forImage ( request , ... targetStates ) { return genericTerminalConditionWaiter ( this . config , ( ) => this . client . getImage ( request ) , response => targetStates . includes ( response . image . lifecycleState ! ) , targetStates . includes ( models . Image . LifecycleState . Deleted ) ) ; } param request param targetStates return public async forInstance ( request , ... targetStates ) { return genericTerminalConditionWaiter ( this . config , ( ) => this . client . getInstance ( request ) , response => targetStates . includes ( response . instance . lifecycleState ! ) , targetStates . includes ( models . Instance . LifecycleState . Terminated ) ) ; } param request param targetStates return public async forInstanceConsoleConnection ( request , ... targetStates ) { return genericTerminalConditionWaiter ( this . config , ( ) => this . client . getInstanceConsoleConnection ( request ) , response => targetStates . includes ( response . instanceConsoleConnection . lifecycleState ! ) , targetStates . includes ( models . InstanceConsoleConnection . LifecycleState . Deleted ) ) ; } param request param targetStates return public async forVnicAttachment ( request , ... targetStates ) { return genericWaiter ( this . config , ( ) => this . client . getVnicAttachment ( request ) , response => targetStates . includes ( response . vnicAttachment . lifecycleState ! ) ) ; } param request param targetStates return public async forVolumeAttachment ( request , ... targetStates ) { return genericWaiter ( this . config , ( ) => this . client . getVolumeAttachment ( request ) , response => targetStates . includes ( response . volumeAttachment . lifecycleState ! ) ) ; } param request return public async forLaunchInstance ( request ) { const launchInstanceResponse = await this . client . launchInstance ( request ) ; const getWorkRequestResponse = await waitForWorkRequest ( this . config , this . workRequestClient , launchInstanceResponse . opcWorkRequestId ) ; return { response : launchInstanceResponse , workRequestResponse : getWorkRequestResponse } ; } param request return public async forUpdateComputeCapacityReservation ( request ) { const updateComputeCapacityReservationResponse = await this . client . updateComputeCapacityReservation ( request ) ; const getWorkRequestResponse = await waitForWorkRequest ( this . config , this . workRequestClient , updateComputeCapacityReservationResponse . opcWorkRequestId ) ; return { response : updateComputeCapacityReservationResponse , workRequestResponse : getWorkRequestResponse } ; } param request return public async forUpdateInstance ( request ) { const updateInstanceResponse = await this . client . updateInstance ( request ) ; const getWorkRequestResponse = await waitForWorkRequest ( this . config , this . workRequestClient , updateInstanceResponse . opcWorkRequestId ) ; return { response : updateInstanceResponse , workRequestResponse : getWorkRequestResponse } ; } }