Skip to content
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
61 changes: 61 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ import {
unmarshalAPIKey,
unmarshalApplication,
unmarshalGroup,
unmarshalJWT,
unmarshalListAPIKeysResponse,
unmarshalListApplicationsResponse,
unmarshalListGroupsResponse,
unmarshalListJWTsResponse,
unmarshalListPermissionSetsResponse,
unmarshalListPoliciesResponse,
unmarshalListQuotaResponse,
Expand All @@ -53,23 +55,28 @@ import type {
DeleteAPIKeyRequest,
DeleteApplicationRequest,
DeleteGroupRequest,
DeleteJWTRequest,
DeletePolicyRequest,
DeleteSSHKeyRequest,
DeleteUserRequest,
GetAPIKeyRequest,
GetApplicationRequest,
GetGroupRequest,
GetJWTRequest,
GetPolicyRequest,
GetQuotumRequest,
GetSSHKeyRequest,
GetUserRequest,
Group,
JWT,
ListAPIKeysRequest,
ListAPIKeysResponse,
ListApplicationsRequest,
ListApplicationsResponse,
ListGroupsRequest,
ListGroupsResponse,
ListJWTsRequest,
ListJWTsResponse,
ListPermissionSetsRequest,
ListPermissionSetsResponse,
ListPoliciesRequest,
Expand Down Expand Up @@ -931,4 +938,58 @@ export class API extends ParentAPI {
},
unmarshalQuotum,
)

protected pageOfListJWTs = (request: Readonly<ListJWTsRequest>) =>
this.client.fetch<ListJWTsResponse>(
{
method: 'GET',
path: `/iam/v1alpha1/jwts`,
urlParams: urlParams(
['audience_id', request.audienceId],
['expired', request.expired],
['order_by', request.orderBy ?? 'created_at_asc'],
['page', request.page],
[
'page_size',
request.pageSize ?? this.client.settings.defaultPageSize,
],
),
},
unmarshalListJWTsResponse,
)

/**
* List JWTs
*
* @param request - The request {@link ListJWTsRequest}
* @returns A Promise of ListJWTsResponse
*/
listJWTs = (request: Readonly<ListJWTsRequest>) =>
enrichForPagination('jwts', this.pageOfListJWTs, request)

/**
* Get a JWT
*
* @param request - The request {@link GetJWTRequest}
* @returns A Promise of JWT
*/
getJWT = (request: Readonly<GetJWTRequest>) =>
this.client.fetch<JWT>(
{
method: 'GET',
path: `/iam/v1alpha1/jwts/${validatePathParam('jti', request.jti)}`,
},
unmarshalJWT,
)

/**
* Delete a JWT
*
* @param request - The request {@link DeleteJWTRequest}
*/
deleteJWT = (request: Readonly<DeleteJWTRequest>) =>
this.client.fetch<void>({
method: 'DELETE',
path: `/iam/v1alpha1/jwts/${validatePathParam('jti', request.jti)}`,
})
}
6 changes: 6 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@ export type {
DeleteAPIKeyRequest,
DeleteApplicationRequest,
DeleteGroupRequest,
DeleteJWTRequest,
DeletePolicyRequest,
DeleteSSHKeyRequest,
DeleteUserRequest,
GetAPIKeyRequest,
GetApplicationRequest,
GetGroupRequest,
GetJWTRequest,
GetPolicyRequest,
GetQuotumRequest,
GetSSHKeyRequest,
GetUserRequest,
Group,
JWT,
ListAPIKeysRequest,
ListAPIKeysRequestOrderBy,
ListAPIKeysResponse,
Expand All @@ -35,6 +38,9 @@ export type {
ListGroupsRequest,
ListGroupsRequestOrderBy,
ListGroupsResponse,
ListJWTsRequest,
ListJWTsRequestOrderBy,
ListJWTsResponse,
ListPermissionSetsRequest,
ListPermissionSetsRequestOrderBy,
ListPermissionSetsResponse,
Expand Down
34 changes: 34 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ import type {
CreatePolicyRequest,
CreateSSHKeyRequest,
Group,
JWT,
ListAPIKeysResponse,
ListApplicationsResponse,
ListGroupsResponse,
ListJWTsResponse,
ListPermissionSetsResponse,
ListPoliciesResponse,
ListQuotaResponse,
Expand Down Expand Up @@ -105,6 +107,25 @@ export const unmarshalGroup = (data: unknown) => {
} as Group
}

export const unmarshalJWT = (data: unknown) => {
if (!isJSONObject(data)) {
throw new TypeError(
`Unmarshalling the type 'JWT' failed as data isn't a dictionary.`,
)
}

return {
audienceId: data.audience_id,
createdAt: unmarshalDate(data.created_at),
expiresAt: unmarshalDate(data.expires_at),
ip: data.ip,
issuerId: data.issuer_id,
jti: data.jti,
updatedAt: unmarshalDate(data.updated_at),
userAgent: data.user_agent,
} as JWT
}

const unmarshalPermissionSet = (data: unknown) => {
if (!isJSONObject(data)) {
throw new TypeError(
Expand Down Expand Up @@ -260,6 +281,19 @@ export const unmarshalListGroupsResponse = (data: unknown) => {
} as ListGroupsResponse
}

export const unmarshalListJWTsResponse = (data: unknown) => {
if (!isJSONObject(data)) {
throw new TypeError(
`Unmarshalling the type 'ListJWTsResponse' failed as data isn't a dictionary.`,
)
}

return {
jwts: unmarshalArrayOfObject(data.jwts, unmarshalJWT),
totalCount: data.total_count,
} as ListJWTsResponse
}

export const unmarshalListPermissionSetsResponse = (data: unknown) => {
if (!isJSONObject(data)) {
throw new TypeError(
Expand Down
54 changes: 54 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ export type ListGroupsRequestOrderBy =
| 'name_asc'
| 'name_desc'

export type ListJWTsRequestOrderBy =
| 'created_at_asc'
| 'created_at_desc'
| 'updated_at_asc'
| 'updated_at_desc'

export type ListPermissionSetsRequestOrderBy =
| 'name_asc'
| 'name_desc'
Expand Down Expand Up @@ -145,6 +151,26 @@ export interface Group {
applicationIds: string[]
}

/** Jwt */
export interface JWT {
/** JWT ID */
jti: string
/** ID of the user who issued the JWT */
issuerId: string
/** ID of the user targeted by the JWT */
audienceId: string
/** Creation date of the JWT */
createdAt?: Date
/** Last update date of the JWT */
updatedAt?: Date
/** Expiration date of the JWT */
expiresAt?: Date
/** IP address used during the creation of the JWT */
ip: string
/** User-agent used during the creation of the JWT */
userAgent: string
}

/** List api keys response */
export interface ListAPIKeysResponse {
/** List of API keys */
Expand All @@ -169,6 +195,11 @@ export interface ListGroupsResponse {
totalCount: number
}

export interface ListJWTsResponse {
jwts: JWT[]
totalCount: number
}

/** List permission sets response */
export interface ListPermissionSetsResponse {
/** List of permission sets */
Expand Down Expand Up @@ -843,3 +874,26 @@ export type GetQuotumRequest = {
/** ID of the organization */
organizationId?: string
}

export type ListJWTsRequest = {
/** Criteria for sorting results */
orderBy?: ListJWTsRequestOrderBy
/** ID of the user to search */
audienceId: string
/** Number of results per page. Value must be between 1 and 100 */
pageSize?: number
/** Number of page. Value must be greater to 1 */
page?: number
/** Filter out expired JWTs or not */
expired?: boolean
}

export type GetJWTRequest = {
/** JWT ID of the JWT to get */
jti: string
}

export type DeleteJWTRequest = {
/** JWT ID of the JWT to delete */
jti: string
}
10 changes: 10 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/validation-rules.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ export const ListGroupsRequest = {
},
}

export const ListJWTsRequest = {
page: {
greaterThanOrEqual: 1,
},
pageSize: {
greaterThanOrEqual: 1,
lessThanOrEqual: 100,
},
}

export const ListPermissionSetsRequest = {
page: {
greaterThanOrEqual: 1,
Expand Down