Skip to content

Commit bbbd435

Browse files
authored
feat(iam): use a random name when creating a resource (#74)
1 parent 38178e5 commit bbbd435

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

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

Lines changed: 5 additions & 4 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,
@@ -381,7 +382,7 @@ export const marshalCreateApplicationRequest = (
381382
defaults: DefaultValues,
382383
): Record<string, unknown> => ({
383384
description: request.description,
384-
name: request.name,
385+
name: request.name || randomName('app'),
385386
organization_id: request.organizationId ?? defaults.defaultOrganizationId,
386387
})
387388

@@ -390,7 +391,7 @@ export const marshalCreateGroupRequest = (
390391
defaults: DefaultValues,
391392
): Record<string, unknown> => ({
392393
description: request.description,
393-
name: request.name,
394+
name: request.name || randomName('grp'),
394395
organization_id: request.organizationId ?? defaults.defaultOrganizationId,
395396
})
396397

@@ -399,7 +400,7 @@ export const marshalCreatePolicyRequest = (
399400
defaults: DefaultValues,
400401
): Record<string, unknown> => ({
401402
description: request.description,
402-
name: request.name,
403+
name: request.name || randomName('pol'),
403404
organization_id: request.organizationId ?? defaults.defaultOrganizationId,
404405
rules: request.rules
405406
? request.rules.map(elt => marshalRuleSpecs(elt, defaults))
@@ -428,7 +429,7 @@ export const marshalCreateSSHKeyRequest = (
428429
request: CreateSSHKeyRequest,
429430
defaults: DefaultValues,
430431
): Record<string, unknown> => ({
431-
name: request.name,
432+
name: request.name || randomName('key'),
432433
project_id: request.projectId ?? defaults.defaultProjectId,
433434
public_key: request.publicKey,
434435
})

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ export type ListSSHKeysRequest = {
391391

392392
export type CreateSSHKeyRequest = {
393393
/** The name of the SSH key. Max length is 1000 */
394-
name: string
394+
name?: string
395395
/**
396396
* SSH public key. Currently ssh-rsa, ssh-dss (DSA), ssh-ed25519 and ecdsa
397397
* keys with NIST curves are supported. Max length is 65000
@@ -455,7 +455,7 @@ export type ListApplicationsRequest = {
455455

456456
export type CreateApplicationRequest = {
457457
/** Name of application to create (max length is 64 chars) */
458-
name: string
458+
name?: string
459459
/** ID of organization */
460460
organizationId?: string
461461
/** Description of application (max length is 200 chars) */
@@ -507,7 +507,7 @@ export type CreateGroupRequest = {
507507
* Name of the group to create (max length is 64 chars). MUST be unique inside
508508
* an organization
509509
*/
510-
name: string
510+
name?: string
511511
/** Description of the group to create (max length is 200 chars) */
512512
description: string
513513
}
@@ -599,7 +599,7 @@ export type ListPoliciesRequest = {
599599

600600
export type CreatePolicyRequest = {
601601
/** Name of policy to create (max length is 64 chars) */
602-
name: string
602+
name?: string
603603
/** Description of policy to create (max length is 200 chars) */
604604
description: string
605605
/** ID of organization */

0 commit comments

Comments
 (0)