Skip to content

feat(iam): add tags on applications, groups, users and policies #1013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ export class API extends ParentAPI {
'page_size',
request.pageSize ?? this.client.settings.defaultPageSize,
],
['tag', request.tag],
['user_ids', request.userIds],
),
},
Expand Down Expand Up @@ -349,6 +350,7 @@ export class API extends ParentAPI {
'page_size',
request.pageSize ?? this.client.settings.defaultPageSize,
],
['tag', request.tag],
),
},
unmarshalListApplicationsResponse,
Expand Down Expand Up @@ -469,6 +471,7 @@ export class API extends ParentAPI {
'page_size',
request.pageSize ?? this.client.settings.defaultPageSize,
],
['tag', request.tag],
['user_ids', request.userIds],
),
},
Expand Down Expand Up @@ -694,6 +697,7 @@ export class API extends ParentAPI {
request.pageSize ?? this.client.settings.defaultPageSize,
],
['policy_name', request.policyName],
['tag', request.tag],
['user_ids', request.userIds],
),
},
Expand Down
11 changes: 11 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export const unmarshalApplication = (data: unknown): Application => {
name: data.name,
nbApiKeys: data.nb_api_keys,
organizationId: data.organization_id,
tags: data.tags,
updatedAt: unmarshalDate(data.updated_at),
} as Application
}
Expand All @@ -125,6 +126,7 @@ export const unmarshalGroup = (data: unknown): Group => {
id: data.id,
name: data.name,
organizationId: data.organization_id,
tags: data.tags,
updatedAt: unmarshalDate(data.updated_at),
userIds: data.user_ids,
} as Group
Expand Down Expand Up @@ -170,6 +172,7 @@ export const unmarshalPolicy = (data: unknown): Policy => {
nbScopes: data.nb_scopes,
noPrincipal: data.no_principal,
organizationId: data.organization_id,
tags: data.tags,
updatedAt: unmarshalDate(data.updated_at),
userId: data.user_id,
} as Policy
Expand Down Expand Up @@ -226,6 +229,7 @@ export const unmarshalUser = (data: unknown): User => {
mfa: data.mfa,
organizationId: data.organization_id,
status: data.status,
tags: data.tags,
twoFactorEnabled: data.two_factor_enabled,
type: data.type,
updatedAt: unmarshalDate(data.updated_at),
Expand Down Expand Up @@ -482,6 +486,7 @@ export const marshalCreateApplicationRequest = (
description: request.description,
name: request.name || randomName('app'),
organization_id: request.organizationId ?? defaults.defaultOrganizationId,
tags: request.tags,
})

export const marshalCreateGroupRequest = (
Expand All @@ -491,6 +496,7 @@ export const marshalCreateGroupRequest = (
description: request.description,
name: request.name || randomName('grp'),
organization_id: request.organizationId ?? defaults.defaultOrganizationId,
tags: request.tags,
})

const marshalRuleSpecs = (
Expand All @@ -515,6 +521,7 @@ export const marshalCreatePolicyRequest = (
request.rules !== undefined
? request.rules.map(elt => marshalRuleSpecs(elt, defaults))
: undefined,
tags: request.tags,
...resolveOneOf<string | boolean>([
{ param: 'user_id', value: request.userId },
{ param: 'group_id', value: request.groupId },
Expand All @@ -538,6 +545,7 @@ export const marshalCreateUserRequest = (
): Record<string, unknown> => ({
email: request.email,
organization_id: request.organizationId ?? defaults.defaultOrganizationId,
tags: request.tags,
})

export const marshalRemoveGroupMemberRequest = (
Expand Down Expand Up @@ -580,6 +588,7 @@ export const marshalUpdateApplicationRequest = (
): Record<string, unknown> => ({
description: request.description,
name: request.name,
tags: request.tags,
})

export const marshalUpdateGroupRequest = (
Expand All @@ -588,6 +597,7 @@ export const marshalUpdateGroupRequest = (
): Record<string, unknown> => ({
description: request.description,
name: request.name,
tags: request.tags,
})

export const marshalUpdatePolicyRequest = (
Expand All @@ -596,6 +606,7 @@ export const marshalUpdatePolicyRequest = (
): Record<string, unknown> => ({
description: request.description,
name: request.name,
tags: request.tags,
...resolveOneOf<string | boolean>([
{ param: 'user_id', value: request.userId },
{ param: 'group_id', value: request.groupId },
Expand Down
30 changes: 30 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ export interface Application {
editable: boolean
/** Number of API keys attributed to the application. */
nbApiKeys: number
/** Tags associated with the user. */
tags: string[]
}

export interface Group {
Expand All @@ -196,6 +198,8 @@ export interface Group {
userIds: string[]
/** IDs of applications attached to this group. */
applicationIds: string[]
/** Tags associated to the group. */
tags: string[]
}

export interface Log {
Expand Down Expand Up @@ -253,6 +257,8 @@ export interface Policy {
nbScopes: number
/** Number of permission sets of the policy. */
nbPermissionSets: number
/** Tags associated with the policy. */
tags: string[]
/**
* ID of the user attributed to the policy.
*
Expand Down Expand Up @@ -376,6 +382,8 @@ export interface User {
mfa: boolean
/** ID of the account root user associated with the user. */
accountRootUserId: string
/** Tags associated with the user. */
tags: string[]
}

export type AddGroupMemberRequest = {
Expand Down Expand Up @@ -436,6 +444,8 @@ export type CreateApplicationRequest = {
organizationId?: string
/** Description of the application (max length is 200 characters). */
description: string
/** Tags associated with the application (maximum of 10 tags). */
tags?: string[]
}

export type CreateGroupRequest = {
Expand All @@ -448,6 +458,8 @@ export type CreateGroupRequest = {
name?: string
/** Description of the group to create (max length is 200 chars). */
description: string
/** Tags associated with the group (maximum of 10 tags). */
tags?: string[]
}

export type CreatePolicyRequest = {
Expand All @@ -459,6 +471,8 @@ export type CreatePolicyRequest = {
organizationId?: string
/** Rules of the policy to create. */
rules?: RuleSpecs[]
/** Tags associated with the policy (maximum of 10 tags). */
tags?: string[]
/**
* ID of user attributed to the policy.
*
Expand Down Expand Up @@ -506,6 +520,8 @@ export type CreateUserRequest = {
organizationId?: string
/** Email of the user. */
email: string
/** Tags associated with the user. */
tags?: string[]
}

export type DeleteAPIKeyRequest = {
Expand Down Expand Up @@ -646,6 +662,8 @@ export type ListApplicationsRequest = {
editable?: boolean
/** Filter by list of IDs. */
applicationIds?: string[]
/** Filter by tags containing a given string. */
tag?: string
}

export interface ListApplicationsResponse {
Expand All @@ -672,6 +690,8 @@ export type ListGroupsRequest = {
userIds?: string[]
/** Filter by a list of group IDs. */
groupIds?: string[]
/** Filter by tags containing a given string. */
tag?: string
}

export interface ListGroupsResponse {
Expand Down Expand Up @@ -766,6 +786,8 @@ export type ListPoliciesRequest = {
noPrincipal?: boolean
/** Name of the policy to fetch. */
policyName?: string
/** Filter by tags containing a given string. */
tag?: string
}

export interface ListPoliciesResponse {
Expand Down Expand Up @@ -846,6 +868,8 @@ export type ListUsersRequest = {
userIds?: string[]
/** Filter by MFA status. */
mfa?: boolean
/** Filter by tags containing a given string. */
tag?: string
}

export interface ListUsersResponse {
Expand Down Expand Up @@ -906,6 +930,8 @@ export type UpdateApplicationRequest = {
name?: string
/** New description for the application (max length is 200 chars). */
description?: string
/** New tags for the application (maximum of 10 tags). */
tags?: string[]
}

export type UpdateGroupRequest = {
Expand All @@ -918,6 +944,8 @@ export type UpdateGroupRequest = {
name?: string
/** New description for the group (max length is 200 chars). */
description?: string
/** New tags for the group (maximum of 10 tags). */
tags?: string[]
}

export type UpdatePolicyRequest = {
Expand All @@ -927,6 +955,8 @@ export type UpdatePolicyRequest = {
name?: string
/** New description of policy (max length is 200 characters). */
description?: string
/** New tags for the policy (maximum of 10 tags). */
tags?: string[]
/**
* New ID of user attributed to the policy.
*
Expand Down