implement schema, store and repository for IAM scopes of organization and project

This commit is contained in:
Jim authored and GitHub committed 2020-05-08 11:36:28 -04:00
1 parent 8824a6f7f9
commit 8a5197e39e
27 files changed
+2007 -38

No files matched your search

@@ -0,0 +1,36 @@
syntax = "proto3";
package controller.storage.iam.store.v1;
option go_package = "github.com/hashicorp/watchtower/internal/iam/store;store";
import "controller/storage/iam/store/v1/timestamp.proto";
message Scope {
// public_id is the used to access the Scope via an API
// @inject_tag: gorm:"primary_key"
string public_id = 1;
// create_time from the RDBMS
// @inject_tag: `gorm:"default:current_timestamp"`
Timestamp create_time = 2;
// update_time from the RDBMS
// @inject_tag: `gorm:"default:current_timestamp"`
Timestamp update_time = 3;
// name is the optional friendly name used to
// access the Scope via an API
// @inject_tag: `gorm:"default:null"`
string name = 4;
// Type of scope
string type = 5;
// parent_id is the id (primary key in the Scope aggregate) of scope's parent
// @inject_tag: `gorm:"default:0"`
string parent_id = 6;
// description of scope
// @inject_tag: `gorm:"default:null"`
string description = 7;
}
@@ -0,0 +1,15 @@
syntax = "proto3";
package controller.storage.iam.store.v1;
option go_package = "github.com/hashicorp/watchtower/internal/iam/store;store";
import "google/protobuf/timestamp.proto";
// Timestamp for iam messages. We've defined a new local type wrapper
// of google.protobuf.Timestamp so we can implement sql.Scanner and sql.Valuer
// interfaces. See:
// https://golang.org/pkg/database/sql/#Scanner
// https://golang.org/pkg/database/sql/driver/#Valuer
message Timestamp {
google.protobuf.Timestamp timestamp = 1;
}