Skip to content

Commit

Permalink
chore: update docs to enable the ext (#23)
Browse files Browse the repository at this point in the history
Signed-off-by: ashutosh16 <[email protected]>
  • Loading branch information
ashutosh16 authored Oct 29, 2024
1 parent eb06cac commit 67cd661
Show file tree
Hide file tree
Showing 20 changed files with 965 additions and 446 deletions.
187 changes: 187 additions & 0 deletions ui/gen/ephemeralAccessAPI.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
/**
* Generated by orval v7.1.1 🍺
* Do not edit manually.
* Ephemeral Access API
* OpenAPI spec version: 0.0.1
*/
import axios from 'axios'
import type {
AxiosRequestConfig,
AxiosResponse
} from 'axios'

// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497
type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <
T,
>() => T extends Y ? 1 : 2
? A
: B;

type WritableKeys<T> = {
[P in keyof T]-?: IfEquals<
{ [Q in P]: T[P] },
{ -readonly [Q in P]: T[P] },
P
>;
}[keyof T];

type UnionToIntersection<U> =
(U extends any ? (k: U)=>void : never) extends ((k: infer I)=>void) ? I : never;
type DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never;

type Writable<T> = Pick<T, WritableKeys<T>>;
type NonReadonly<T> = [T] extends [UnionToIntersection<T>] ? {
[P in keyof Writable<T>]: T[P] extends object
? NonReadonly<NonNullable<T[P]>>
: T[P];
} : DistributeReadOnlyOverUnions<T>;

export type GetAccessrequestByNameParams = {
/**
* The namespace to use while searching for the access request.
*/
namespace?: string;
};

export type ListAccessrequestParams = {
/**
* Will search for all access requests for the given username.
*/
username?: string;
/**
* Will search for all access requests for the given application (format <namespace>:<name>).
*/
appName?: string;
};

export interface ListAccessRequestResponseBody {
/** A URL to the JSON Schema for this object. */
readonly $schema?: string;
/** @nullable */
items: AccessRequestResponseBody[] | null;
}

export interface ErrorDetail {
/** Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id' */
location?: string;
/** Error message text */
message?: string;
/** The value at the given location */
value?: unknown;
}

export interface ErrorModel {
/** A URL to the JSON Schema for this object. */
readonly $schema?: string;
/** A human-readable explanation specific to this occurrence of the problem. */
detail?: string;
/**
* Optional list of individual error details
* @nullable
*/
errors?: ErrorDetail[] | null;
/** A URI reference that identifies the specific occurrence of the problem. */
instance?: string;
/** HTTP status code */
status?: number;
/** A short, human-readable summary of the problem type. This value should not change between occurrences of the error. */
title?: string;
/** A URI reference to human-readable documentation for the error. */
type?: string;
}

export interface CreateAccessRequestBody {
/** A URL to the JSON Schema for this object. */
readonly $schema?: string;
/** The application to be associated with the access request (format <namespace>:<name>). */
appName: string;
/** The user to be associated with the access request. */
username: string;
}

/**
* The current access request status.
*/
export type AccessRequestResponseBodyStatus = typeof AccessRequestResponseBodyStatus[keyof typeof AccessRequestResponseBodyStatus];


// eslint-disable-next-line @typescript-eslint/no-redeclare
export const AccessRequestResponseBodyStatus = {
REQUESTED: 'REQUESTED',
GRANTED: 'GRANTED',
EXPIRED: 'EXPIRED',
DENIED: 'DENIED',
} as const;

export interface AccessRequestResponseBody {
/** A URL to the JSON Schema for this object. */
readonly $schema?: string;
/** The timestamp the access will expire (RFC3339 format). */
expiresAt?: string;
/** A human readeable description with details about the access request. */
message?: string;
/** The access request name. */
name: string;
/** The access request namespace. */
namespace: string;
/** The current permission description for the user. */
permission: string;
/** The timestamp the access was requested (RFC3339 format). */
requestedAt?: string;
/** The current role the user is associated with. */
role?: string;
/** The current access request status. */
status?: AccessRequestResponseBodyStatus;
/** The user associated with the access request. */
username: string;
}





/**
* Will retrieve a list of accessrequests respecting the search criteria provided as query params.
* @summary List AccessRequests
*/
export const listAccessrequest = <TData = AxiosResponse<ListAccessRequestResponseBody>>(
params?: ListAccessrequestParams, options?: AxiosRequestConfig
): Promise<TData> => {
return axios.get(
`/accessrequests`,{
...options,
params: {...params, ...options?.params},}
);
}

/**
* Will create an access request for the given user and application.
* @summary Create AccessRequest
*/
export const createAccessrequest = <TData = AxiosResponse<AccessRequestResponseBody>>(
createAccessRequestBody: NonReadonly<CreateAccessRequestBody>, options?: AxiosRequestConfig
): Promise<TData> => {
return axios.post(
`/accessrequests`,
createAccessRequestBody,options
);
}

/**
* Will retrieve the accessrequest by name
* @summary Get AccessRequest
*/
export const getAccessrequestByName = <TData = AxiosResponse<AccessRequestResponseBody>>(
name: string,
params?: GetAccessrequestByNameParams, options?: AxiosRequestConfig
): Promise<TData> => {
return axios.get(
`/accessrequests/${name}`,{
...options,
params: {...params, ...options?.params},}
);
}

export type ListAccessrequestResult = AxiosResponse<ListAccessRequestResponseBody>
export type CreateAccessrequestResult = AxiosResponse<AccessRequestResponseBody>
export type GetAccessrequestByNameResult = AxiosResponse<AccessRequestResponseBody>
22 changes: 14 additions & 8 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
"@react-buddy/ide-toolbox": "^2.4.0",
"@react-buddy/palette-antd": "^5.3.0",
"antd": "^5.20.0",
"argo-ui": "git+https://github.com/argoproj/argo-ui.git",
"classnames": "^2.5.1",
"moment": "^2.29.4",
"react": "^16.9.3",
"react-dom": "^16.9.3",
"moment-timezone": "^0.5.33",
"react-moment": "^0.9.7",
"react-router-dom": "^6.25.1",
"react-hot-loader": "^3.1.3",
"react-moment": "^0.9.7"
"@tanstack/react-query": "4.36.1",
"@tanstack/react-query-devtools": "^5.59.0",
"axios": "1.6.2"
},
"peerDependencies": {
"moment": "^2.29.4",
Expand Down Expand Up @@ -46,8 +47,8 @@
]
},
"devDependencies": {
"@types/react": "^17.0.44",
"@types/react-dom": "^17.0.9",
"@types/react": "^16.9.3",
"@types/react-dom": "^16.9.3",
"@types/react-helmet": "^6.1.0",
"@types/react-router-dom": "^5.1.8",
"@types/styled-components": "^5.1.25",
Expand All @@ -57,7 +58,6 @@
"portable-fetch": "^3.0.0",
"prettier": "3.3.3",
"raw-loader": "0.5.1",
"react-dom": "^17.0.2",
"react-keyhooks": "^0.2.3",
"rxjs": "^7.1.0",
"sass": "1.34.1",
Expand All @@ -68,5 +68,11 @@
"webpack": "^5.75.0",
"webpack-bundle-analyzer": "^4.8.0",
"webpack-cli": "^4.7.2"
}
},
"resolutions": {
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.26",
"react-toastify": "9.0.8"
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
Loading

0 comments on commit 67cd661

Please sign in to comment.