store: Update api schema

This updates the api schema to the newest version and also adds `isOciUploadStatus` to the type guards.
This commit is contained in:
regexowl 2023-10-17 09:27:59 +02:00 committed by Klara Simickova
parent f1762e91d9
commit de30c6c637
3 changed files with 40 additions and 4 deletions

View file

@ -506,6 +506,7 @@ components:
- $ref: '#/components/schemas/AWSS3UploadStatus'
- $ref: '#/components/schemas/GCPUploadStatus'
- $ref: '#/components/schemas/AzureUploadStatus'
- $ref: '#/components/schemas/OCIUploadStatus'
AWSUploadStatus:
type: object
required:
@ -545,6 +546,13 @@ components:
image_name:
type: string
example: 'my-image'
OCIUploadStatus:
type: object
required:
- url
properties:
url:
type: string
ComposeRequest:
type: object
additionalProperties: false
@ -636,6 +644,7 @@ components:
- gcp
- guest-image
- image-installer
- oci
- vsphere
- vsphere-ova
- wsl
@ -709,9 +718,15 @@ components:
- $ref: '#/components/schemas/AWSS3UploadRequestOptions'
- $ref: '#/components/schemas/GCPUploadRequestOptions'
- $ref: '#/components/schemas/AzureUploadRequestOptions'
- $ref: '#/components/schemas/OCIUploadRequestOptions'
UploadTypes:
type: string
enum: ['aws', 'gcp', 'azure', 'aws.s3']
enum:
- aws
- gcp
- azure
- aws.s3
- oci.objectstorage
AWSUploadRequestOptions:
type: object
properties:
@ -796,6 +811,8 @@ components:
Name of the created image.
Must begin with a letter or number, end with a letter, number or underscore, and may contain only letters, numbers, underscores, periods, or hyphens.
The total length is limited to 60 characters.
OCIUploadRequestOptions:
type: object
Customizations:
type: object
properties:

View file

@ -215,6 +215,7 @@ export type ImageTypes =
| "gcp"
| "guest-image"
| "image-installer"
| "oci"
| "vsphere"
| "vsphere-ova"
| "wsl"
@ -222,7 +223,12 @@ export type ImageTypes =
| "rhel-edge-commit"
| "rhel-edge-installer"
| "vhd";
export type UploadTypes = "aws" | "gcp" | "azure" | "aws.s3";
export type UploadTypes =
| "aws"
| "gcp"
| "azure"
| "aws.s3"
| "oci.objectstorage";
export type AwsUploadRequestOptions = {
share_with_accounts?: string[];
share_with_sources?: string[];
@ -238,13 +244,15 @@ export type AzureUploadRequestOptions = {
resource_group: string;
image_name?: string;
};
export type OciUploadRequestOptions = object;
export type UploadRequest = {
type: UploadTypes;
options:
| AwsUploadRequestOptions
| Awss3UploadRequestOptions
| GcpUploadRequestOptions
| AzureUploadRequestOptions;
| AzureUploadRequestOptions
| OciUploadRequestOptions;
};
export type OsTree = {
url?: string;
@ -339,6 +347,9 @@ export type GcpUploadStatus = {
export type AzureUploadStatus = {
image_name: string;
};
export type OciUploadStatus = {
url: string;
};
export type UploadStatus = {
status: "success" | "failure" | "pending" | "running";
type: UploadTypes;
@ -346,7 +357,8 @@ export type UploadStatus = {
| AwsUploadStatus
| Awss3UploadStatus
| GcpUploadStatus
| AzureUploadStatus;
| AzureUploadStatus
| OciUploadStatus;
};
export type ComposeStatusError = {
id: number;

View file

@ -5,6 +5,7 @@ import {
AzureUploadStatus,
GcpUploadRequestOptions,
GcpUploadStatus,
OciUploadStatus,
UploadRequest,
UploadStatus,
} from './imageBuilderApi';
@ -33,6 +34,12 @@ export const isGcpUploadStatus = (
return (status as GcpUploadStatus).project_id !== undefined;
};
export const isOciUploadStatus = (
status: UploadStatus['options']
): status is OciUploadStatus => {
return (status as OciUploadStatus).url !== undefined;
};
export const isAwss3UploadStatus = (
status: UploadStatus['options']
): status is Awss3UploadStatus => {