|
| 1 | +/** |
| 2 | + * Container Images API |
| 3 | + * API covering the [Registry](/iaas/Content/Registry/Concepts/registryoverview.htm) services. |
| 4 | +Use this API to manage resources such as container images and repositories. |
| 5 | +
|
| 6 | + * OpenAPI spec version: 20160918 |
| 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 { ArtifactsClient } from "./client"; |
| 20 | +import { genericWaiter, genericTerminalConditionWaiter, WaiterConfiguration } from "oci-common"; |
| 21 | + |
| 22 | +export class ArtifactsWaiter { |
| 23 | + public constructor( |
| 24 | + private client: ArtifactsClient, |
| 25 | + private readonly config?: WaiterConfiguration |
| 26 | + ) {} |
| 27 | + |
| 28 | + /** |
| 29 | + * Waits forContainerImage 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 GetContainerImageResponse | null (null in case of 404 response) |
| 34 | + */ |
| 35 | + public async forContainerImage( |
| 36 | + request: serviceRequests.GetContainerImageRequest, |
| 37 | + ...targetStates: models.ContainerImage.LifecycleState[] |
| 38 | + ): Promise<serviceResponses.GetContainerImageResponse | null> { |
| 39 | + return genericTerminalConditionWaiter( |
| 40 | + this.config, |
| 41 | + () => this.client.getContainerImage(request), |
| 42 | + response => targetStates.includes(response.containerImage.lifecycleState!), |
| 43 | + targetStates.includes(models.ContainerImage.LifecycleState.Deleted) |
| 44 | + ); |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Waits forContainerRepository till it reaches any of the provided states |
| 49 | + * |
| 50 | + * @param request the request to send |
| 51 | + * @param targetStates the desired states to wait for. The waiter will return once the resource reaches any of the provided states |
| 52 | + * @return response returns GetContainerRepositoryResponse | null (null in case of 404 response) |
| 53 | + */ |
| 54 | + public async forContainerRepository( |
| 55 | + request: serviceRequests.GetContainerRepositoryRequest, |
| 56 | + ...targetStates: models.ContainerRepository.LifecycleState[] |
| 57 | + ): Promise<serviceResponses.GetContainerRepositoryResponse | null> { |
| 58 | + return genericTerminalConditionWaiter( |
| 59 | + this.config, |
| 60 | + () => this.client.getContainerRepository(request), |
| 61 | + response => targetStates.includes(response.containerRepository.lifecycleState!), |
| 62 | + targetStates.includes(models.ContainerRepository.LifecycleState.Deleted) |
| 63 | + ); |
| 64 | + } |
| 65 | +} |
0 commit comments