internal/boundary: add GetResourceType to Resource
The resource type method is used to automatically create refresh tokens from a resource when that resource is the last item returned in a page. This also renames the iam domain ResourceType method to GetResourceType to align with the new method.
This commit is contained in:
1 parent
5cded25c8d
commit
0d39456418
36 files changed
+184
-21
No files matched your search
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/hashicorp/boundary/internal/errors"
|
||||
"github.com/hashicorp/boundary/internal/oplog"
|
||||
"github.com/hashicorp/boundary/internal/target/store"
|
||||
"github.com/hashicorp/boundary/internal/types/resource"
|
||||
)
|
||||
|
||||
// Target is a commmon interface for all target subtypes
|
||||
@@ -26,6 +27,7 @@ type Target interface {
|
||||
GetDescription() string
|
||||
GetVersion() uint32
|
||||
GetType() globals.Subtype
|
||||
GetResourceType() resource.Type
|
||||
GetCreateTime() *timestamp.Timestamp
|
||||
GetUpdateTime() *timestamp.Timestamp
|
||||
GetSessionMaxSeconds() uint32
|
||||
@@ -108,6 +110,11 @@ func (t *targetView) SetTableName(n string) {
|
||||
}
|
||||
}
|
||||
|
||||
// GetResourceType returns the resource type of the Target
|
||||
func (t *targetView) GetResourceType() resource.Type {
|
||||
return resource.Target
|
||||
}
|
||||
|
||||
func (t *targetView) SetHostSources(hs []HostSource) {
|
||||
t.HostSource = hs
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/hashicorp/boundary/internal/oplog"
|
||||
"github.com/hashicorp/boundary/internal/target"
|
||||
"github.com/hashicorp/boundary/internal/target/targettest/store"
|
||||
"github.com/hashicorp/boundary/internal/types/resource"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
@@ -181,6 +182,11 @@ func (t *Target) SetDescription(description string) {
|
||||
t.Description = description
|
||||
}
|
||||
|
||||
// GetResourceType returns the resource type of the Target
|
||||
func (t *Target) GetResourceType() resource.Type {
|
||||
return resource.Target
|
||||
}
|
||||
|
||||
func (t *Target) SetVersion(v uint32) {
|
||||
t.Version = v
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/hashicorp/boundary/internal/oplog"
|
||||
"github.com/hashicorp/boundary/internal/target"
|
||||
"github.com/hashicorp/boundary/internal/target/tcp/store"
|
||||
"github.com/hashicorp/boundary/internal/types/resource"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
@@ -178,6 +179,11 @@ func (t *Target) SetDescription(description string) {
|
||||
t.Description = description
|
||||
}
|
||||
|
||||
// GetResourceType returns the resource type of the Target
|
||||
func (t *Target) GetResourceType() resource.Type {
|
||||
return resource.Target
|
||||
}
|
||||
|
||||
func (t *Target) SetVersion(v uint32) {
|
||||
t.Version = v
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user