|
| 1 | +/** |
| 2 | + * Application Performance Monitoring (APM) Control Plane API |
| 3 | + * Provide a set of APIs for tenant to perform operations like create, update, delete and list APM domains, and also |
| 4 | +work request APIs to monitor progress of these operations. |
| 5 | +
|
| 6 | + * OpenAPI spec version: 20200630 |
| 7 | + * |
| 8 | + * |
| 9 | + * NOTE: This class is auto generated by OracleSDKGenerator. |
| 10 | + * Do not edit the class manually. |
| 11 | + * |
| 12 | + * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. |
| 13 | + * 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. |
| 14 | + */ |
| 15 | + |
| 16 | +import * as serviceRequests from "./request"; |
| 17 | +import * as serviceResponses from "./response"; |
| 18 | +import * as models from "./model"; |
| 19 | +import { ApmDomainClient } from "./client"; |
| 20 | +import { genericWaiter, genericTerminalConditionWaiter, WaiterConfiguration } from "oci-common"; |
| 21 | + |
| 22 | +export class ApmDomainWaiter { |
| 23 | + public constructor( |
| 24 | + private client: ApmDomainClient, |
| 25 | + private readonly config?: WaiterConfiguration |
| 26 | + ) {} |
| 27 | + |
| 28 | + /** |
| 29 | + * Waits forApmDomain till it reaches any of the provided states |
| 30 | + * |
| 31 | + * @param request the request to send |
| 32 | + * @param targetStates the desired states to wait for. The waiter will return once the resource reaches any of the provided states |
| 33 | + * @return response returns GetApmDomainResponse |
| 34 | + */ |
| 35 | + public async forApmDomain( |
| 36 | + request: serviceRequests.GetApmDomainRequest, |
| 37 | + ...targetStates: models.LifecycleStates[] |
| 38 | + ): Promise<serviceResponses.GetApmDomainResponse> { |
| 39 | + return genericWaiter( |
| 40 | + this.config, |
| 41 | + () => this.client.getApmDomain(request), |
| 42 | + response => targetStates.includes(response.apmDomain.lifecycleState!) |
| 43 | + ); |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * Waits forWorkRequest |
| 48 | + * |
| 49 | + * @param request the request to send |
| 50 | + * @return response returns GetWorkRequestResponse |
| 51 | + */ |
| 52 | + public async forWorkRequest( |
| 53 | + request: serviceRequests.GetWorkRequestRequest |
| 54 | + ): Promise<serviceResponses.GetWorkRequestResponse> { |
| 55 | + return genericWaiter( |
| 56 | + this.config, |
| 57 | + () => this.client.getWorkRequest(request), |
| 58 | + response => (response.workRequest.timeFinished ? true : false) |
| 59 | + ); |
| 60 | + } |
| 61 | +} |
0 commit comments