* Feature: Create MaskManager logic to handle project -> scope update mask logic.
* Updating resource protos and services to use new mask manager setup.
Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
* Adding grants related methods to Roles.
* Adding grants back after the merge of Principals.
* Adding tests for Grant related custom methods.
* Improving api handler methods.
* Fixing tests and sdk field.
* Adding todos for adding principals and grants to List and Update Role responses.
* Fix up Set* tests and fix SetPrincipals bug.
* Making AddPrincipals and RemovePrincipals similar to the tests for AddGrants and RemoveGrants.
* Add JSON grants to output (#187)
I also changed canonical_grants to grants_canonical and used
grants_json. I believe that when members are simply different formats of
other members this is the preferred way to have it in the API. Let me
know if you disagree and we can dig in more.
* Regenerate the API role resource.
Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
* Create the organization Get handler.
* Added org listing.
* Make sure the cmp.Diff always sorts the returned organizations before comparing.
* Connect organization service to the Controller handler.
This adds parsing and validation for grant strings along with the ability to create canonical JSON and text strings from a grant.
It also adds an ACL implementation, allowing a collection of grant strings to then be checked against a resource/action tuple and indicate if it's allowed.
Note that only specific sets of provided data in grant strings is allowed. This vastly simplifies logic.
Test coverage is 100%.
A future update will consolidate and migrate types between this and IAM but I didn't want to mix that in with this.
* NewService for the project service now returns a non pointer and an error.
* Replacing t.Fatal calls with require.NoError calls.
* Initialize empty slices following the recommended way.
* Don't inline the prefix strings when validating requests.
* Check error when cleaning up the test.
* Add check that update updates the time.
* Use google.golang.org/protobuf where possible instead of github.com/golang/protobuf.
* Shorten the validateX function names.
* Inline API responses.
* Change test cleanup error logging to t.Errorf.
* Remove unneeded creation of an extra project.
* Inline regex check for invalid id.
* Build the pb.Project inline when converting from db to wire proto.
* Change stored repos into repo creating functions.
* Using iam.TestScopes instead of creating them myself.
* Remove out of date comments.
* Update name to match go test naming standards.
* Adding project service comments.
* Using scopeType's new prefix method inside scope.go
* Setting test project's name and desc to default to pass tests.
* Change host catalog to project in test.
* Fixing merge errors.
* Fixing some more merge errors.
* Fix typo in comments.
* Fix typos in project_service.go.
* Update error indicating provided id and the expected prefix.
* Make the RepoFactory types in a common directory.
* 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>