Skip to content

Commit

Permalink
feat: add POST endpoint for chartVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
cpate4 committed Apr 16, 2024
1 parent 47e6b7d commit 9cbefe9
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
21 changes: 21 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,27 @@ start compiling your repo.

(build out this section based on questions asked of the team)

### How do I add a new API endpoint?

New endpoints starts in [openapi.yml](./service/src/main/resources/api/openapi.yml).

Add and/or modify the desired endpoints in this document.
For documentation on `openapi` document structure,
[please start here](https://swagger.io/docs/specification/basic-structure/).

> **NOTE: This is our public facing contract.**
> Changes to this must be considered carefully for version management.
> See [API Versioning](./docs/api_versioning.md)
From here, run the following command to validate and generate the necessary `service/`
[interfaces](./service/build/swagger-code/src/main/java/bio/terra/appmanager/api),
[models](./service/build/swagger-code/src/main/java/bio/terra/appmanager/model), and
[`client/` code](./client/build/swagger-code/src/main/java/bio/terra/appmanager).

```shell
/scripts/build -t project
```

## Additional questions

The [Interactive Analysis Team](https://github.com/orgs/DataBiosphere/teams/broad-interactive-analysis)
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ http://localhost:8080
./scripts/run docker
```

## Service swagger endpoints

Existing deployed versions of this service are:

- https://appmanager.dsde-dev.broadinstitute.org

## Next steps

Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for more information about the process of
Expand Down
3 changes: 2 additions & 1 deletion scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ skip_tests=""
die() { log_error "$*" >&2; echo ""; usage; exit 2; } # complain to STDERR and exit with error
needs_arg() { if [ -z "$OPTARG" ]; then die "No arg for --$OPT option"; fi; }

while getopts h-: OPT; do # allow -h and -- "with arg"
while getopts th-: OPT; do # allow -h and -- "with arg"
# support long options: https://stackoverflow.com/a/28466267/519360
if [ "$OPT" = "-" ]; then # long option: reformulate OPT and OPTARG
OPT="${OPTARG%%=*}" # extract long option name
Expand All @@ -44,6 +44,7 @@ shift $((OPTIND-1)) # remove parsed options and args from $@ list

# process positional arguments (if any)
BUILDTYPE=$1
[ -z "${BUILDTYPE}" ] && die "Missing BUILDTYPE: '${BUILDTYPE}'"
shift 1

# use all trailing arguments as caveats to BUILD command
Expand Down
40 changes: 40 additions & 0 deletions service/src/main/resources/api/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,26 @@ paths:
$ref: '#/components/responses/ServerError'

# README /docs/api_versioning.md
#
/api/admin/v1/charts/versions:
post:
tags: [ admin ]
summary: Create new ChartVersion(s) to track
operationId: createChartVersions
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ChartArray'
responses:
'204':
description: ChartVersion(s) have been successfully created
'403':
description: Request did not come from an admin
'500':
$ref: '#/components/responses/ServerError'

/api/example/v1/message:
get:
summary: Gets your message
Expand Down Expand Up @@ -191,6 +211,26 @@ components:
build:
type: string

ChartVersion:
type: object
properties:
chartName:
type: string
chartVersion:
type: string
appVersion:
type: string
activeAt:
type: string
format: date-time
inactiveAt:
type: string
format: date-time
ChartArray:
type: array
items:
$ref: '#/components/schemas/ChartVersion'

securitySchemes:
bearerAuth:
type: http
Expand Down

0 comments on commit 9cbefe9

Please sign in to comment.