api: update image-builder-crc api

Includes fetching tailored customizations for compliance policies.
This commit is contained in:
Sanne Raymaekers 2025-04-17 13:03:22 +02:00 committed by Klara Simickova
parent ae40150996
commit a69a09fa4f
3 changed files with 45 additions and 0 deletions

View file

@ -19,6 +19,7 @@ const config: ConfigFile = {
'getPackages',
'getOscapProfiles',
'getOscapCustomizations',
'getOscapCustomizationsForPolicy',
'createBlueprint',
'updateBlueprint',
'composeBlueprint',

View file

@ -702,6 +702,33 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Customizations'
/oscap/{policy}/{distribution}/policy_customizations:
parameters:
- in: path
name: policy
schema:
type: string
format: uuid
example: '123e4567-e89b-12d3-a456-426655440000'
required: true
- in: path
name: distribution
schema:
$ref: '#/components/schemas/Distributions'
required: true
get:
summary: get the customizations for a compliance policy
operationId: getOscapCustomizationsForPolicy
tags:
- oscap
responses:
'200':
description: |
A customizations array updated with the needed elements.
content:
application/json:
schema:
$ref: '#/components/schemas/Customizations'
/experimental/recommendations:
post:
summary: List recommended packages.

View file

@ -161,6 +161,14 @@ const injectedRtkApi = api.injectEndpoints({
url: `/oscap/${queryArg.distribution}/${queryArg.profile}/customizations`,
}),
}),
getOscapCustomizationsForPolicy: build.query<
GetOscapCustomizationsForPolicyApiResponse,
GetOscapCustomizationsForPolicyApiArg
>({
query: (queryArg) => ({
url: `/oscap/${queryArg.policy}/${queryArg.distribution}/policy_customizations`,
}),
}),
recommendPackage: build.mutation<
RecommendPackageApiResponse,
RecommendPackageApiArg
@ -339,6 +347,13 @@ export type GetOscapCustomizationsApiArg = {
/** Name of the profile to retrieve customizations from */
profile: DistributionProfileItem;
};
export type GetOscapCustomizationsForPolicyApiResponse =
/** status 200 A customizations array updated with the needed elements.
*/ Customizations;
export type GetOscapCustomizationsForPolicyApiArg = {
policy: string;
distribution: Distributions;
};
export type RecommendPackageApiResponse =
/** status 200 Return the recommended packages. */ RecommendationsResponse;
export type RecommendPackageApiArg = {
@ -1002,6 +1017,8 @@ export const {
useLazyGetOscapProfilesQuery,
useGetOscapCustomizationsQuery,
useLazyGetOscapCustomizationsQuery,
useGetOscapCustomizationsForPolicyQuery,
useLazyGetOscapCustomizationsForPolicyQuery,
useRecommendPackageMutation,
useFixupBlueprintMutation,
} = injectedRtkApi;