From 905ee1f0bb2ba30956d6b475eeeca184c269cd65 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Tue, 15 Nov 2022 13:24:19 +0000 Subject: [PATCH] feat: update generated APIs --- .../clients/src/api/domain/v2beta1/api.gen.ts | 49 ++++++++++++++++++- .../src/api/domain/v2beta1/content.gen.ts | 42 +++++++++++++++- .../src/api/domain/v2beta1/types.gen.ts | 2 +- 3 files changed, 90 insertions(+), 3 deletions(-) diff --git a/packages/clients/src/api/domain/v2beta1/api.gen.ts b/packages/clients/src/api/domain/v2beta1/api.gen.ts index 1935289de..0b0b8eda1 100644 --- a/packages/clients/src/api/domain/v2beta1/api.gen.ts +++ b/packages/clients/src/api/domain/v2beta1/api.gen.ts @@ -6,8 +6,13 @@ import { unmarshalScwFile, urlParams, validatePathParam, + waitForResource, } from '../../../bridge' -import type { ScwFile } from '../../../bridge' +import type { ScwFile, WaitForOptions } from '../../../bridge' +import { + DOMAIN_TRANSIENT_STATUSES, + SSL_CERTIFICATE_TRANSIENT_STATUSES, +} from './content.gen' import { marshalCloneDNSZoneRequest, marshalCreateDNSZoneRequest, @@ -636,6 +641,28 @@ export class DomainV2Beta1GenAPI extends API { unmarshalSSLCertificate, ) + /** + * Waits for {@link SSLCertificate} to be in a final state. + * + * @param request - The request {@link GetSSLCertificateRequest} + * @param options - The waiting options + * @returns A Promise of SSLCertificate + */ + waitForSSLCertificate = ( + request: Readonly, + options?: Readonly>, + ) => + waitForResource( + options?.stop ?? + (res => + Promise.resolve( + !SSL_CERTIFICATE_TRANSIENT_STATUSES.includes(res.status), + )), + this.getSSLCertificate, + request, + options, + ) + /** * Create or return the zone TLS certificate * @@ -1119,6 +1146,26 @@ export class DomainRegistrarV2Beta1GenAPI extends API { unmarshalDomain, ) + /** + * Waits for {@link Domain} to be in a final state. + * + * @param request - The request {@link GetDomainRequest} + * @param options - The waiting options + * @returns A Promise of Domain + */ + waitForDomain = ( + request: Readonly, + options?: Readonly>, + ) => + waitForResource( + options?.stop ?? + (res => + Promise.resolve(!DOMAIN_TRANSIENT_STATUSES.includes(res.status))), + this.getDomain, + request, + options, + ) + /** * Update the domain contacts or create a new one.
If you add the same * contact for multiple roles. Only one ID will be created and used for all of diff --git a/packages/clients/src/api/domain/v2beta1/content.gen.ts b/packages/clients/src/api/domain/v2beta1/content.gen.ts index 230f55a21..8b21d2f73 100644 --- a/packages/clients/src/api/domain/v2beta1/content.gen.ts +++ b/packages/clients/src/api/domain/v2beta1/content.gen.ts @@ -1,9 +1,49 @@ // This file was automatically generated. DO NOT EDIT. // If you have any remark or suggestion do not hesitate to open an issue. -import type { DNSZoneStatus, HostStatus } from './types.gen' +import type { + DNSZoneStatus, + DomainFeatureStatus, + DomainRegistrationStatusTransferStatus, + DomainStatus, + HostStatus, + SSLCertificateStatus, + TaskStatus, +} from './types.gen' /** Lists transient statutes of the enum {@link DNSZoneStatus}. */ export const DNS_ZONE_TRANSIENT_STATUSES: DNSZoneStatus[] = ['pending'] +/** Lists transient statutes of the enum {@link DomainFeatureStatus}. */ +export const DOMAIN_FEATURE_TRANSIENT_STATUSES: DomainFeatureStatus[] = [ + 'enabling', + 'disabling', +] + +/** + * Lists transient statutes of the enum + * {@link DomainRegistrationStatusTransferStatus}. + */ +export const DOMAIN_REGISTRATION_STATUS_TRANSFER_TRANSIENT_STATUSES: DomainRegistrationStatusTransferStatus[] = + ['pending', 'processing'] + +/** Lists transient statutes of the enum {@link DomainStatus}. */ +export const DOMAIN_TRANSIENT_STATUSES: DomainStatus[] = [ + 'creating', + 'renewing', + 'xfering', + 'expiring', + 'updating', + 'checking', + 'deleting', +] + /** Lists transient statutes of the enum {@link HostStatus}. */ export const HOST_TRANSIENT_STATUSES: HostStatus[] = ['updating', 'deleting'] + +/** Lists transient statutes of the enum {@link SSLCertificateStatus}. */ +export const SSL_CERTIFICATE_TRANSIENT_STATUSES: SSLCertificateStatus[] = [ + 'pending', +] + +/** Lists transient statutes of the enum {@link TaskStatus}. */ +export const TASK_TRANSIENT_STATUSES: TaskStatus[] = ['pending'] diff --git a/packages/clients/src/api/domain/v2beta1/types.gen.ts b/packages/clients/src/api/domain/v2beta1/types.gen.ts index b88770ed5..d139d2880 100644 --- a/packages/clients/src/api/domain/v2beta1/types.gen.ts +++ b/packages/clients/src/api/domain/v2beta1/types.gen.ts @@ -131,7 +131,7 @@ export type DomainStatus = export type HostStatus = 'unknown_status' | 'active' | 'updating' | 'deleting' -export type LanguageCode = 'unknown_language_code' | 'en_US' | 'fr_FR' +export type LanguageCode = 'unknown_language_code' | 'en_US' | 'fr_FR' | 'de_DE' export type ListDNSZoneRecordsRequestOrderBy = 'name_asc' | 'name_desc'