-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added function to sls block type * created the yor_name tag * fixed test * added cfngoat.yaml * added sls file * fixed sls file * added tf file * added tests and adjusted integration test * create new instance of ChangeAccumulator * moved all files to single dir * one test * final test fix
- Loading branch information
Showing
11 changed files
with
1,555 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package code2cloud | ||
|
||
import ( | ||
"fmt" | ||
"github.com/bridgecrewio/yor/src/common/structure" | ||
"github.com/bridgecrewio/yor/src/common/tagging/tags" | ||
"reflect" | ||
) | ||
|
||
type YorNameTag struct { | ||
tags.Tag | ||
} | ||
|
||
func (t *YorNameTag) Init() { | ||
t.Key = tags.YorNameTagKey | ||
} | ||
|
||
func (t *YorNameTag) CalculateValue(block interface{}) (tags.ITag, error) { | ||
blockVal, ok := block.(structure.IBlock) | ||
if !ok { | ||
return nil, fmt.Errorf("failed to convert data to IBlock, which is required to calculte tag value. Type of data: %s", reflect.TypeOf(block)) | ||
} | ||
|
||
return &tags.Tag{Key: t.Key, Value: blockVal.GetResourceName()}, nil | ||
} | ||
|
||
func (t *YorNameTag) GetDescription() string { | ||
return "A tag that states the resource name in the IaC config file" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.