Move base interfaces of the domain into a boundary package (#1415)

pull/1421/head
Michael Gaffney 5 years ago committed by GitHub
parent 11124794bf
commit d4fc2efa53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,27 @@
// Package boundary contains global interfaces and other definitions that
// define the Boundary domain.
package boundary
import "github.com/hashicorp/boundary/internal/db/timestamp"
// An Entity is an object distinguished by its identity, rather than its
// attributes. It can contain value objects and other entities.
type Entity interface {
GetPublicId() string
}
// An Aggregate is an entity that is the root of a transactional
// consistency boundary.
type Aggregate interface {
Entity
GetVersion() uint32
GetCreateTime() *timestamp.Timestamp
GetUpdateTime() *timestamp.Timestamp
}
// A Resource is an aggregate with a name and description.
type Resource interface {
Aggregate
GetName() string
GetDescription() string
}

@ -5,45 +5,23 @@ package credential
import (
"context"
"github.com/hashicorp/boundary/internal/db/timestamp"
"github.com/hashicorp/boundary/internal/boundary"
)
// An Entity is an object distinguished by its identity, rather than its
// attributes. It can contain value objects and other entities.
type Entity interface {
GetPublicId() string
}
// An Aggregate is an entity that is the root of a transactional
// consistency boundary.
type Aggregate interface {
Entity
GetVersion() uint32
GetCreateTime() *timestamp.Timestamp
GetUpdateTime() *timestamp.Timestamp
}
// A Resource is an aggregate with a name and description.
type Resource interface {
Aggregate
GetName() string
GetDescription() string
}
// A Store is a resource that can store, retrieve, and potentially generate
// credentials of differing types and access levels. It belongs to a scope
// and must support the principle of least privilege by providing
// mechanisms to limit the credentials it can access to the minimum
// necessary for the scope it is in.
type Store interface {
Resource
boundary.Resource
GetScopeId() string
}
// A Library is a resource that provides credentials that are of the same
// type and access level from a single store.
type Library interface {
Resource
boundary.Resource
GetStoreId() string
}
@ -72,7 +50,7 @@ type SecretData interface{}
// Credential is an entity containing secret data.
type Credential interface {
Entity
boundary.Entity
Secret() SecretData
}

Loading…
Cancel
Save