Refactor: multiple rename to fix the spelling of subtype (#1227)

The definition of 'subtype' is 'a secondary or subordinate type'. The
'T' should not be capitalized (unless it is referring to a type of
submarine, which its not).
This commit is contained in:
Michael Gaffney authored and GitHub committed 2021-05-17 15:36:45 -04:00
1 parent a23d68b0dd
commit 21033a6174
16 files changed
+80 -80

No files matched your search

@@ -52,7 +52,7 @@ var (
// IdActions contains the set of actions that can be performed on
// individual resources
IdActions = map[auth.SubType]action.ActionSet{
IdActions = map[auth.Subtype]action.ActionSet{
auth.PasswordSubtype: {
action.NoOp,
action.Read,
@@ -49,7 +49,7 @@ const (
var (
// IdActions contains the set of actions that can be performed on
// individual resources
IdActions = make(map[auth.SubType]action.ActionSet)
IdActions = make(map[auth.Subtype]action.ActionSet)
// CollectionActions contains the set of actions that can be performed on
// this collection
@@ -87,7 +87,7 @@ func TestGetSession(t *testing.T) {
Scope: &scopes.ScopeInfo{Id: p.GetPublicId(), Type: scope.Project.String(), ParentScopeId: o.GetPublicId()},
States: []*pb.SessionState{{Status: session.StatusPending.String(), StartTime: sess.CreateTime.GetTimestamp()}},
Certificate: sess.Certificate,
Type: target.TcpSubType.String(),
Type: target.TcpSubtype.String(),
AuthorizedActions: testAuthorizedActions,
}
@@ -300,7 +300,7 @@ func TestList(t *testing.T) {
Status: status,
States: states,
Certificate: sess.Certificate,
Type: target.TcpSubType.String(),
Type: target.TcpSubtype.String(),
AuthorizedActions: testAuthorizedActions,
})
@@ -335,7 +335,7 @@ func TestList(t *testing.T) {
Status: status,
States: states,
Certificate: sess.Certificate,
Type: target.TcpSubType.String(),
Type: target.TcpSubtype.String(),
AuthorizedActions: testAuthorizedActions,
})
}
@@ -498,7 +498,7 @@ func TestCancel(t *testing.T) {
Scope: &scopes.ScopeInfo{Id: p.GetPublicId(), Type: scope.Project.String(), ParentScopeId: o.GetPublicId()},
Status: session.StatusCanceling.String(),
Certificate: sess.Certificate,
Type: target.TcpSubType.String(),
Type: target.TcpSubtype.String(),
AuthorizedActions: testAuthorizedActions,
}
@@ -1067,7 +1067,7 @@ func validateCreateRequest(req *pbs.CreateTargetRequest) error {
badFields["session_max_seconds"] = "This must be greater than zero."
}
switch target.SubtypeFromType(req.GetItem().GetType()) {
case target.TcpSubType:
case target.TcpSubtype:
tcpAttrs := &pb.TcpTargetAttributes{}
if err := handlers.StructToProto(req.GetItem().GetAttributes(), tcpAttrs); err != nil {
badFields["attributes"] = "Attribute fields do not match the expected format."
@@ -1111,8 +1111,8 @@ func validateUpdateRequest(req *pbs.UpdateTargetRequest) error {
badFields["session_max_seconds"] = "This must be greater than zero."
}
switch target.SubtypeFromId(req.GetItem().GetType()) {
case target.TcpSubType:
if req.GetItem().GetType() != "" && target.SubtypeFromType(req.GetItem().GetType()) != target.TcpSubType {
case target.TcpSubtype:
if req.GetItem().GetType() != "" && target.SubtypeFromType(req.GetItem().GetType()) != target.TcpSubtype {
badFields["type"] = "Cannot modify the resource type."
}
tcpAttrs := &pb.TcpTargetAttributes{}
@@ -572,7 +572,7 @@ func TestUpdate(t *testing.T) {
Description: wrapperspb.String("desc"),
SessionMaxSeconds: wrapperspb.UInt32(3600),
SessionConnectionLimit: wrapperspb.Int32(5),
Type: target.TcpSubType.String(),
Type: target.TcpSubtype.String(),
},
},
res: &pbs.UpdateTargetResponse{
@@ -604,7 +604,7 @@ func TestUpdate(t *testing.T) {
Item: &pb.Target{
Name: wrapperspb.String("name"),
Description: wrapperspb.String("desc"),
Type: target.TcpSubType.String(),
Type: target.TcpSubtype.String(),
},
},
res: &pbs.UpdateTargetResponse{