Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): add plan submit/get endpoints #175

Merged
merged 3 commits into from Jun 25, 2021

Conversation

hbollon
Copy link
Member

@hbollon hbollon commented Jun 21, 2021

I had a unique endpoint /api/plans which is used to submit plan in POST and get ones with GET method:

  • GET request: <IP>:8080/api/plans?lineage=<LINEAGE>&limit=<Optional limit> results will be sorted by most recent to oldest
  • POST request: <IP>:8080/api/plans with as body:
{
    "lineage": "<LINEAGE>",
    "terraform_version": "0.12.11",
    "git_remote": "https://github.com",
    "git_commit": "#deadbeef",
    "ci_url": "https://github.com/ci",
    "source": "foo",
    "plan_json": <PLAN_JSON_OUTPUT>
}

I also done some tweaks to the plan model:

  • added a missing omitempty tag on PlanStateResource.SchemaVersion
  • replaced PlanOutputChange by generic Change structure (and adapted json unmarshalling method), this led to the deletion of the unnecessary plan_output_changes table with the new model

This PR depends on #173, will be ready after his merge and a rebase

@coveralls
Copy link

coveralls commented Jun 21, 2021

Coverage Status

Coverage decreased (-0.6%) to 11.597% when pulling 9814af5 on hbollon:api_endpoints into aa7d455 on camptocamp:master.

@hbollon hbollon force-pushed the api_endpoints branch 3 times, most recently from 90df706 to 13f0d95 Compare June 22, 2021 11:55
api/api.go Outdated Show resolved Hide resolved
* fix: missing omitempty tag on PlanStateResource.SchemaVersion
* fix: replace PlanOutputChange by generic Change (adapt json unmarshalling)
Copy link
Contributor

@raphink raphink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hbollon
Copy link
Member Author

hbollon commented Jun 25, 2021

@raphink can we merge this PR?
So that I can open to review #176

Copy link
Contributor

@raphink raphink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@raphink raphink merged commit f341ffd into camptocamp:master Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants