Skip to content

Conversation

@joshmarsh
Copy link
Contributor

@joshmarsh joshmarsh commented Oct 28, 2019

Summary

This PR essentially "matures" the CLI from POC status to something that you can use.

Related PRs

Optum/dce#106 corrects syntax that prevents go-swagger from generating client response models.

Code Review Tips

  • client/, models/, and mocks/ all contain autogenerated code.
  • The commands in the Makefile are listed in the order they should be run to generate said code.
  • export DCE_LOG_LEVEL=DEBUG for debug logs.

Work contained in this PR

  • Added mocks for testing
  • Added leveled logging (So we can have debug logs without effecting output users see)
  • Implemented tests on things that aren't autogenerated
  • Added swagger autogenerated api client
  • Implemented dce accounts list, dce accounts describe, dce leases list, dce leases describe, dce leases login, and dce usage
  • Added tf var configuration flags dce system deploy
  • Removed user and log command stubs
  • Added Makefile with steps for autogenerating swagger client and mocks
  • Removed redundant aws credentials from config

LevelLogger
}

func (l *LogObservation) Endf(format string, args ...interface{}) {
Copy link
Contributor Author

@joshmarsh joshmarsh Oct 28, 2019

Choose a reason for hiding this comment

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

The idomatic way of exiting with status 1 in go seems to be log.Fatal(). Added log.End() to exit 0 in cases where we need to end gracefully (e.g. user responds "no" to a confirmation prompt).

func New(config *configs.Root, awsCreds *credentials.Credentials) *UtilContainer {
func New(config *configs.Root, observation *observ.ObservationContainer) *UtilContainer {

log = observation.Logger
Copy link
Contributor Author

@joshmarsh joshmarsh Oct 28, 2019

Choose a reason for hiding this comment

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

This allows us to use idiomatic syntax like log.Info() while still using the injected logger, as opposed to s.Observation.Info().

@joshmarsh joshmarsh changed the title WIP: Feature/adding tests Feature/adding tests Nov 6, 2019
@joshmarsh joshmarsh changed the title Feature/adding tests Adding tests, logging, and remaining commands Nov 6, 2019
Copy link
Contributor

@eschwartz eschwartz left a comment

Choose a reason for hiding this comment

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

👾

@joshmarsh
Copy link
Contributor Author

/azp help

@azure-pipelines
Copy link

Supported commands
  • help:
    • Get descriptions, examples and documentation about supported commands
    • Example: help "command_name"
  • list:
    • List all pipelines for this repository using a comment.
    • Example: "list"
  • run:
    • Run all pipelines or a specific pipeline for this repository using a comment. Use this command by itself to trigger all related pipelines, or specify a pipeline to run.
    • Example: "run" or "run pipeline_name"
  • where:
    • Report back the Azure DevOps orgs that are related to this repository and org
    • Example: "where"

See additional documentation.

@joshmarsh joshmarsh merged commit 5dec9bf into master Nov 8, 2019
@joshmarsh joshmarsh deleted the feature/adding-tests branch November 8, 2019 15:26
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.

3 participants