Commit Graph
39 Commits
Author SHA1 Message Date
Jeff Mitchell 670abaed88 Rename GormReadWriter -> Db 2020-05-11 16:54:05 -04:00
Jim ee4a0d3f45 refactor lookups so we can easily check for not found and do the "right" thing in the repos (#42) 2020-05-11 16:21:09 -04:00
Michael Gaffney 98cd37da97 Rename test files to match the name of the file they test (#43)
Rename test files to follow the convention of 'foo.go' and
'foo_test.go'.
2020-05-11 16:01:49 -04:00
Jim cd74d7f0ef refactor ClonableResource to just be a clonable interface (#40) 2020-05-11 14:11:21 -04:00
Jeff Mitchell 4d1b916348 Remove AllLoggers (#39)
This was copied from Vault code but shouldn't be necessary any more as a
change in hclog a while back meant that derived loggers share the log
level of the parent.
2020-05-11 13:30:38 -04:00
Jeff Mitchell 5a721f0ce3 Update deps (#38)
* Update deps

* Update against latest Vault dep
2020-05-11 13:27:54 -04:00
Jeff Mitchell 7f2aa5ca8f Add httpfs DB migrations and generate the input (#35) 2020-05-11 12:42:10 -04:00
Jim bd5ddea6e4 refactor clonable to not rely on the resource interface (#36) 2020-05-11 10:31:15 -04:00
Jim 0676ea51f1 refactor oplog to use db/internal migrations, remove InitTicket() for more reliability and simplify test step up and tear down (#37) 2020-05-11 10:30:44 -04:00
Jim c43e05be2e provide db.Open() and db.Migrate() as part of icu-64 (#34) 2020-05-08 17:21:22 -04:00
Jim 8a5197e39e implement schema, store and repository for IAM scopes of organization and project 2020-05-08 11:36:28 -04:00
Michael Gaffney 8824a6f7f9 database: add wt_public_id domain type (#30) 2020-05-06 08:29:13 -04:00
Todd Knight 05330db741 Add projectless paths for host-catalogs. (#31)
* Add projectless paths for host-catalogs.
2020-05-05 16:33:03 -07:00
Jim 725a777baf refactor friendly name to just be name (#29) 2020-05-05 16:35:24 -04:00
Jeff Mitchell 11f640a0f8 Fix compilation after Id changing 2020-05-05 14:13:08 -04:00
Jeff Mitchell f36f25a23b Add json_name fields to proto for complex names (#27)
This was generating fine before but it makes it explicit in the proto
and it avoids weirdness where the protobuf tag will say a name is
something like requestId where the json tag says it's request_id. This
way they line up.

One thing not honoring this properly is TraceId. I don't know why the
JSON tag being generated doesn't match even when explicitly set here.
For now I'm just manually fixing it.
2020-05-05 14:08:13 -04:00
Jim 27b4d7a034 basic internal db interfaces and Gorm implementation
* db reader and writer interfaces which should allow us to encapsulate the vast majority of database code in this package.

* GormReadWriter implementation of the Reader and Writer interfaces
2020-05-05 13:29:47 -04:00
Jeff Mitchell 1519a17f17 Rename catalog flag to catalog-id in hosts create command 2020-05-05 11:21:37 -04:00
Jeff Mitchell 1f3c52f495 Name and addr updates (#26)
* Rename FriendlyName to Name

* Standardize on connection parameters for the server being addr

This syncs up WATCHTOWER_ADDR and -addr (formerly -address) and frees up
-address to be used in resources (which it is).

* Add description fields
2020-05-05 11:19:42 -04:00
Jeff Mitchell e3c7ca3070 Add a hosts create command (#25) 2020-05-04 23:04:55 -04:00
Jeff Mitchell 4afb4f6be5 Minor proto updates (#22) 2020-05-04 22:57:22 -04:00
Jeff Mitchell 6970b14143 Update type value to wrapper 2020-05-04 14:58:18 -04:00
Jeff Mitchell 6254e18698 Fix compilation of command 2020-05-04 12:41:36 -04:00
Jeff Mitchell 2926cc1000 Add initial API generation bits (#20)
* Add initial API generation bits

* Revert accidental changes to oplog
2020-05-04 10:58:20 -04:00
Jeff Mitchell 7f03246c6f Add basic API client (#19) 2020-05-04 10:58:03 -04:00
Jim 2f0dd58f11 set default value in gorm tag, so database timestamp defaults will get set 2020-05-03 16:10:14 -04:00
Jim 73363d4c71 adapt to use structwrapping from go-kms-wrapping 2020-05-03 16:09:22 -04:00
Jeff Mitchell 13056e1f51 Migrate host resources to hosts package (#15)
Migrate host resources to hosts package and some other minor changes
2020-05-01 18:05:54 -04:00
Todd KnightandJeff Mitchell c7126ae69b Static Catalog Api definition (#12)
* Setup buf to see and process protos correctly.

This commit adds a proposed directory structure for protos.  Included is a rough draft of the Ec2Catalog protos.

* Add host and host_catalog service apis.

This also has for the first time the move away from holding individual ids for resources and instead using the full uri path as the api facing identifier.  There are some issues with the swagger generation stripping out the format of the path matching so currently only PATCH uses the approach I would like to move to.  In follow up commits I'll try to either get swagger to display the correct expected paths or I'll resolve if that is even needed by our clients.

* Move all protos and generated files to under the internal directory.

This also required updating the buf config to explicitly name the exluded linted proto files under oplog since previously /internal/ was listed as a root in buf.  Future commit will move oplog proto files to be with the others.

* Moved oplog related protos to under the proto directory and regenerated.

* Update the oplog protos to be compliant with buf lint.

* Clean up comments in tools.

* Merged in recent changes to oplog protos.

* Add resource result messages to contain the read only fields and separate them from the writable fields.

* Merge the ec2 catalog resources in with the more generic host_catalog resource.

* Cleaning the generated swagger.

This included adding summaries for each proto rpc method, Making the resources be the full fqn, removing the default error, and a few other tweaks.

* Make project plural in the paths.

* Adding the ability to add and remove hosts from a host set.

* Add the ignore result limit for host set request.

* Make size and host lists read only.

* Add documentation about what host references are allowed to be added.

* Remove ignore result limit when listing items.  These can be added in later.

* Add handlers and tests for unimplemented services.

* Add bootstrap target and update how tools are built (#13)

* Update tool installation method, add bootstrap target to makefile

* Changing org to orgs in all paths and org param to org_id.

* Adding tests for unimplemented service implementations.

Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
2020-05-01 12:38:01 -07:00
Todd Knight 4d86db6ba5 Introduce the proto directory structure. (#9)
* Setup buf to see and process protos correctly.

This commit adds a proposed directory structure for protos.  Included is a rough draft of the Ec2Catalog protos.

* Setup buf to see and process protos correctly.

This commit adds a proposed directory structure for protos, but leaves the existing oplog related protos alone.  Included is a rough draft of the Ec2Catalog protos.

* Update makefile and add script to generate the appropriate pb.go files.

* Add comment explaining google.golang.org/protobuf vs github.com/golang/protobuf

* Move all protos and generated files to under the internal directory.

This also required updating the buf config to explicitly name the excluded linted proto files under oplog since previously /internal/ was listed as a root in buf.  Future commit will move oplog proto files to be with the others.

* Moved oplog related protos to under the proto directory and regenerated.

* Update the oplog protos to be compliant with buf lint.
2020-04-28 11:20:37 -07:00
fca36970bf refactor replay, so that it creates the required tables during replay (#7)
Co-authored-by: Jim Lambert <jimlambrt@Jims-MBP-3.home>
Co-authored-by: Todd Knight <T.Alan.Knight@gmail.com>
2020-04-20 16:42:16 -04:00
34f530e0df Basic oplog capability (#6)
The ability to write oplog entries using a ticket based system to ensure serialization.   Uses a go-kms-wrapper for encrypting/decrypting entries.

Co-authored-by: Jim Lambert <jlm.lambert@gmail.com>
Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>
Co-authored-by: Todd Knight <T.Alan.Knight@gmail.com>
Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
2020-04-08 14:55:40 -04:00
Jeff Mitchell 5e82db8a2d Minor bugfixes and cleanup 2020-03-23 14:50:19 -04:00
Jeff Mitchell cad3c24f54 Add auth over ALPN (#5) 2020-03-22 20:17:23 -04:00
Jeff Mitchell 5acda6a0b1 Begin purpose-based listener refactoring (#4) 2020-03-22 08:27:24 -04:00
Jeff Mitchell 07032f6908 Refactoring and the worker is more distinct now (#3) 2020-03-20 12:51:39 -04:00
Jeff Mitchell 1645c3106e Migrate a bunch of stuff around to prep for worker command (#2)
Right now it's essentially a copy; it needs some updating, integration
into dev, and so on.
2020-03-19 15:17:40 -04:00
Michael Gaffney 5e5a56cac0 Refactor names to avoid stutter (#1)
Since client code uses the package name as a prefix when referring to
the package contents, the names for those contents need not repeat the
package name.

- Rename base.BaseCommand to base.Command
- Rename base.BaseServer to base.Server
- Rename config.DevConfig() to config.Dev()
- Rename config.LoadConfigFile() to config.LoadFile()
- Rename config.NewConfig() to config.New()
- Rename config.ParseConfig() to config.Parse()
- Rename controller.ControllerCommand to controller.Command
- Rename controller.NewController() to controller.New()
- Rename dev.DevCommand to dev.Command
- Rename listener.ListenerFactory to listener.Factory
- Rename listener.NewListener() to listener.New()
- Rename version.GetVersion() to version.Get()
- Rename version.VersionInfo to version.Info

See:
- https://golang.org/doc/effective_go.html#package-names
- https://blog.golang.org/package-names#TOC_3.
- https://github.com/golang/go/wiki/CodeReviewComments#package-names
2020-03-10 15:48:04 -04:00
Jeff Mitchell 482b4d56dd Initial commit 2020-03-04 12:51:46 -05:00