Skip to content

Commit f4ccf51

Browse files
authored
feat(mnq): set by default a random name when creating a namespace or credential (#192)
1 parent 06e1ab2 commit f4ccf51

File tree

3 files changed

+97
-11
lines changed

3 files changed

+97
-11
lines changed

packages/clients/src/api/mnq/v1alpha1/api.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const jsonContentHeaders = {
3939
}
4040

4141
/**
42-
* MnQ API.
42+
* MnQ API (beta).
4343
*
4444
* This API allows you to manage Messaging or Queueing brokers.
4545
*/

packages/clients/src/api/mnq/v1alpha1/marshalling.gen.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// This file was automatically generated. DO NOT EDIT.
22
// If you have any remark or suggestion do not hesitate to open an issue.
3+
import randomName from '@scaleway/random-name'
34
import {
45
isJSONObject,
56
resolveOneOf,
@@ -217,7 +218,7 @@ export const marshalCreateCredentialRequest = (
217218
request: CreateCredentialRequest,
218219
defaults: DefaultValues,
219220
): Record<string, unknown> => ({
220-
name: request.name,
221+
name: request.name || randomName('mnq'),
221222
namespace_id: request.namespaceId,
222223
...resolveOneOf([
223224
{
@@ -233,7 +234,7 @@ export const marshalCreateNamespaceRequest = (
233234
request: CreateNamespaceRequest,
234235
defaults: DefaultValues,
235236
): Record<string, unknown> => ({
236-
name: request.name,
237+
name: request.name || randomName('mnq'),
237238
project_id: request.projectId ?? defaults.defaultProjectId,
238239
protocol: request.protocol,
239240
})

packages/clients/src/api/mnq/v1alpha1/types.gen.ts

Lines changed: 93 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,170 +22,255 @@ export type ListNamespacesRequestOrderBy =
2222

2323
export type NamespaceProtocol = 'unknown' | 'nats' | 'sqs_sns' | 'amqp'
2424

25+
/** Credential */
2526
export interface Credential {
27+
/** Credential ID */
2628
id: string
29+
/** Credential name */
2730
name: string
31+
/** Namespace containing the Credential */
2832
namespaceId: string
33+
/** Protocol associated to the Credential */
2934
protocol: NamespaceProtocol
3035
/**
36+
* Credentials file used to connect to the NATS service.
37+
*
3138
* One-of ('credentialType'): at most one of 'natsCredentials',
3239
* 'sqsSnsCredentials', 'amqpCredentials' could be set.
3340
*/
3441
natsCredentials?: CredentialNATSCredsFile
3542
/**
43+
* Credential used to connect to the SQS/SNS service.
44+
*
3645
* One-of ('credentialType'): at most one of 'natsCredentials',
3746
* 'sqsSnsCredentials', 'amqpCredentials' could be set.
3847
*/
3948
sqsSnsCredentials?: CredentialSQSSNSCreds
4049
/**
50+
* Credential used to connect to the AMQP service.
51+
*
4152
* One-of ('credentialType'): at most one of 'natsCredentials',
4253
* 'sqsSnsCredentials', 'amqpCredentials' could be set.
4354
*/
4455
amqpCredentials?: CredentialAMQPCreds
4556
}
4657

58+
/** Credential.amqp creds */
4759
export interface CredentialAMQPCreds {
60+
/** Username used to connect to the AMQP service */
4861
username: string
62+
/** Password used to connect to the AMQP service */
4963
password?: string
64+
/** List of permissions associated to this Credential */
5065
permissions?: Permissions
5166
}
5267

68+
/** Credential.nats creds file */
5369
export interface CredentialNATSCredsFile {
70+
/** Raw content of the NATS credentials file */
5471
content: string
5572
}
5673

74+
/** Credential.sqssns creds */
5775
export interface CredentialSQSSNSCreds {
76+
/** ID of the key */
5877
accessKey: string
78+
/** Secret value of the key */
5979
secretKey?: string
80+
/** List of permissions associated to this Credential */
6081
permissions?: Permissions
6182
}
6283

84+
/** Credential summary */
6385
export interface CredentialSummary {
86+
/** Credential ID */
6487
id: string
88+
/** Credential name */
6589
name: string
90+
/** Namespace containing the Credential */
6691
namespaceId: string
92+
/** Protocol associated to the Credential */
6793
protocol: NamespaceProtocol
6894
/**
95+
* Credential used to connect to the SQS/SNS service.
96+
*
6997
* One-of ('credentialType'): at most one of 'sqsSnsCredentials',
7098
* 'amqpCredentials' could be set.
7199
*/
72100
sqsSnsCredentials?: CredentialSummarySQSSNSCreds
73101
/**
102+
* Credential used to connect to the AMQP service.
103+
*
74104
* One-of ('credentialType'): at most one of 'sqsSnsCredentials',
75105
* 'amqpCredentials' could be set.
76106
*/
77107
amqpCredentials?: CredentialSummaryAMQPCreds
78108
}
79109

110+
/** Credential summary.amqp creds */
80111
export interface CredentialSummaryAMQPCreds {
112+
/** Username used to connect to the AMQP service */
81113
username: string
114+
/** List of permissions associated to this Credential */
82115
permissions?: Permissions
83116
}
84117

118+
/** Credential summary.sqssns creds */
85119
export interface CredentialSummarySQSSNSCreds {
120+
/** ID of the key */
86121
accessKey: string
122+
/** List of permissions associated to this Credential */
87123
permissions?: Permissions
88124
}
89125

126+
/** List credentials response */
90127
export interface ListCredentialsResponse {
128+
/** Total number of existing Credentials */
91129
totalCount: number
130+
/** A page of Credentials */
92131
credentials: Array<CredentialSummary>
93132
}
94133

134+
/** List namespaces response */
95135
export interface ListNamespacesResponse {
136+
/** Total number of existing Namespaces */
96137
totalCount: number
138+
/** A page of Namespaces */
97139
namespaces: Array<Namespace>
98140
}
99141

142+
/** Namespace */
100143
export interface Namespace {
144+
/** Namespace ID */
101145
id: string
102-
projectId: string
146+
/** Namespace name */
103147
name: string
148+
/** Endpoint of the service matching the Namespace protocol */
104149
endpoint: string
150+
/** Namespace protocol */
105151
protocol: NamespaceProtocol
152+
/** Project containing the Namespace */
153+
projectId: string
154+
/** Region where the Namespace is deployed */
155+
region: Region
156+
/** Namespace creation date */
106157
createdAt?: Date
158+
/** Namespace last modification date */
107159
updatedAt?: Date
108-
region: Region
109160
}
110161

162+
/** Permissions */
111163
export interface Permissions {
164+
/** Defines if user can publish messages to the service */
112165
canPublish?: boolean
166+
/** Defines if user can receive messages from the service */
113167
canReceive?: boolean
168+
/** Defines if user can manage the associated resource(s) */
114169
canManage?: boolean
115170
}
116171

117172
export type ListNamespacesRequest = {
118173
/** Region to target. If none is passed will use default region from the config */
119174
region?: Region
175+
/** Will list only the Namespaces owned by the specified organization */
176+
organizationId?: string
177+
/** Will list only the Namespaces contained into the specified project */
120178
projectId?: string
179+
/** Indicate the page number of results to be returned */
121180
page?: number
181+
/** Maximum number of results returned by page */
122182
pageSize?: number
183+
/** Field used for sorting results */
123184
orderBy?: ListNamespacesRequestOrderBy
124-
organizationId?: string
125185
}
126186

127187
export type CreateNamespaceRequest = {
128188
/** Region to target. If none is passed will use default region from the config */
129189
region?: Region
130-
name: string
131-
projectId?: string
190+
/** Namespace name */
191+
name?: string
192+
/** Namespace protocol */
132193
protocol: NamespaceProtocol
194+
/** Project containing the Namespace */
195+
projectId?: string
133196
}
134197

135198
export type UpdateNamespaceRequest = {
136199
/** Region to target. If none is passed will use default region from the config */
137200
region?: Region
201+
/** ID of the Namespace to update */
138202
namespaceId: string
203+
/** Namespace name */
139204
name?: string
140205
}
141206

142207
export type GetNamespaceRequest = {
143208
/** Region to target. If none is passed will use default region from the config */
144209
region?: Region
210+
/** ID of the Namespace to get */
145211
namespaceId: string
146212
}
147213

148214
export type DeleteNamespaceRequest = {
149215
/** Region to target. If none is passed will use default region from the config */
150216
region?: Region
217+
/** ID of the Namespace to delete */
151218
namespaceId: string
152219
}
153220

154221
export type CreateCredentialRequest = {
155222
/** Region to target. If none is passed will use default region from the config */
156223
region?: Region
157-
name: string
224+
/** Namespace containing the Credential */
158225
namespaceId: string
159-
/** One-of ('optionalPermissions'): at most one of 'permissions' could be set. */
226+
/** Credential name */
227+
name?: string
228+
/**
229+
* List of permissions associated to this Credential.
230+
*
231+
* One-of ('optionalPermissions'): at most one of 'permissions' could be set.
232+
*/
160233
permissions?: Permissions
161234
}
162235

163236
export type DeleteCredentialRequest = {
164237
/** Region to target. If none is passed will use default region from the config */
165238
region?: Region
239+
/** ID of the Credential to delete */
166240
credentialId: string
167241
}
168242

169243
export type ListCredentialsRequest = {
170244
/** Region to target. If none is passed will use default region from the config */
171245
region?: Region
246+
/** Namespace containing the Credential */
172247
namespaceId?: string
248+
/** Indicate the page number of results to be returned */
173249
page?: number
250+
/** Maximum number of results returned by page */
174251
pageSize?: number
252+
/** Field used for sorting results */
175253
orderBy?: ListCredentialsRequestOrderBy
176254
}
177255

178256
export type UpdateCredentialRequest = {
179257
/** Region to target. If none is passed will use default region from the config */
180258
region?: Region
259+
/** ID of the Credential to update */
181260
credentialId: string
261+
/** Credential name */
182262
name?: string
183-
/** One-of ('optionalPermissions'): at most one of 'permissions' could be set. */
263+
/**
264+
* List of permissions associated to this Credential.
265+
*
266+
* One-of ('optionalPermissions'): at most one of 'permissions' could be set.
267+
*/
184268
permissions?: Permissions
185269
}
186270

187271
export type GetCredentialRequest = {
188272
/** Region to target. If none is passed will use default region from the config */
189273
region?: Region
274+
/** ID of the Credential to get */
190275
credentialId: string
191276
}

0 commit comments

Comments
 (0)