feat(HMS-4200): remove blueprint endpoints /experimental
This commit is contained in:
parent
55d56a3198
commit
54d09d636e
6 changed files with 472 additions and 234 deletions
|
|
@ -97,6 +97,256 @@ paths:
|
|||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/HTTPErrorList'
|
||||
/blueprints:
|
||||
get:
|
||||
summary: get a collection of blueprints
|
||||
description: "get a collection of blueprints, returns just the latest version of each blueprint"
|
||||
operationId: getBlueprints
|
||||
tags:
|
||||
- blueprint
|
||||
parameters:
|
||||
- in: query
|
||||
name: name
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
description: fetch blueprint with specific name
|
||||
- in: query
|
||||
name: search
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
description: search for blueprints by name or description
|
||||
- in: query
|
||||
name: limit
|
||||
schema:
|
||||
type: integer
|
||||
default: 100
|
||||
minimum: 1
|
||||
maximum: 100
|
||||
description: max amount of blueprints, default 100
|
||||
- in: query
|
||||
name: offset
|
||||
schema:
|
||||
type: integer
|
||||
default: 0
|
||||
minimum: 0
|
||||
description: blueprint page offset, default 0
|
||||
responses:
|
||||
'200':
|
||||
description: a list of blueprints
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/BlueprintsResponse'
|
||||
post:
|
||||
summary: create blueprint
|
||||
description: "create blueprint"
|
||||
operationId: createBlueprint
|
||||
tags:
|
||||
- blueprint
|
||||
requestBody:
|
||||
required: true
|
||||
description: details of blueprint
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/CreateBlueprintRequest"
|
||||
responses:
|
||||
'201':
|
||||
description: blueprint was saved
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CreateBlueprintResponse'
|
||||
'422':
|
||||
description: blueprint is malformed
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/HTTPErrorList'
|
||||
'403':
|
||||
description: user is not allowed to create blueprints
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/HTTPErrorList'
|
||||
/blueprints/{id}:
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
example: '123e4567-e89b-12d3-a456-426655440000'
|
||||
required: true
|
||||
description: UUID of a blueprint
|
||||
put:
|
||||
summary: update blueprint
|
||||
description: "update blueprint"
|
||||
operationId: updateBlueprint
|
||||
tags:
|
||||
- blueprint
|
||||
requestBody:
|
||||
required: true
|
||||
description: details of blueprint
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/CreateBlueprintRequest"
|
||||
responses:
|
||||
'200':
|
||||
description: blueprint was updated
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CreateBlueprintResponse'
|
||||
'404':
|
||||
description: blueprint was not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/HTTPErrorList'
|
||||
get:
|
||||
summary: get detail of a blueprint
|
||||
description: "get a blueprint detail"
|
||||
operationId: getBlueprint
|
||||
tags:
|
||||
- blueprint
|
||||
responses:
|
||||
'200':
|
||||
description: detail of a blueprint
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/BlueprintResponse'
|
||||
'404':
|
||||
description: blueprint was not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/HTTPErrorList'
|
||||
delete:
|
||||
summary: delete a blueprint
|
||||
description: |
|
||||
Deletes all versions of Blueprint, the compose will still count towards quota.
|
||||
operationId: deleteBlueprint
|
||||
tags:
|
||||
- blueprint
|
||||
responses:
|
||||
'204':
|
||||
description: Successfully deleted
|
||||
'404':
|
||||
description: Blueprint to delete was not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/HTTPErrorList'
|
||||
/blueprints/{id}/compose:
|
||||
post:
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
example: '123e4567-e89b-12d3-a456-426655440000'
|
||||
required: true
|
||||
description: UUID of a blueprint
|
||||
summary: create new compose from blueprint
|
||||
description: "create new compose from blueprint, optionally specifying the target image types to build"
|
||||
operationId: composeBlueprint
|
||||
tags:
|
||||
- blueprint
|
||||
requestBody:
|
||||
required: false
|
||||
description: "list of target image types that the user wants to build for this compose"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
image_types:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/ImageTypes"
|
||||
example: ["azure", "aws"]
|
||||
responses:
|
||||
'201':
|
||||
description: compose was created
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/ComposeResponse'
|
||||
'403':
|
||||
description: user is not allowed to compose from blueprints
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/HTTPErrorList'
|
||||
/blueprints/{id}/composes:
|
||||
get:
|
||||
summary: get composes associated with a blueprint
|
||||
description: "get a collection of composes associated to a blueprint, allows for filtering by version"
|
||||
operationId: getBlueprintComposes
|
||||
tags:
|
||||
- blueprint
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
example: '123e4567-e89b-12d3-a456-426655440000'
|
||||
required: true
|
||||
description: UUID of a blueprint
|
||||
- in: query
|
||||
name: blueprint_version
|
||||
schema:
|
||||
type: integer
|
||||
description: |
|
||||
Filter by a specific version of the Blueprint we want to fetch composes for.
|
||||
Pass special value -1 to fetch composes for latest version of the Blueprint.
|
||||
- in: query
|
||||
name: limit
|
||||
schema:
|
||||
type: integer
|
||||
default: 100
|
||||
minimum: 1
|
||||
maximum: 100
|
||||
description: max amount of composes, default 100
|
||||
- in: query
|
||||
name: offset
|
||||
schema:
|
||||
type: integer
|
||||
default: 0
|
||||
minimum: 0
|
||||
description: composes page offset, default 0
|
||||
- in: query
|
||||
name: ignoreImageTypes
|
||||
required: false
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/ImageTypes'
|
||||
example: ['rhel-edge-installer', 'rhel-edge-commit', ...]
|
||||
description: |
|
||||
Filter the composes on image type. The filter is optional and can be specified multiple times.
|
||||
responses:
|
||||
'200':
|
||||
description: a list of composes
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ComposesResponse'
|
||||
'404':
|
||||
description: blueprint was not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/HTTPErrorList'
|
||||
/composes:
|
||||
get:
|
||||
summary: get a collection of previous compose requests for the logged in user
|
||||
|
|
@ -419,7 +669,7 @@ paths:
|
|||
get:
|
||||
summary: get a collection of blueprints
|
||||
description: "get a collection of blueprints, returns just the latest version of each blueprint"
|
||||
operationId: getBlueprints
|
||||
operationId: getBlueprintsExperimental
|
||||
tags:
|
||||
- blueprint
|
||||
parameters:
|
||||
|
|
@ -460,7 +710,7 @@ paths:
|
|||
post:
|
||||
summary: create blueprint
|
||||
description: "create blueprint"
|
||||
operationId: createBlueprint
|
||||
operationId: createBlueprintExperimental
|
||||
tags:
|
||||
- blueprint
|
||||
requestBody:
|
||||
|
|
@ -502,7 +752,7 @@ paths:
|
|||
put:
|
||||
summary: update blueprint
|
||||
description: "update blueprint"
|
||||
operationId: updateBlueprint
|
||||
operationId: updateBlueprintExperimental
|
||||
tags:
|
||||
- blueprint
|
||||
requestBody:
|
||||
|
|
@ -528,7 +778,7 @@ paths:
|
|||
get:
|
||||
summary: get detail of a blueprint
|
||||
description: "get a blueprint detail"
|
||||
operationId: getBlueprint
|
||||
operationId: getBlueprintExperimental
|
||||
tags:
|
||||
- blueprint
|
||||
responses:
|
||||
|
|
@ -548,7 +798,7 @@ paths:
|
|||
summary: delete a blueprint
|
||||
description: |
|
||||
Deletes all versions of Blueprint, the compose will still count towards quota.
|
||||
operationId: deleteBlueprint
|
||||
operationId: deleteBlueprintExperimental
|
||||
tags:
|
||||
- blueprint
|
||||
responses:
|
||||
|
|
@ -573,7 +823,7 @@ paths:
|
|||
description: UUID of a blueprint
|
||||
summary: create new compose from blueprint
|
||||
description: "create new compose from blueprint, optionally specifying the target image types to build"
|
||||
operationId: composeBlueprint
|
||||
operationId: composeBlueprintExperimental
|
||||
tags:
|
||||
- blueprint
|
||||
requestBody:
|
||||
|
|
@ -608,7 +858,7 @@ paths:
|
|||
get:
|
||||
summary: get composes associated with a blueprint
|
||||
description: "get a collection of composes associated to a blueprint, allows for filtering by version"
|
||||
operationId: getBlueprintComposes
|
||||
operationId: getBlueprintComposesExperimental
|
||||
tags:
|
||||
- blueprint
|
||||
parameters:
|
||||
|
|
@ -1038,6 +1288,7 @@ components:
|
|||
- rhel-94
|
||||
- centos-8
|
||||
- centos-9
|
||||
- centos-10
|
||||
- fedora-37
|
||||
- fedora-38
|
||||
- fedora-39
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ const Release = ({ release }: ReleaseProps) => {
|
|||
'rhel-94': 'RHEL 9.4',
|
||||
'centos-8': 'CentOS Stream 8',
|
||||
'centos-9': 'CentOS Stream 9',
|
||||
'centos-10': 'CentOS Stream 10',
|
||||
'fedora-35': 'Fedora 35',
|
||||
'fedora-36': 'Fedora 36',
|
||||
'fedora-37': 'Fedora 37',
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ export const RHSM_API = '/api/rhsm/v2';
|
|||
export const EDGE_API = '/api/edge/v1';
|
||||
export const CONTENT_SOURCES_API = '/api/content-sources/v1';
|
||||
export const PROVISIONING_API = '/api/provisioning/v1';
|
||||
export const CREATE_BLUEPRINT = `${IMAGE_BUILDER_API}/experimental/blueprints`;
|
||||
export const EDIT_BLUEPRINT = `${IMAGE_BUILDER_API}/experimental/blueprints`;
|
||||
export const CREATE_BLUEPRINT = `${IMAGE_BUILDER_API}/blueprints`;
|
||||
export const EDIT_BLUEPRINT = `${IMAGE_BUILDER_API}/blueprints`;
|
||||
|
||||
export const CDN_PROD_URL = 'https://cdn.redhat.com/';
|
||||
export const CDN_STAGE_URL = 'https://cdn.stage.redhat.com/';
|
||||
|
|
|
|||
|
|
@ -7,6 +7,73 @@ const injectedRtkApi = api.injectEndpoints({
|
|||
>({
|
||||
query: (queryArg) => ({ url: `/architectures/${queryArg.distribution}` }),
|
||||
}),
|
||||
getBlueprints: build.query<GetBlueprintsApiResponse, GetBlueprintsApiArg>({
|
||||
query: (queryArg) => ({
|
||||
url: `/blueprints`,
|
||||
params: {
|
||||
name: queryArg.name,
|
||||
search: queryArg.search,
|
||||
limit: queryArg.limit,
|
||||
offset: queryArg.offset,
|
||||
},
|
||||
}),
|
||||
}),
|
||||
createBlueprint: build.mutation<
|
||||
CreateBlueprintApiResponse,
|
||||
CreateBlueprintApiArg
|
||||
>({
|
||||
query: (queryArg) => ({
|
||||
url: `/blueprints`,
|
||||
method: "POST",
|
||||
body: queryArg.createBlueprintRequest,
|
||||
}),
|
||||
}),
|
||||
updateBlueprint: build.mutation<
|
||||
UpdateBlueprintApiResponse,
|
||||
UpdateBlueprintApiArg
|
||||
>({
|
||||
query: (queryArg) => ({
|
||||
url: `/blueprints/${queryArg.id}`,
|
||||
method: "PUT",
|
||||
body: queryArg.createBlueprintRequest,
|
||||
}),
|
||||
}),
|
||||
getBlueprint: build.query<GetBlueprintApiResponse, GetBlueprintApiArg>({
|
||||
query: (queryArg) => ({ url: `/blueprints/${queryArg.id}` }),
|
||||
}),
|
||||
deleteBlueprint: build.mutation<
|
||||
DeleteBlueprintApiResponse,
|
||||
DeleteBlueprintApiArg
|
||||
>({
|
||||
query: (queryArg) => ({
|
||||
url: `/blueprints/${queryArg.id}`,
|
||||
method: "DELETE",
|
||||
}),
|
||||
}),
|
||||
composeBlueprint: build.mutation<
|
||||
ComposeBlueprintApiResponse,
|
||||
ComposeBlueprintApiArg
|
||||
>({
|
||||
query: (queryArg) => ({
|
||||
url: `/blueprints/${queryArg.id}/compose`,
|
||||
method: "POST",
|
||||
body: queryArg.body,
|
||||
}),
|
||||
}),
|
||||
getBlueprintComposes: build.query<
|
||||
GetBlueprintComposesApiResponse,
|
||||
GetBlueprintComposesApiArg
|
||||
>({
|
||||
query: (queryArg) => ({
|
||||
url: `/blueprints/${queryArg.id}/composes`,
|
||||
params: {
|
||||
blueprint_version: queryArg.blueprintVersion,
|
||||
limit: queryArg.limit,
|
||||
offset: queryArg.offset,
|
||||
ignoreImageTypes: queryArg.ignoreImageTypes,
|
||||
},
|
||||
}),
|
||||
}),
|
||||
getComposes: build.query<GetComposesApiResponse, GetComposesApiArg>({
|
||||
query: (queryArg) => ({
|
||||
url: `/composes`,
|
||||
|
|
@ -80,73 +147,6 @@ const injectedRtkApi = api.injectEndpoints({
|
|||
url: `/oscap/${queryArg.distribution}/${queryArg.profile}/customizations`,
|
||||
}),
|
||||
}),
|
||||
getBlueprints: build.query<GetBlueprintsApiResponse, GetBlueprintsApiArg>({
|
||||
query: (queryArg) => ({
|
||||
url: `/experimental/blueprints`,
|
||||
params: {
|
||||
name: queryArg.name,
|
||||
search: queryArg.search,
|
||||
limit: queryArg.limit,
|
||||
offset: queryArg.offset,
|
||||
},
|
||||
}),
|
||||
}),
|
||||
createBlueprint: build.mutation<
|
||||
CreateBlueprintApiResponse,
|
||||
CreateBlueprintApiArg
|
||||
>({
|
||||
query: (queryArg) => ({
|
||||
url: `/experimental/blueprints`,
|
||||
method: "POST",
|
||||
body: queryArg.createBlueprintRequest,
|
||||
}),
|
||||
}),
|
||||
updateBlueprint: build.mutation<
|
||||
UpdateBlueprintApiResponse,
|
||||
UpdateBlueprintApiArg
|
||||
>({
|
||||
query: (queryArg) => ({
|
||||
url: `/experimental/blueprints/${queryArg.id}`,
|
||||
method: "PUT",
|
||||
body: queryArg.createBlueprintRequest,
|
||||
}),
|
||||
}),
|
||||
getBlueprint: build.query<GetBlueprintApiResponse, GetBlueprintApiArg>({
|
||||
query: (queryArg) => ({ url: `/experimental/blueprints/${queryArg.id}` }),
|
||||
}),
|
||||
deleteBlueprint: build.mutation<
|
||||
DeleteBlueprintApiResponse,
|
||||
DeleteBlueprintApiArg
|
||||
>({
|
||||
query: (queryArg) => ({
|
||||
url: `/experimental/blueprints/${queryArg.id}`,
|
||||
method: "DELETE",
|
||||
}),
|
||||
}),
|
||||
composeBlueprint: build.mutation<
|
||||
ComposeBlueprintApiResponse,
|
||||
ComposeBlueprintApiArg
|
||||
>({
|
||||
query: (queryArg) => ({
|
||||
url: `/experimental/blueprints/${queryArg.id}/compose`,
|
||||
method: "POST",
|
||||
body: queryArg.body,
|
||||
}),
|
||||
}),
|
||||
getBlueprintComposes: build.query<
|
||||
GetBlueprintComposesApiResponse,
|
||||
GetBlueprintComposesApiArg
|
||||
>({
|
||||
query: (queryArg) => ({
|
||||
url: `/experimental/blueprints/${queryArg.id}/composes`,
|
||||
params: {
|
||||
blueprint_version: queryArg.blueprintVersion,
|
||||
limit: queryArg.limit,
|
||||
offset: queryArg.offset,
|
||||
ignoreImageTypes: queryArg.ignoreImageTypes,
|
||||
},
|
||||
}),
|
||||
}),
|
||||
recommendPackage: build.mutation<
|
||||
RecommendPackageApiResponse,
|
||||
RecommendPackageApiArg
|
||||
|
|
@ -167,6 +167,71 @@ export type GetArchitecturesApiArg = {
|
|||
/** distribution for which to look up available architectures */
|
||||
distribution: Distributions;
|
||||
};
|
||||
export type GetBlueprintsApiResponse =
|
||||
/** status 200 a list of blueprints */ BlueprintsResponse;
|
||||
export type GetBlueprintsApiArg = {
|
||||
/** fetch blueprint with specific name */
|
||||
name?: string;
|
||||
/** search for blueprints by name or description */
|
||||
search?: string;
|
||||
/** max amount of blueprints, default 100 */
|
||||
limit?: number;
|
||||
/** blueprint page offset, default 0 */
|
||||
offset?: number;
|
||||
};
|
||||
export type CreateBlueprintApiResponse =
|
||||
/** status 201 blueprint was saved */ CreateBlueprintResponse;
|
||||
export type CreateBlueprintApiArg = {
|
||||
/** details of blueprint */
|
||||
createBlueprintRequest: CreateBlueprintRequest;
|
||||
};
|
||||
export type UpdateBlueprintApiResponse =
|
||||
/** status 200 blueprint was updated */ CreateBlueprintResponse;
|
||||
export type UpdateBlueprintApiArg = {
|
||||
/** UUID of a blueprint */
|
||||
id: string;
|
||||
/** details of blueprint */
|
||||
createBlueprintRequest: CreateBlueprintRequest;
|
||||
};
|
||||
export type GetBlueprintApiResponse =
|
||||
/** status 200 detail of a blueprint */ BlueprintResponse;
|
||||
export type GetBlueprintApiArg = {
|
||||
/** UUID of a blueprint */
|
||||
id: string;
|
||||
};
|
||||
export type DeleteBlueprintApiResponse =
|
||||
/** status 204 Successfully deleted */ void;
|
||||
export type DeleteBlueprintApiArg = {
|
||||
/** UUID of a blueprint */
|
||||
id: string;
|
||||
};
|
||||
export type ComposeBlueprintApiResponse =
|
||||
/** status 201 compose was created */ ComposeResponse[];
|
||||
export type ComposeBlueprintApiArg = {
|
||||
/** UUID of a blueprint */
|
||||
id: string;
|
||||
/** list of target image types that the user wants to build for this compose */
|
||||
body: {
|
||||
image_types?: ImageTypes[];
|
||||
};
|
||||
};
|
||||
export type GetBlueprintComposesApiResponse =
|
||||
/** status 200 a list of composes */ ComposesResponse;
|
||||
export type GetBlueprintComposesApiArg = {
|
||||
/** UUID of a blueprint */
|
||||
id: string;
|
||||
/** Filter by a specific version of the Blueprint we want to fetch composes for.
|
||||
Pass special value -1 to fetch composes for latest version of the Blueprint.
|
||||
*/
|
||||
blueprintVersion?: number;
|
||||
/** max amount of composes, default 100 */
|
||||
limit?: number;
|
||||
/** composes page offset, default 0 */
|
||||
offset?: number;
|
||||
/** Filter the composes on image type. The filter is optional and can be specified multiple times.
|
||||
*/
|
||||
ignoreImageTypes?: ImageTypes[];
|
||||
};
|
||||
export type GetComposesApiResponse =
|
||||
/** status 200 a list of composes */ ComposesResponse;
|
||||
export type GetComposesApiArg = {
|
||||
|
|
@ -242,71 +307,6 @@ export type GetOscapCustomizationsApiArg = {
|
|||
/** Name of the profile to retrieve customizations from */
|
||||
profile: DistributionProfileItem;
|
||||
};
|
||||
export type GetBlueprintsApiResponse =
|
||||
/** status 200 a list of blueprints */ BlueprintsResponse;
|
||||
export type GetBlueprintsApiArg = {
|
||||
/** fetch blueprint with specific name */
|
||||
name?: string;
|
||||
/** search for blueprints by name or description */
|
||||
search?: string;
|
||||
/** max amount of blueprints, default 100 */
|
||||
limit?: number;
|
||||
/** blueprint page offset, default 0 */
|
||||
offset?: number;
|
||||
};
|
||||
export type CreateBlueprintApiResponse =
|
||||
/** status 201 blueprint was saved */ CreateBlueprintResponse;
|
||||
export type CreateBlueprintApiArg = {
|
||||
/** details of blueprint */
|
||||
createBlueprintRequest: CreateBlueprintRequest;
|
||||
};
|
||||
export type UpdateBlueprintApiResponse =
|
||||
/** status 200 blueprint was updated */ CreateBlueprintResponse;
|
||||
export type UpdateBlueprintApiArg = {
|
||||
/** UUID of a blueprint */
|
||||
id: string;
|
||||
/** details of blueprint */
|
||||
createBlueprintRequest: CreateBlueprintRequest;
|
||||
};
|
||||
export type GetBlueprintApiResponse =
|
||||
/** status 200 detail of a blueprint */ BlueprintResponse;
|
||||
export type GetBlueprintApiArg = {
|
||||
/** UUID of a blueprint */
|
||||
id: string;
|
||||
};
|
||||
export type DeleteBlueprintApiResponse =
|
||||
/** status 204 Successfully deleted */ void;
|
||||
export type DeleteBlueprintApiArg = {
|
||||
/** UUID of a blueprint */
|
||||
id: string;
|
||||
};
|
||||
export type ComposeBlueprintApiResponse =
|
||||
/** status 201 compose was created */ ComposeResponse[];
|
||||
export type ComposeBlueprintApiArg = {
|
||||
/** UUID of a blueprint */
|
||||
id: string;
|
||||
/** list of target image types that the user wants to build for this compose */
|
||||
body: {
|
||||
image_types?: ImageTypes[];
|
||||
};
|
||||
};
|
||||
export type GetBlueprintComposesApiResponse =
|
||||
/** status 200 a list of composes */ ComposesResponse;
|
||||
export type GetBlueprintComposesApiArg = {
|
||||
/** UUID of a blueprint */
|
||||
id: string;
|
||||
/** Filter by a specific version of the Blueprint we want to fetch composes for.
|
||||
Pass special value -1 to fetch composes for latest version of the Blueprint.
|
||||
*/
|
||||
blueprintVersion?: number;
|
||||
/** max amount of composes, default 100 */
|
||||
limit?: number;
|
||||
/** composes page offset, default 0 */
|
||||
offset?: number;
|
||||
/** Filter the composes on image type. The filter is optional and can be specified multiple times.
|
||||
*/
|
||||
ignoreImageTypes?: ImageTypes[];
|
||||
};
|
||||
export type RecommendPackageApiResponse =
|
||||
/** status 200 Return the recommended packages. */ RecommendationsResponse;
|
||||
export type RecommendPackageApiArg = {
|
||||
|
|
@ -358,6 +358,7 @@ export type Distributions =
|
|||
| "rhel-94"
|
||||
| "centos-8"
|
||||
| "centos-9"
|
||||
| "centos-10"
|
||||
| "fedora-37"
|
||||
| "fedora-38"
|
||||
| "fedora-39"
|
||||
|
|
@ -370,7 +371,21 @@ export type ListResponseLinks = {
|
|||
first: string;
|
||||
last: string;
|
||||
};
|
||||
export type ClientId = "api" | "ui";
|
||||
export type BlueprintItem = {
|
||||
id: string;
|
||||
version: number;
|
||||
name: string;
|
||||
description: string;
|
||||
last_modified_at: string;
|
||||
};
|
||||
export type BlueprintsResponse = {
|
||||
meta: ListResponseMeta;
|
||||
links: ListResponseLinks;
|
||||
data: BlueprintItem[];
|
||||
};
|
||||
export type CreateBlueprintResponse = {
|
||||
id: string;
|
||||
};
|
||||
export type ImageTypes =
|
||||
| "aws"
|
||||
| "azure"
|
||||
|
|
@ -668,6 +683,29 @@ export type Customizations = {
|
|||
fips?: Fips;
|
||||
installer?: Installer;
|
||||
};
|
||||
export type CreateBlueprintRequest = {
|
||||
name: string;
|
||||
description?: string;
|
||||
distribution: Distributions;
|
||||
/** Array of image requests. Having more image requests in a single blueprint is currently not supported.
|
||||
*/
|
||||
image_requests: ImageRequest[];
|
||||
customizations: Customizations;
|
||||
};
|
||||
export type BlueprintResponse = {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
distribution: Distributions;
|
||||
/** Array of image requests. Having more image requests in a single blueprint is currently not supported.
|
||||
*/
|
||||
image_requests: ImageRequest[];
|
||||
customizations: Customizations;
|
||||
};
|
||||
export type ComposeResponse = {
|
||||
id: string;
|
||||
};
|
||||
export type ClientId = "api" | "ui";
|
||||
export type ComposeRequest = {
|
||||
distribution: Distributions;
|
||||
image_name?: string;
|
||||
|
|
@ -769,9 +807,6 @@ export type ClonesResponse = {
|
|||
export type CloneStatusResponse = {
|
||||
compose_id?: string;
|
||||
} & UploadStatus;
|
||||
export type ComposeResponse = {
|
||||
id: string;
|
||||
};
|
||||
export type Package = {
|
||||
name: string;
|
||||
summary: string;
|
||||
|
|
@ -800,40 +835,6 @@ export type DistributionProfileItem =
|
|||
| "xccdf_org.ssgproject.content_profile_stig"
|
||||
| "xccdf_org.ssgproject.content_profile_stig_gui";
|
||||
export type DistributionProfileResponse = DistributionProfileItem[];
|
||||
export type BlueprintItem = {
|
||||
id: string;
|
||||
version: number;
|
||||
name: string;
|
||||
description: string;
|
||||
last_modified_at: string;
|
||||
};
|
||||
export type BlueprintsResponse = {
|
||||
meta: ListResponseMeta;
|
||||
links: ListResponseLinks;
|
||||
data: BlueprintItem[];
|
||||
};
|
||||
export type CreateBlueprintResponse = {
|
||||
id: string;
|
||||
};
|
||||
export type CreateBlueprintRequest = {
|
||||
name: string;
|
||||
description?: string;
|
||||
distribution: Distributions;
|
||||
/** Array of image requests. Having more image requests in a single blueprint is currently not supported.
|
||||
*/
|
||||
image_requests: ImageRequest[];
|
||||
customizations: Customizations;
|
||||
};
|
||||
export type BlueprintResponse = {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
distribution: Distributions;
|
||||
/** Array of image requests. Having more image requests in a single blueprint is currently not supported.
|
||||
*/
|
||||
image_requests: ImageRequest[];
|
||||
customizations: Customizations;
|
||||
};
|
||||
export type RecommendationsResponse = {
|
||||
packages: string[];
|
||||
};
|
||||
|
|
@ -844,6 +845,16 @@ export type RecommendPackageRequest = {
|
|||
export const {
|
||||
useGetArchitecturesQuery,
|
||||
useLazyGetArchitecturesQuery,
|
||||
useGetBlueprintsQuery,
|
||||
useLazyGetBlueprintsQuery,
|
||||
useCreateBlueprintMutation,
|
||||
useUpdateBlueprintMutation,
|
||||
useGetBlueprintQuery,
|
||||
useLazyGetBlueprintQuery,
|
||||
useDeleteBlueprintMutation,
|
||||
useComposeBlueprintMutation,
|
||||
useGetBlueprintComposesQuery,
|
||||
useLazyGetBlueprintComposesQuery,
|
||||
useGetComposesQuery,
|
||||
useLazyGetComposesQuery,
|
||||
useGetComposeStatusQuery,
|
||||
|
|
@ -860,15 +871,5 @@ export const {
|
|||
useLazyGetOscapProfilesQuery,
|
||||
useGetOscapCustomizationsQuery,
|
||||
useLazyGetOscapCustomizationsQuery,
|
||||
useGetBlueprintsQuery,
|
||||
useLazyGetBlueprintsQuery,
|
||||
useCreateBlueprintMutation,
|
||||
useUpdateBlueprintMutation,
|
||||
useGetBlueprintQuery,
|
||||
useLazyGetBlueprintQuery,
|
||||
useDeleteBlueprintMutation,
|
||||
useComposeBlueprintMutation,
|
||||
useGetBlueprintComposesQuery,
|
||||
useLazyGetBlueprintComposesQuery,
|
||||
useRecommendPackageMutation,
|
||||
} = injectedRtkApi;
|
||||
|
|
|
|||
|
|
@ -57,12 +57,9 @@ describe('Blueprints', () => {
|
|||
window.HTMLElement.prototype.scrollTo = function () {};
|
||||
|
||||
server.use(
|
||||
rest.get(
|
||||
`${IMAGE_BUILDER_API}/experimental/blueprints`,
|
||||
(req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(emptyGetBlueprints));
|
||||
}
|
||||
)
|
||||
rest.get(`${IMAGE_BUILDER_API}/blueprints`, (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(emptyGetBlueprints));
|
||||
})
|
||||
);
|
||||
|
||||
const { router } = await renderWithReduxRouter('', {});
|
||||
|
|
@ -163,7 +160,7 @@ describe('Blueprints', () => {
|
|||
test('redirect to index page when blueprint is invalid', async () => {
|
||||
server.use(
|
||||
rest.get(
|
||||
`${IMAGE_BUILDER_API}/experimental/blueprints/invalid-compose-id`,
|
||||
`${IMAGE_BUILDER_API}/blueprints/invalid-compose-id`,
|
||||
(req, res, ctx) => {
|
||||
return res(ctx.status(404));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ export const handlers = [
|
|||
return res(ctx.status(200), ctx.json(oscapCustomizations(profile)));
|
||||
}
|
||||
),
|
||||
rest.get(`${IMAGE_BUILDER_API}/experimental/blueprints`, (req, res, ctx) => {
|
||||
rest.get(`${IMAGE_BUILDER_API}/blueprints`, (req, res, ctx) => {
|
||||
const search = req.url.searchParams.get('search');
|
||||
const limit = req.url.searchParams.get('limit') || '10';
|
||||
const offset = req.url.searchParams.get('offset') || '0';
|
||||
|
|
@ -168,51 +168,39 @@ export const handlers = [
|
|||
|
||||
return res(ctx.status(200), ctx.json(resp));
|
||||
}),
|
||||
rest.post(
|
||||
`${IMAGE_BUILDER_API}/experimental/blueprint/:id/compose`,
|
||||
(req, res, ctx) => {
|
||||
return res(ctx.status(200));
|
||||
}
|
||||
),
|
||||
rest.post(`${IMAGE_BUILDER_API}/blueprint/:id/compose`, (req, res, ctx) => {
|
||||
return res(ctx.status(200));
|
||||
}),
|
||||
rest.post(CREATE_BLUEPRINT, (req, res, ctx) => {
|
||||
const response = {
|
||||
id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
|
||||
};
|
||||
return res(ctx.status(201), ctx.json(response));
|
||||
}),
|
||||
rest.get(
|
||||
`${IMAGE_BUILDER_API}/experimental/blueprints/:id/composes`,
|
||||
(req, res, ctx) => {
|
||||
const emptyBlueprintId = mockGetBlueprints.data[1].id;
|
||||
const outOfSyncBlueprintId = mockGetBlueprints.data[2].id;
|
||||
const centosBlueprintId = mockGetBlueprints.data[3].id;
|
||||
rest.get(`${IMAGE_BUILDER_API}/blueprints/:id/composes`, (req, res, ctx) => {
|
||||
const emptyBlueprintId = mockGetBlueprints.data[1].id;
|
||||
const outOfSyncBlueprintId = mockGetBlueprints.data[2].id;
|
||||
const centosBlueprintId = mockGetBlueprints.data[3].id;
|
||||
|
||||
switch (req.params.id) {
|
||||
case emptyBlueprintId:
|
||||
return res(ctx.status(200), ctx.json(mockEmptyBlueprintsComposes));
|
||||
case outOfSyncBlueprintId:
|
||||
return res(ctx.status(200), ctx.json(mockBlueprintComposesOutOfSync));
|
||||
case centosBlueprintId:
|
||||
return res(ctx.status(200), ctx.json(mockCentosBlueprintComposes));
|
||||
default:
|
||||
return res(ctx.status(200), ctx.json(mockBlueprintComposes));
|
||||
}
|
||||
switch (req.params.id) {
|
||||
case emptyBlueprintId:
|
||||
return res(ctx.status(200), ctx.json(mockEmptyBlueprintsComposes));
|
||||
case outOfSyncBlueprintId:
|
||||
return res(ctx.status(200), ctx.json(mockBlueprintComposesOutOfSync));
|
||||
case centosBlueprintId:
|
||||
return res(ctx.status(200), ctx.json(mockCentosBlueprintComposes));
|
||||
default:
|
||||
return res(ctx.status(200), ctx.json(mockBlueprintComposes));
|
||||
}
|
||||
),
|
||||
rest.get(
|
||||
`${IMAGE_BUILDER_API}/experimental/blueprints/:id`,
|
||||
(req, res, ctx) => {
|
||||
const id = req.params['id'];
|
||||
return res(ctx.status(200), ctx.json(getMockBlueprintResponses(id)));
|
||||
}
|
||||
),
|
||||
rest.put(
|
||||
`${IMAGE_BUILDER_API}/experimental/blueprints/:id`,
|
||||
(req, res, ctx) => {
|
||||
const id = req.params['id'];
|
||||
return res(ctx.status(200), ctx.json({ id: id }));
|
||||
}
|
||||
),
|
||||
}),
|
||||
rest.get(`${IMAGE_BUILDER_API}/blueprints/:id`, (req, res, ctx) => {
|
||||
const id = req.params['id'];
|
||||
return res(ctx.status(200), ctx.json(getMockBlueprintResponses(id)));
|
||||
}),
|
||||
rest.put(`${IMAGE_BUILDER_API}/blueprints/:id`, (req, res, ctx) => {
|
||||
const id = req.params['id'];
|
||||
return res(ctx.status(200), ctx.json({ id: id }));
|
||||
}),
|
||||
rest.post(
|
||||
`${IMAGE_BUILDER_API}/experimental/recommendations`,
|
||||
(req, res, ctx) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue