Commit Graph
12 Commits
Author SHA1 Message Date
Jeff Mitchell acce195dcb Organizations -> orgs consistency (#189)
* Organizations -> orgs consistency

* Fix up some tests and some mistaken substitutions
2020-07-11 12:00:49 -04:00
JimandJeff Mitchell 260703febe add group member capabilities (#178)
* add group member capabilities

Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
2020-07-10 19:01:23 -04:00
bcdcaffa6f Port over 162 and 165 to master (#176)
Co-authored-by: Jim Lambert <jlambert@hashicorp.com>
Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>
2020-07-10 15:46:26 -04:00
Jim 6c1b45f7f5 add principal roles (users and groups) to iam (#163) 2020-07-08 17:02:01 -04:00
Jim 3e3144117e iam and auth integration (#144) 2020-06-29 08:18:57 -04:00
Jim 342bef7767 listing projects and organizations (#124) 2020-06-18 14:53:11 -04:00
Jim ffddf24f86 iam roles (#116) 2020-06-15 12:42:08 -04:00
Jim 5c2cff3ad2 iam groups (#112) 2020-06-11 16:36:47 -04:00
Jim 10e08e90f0 cleanup tests: properly use require, catch defer errors, use testing functions (#113) 2020-06-10 12:10:34 -04:00
Jim 7d4993fb61 iam users (#96) 2020-06-04 20:05:08 -04:00
Jim ef6edbd515 Null updates (#78) 2020-05-31 19:55:56 -04:00
0c7f6da936 Static Host Catalog (#51)
* database: add wt_public_id domain type

* static-hosts: add migrations

* Rename migrations

* migrations: add description column and fix foreign keys

* Add protobuf for static host

* Add HostCatalog and HostSet

* Add Options

* Add foreign key constraint

* Add package doc

* Add copied scanner code

* Add NewHostCatalog with tests

* Override default table name for static host catalog

* WIP: save static host catalog to database

* WIP: Print db url for debugging

* Add iam test helper function

* Make gorm default to null for names and descriptions

* Add foreign key constraint from host catalog to scope

* Names are not needed for the test org and project

* Avoid an ordering dependency in down migrations

* Use wt_timestamp

* Add check constraint on host address column

* Add Host

* Add HostSet

* Add HostSetMember

* Test a HostSetMember can be written to the database

* Move the getters and setters for table name to a new file

The TableName methods are needed by gorm and the SetTableName methods
are for oplog. Moving them to a new file so related functionality is in
the same file.

* Add repository

* Add NewRepository

* Close connection before cleanup of database

* Add comments to protobuf file and regenerate

* Define repository methods for HostCatalog

* Assign PublicId when resource is inserted into the database

* Wrap a nil parameter error

* Add oplog tickets for static host types

* WIP: first cut at CreateCatalog

* CreateHostCatalog: more tests

* Detect unique constraint violation

* Use const for PublicId prefixes

* Use PostgreSQL error name instead of error code

* Add TODO comments

* Fix comments

* Use PublicId not PublicID

* Refactor: move error variables from host/static to db

The error variables defined in host/static are generic and can be reused
by other packages.

* Create a new repository for each test

* Validate CreateCatalog returns a new HostCatalog

* Do not modify the HostCatalog passed in

* Implement UpdateCatalog

* Minor cleanup to make folds work

* Implement LookupCatalog

* Refactor: extract allocCatalog function

* Add comment

* Refactor: extract newCatalogMetadata function

* Make error strings more consistent

* Move database specific error check to internal/db package

* Change signature of DeleteCatalog and update docs

* Implement DeleteCatalog

* Make error strings more consistent

* Add examples

* Update docs

* Add package level doc and example for repository

* No need for using reflect.DeepEqual

* Remove redundant comment

* Clarify ErrMultipleRecords results in the transaction being rolled back

* Remove redundant error checks

* Remove unnecessary check

* Return early instead of using nested 'else' statements

* Update and Delete must return a row count

* catch err on defers (#82)

Co-authored-by: Jim Lambert <jimlambrt@Jims-MBP-3.home>

* Remove 'if assert' pattern

* Use assert package in test helper function

* Add test for updating a non existent catalog

* Use a single assert when a specific error is expected

* Use assert package when it clarifies the check

* Catch errors in cleanup functions

* Update comments in protobuf file

* Update doc for UpdateCatalog to reflect the new behavior

* Add common error values for field mask errors

* Require a field mask when calling update methods

* Add TODO for removing direct call to gorm

* Export Public ID prefixes

* Add db timestamp guards

* Remove unused option

Co-authored-by: Jim <jlambert@hashicorp.com>
Co-authored-by: Jim Lambert <jimlambrt@Jims-MBP-3.home>
2020-05-27 18:16:43 -04:00