Skip to content

Commit aa60254

Browse files
authored
feat(iam): add listing of user connections (#1876)
1 parent c0ef051 commit aa60254

File tree

4 files changed

+120
-0
lines changed

4 files changed

+120
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import {
4646
unmarshalListQuotaResponse,
4747
unmarshalListRulesResponse,
4848
unmarshalListSSHKeysResponse,
49+
unmarshalListUserConnectionsResponse,
4950
unmarshalListUsersResponse,
5051
unmarshalLog,
5152
unmarshalMFAOTP,
@@ -114,6 +115,8 @@ import type {
114115
ListRulesResponse,
115116
ListSSHKeysRequest,
116117
ListSSHKeysResponse,
118+
ListUserConnectionsRequest,
119+
ListUserConnectionsResponse,
117120
ListUsersRequest,
118121
ListUsersResponse,
119122
LockUserRequest,
@@ -509,6 +512,15 @@ export class API extends ParentAPI {
509512
unmarshalListGracePeriodsResponse,
510513
)
511514

515+
listUserConnections = (request: Readonly<ListUserConnectionsRequest>) =>
516+
this.client.fetch<ListUserConnectionsResponse>(
517+
{
518+
method: 'GET',
519+
path: `/iam/v1alpha1/users/${validatePathParam('userId', request.userId)}/connections`,
520+
},
521+
unmarshalListUserConnectionsResponse,
522+
)
523+
512524
protected pageOfListApplications = (
513525
request: Readonly<ListApplicationsRequest> = {},
514526
) =>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ export type {
7171
ListSSHKeysRequest,
7272
ListSSHKeysRequestOrderBy,
7373
ListSSHKeysResponse,
74+
ListUserConnectionsRequest,
75+
ListUserConnectionsResponse,
76+
ListUserConnectionsResponseConnection,
77+
ListUserConnectionsResponseConnectionConnectedOrganization,
78+
ListUserConnectionsResponseConnectionConnectedUser,
7479
ListUsersRequest,
7580
ListUsersRequestOrderBy,
7681
ListUsersResponse,

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

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ import type {
3636
ListQuotaResponse,
3737
ListRulesResponse,
3838
ListSSHKeysResponse,
39+
ListUserConnectionsResponse,
40+
ListUserConnectionsResponseConnection,
41+
ListUserConnectionsResponseConnectionConnectedOrganization,
42+
ListUserConnectionsResponseConnectionConnectedUser,
3943
ListUsersResponse,
4044
Log,
4145
MFAOTP,
@@ -513,6 +517,76 @@ export const unmarshalListSSHKeysResponse = (
513517
} as ListSSHKeysResponse
514518
}
515519

520+
const unmarshalListUserConnectionsResponseConnectionConnectedOrganization = (
521+
data: unknown,
522+
): ListUserConnectionsResponseConnectionConnectedOrganization => {
523+
if (!isJSONObject(data)) {
524+
throw new TypeError(
525+
`Unmarshalling the type 'ListUserConnectionsResponseConnectionConnectedOrganization' failed as data isn't a dictionary.`,
526+
)
527+
}
528+
529+
return {
530+
id: data.id,
531+
locked: data.locked,
532+
name: data.name,
533+
} as ListUserConnectionsResponseConnectionConnectedOrganization
534+
}
535+
536+
const unmarshalListUserConnectionsResponseConnectionConnectedUser = (
537+
data: unknown,
538+
): ListUserConnectionsResponseConnectionConnectedUser => {
539+
if (!isJSONObject(data)) {
540+
throw new TypeError(
541+
`Unmarshalling the type 'ListUserConnectionsResponseConnectionConnectedUser' failed as data isn't a dictionary.`,
542+
)
543+
}
544+
545+
return {
546+
id: data.id,
547+
type: data.type,
548+
username: data.username,
549+
} as ListUserConnectionsResponseConnectionConnectedUser
550+
}
551+
552+
const unmarshalListUserConnectionsResponseConnection = (
553+
data: unknown,
554+
): ListUserConnectionsResponseConnection => {
555+
if (!isJSONObject(data)) {
556+
throw new TypeError(
557+
`Unmarshalling the type 'ListUserConnectionsResponseConnection' failed as data isn't a dictionary.`,
558+
)
559+
}
560+
561+
return {
562+
organization: data.organization
563+
? unmarshalListUserConnectionsResponseConnectionConnectedOrganization(
564+
data.organization,
565+
)
566+
: undefined,
567+
user: data.user
568+
? unmarshalListUserConnectionsResponseConnectionConnectedUser(data.user)
569+
: undefined,
570+
} as ListUserConnectionsResponseConnection
571+
}
572+
573+
export const unmarshalListUserConnectionsResponse = (
574+
data: unknown,
575+
): ListUserConnectionsResponse => {
576+
if (!isJSONObject(data)) {
577+
throw new TypeError(
578+
`Unmarshalling the type 'ListUserConnectionsResponse' failed as data isn't a dictionary.`,
579+
)
580+
}
581+
582+
return {
583+
connections: unmarshalArrayOfObject(
584+
data.connections,
585+
unmarshalListUserConnectionsResponseConnection,
586+
),
587+
} as ListUserConnectionsResponse
588+
}
589+
516590
export const unmarshalListUsersResponse = (
517591
data: unknown,
518592
): ListUsersResponse => {

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,18 @@ export interface QuotumLimit {
135135
unlimited?: boolean
136136
}
137137

138+
export interface ListUserConnectionsResponseConnectionConnectedOrganization {
139+
id: string
140+
name: string
141+
locked: boolean
142+
}
143+
144+
export interface ListUserConnectionsResponseConnectionConnectedUser {
145+
id: string
146+
username: string
147+
type: UserType
148+
}
149+
138150
export interface JWT {
139151
/** JWT ID. */
140152
jti: string
@@ -463,6 +475,13 @@ export interface SSHKey {
463475
disabled: boolean
464476
}
465477

478+
export interface ListUserConnectionsResponseConnection {
479+
/** Information about the connected organization. */
480+
organization?: ListUserConnectionsResponseConnectionConnectedOrganization
481+
/** Information about the connected user. */
482+
user?: ListUserConnectionsResponseConnectionConnectedUser
483+
}
484+
466485
export interface User {
467486
/** ID of user. */
468487
id: string
@@ -1022,6 +1041,16 @@ export interface ListSSHKeysResponse {
10221041
totalCount: number
10231042
}
10241043

1044+
export type ListUserConnectionsRequest = {
1045+
/** ID of the user to list connections for. */
1046+
userId: string
1047+
}
1048+
1049+
export interface ListUserConnectionsResponse {
1050+
/** List of connections. */
1051+
connections: ListUserConnectionsResponseConnection[]
1052+
}
1053+
10251054
export type ListUsersRequest = {
10261055
/** Criteria for sorting results. */
10271056
orderBy?: ListUsersRequestOrderBy

0 commit comments

Comments
 (0)