* Bump generated proto code
* Add argon2 conf sql and proto files
* Add generated code for argon2 conf
* Add Resources for Argon2 configuration
* Add get and set Configuration to repository
* Add current config reference to AuthMethod
* Fix authmethod_test
* Fix TestAccount_New
* Add WithConfiguration to options
* Add sql views for current configuration
* Fix SetTableName
* Remove duplicate testAccounts function
* Make tests clearer
* Fix comment
* Rename test variable
* Use NewPrivateId function for private Ids
* Refactor: rename public_id to private_id for password_conf and password_credential
* Remove bad comment
* Check if embedded argon2 configuration is nil
* Add checks around the WithConfiguration option
* Use spaces not tabs in proto file
* Add doc to explain choice of oplog ticket
* Verify oplog in test
* Add base SQL and protobuf files
* Add options and public Ids
* Add AuthMethod and Account resources
* Add repository
* Add CreateAuthMethod to repository
* Add CreateAccount method to repository
* Remove redundant foreign keys
* Document relationships between iam and auth tables
* Document relationships between auth and auth_password tables
* Add documentation for subtype triggers
* Use wt_scope_id domain type for scope_id
* Refactor: move test helper function
* Remove check from SetTableName
* Remove check from another SetTableName
* Use org scope in tests
* Remove handling of CreateTime and UpdateTime from docs
* Add mechanism for bundling UI assets.
The scripts/uigen.sh script will check out the UI repo, build assets,
create a static assets file, and clean up.
The dev Makefile target has been modified to run this script if no
assets file is found. There is also a build-ui target that will
unilaterally update (the dev target only builds if the file isn't found,
but doesn't update).
The handler has been updated to add the default org ID as a header if
the request path is "/".
Co-authored-by: Randall Morey <randall@randallmorey.com>
* 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>
* 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
* 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>
* 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.