Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 166 additions & 21 deletions openapi-specs/component-catalog-v1.0.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ paths:
required: true
schema:
type: string
- name: accessToken
in: query
description: access token for azure queries.
required: true
schema:
type: string
responses:
"200":
description: A list of Project Component Information
Expand Down Expand Up @@ -162,6 +156,72 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/RestErrorMessage'
/catalog-items/slug/{slug}:
get:
tags:
- CatalogItems
summary: Returns the CatalogItem associated to the provided slug.
description: >
Returns the CatalogItem identified by a composite slug with format `{project-key}_{catalog-item-repository-name}`.<br/>
The separator is the first underscore (`_`); everything after it (the repo name) may itself contain underscores.<br/>
The project-key is the normalised (lowercase) Bitbucket project key that owns the item's repository.
The catalog-item-repository-name is matched against the Bitbucket repository slug of the item.<br/>
Returns 404 if no catalog item matches the provided slug.
operationId: getCatalogItemBySlug
parameters:
- name: slug
in: path
description: >
Composite slug with format `{project-key}_{catalog-item-repository-name}`.
The separator is the first underscore; the repo name may contain additional underscores.
Example: `myproject_my-component-repo`
required: true
schema:
type: string
example: 'myproject_my-component-repo'
responses:
"200":
description: The CatalogItem.
content:
application/json:
schema:
$ref: '#/components/schemas/CatalogItem'
"400":
description: Invalid or malformed slug provided.
content:
application/json:
schema:
$ref: '#/components/schemas/RestErrorMessage'
"401":
description: Invalid client token on the request.
content:
application/json:
schema:
$ref: '#/components/schemas/RestErrorMessage'
"403":
description: Insufficient permissions for the client to access the resource.
content:
application/json:
schema:
$ref: '#/components/schemas/RestErrorMessage'
"404":
description: No CatalogItem associated to the provided slug.
content:
application/json:
schema:
$ref: '#/components/schemas/RestErrorMessage'
"422":
description: Invalid CatalogItem associated to the provided slug.
content:
application/json:
schema:
$ref: '#/components/schemas/RestErrorMessage'
"500":
description: Server error.
content:
application/json:
schema:
$ref: '#/components/schemas/RestErrorMessage'
/catalog-items:
get:
tags:
Expand Down Expand Up @@ -291,12 +351,6 @@ paths:
required: true
schema:
type: string
- name: accessToken
in: query
description: access token for azure queries.
required: true
schema:
type: string
- name: sortByTitle
in: query
description: Sort the returned CatalogItems by title, either in ascending or descending order.
Expand Down Expand Up @@ -370,12 +424,6 @@ paths:
required: true
schema:
type: string
- name: accessToken
in: query
description: access token for azure queries.
required: true
schema:
type: string
responses:
"200":
description: The CatalogItem.
Expand Down Expand Up @@ -642,9 +690,9 @@ paths:
put:
tags:
- ProvisionerActions
summary: Notify provisioning Status Update
summary: Create new project component
description: >
This endpoint receives provisioning status update notifications from AWX.
This endpoint will create a new project component.
operationId: notifyProvisioningStatusUpdate
parameters:
- name: project-key
Expand Down Expand Up @@ -678,6 +726,45 @@ paths:
description: Insufficient permissions for the client to access the resource.
"500":
description: Server error.
patch:
tags:
- ProvisionerActions
summary: Update an existing project component
description: >
This endpoint receives provisioning status update notifications from AWX.
operationId: notifyProvisioningStatusUpdatePartially
parameters:
- name: project-key
in: path
description: Project key of the provisioned component.
required: true
schema:
type: string
- name: status
in: path
description: Provisioning status for the component.
required: true
example: CREATING
schema:
type: string
enum: [ CREATING, CREATED, FAILED, DELETING, UNKNOWN ]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ProvisioningStatusUpdateRequest'
responses:
"200":
description: Provisioning status update completed.
"400":
description: Bad request.
"401":
description: Invalid client token on the request.
"403":
description: Insufficient permissions for the client to access the resource.
"500":
description: Server error.

/provision/{project-key}:
delete:
Expand Down Expand Up @@ -787,6 +874,12 @@ components:
id:
type: string
example: 'aSdFam...yCg=='
slug:
type: string
description: >
Composite slug computed from the normalised Bitbucket project key and the repository slug of the item,
in the format `{project-key}_{repo-name}`. Calculated at mapping time; not retrieved from Bitbucket.
example: 'myproject_my-component-repo'
path:
type: string
example: projects/SOMEPROJECT/repos/some-repo/raw/CatalogItem.yaml?at=refs/heads/master
Expand Down Expand Up @@ -836,6 +929,7 @@ components:
- date
example:
id: aSdFam...yCg==
slug: myproject_some-repo
path: projects/SOMEPROJECT/repos/some-repo/raw/CatalogItem.yaml?at=refs/heads/master
title: An item title
shortDescription: This is a short description for the item
Expand Down Expand Up @@ -974,6 +1068,10 @@ components:
type: string
nullable: true
example: 'some hint for a workflow'
sendOnDeletion:
type: boolean
nullable: true
example: false
visible:
type: boolean
example: 'true'
Expand Down Expand Up @@ -1096,15 +1194,40 @@ components:
pattern: '^(?!\s*$).+' # reject whitespace-only
description: The componentId set by the user.
example: "any-component-id-from-backend"

catalogItemId:
type: string
description: The base64 encoded path for the catalogItem. It may include branch reference.
example: "cHJvamVjdHMvQ0FURVNUL3JlcG9zL3VzZXItYWN0aW9ucy1pdGVtL3Jhdy9DYXRhbG9nSXRlbS55YW1sP2F0PXJlZnMvaGVhZHMvbWFzdGVy"

componentUrl:
type: string
description: the repository url where the component was provisioned
example: "https://bitbucket.com/projects/DEVSTACK/repos/devstack-component-catalog"
nullable: true

parameters:
type: array
description: List of name/value string parameters.
items:
type: object
required:
- name
- value
properties:
name:
type: string
description: Parameter name
example: "environment"
values:
type: array
description: Parameter values
items:
type: string
example:
- "production"
- "staging"

ProvisioningDeleteRequest:
type: object
properties:
Expand All @@ -1113,4 +1236,26 @@ components:
minLength: 1 # disallows empty string ""
pattern: '^(?!\s*$).+' # reject whitespace-only
description: The componentId set by the user.
example: "any-component-id-from-backend"
example: "any-component-id-from-backend"

parameters:
type: array
description: List of name/value string parameters.
items:
type: object
required:
- name
- value
properties:
name:
type: string
description: Parameter name
example: "environment"
values:
type: array
description: Parameter values
items:
type: string
example:
- "production"
- "staging"
20 changes: 0 additions & 20 deletions openapi-specs/projects-info-service-v1.0.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ paths:
description: >
This endpoint receives an azure token, and returns all the groups associated to the user.
operationId: getAzureGroups
parameters:
- name: token
in: header
required: true
schema:
type: string
description: Azure token used to get the groups.
responses:
"200":
description: List of azure groups associated to the user.
Expand Down Expand Up @@ -77,13 +70,6 @@ paths:
Get all the projects a user get access to. For that, first of all it will get all the azure groups associated to the user,
and then it will get all the projects associated to those groups.
operationId: getProjects
parameters:
- name: token
in: header
required: true
schema:
type: string
description: Azure token used to get the groups.
responses:
"200":
description: List of projects the user has access to.
Expand Down Expand Up @@ -120,12 +106,6 @@ paths:
Get all project info and cluster for a given project key.
operationId: getProjectClusters
parameters:
- name: token
in: header
required: true
schema:
type: string
description: Azure token used to get the groups.
- name: projectKey
in: path
required: true
Expand Down
31 changes: 14 additions & 17 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,25 +139,22 @@ export class AppComponent implements OnInit, OnDestroy {
// Apply optimistic UI, start with it and later apply validations after fetching projects to avoid empty parts
this.projectPicker = {...this.projectPicker, label: 'Project: ', selected: currentProjectForUi.projectKey};
}
this.azureService.getAccessToken().then((accessToken: string) => {
this.projectService.getUserProjects(accessToken).subscribe((projects: string[]) => {
user.projects = projects;
this.initializeNats(user);
if (projects.length > 0) {
const latestCurrentProject = this.projectService.getCurrentProject();
if (latestCurrentProject != null && projects.includes(latestCurrentProject.projectKey)) {
this.pickProject(latestCurrentProject.projectKey);
this.projectPicker = {...this.projectPicker, label: 'Project: ', selected: latestCurrentProject.projectKey, options: projects};
} else {
this.pickProject(projects[0]);
this.projectPicker = {...this.projectPicker, label: 'Project: ', selected: projects[0], options: projects};
}
this.projectService.getUserProjects().subscribe((projects: string[]) => {
user.projects = projects;
this.initializeNats(user);
if (projects.length > 0) {
const latestCurrentProject = this.projectService.getCurrentProject();
if (latestCurrentProject != null && projects.includes(latestCurrentProject.projectKey)) {
this.pickProject(latestCurrentProject.projectKey);
this.projectPicker = {...this.projectPicker, label: 'Project: ', selected: latestCurrentProject.projectKey, options: projects};
} else {
this.pickProject(null);
this.projectPicker = {...this.projectPicker, label: 'Select project', selected: undefined, options: [] };
this.pickProject(projects[0]);
this.projectPicker = {...this.projectPicker, label: 'Project: ', selected: projects[0], options: projects};
}

});
} else {
this.pickProject(null);
this.projectPicker = {...this.projectPicker, label: 'Select project', selected: undefined, options: [] };
}
});
}
});
Expand Down
Loading
Loading