From bb5eac76e36885e56d343890a592e6734db32612 Mon Sep 17 00:00:00 2001 From: Scaleway Bot Date: Tue, 26 Jul 2022 14:34:27 +0200 Subject: [PATCH] feat(mnq): add AMQP credentials (#26) --- .../src/api/mnq/v1alpha1/marshalling.gen.ts | 39 +++++++++++++++++++ .../clients/src/api/mnq/v1alpha1/types.gen.ts | 30 ++++++++++++-- 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/packages/clients/src/api/mnq/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/mnq/v1alpha1/marshalling.gen.ts index d87c16241..25e451fad 100644 --- a/packages/clients/src/api/mnq/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/mnq/v1alpha1/marshalling.gen.ts @@ -10,9 +10,11 @@ import type { CreateCredentialRequest, CreateNamespaceRequest, Credential, + CredentialAMQPCreds, CredentialNATSCredsFile, CredentialSQSSNSCreds, CredentialSummary, + CredentialSummaryAMQPCreds, CredentialSummarySQSSNSCreds, ListCredentialsResponse, ListNamespacesResponse, @@ -36,6 +38,21 @@ const unmarshalPermissions = (data: unknown) => { } as Permissions } +const unmarshalCredentialSummaryAMQPCreds = (data: unknown) => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'CredentialSummaryAMQPCreds' failed as data isn't a dictionary.`, + ) + } + + return { + permissions: data.permissions + ? unmarshalPermissions(data.permissions) + : undefined, + username: data.username, + } as CredentialSummaryAMQPCreds +} + const unmarshalCredentialSummarySQSSNSCreds = (data: unknown) => { if (!isJSONObject(data)) { throw new TypeError( @@ -51,6 +68,22 @@ const unmarshalCredentialSummarySQSSNSCreds = (data: unknown) => { } as CredentialSummarySQSSNSCreds } +const unmarshalCredentialAMQPCreds = (data: unknown) => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'CredentialAMQPCreds' failed as data isn't a dictionary.`, + ) + } + + return { + password: data.password, + permissions: data.permissions + ? unmarshalPermissions(data.permissions) + : undefined, + username: data.username, + } as CredentialAMQPCreds +} + const unmarshalCredentialNATSCredsFile = (data: unknown) => { if (!isJSONObject(data)) { throw new TypeError( @@ -85,6 +118,9 @@ const unmarshalCredentialSummary = (data: unknown) => { } return { + amqpCredentials: data.amqp_credentials + ? unmarshalCredentialSummaryAMQPCreds(data.amqp_credentials) + : undefined, id: data.id, name: data.name, namespaceId: data.namespace_id, @@ -120,6 +156,9 @@ export const unmarshalCredential = (data: unknown) => { } return { + amqpCredentials: data.amqp_credentials + ? unmarshalCredentialAMQPCreds(data.amqp_credentials) + : undefined, id: data.id, name: data.name, namespaceId: data.namespace_id, diff --git a/packages/clients/src/api/mnq/v1alpha1/types.gen.ts b/packages/clients/src/api/mnq/v1alpha1/types.gen.ts index 0260e0891..ebaf32987 100644 --- a/packages/clients/src/api/mnq/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/mnq/v1alpha1/types.gen.ts @@ -25,14 +25,25 @@ export interface Credential { protocol: NamespaceProtocol /** * One-of ('credentialType'): at most one of 'natsCredentials', - * 'sqsSnsCredentials' could be set. + * 'sqsSnsCredentials', 'amqpCredentials' could be set. */ natsCredentials?: CredentialNATSCredsFile /** * One-of ('credentialType'): at most one of 'natsCredentials', - * 'sqsSnsCredentials' could be set. + * 'sqsSnsCredentials', 'amqpCredentials' could be set. */ sqsSnsCredentials?: CredentialSQSSNSCreds + /** + * One-of ('credentialType'): at most one of 'natsCredentials', + * 'sqsSnsCredentials', 'amqpCredentials' could be set. + */ + amqpCredentials?: CredentialAMQPCreds +} + +export interface CredentialAMQPCreds { + username: string + password?: string + permissions?: Permissions } export interface CredentialNATSCredsFile { @@ -50,8 +61,21 @@ export interface CredentialSummary { name: string namespaceId: string protocol: NamespaceProtocol - /** One-of ('credentialType'): at most one of 'sqsSnsCredentials' could be set. */ + /** + * One-of ('credentialType'): at most one of 'sqsSnsCredentials', + * 'amqpCredentials' could be set. + */ sqsSnsCredentials?: CredentialSummarySQSSNSCreds + /** + * One-of ('credentialType'): at most one of 'sqsSnsCredentials', + * 'amqpCredentials' could be set. + */ + amqpCredentials?: CredentialSummaryAMQPCreds +} + +export interface CredentialSummaryAMQPCreds { + username: string + permissions?: Permissions } export interface CredentialSummarySQSSNSCreds {