openapi: import from yaml instead of JSON
Use the yaml representation of the openapi used in Image Builder to load generate the RTKQ code.
This commit is contained in:
parent
d85b02daa8
commit
45b717bc27
4 changed files with 1176 additions and 105 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import type { ConfigFile } from '@rtk-query/codegen-openapi';
|
import type { ConfigFile } from '@rtk-query/codegen-openapi';
|
||||||
|
|
||||||
const config: ConfigFile = {
|
const config: ConfigFile = {
|
||||||
schemaFile: '../schema/imageBuilder.json',
|
schemaFile: '../schema/imageBuilder.yaml',
|
||||||
apiFile: '../../src/store/emptyImageBuilderApi.ts',
|
apiFile: '../../src/store/emptyImageBuilderApi.ts',
|
||||||
apiImport: 'emptyImageBuilderApi',
|
apiImport: 'emptyImageBuilderApi',
|
||||||
outputFile: '../../src/store/imageBuilderApi.ts',
|
outputFile: '../../src/store/imageBuilderApi.ts',
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
1070
api/schema/imageBuilder.yaml
Normal file
1070
api/schema/imageBuilder.yaml
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -7,12 +7,6 @@ const injectedRtkApi = api.injectEndpoints({
|
||||||
>({
|
>({
|
||||||
query: (queryArg) => ({ url: `/architectures/${queryArg.distribution}` }),
|
query: (queryArg) => ({ url: `/architectures/${queryArg.distribution}` }),
|
||||||
}),
|
}),
|
||||||
getCloneStatus: build.query<
|
|
||||||
GetCloneStatusApiResponse,
|
|
||||||
GetCloneStatusApiArg
|
|
||||||
>({
|
|
||||||
query: (queryArg) => ({ url: `/clones/${queryArg.id}` }),
|
|
||||||
}),
|
|
||||||
getComposes: build.query<GetComposesApiResponse, GetComposesApiArg>({
|
getComposes: build.query<GetComposesApiResponse, GetComposesApiArg>({
|
||||||
query: (queryArg) => ({
|
query: (queryArg) => ({
|
||||||
url: `/composes`,
|
url: `/composes`,
|
||||||
|
|
@ -34,6 +28,12 @@ const injectedRtkApi = api.injectEndpoints({
|
||||||
params: { limit: queryArg.limit, offset: queryArg.offset },
|
params: { limit: queryArg.limit, offset: queryArg.offset },
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
getCloneStatus: build.query<
|
||||||
|
GetCloneStatusApiResponse,
|
||||||
|
GetCloneStatusApiArg
|
||||||
|
>({
|
||||||
|
query: (queryArg) => ({ url: `/clones/${queryArg.id}` }),
|
||||||
|
}),
|
||||||
getPackages: build.query<GetPackagesApiResponse, GetPackagesApiArg>({
|
getPackages: build.query<GetPackagesApiResponse, GetPackagesApiArg>({
|
||||||
query: (queryArg) => ({
|
query: (queryArg) => ({
|
||||||
url: `/packages`,
|
url: `/packages`,
|
||||||
|
|
@ -56,12 +56,6 @@ export type GetArchitecturesApiArg = {
|
||||||
/** distribution for which to look up available architectures */
|
/** distribution for which to look up available architectures */
|
||||||
distribution: string;
|
distribution: string;
|
||||||
};
|
};
|
||||||
export type GetCloneStatusApiResponse =
|
|
||||||
/** status 200 clone status */ UploadStatus;
|
|
||||||
export type GetCloneStatusApiArg = {
|
|
||||||
/** Id of clone status to get */
|
|
||||||
id: string;
|
|
||||||
};
|
|
||||||
export type GetComposesApiResponse =
|
export type GetComposesApiResponse =
|
||||||
/** status 200 a list of composes */ ComposesResponse;
|
/** status 200 a list of composes */ ComposesResponse;
|
||||||
export type GetComposesApiArg = {
|
export type GetComposesApiArg = {
|
||||||
|
|
@ -86,6 +80,12 @@ export type GetComposeClonesApiArg = {
|
||||||
/** clones page offset, default 0 */
|
/** clones page offset, default 0 */
|
||||||
offset?: number;
|
offset?: number;
|
||||||
};
|
};
|
||||||
|
export type GetCloneStatusApiResponse =
|
||||||
|
/** status 200 clone status */ UploadStatus;
|
||||||
|
export type GetCloneStatusApiArg = {
|
||||||
|
/** Id of clone status to get */
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
export type GetPackagesApiResponse =
|
export type GetPackagesApiResponse =
|
||||||
/** status 200 a list of packages */ PackagesResponse;
|
/** status 200 a list of packages */ PackagesResponse;
|
||||||
export type GetPackagesApiArg = {
|
export type GetPackagesApiArg = {
|
||||||
|
|
@ -101,14 +101,14 @@ export type GetPackagesApiArg = {
|
||||||
offset?: number;
|
offset?: number;
|
||||||
};
|
};
|
||||||
export type Repository = {
|
export type Repository = {
|
||||||
|
rhsm: boolean;
|
||||||
baseurl?: string;
|
baseurl?: string;
|
||||||
|
mirrorlist?: string;
|
||||||
|
metalink?: string;
|
||||||
|
gpgkey?: string;
|
||||||
check_gpg?: boolean;
|
check_gpg?: boolean;
|
||||||
check_repo_gpg?: boolean;
|
check_repo_gpg?: boolean;
|
||||||
gpgkey?: string;
|
|
||||||
ignore_ssl?: boolean;
|
ignore_ssl?: boolean;
|
||||||
metalink?: string;
|
|
||||||
mirrorlist?: string;
|
|
||||||
rhsm: boolean;
|
|
||||||
};
|
};
|
||||||
export type ArchitectureItem = {
|
export type ArchitectureItem = {
|
||||||
arch: string;
|
arch: string;
|
||||||
|
|
@ -116,6 +116,23 @@ export type ArchitectureItem = {
|
||||||
repositories: Repository[];
|
repositories: Repository[];
|
||||||
};
|
};
|
||||||
export type Architectures = ArchitectureItem[];
|
export type Architectures = ArchitectureItem[];
|
||||||
|
export type ComposesResponseItem = {
|
||||||
|
id: string;
|
||||||
|
request: any;
|
||||||
|
created_at: string;
|
||||||
|
image_name?: string;
|
||||||
|
};
|
||||||
|
export type ComposesResponse = {
|
||||||
|
meta: {
|
||||||
|
count: number;
|
||||||
|
};
|
||||||
|
links: {
|
||||||
|
first: string;
|
||||||
|
last: string;
|
||||||
|
};
|
||||||
|
data: ComposesResponseItem[];
|
||||||
|
};
|
||||||
|
export type UploadTypes = "aws" | "gcp" | "azure" | "aws.s3";
|
||||||
export type AwsUploadStatus = {
|
export type AwsUploadStatus = {
|
||||||
ami: string;
|
ami: string;
|
||||||
region: string;
|
region: string;
|
||||||
|
|
@ -124,45 +141,27 @@ export type Awss3UploadStatus = {
|
||||||
url: string;
|
url: string;
|
||||||
};
|
};
|
||||||
export type GcpUploadStatus = {
|
export type GcpUploadStatus = {
|
||||||
image_name: string;
|
|
||||||
project_id: string;
|
project_id: string;
|
||||||
|
image_name: string;
|
||||||
};
|
};
|
||||||
export type AzureUploadStatus = {
|
export type AzureUploadStatus = {
|
||||||
image_name: string;
|
image_name: string;
|
||||||
};
|
};
|
||||||
export type UploadTypes = "aws" | "gcp" | "azure" | "aws.s3";
|
|
||||||
export type UploadStatus = {
|
export type UploadStatus = {
|
||||||
|
status: "success" | "failure" | "pending" | "running";
|
||||||
|
type: UploadTypes;
|
||||||
options:
|
options:
|
||||||
| AwsUploadStatus
|
| AwsUploadStatus
|
||||||
| Awss3UploadStatus
|
| Awss3UploadStatus
|
||||||
| GcpUploadStatus
|
| GcpUploadStatus
|
||||||
| AzureUploadStatus;
|
| AzureUploadStatus;
|
||||||
status: "success" | "failure" | "pending" | "running";
|
|
||||||
type: UploadTypes;
|
|
||||||
};
|
|
||||||
export type ComposesResponseItem = {
|
|
||||||
created_at: string;
|
|
||||||
id: string;
|
|
||||||
image_name?: string;
|
|
||||||
request: any;
|
|
||||||
};
|
|
||||||
export type ComposesResponse = {
|
|
||||||
data: ComposesResponseItem[];
|
|
||||||
links: {
|
|
||||||
first: string;
|
|
||||||
last: string;
|
|
||||||
};
|
|
||||||
meta: {
|
|
||||||
count: number;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
export type ComposeStatusError = {
|
export type ComposeStatusError = {
|
||||||
details?: any;
|
|
||||||
id: number;
|
id: number;
|
||||||
reason: string;
|
reason: string;
|
||||||
|
details?: any;
|
||||||
};
|
};
|
||||||
export type ImageStatus = {
|
export type ImageStatus = {
|
||||||
error?: ComposeStatusError;
|
|
||||||
status:
|
status:
|
||||||
| "success"
|
| "success"
|
||||||
| "failure"
|
| "failure"
|
||||||
|
|
@ -171,48 +170,7 @@ export type ImageStatus = {
|
||||||
| "uploading"
|
| "uploading"
|
||||||
| "registering";
|
| "registering";
|
||||||
upload_status?: UploadStatus;
|
upload_status?: UploadStatus;
|
||||||
};
|
error?: ComposeStatusError;
|
||||||
export type CustomRepository = {
|
|
||||||
baseurl?: string[];
|
|
||||||
check_gpg?: boolean;
|
|
||||||
check_repo_gpg?: boolean;
|
|
||||||
enabled?: boolean;
|
|
||||||
filename?: string;
|
|
||||||
gpgkey?: string[];
|
|
||||||
id: string;
|
|
||||||
metalink?: string;
|
|
||||||
mirrorlist?: string;
|
|
||||||
name?: string;
|
|
||||||
priority?: number;
|
|
||||||
ssl_verify?: boolean;
|
|
||||||
};
|
|
||||||
export type Filesystem = {
|
|
||||||
min_size: any;
|
|
||||||
mountpoint: string;
|
|
||||||
};
|
|
||||||
export type OpenScap = {
|
|
||||||
profile_id: string;
|
|
||||||
};
|
|
||||||
export type Subscription = {
|
|
||||||
"activation-key": string;
|
|
||||||
"base-url": string;
|
|
||||||
insights: boolean;
|
|
||||||
organization: number;
|
|
||||||
rhc?: boolean;
|
|
||||||
"server-url": string;
|
|
||||||
};
|
|
||||||
export type User = {
|
|
||||||
name: string;
|
|
||||||
ssh_key: string;
|
|
||||||
};
|
|
||||||
export type Customizations = {
|
|
||||||
custom_repositories?: CustomRepository[];
|
|
||||||
filesystem?: Filesystem[];
|
|
||||||
openscap?: OpenScap;
|
|
||||||
packages?: string[];
|
|
||||||
payload_repositories?: Repository[];
|
|
||||||
subscription?: Subscription;
|
|
||||||
users?: User[];
|
|
||||||
};
|
};
|
||||||
export type Distributions =
|
export type Distributions =
|
||||||
| "rhel-8"
|
| "rhel-8"
|
||||||
|
|
@ -247,13 +205,6 @@ export type ImageTypes =
|
||||||
| "rhel-edge-commit"
|
| "rhel-edge-commit"
|
||||||
| "rhel-edge-installer"
|
| "rhel-edge-installer"
|
||||||
| "vhd";
|
| "vhd";
|
||||||
export type OsTree = {
|
|
||||||
contenturl?: string;
|
|
||||||
parent?: string;
|
|
||||||
ref?: string;
|
|
||||||
rhsm?: boolean;
|
|
||||||
url?: string;
|
|
||||||
};
|
|
||||||
export type AwsUploadRequestOptions = {
|
export type AwsUploadRequestOptions = {
|
||||||
share_with_accounts?: string[];
|
share_with_accounts?: string[];
|
||||||
share_with_sources?: string[];
|
share_with_sources?: string[];
|
||||||
|
|
@ -263,70 +214,121 @@ export type GcpUploadRequestOptions = {
|
||||||
share_with_accounts: string[];
|
share_with_accounts: string[];
|
||||||
};
|
};
|
||||||
export type AzureUploadRequestOptions = {
|
export type AzureUploadRequestOptions = {
|
||||||
image_name?: string;
|
|
||||||
resource_group: string;
|
|
||||||
source_id?: string;
|
source_id?: string;
|
||||||
subscription_id?: string;
|
|
||||||
tenant_id?: string;
|
tenant_id?: string;
|
||||||
|
subscription_id?: string;
|
||||||
|
resource_group: string;
|
||||||
|
image_name?: string;
|
||||||
};
|
};
|
||||||
export type UploadRequest = {
|
export type UploadRequest = {
|
||||||
|
type: UploadTypes;
|
||||||
options:
|
options:
|
||||||
| AwsUploadRequestOptions
|
| AwsUploadRequestOptions
|
||||||
| Awss3UploadRequestOptions
|
| Awss3UploadRequestOptions
|
||||||
| GcpUploadRequestOptions
|
| GcpUploadRequestOptions
|
||||||
| AzureUploadRequestOptions;
|
| AzureUploadRequestOptions;
|
||||||
type: UploadTypes;
|
};
|
||||||
|
export type OsTree = {
|
||||||
|
url?: string;
|
||||||
|
contenturl?: string;
|
||||||
|
ref?: string;
|
||||||
|
parent?: string;
|
||||||
|
rhsm?: boolean;
|
||||||
};
|
};
|
||||||
export type ImageRequest = {
|
export type ImageRequest = {
|
||||||
architecture: "x86_64" | "aarch64";
|
architecture: "x86_64" | "aarch64";
|
||||||
image_type: ImageTypes;
|
image_type: ImageTypes;
|
||||||
ostree?: OsTree;
|
|
||||||
upload_request: UploadRequest;
|
upload_request: UploadRequest;
|
||||||
|
ostree?: OsTree;
|
||||||
|
size?: any;
|
||||||
|
};
|
||||||
|
export type Subscription = {
|
||||||
|
organization: number;
|
||||||
|
"activation-key": string;
|
||||||
|
"server-url": string;
|
||||||
|
"base-url": string;
|
||||||
|
insights: boolean;
|
||||||
|
rhc?: boolean;
|
||||||
|
};
|
||||||
|
export type CustomRepository = {
|
||||||
|
id: string;
|
||||||
|
name?: string;
|
||||||
|
filename?: string;
|
||||||
|
baseurl?: string[];
|
||||||
|
mirrorlist?: string;
|
||||||
|
metalink?: string;
|
||||||
|
gpgkey?: string[];
|
||||||
|
check_gpg?: boolean;
|
||||||
|
check_repo_gpg?: boolean;
|
||||||
|
enabled?: boolean;
|
||||||
|
priority?: number;
|
||||||
|
ssl_verify?: boolean;
|
||||||
|
};
|
||||||
|
export type OpenScap = {
|
||||||
|
profile_id: string;
|
||||||
|
};
|
||||||
|
export type Filesystem = {
|
||||||
|
mountpoint: string;
|
||||||
|
min_size: any;
|
||||||
|
};
|
||||||
|
export type User = {
|
||||||
|
name: string;
|
||||||
|
ssh_key: string;
|
||||||
|
};
|
||||||
|
export type Customizations = {
|
||||||
|
subscription?: Subscription;
|
||||||
|
packages?: string[];
|
||||||
|
payload_repositories?: Repository[];
|
||||||
|
custom_repositories?: CustomRepository[];
|
||||||
|
openscap?: OpenScap;
|
||||||
|
filesystem?: Filesystem[];
|
||||||
|
users?: User[];
|
||||||
};
|
};
|
||||||
export type ComposeRequest = {
|
export type ComposeRequest = {
|
||||||
customizations?: Customizations;
|
|
||||||
distribution: Distributions;
|
distribution: Distributions;
|
||||||
image_name?: string;
|
image_name?: string;
|
||||||
|
image_description?: string;
|
||||||
image_requests: ImageRequest[];
|
image_requests: ImageRequest[];
|
||||||
|
customizations?: Customizations;
|
||||||
};
|
};
|
||||||
export type ComposeStatus = {
|
export type ComposeStatus = {
|
||||||
image_status: ImageStatus;
|
image_status: ImageStatus;
|
||||||
request: ComposeRequest;
|
request: ComposeRequest;
|
||||||
};
|
};
|
||||||
export type ClonesResponseItem = {
|
export type ClonesResponseItem = {
|
||||||
created_at: string;
|
|
||||||
id: string;
|
id: string;
|
||||||
request: any;
|
request: any;
|
||||||
|
created_at: string;
|
||||||
};
|
};
|
||||||
export type ClonesResponse = {
|
export type ClonesResponse = {
|
||||||
data: ClonesResponseItem[];
|
meta: {
|
||||||
|
count: number;
|
||||||
|
};
|
||||||
links: {
|
links: {
|
||||||
first: string;
|
first: string;
|
||||||
last: string;
|
last: string;
|
||||||
};
|
};
|
||||||
meta: {
|
data: ClonesResponseItem[];
|
||||||
count: number;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
export type Package = {
|
export type Package = {
|
||||||
name: string;
|
name: string;
|
||||||
summary: string;
|
summary: string;
|
||||||
};
|
};
|
||||||
export type PackagesResponse = {
|
export type PackagesResponse = {
|
||||||
data: Package[];
|
meta: {
|
||||||
|
count: number;
|
||||||
|
};
|
||||||
links: {
|
links: {
|
||||||
first: string;
|
first: string;
|
||||||
last: string;
|
last: string;
|
||||||
};
|
};
|
||||||
meta: {
|
data: Package[];
|
||||||
count: number;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
export const {
|
export const {
|
||||||
useGetArchitecturesQuery,
|
useGetArchitecturesQuery,
|
||||||
useGetCloneStatusQuery,
|
|
||||||
useGetComposesQuery,
|
useGetComposesQuery,
|
||||||
useGetComposeStatusQuery,
|
useGetComposeStatusQuery,
|
||||||
useGetComposeClonesQuery,
|
useGetComposeClonesQuery,
|
||||||
|
useGetCloneStatusQuery,
|
||||||
useGetPackagesQuery,
|
useGetPackagesQuery,
|
||||||
} = injectedRtkApi;
|
} = injectedRtkApi;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue