-
Notifications
You must be signed in to change notification settings - Fork 12
Conversation
Signed-off-by: warber <[email protected]>
Signed-off-by: warber <[email protected]>
@@ -0,0 +1,5 @@ | |||
package strutils | |||
|
|||
func Stringp(str string) *string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported function Stringp should have comment or be unexported
Signed-off-by: warber <[email protected]>
Signed-off-by: warber <[email protected]>
pkg/common/eventutils/eventutils.go
Outdated
return keptnEvent, nil | ||
} | ||
|
||
func IsTaskEventType(eventType string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported function IsTaskEventType should have comment or be unexported
pkg/common/eventutils/eventutils.go
Outdated
return len(parts) == 5 | ||
} | ||
|
||
func IsSequenceEventType(eventType string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported function IsSequenceEventType should have comment or be unexported
pkg/common/eventutils/eventutils.go
Outdated
return len(parts) == 6 | ||
} | ||
|
||
func IsValidEventType(eventType string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported function IsValidEventType should have comment or be unexported
pkg/common/eventutils/eventutils.go
Outdated
return IsSequenceEventType(eventType) || IsTaskEventType(eventType) | ||
} | ||
|
||
func ParseSequenceEventType(sequenceTriggeredEventType string) (string, string, string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported function ParseSequenceEventType should have comment or be unexported
pkg/common/eventutils/eventutils.go
Outdated
return "", "", "", fmt.Errorf("%s is not a valid keptn sequence triggered event type", sequenceTriggeredEventType) | ||
} | ||
|
||
func ParseTaskEventType(taskEventType string) (string, string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported function ParseTaskEventType should have comment or be unexported
pkg/common/eventutils/eventutils.go
Outdated
return parts[3], parts[4], nil | ||
} | ||
|
||
func ParseEventKind(eventType string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported function ParseEventKind should have comment or be unexported
pkg/common/eventutils/eventutils.go
Outdated
return parts[len(parts)-1], nil | ||
} | ||
|
||
func ParseEventTypeWithoutKind(eventType string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported function ParseEventTypeWithoutKind should have comment or be unexported
pkg/common/eventutils/eventutils.go
Outdated
return strings.TrimSuffix(eventType, "."+kind), nil | ||
} | ||
|
||
func ReplaceEventTypeKind(eventType, newKind string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported function ReplaceEventTypeKind should have comment or be unexported
Signed-off-by: warber <[email protected]>
pkg/lib/v0_2_0/events.go
Outdated
@@ -176,3 +265,109 @@ func Decode(in, out interface{}) error { | |||
func EventDataAs(in models.KeptnContextExtendedCE, out interface{}) error { | |||
return Decode(in.Data, out) | |||
} | |||
|
|||
func KeptnEvent(eventType string, payload interface{}) *KeptnEventBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported function KeptnEvent should have comment or be unexported
return &KeptnEventBuilder{ce} | ||
} | ||
|
||
type KeptnEventBuilder struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported type KeptnEventBuilder should have comment or be unexported
models.KeptnContextExtendedCE | ||
} | ||
|
||
func (eb *KeptnEventBuilder) Build() (models.KeptnContextExtendedCE, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported method KeptnEventBuilder.Build should have comment or be unexported
return eb.KeptnContextExtendedCE, nil | ||
} | ||
|
||
func (eb *KeptnEventBuilder) WithKeptnSpecVersion(keptnSpecVersion string) *KeptnEventBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported method KeptnEventBuilder.WithKeptnSpecVersion should have comment or be unexported
return eb | ||
} | ||
|
||
func (eb *KeptnEventBuilder) WithKeptnContext(keptnContext string) *KeptnEventBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported method KeptnEventBuilder.WithKeptnContext should have comment or be unexported
pkg/lib/v0_2_0/events.go
Outdated
return eb | ||
} | ||
|
||
func (eb *KeptnEventBuilder) WithSource(source string) *KeptnEventBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported method KeptnEventBuilder.WithSource should have comment or be unexported
return eb | ||
} | ||
|
||
func (eb *KeptnEventBuilder) WithTriggeredID(triggeredID string) *KeptnEventBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported method KeptnEventBuilder.WithTriggeredID should have comment or be unexported
return eb | ||
} | ||
|
||
func (eb *KeptnEventBuilder) WithID(id string) *KeptnEventBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported method KeptnEventBuilder.WithID should have comment or be unexported
return eb | ||
} | ||
|
||
func ToCloudEvent(keptnEvent models.KeptnContextExtendedCE) cloudevents.Event { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported function ToCloudEvent should have comment or be unexported
return event | ||
} | ||
|
||
func ToKeptnEvent(event cloudevents.Event) (models.KeptnContextExtendedCE, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported function ToKeptnEvent should have comment or be unexported
Signed-off-by: Florian Bacher <[email protected]>
Signed-off-by: warber <[email protected]>
Signed-off-by: warber <[email protected]>
pkg/common/osutils/osutils.go
Outdated
|
||
import "os" | ||
|
||
// GetOSEnv retrieves the value of the environment variable named by the key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
comment on exported function GetOSEnvOrDefault should be of the form "GetOSEnvOrDefault ..."
Signed-off-by: Florian Bacher <[email protected]>
|
||
const keptnTimeFormat = "2006-01-02T15:04:05.000Z" | ||
|
||
func GetKeptnTimeStamp(timestamp time.Time) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported function GetKeptnTimeStamp should have comment or be unexported
Signed-off-by: warber <[email protected]>
@@ -176,3 +266,105 @@ func Decode(in, out interface{}) error { | |||
func EventDataAs(in models.KeptnContextExtendedCE, out interface{}) error { | |||
return Decode(in.Data, out) | |||
} | |||
|
|||
func KeptnEvent(eventType string, source string, payload interface{}) *KeptnEventBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported function KeptnEvent should have comment or be unexported
Signed-off-by: warber <[email protected]>
This reverts commit ac6c097 Signed-off-by: warber <[email protected]>
Signed-off-by: warber <[email protected]>
Signed-off-by: warber <[email protected]>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@@ -0,0 +1,6 @@ | |||
package strutils | |||
|
|||
// Sringp returns a string pointer of the given string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
comment on exported function Stringp should be of the form "Stringp ..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This PR contains utilities for creating Keptn Cloud Events as well as several other utility functions