Skip to content

Commit 4a1adab

Browse files
committed
Add artifactId to service events
Signed-off-by: Andrea Frittoli <[email protected]>
1 parent 2bc3ea6 commit 4a1adab

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

pkg/api/bindings_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,8 @@ var (
654654
"content": {
655655
"environment": {
656656
"id": "test123"
657-
}
657+
},
658+
"artifactId": "0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427"
658659
}
659660
}
660661
}`
@@ -674,7 +675,8 @@ var (
674675
"content": {
675676
"environment": {
676677
"id": "test123"
677-
}
678+
},
679+
"artifactId": "0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427"
678680
}
679681
}
680682
}`
@@ -694,7 +696,8 @@ var (
694696
"content": {
695697
"environment": {
696698
"id": "test123"
697-
}
699+
},
700+
"artifactId": "0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427"
698701
}
699702
}
700703
}`
@@ -1003,14 +1006,17 @@ func init() {
10031006
serviceDeployedEvent, _ = NewServiceDeployedEvent()
10041007
setContext(serviceDeployedEvent)
10051008
serviceDeployedEvent.SetSubjectEnvironment(Reference{Id: testEnvironmentId})
1009+
serviceDeployedEvent.SetSubjectArtifactId(testArtifactId)
10061010

10071011
serviceUpgradedEvent, _ = NewServiceUpgradedEvent()
10081012
setContext(serviceUpgradedEvent)
10091013
serviceUpgradedEvent.SetSubjectEnvironment(Reference{Id: testEnvironmentId})
1014+
serviceUpgradedEvent.SetSubjectArtifactId(testArtifactId)
10101015

10111016
serviceRolledBackEvent, _ = NewServiceRolledbackEvent()
10121017
setContext(serviceRolledBackEvent)
10131018
serviceRolledBackEvent.SetSubjectEnvironment(Reference{Id: testEnvironmentId})
1019+
serviceRolledBackEvent.SetSubjectArtifactId(testArtifactId)
10141020

10151021
serviceRemovedEvent, _ = NewServiceRemovedEvent()
10161022
setContext(serviceRemovedEvent)

pkg/api/servicedeployed.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ type ServiceDeployedSubjectContent struct {
3232

3333
// The Environment where the service is deployed
3434
Environment Reference `json:"environment,omitempty"`
35+
36+
// The Id of the artifact deployed
37+
ArtifactId string `json:"artifactId,omitempty"`
3538
}
3639

3740
type ServiceDeployedSubject struct {
@@ -148,6 +151,10 @@ func (e *ServiceDeployedEvent) SetSubjectEnvironment(environment Reference) {
148151
e.Subject.Content.Environment = environment
149152
}
150153

154+
func (e *ServiceDeployedEvent) SetSubjectArtifactId(artifactId string) {
155+
e.Subject.Content.ArtifactId = artifactId
156+
}
157+
151158
func NewServiceDeployedEvent() (*ServiceDeployedEvent, error) {
152159
e := &ServiceDeployedEvent{
153160
Context: Context{

pkg/api/servicerolledback.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ type ServiceRolledbackSubjectContent struct {
3232

3333
// The Environment where the service is deployed
3434
Environment Reference `json:"environment,omitempty"`
35+
36+
// The Id of the target artifact
37+
ArtifactId string `json:"artifactId,omitempty"`
3538
}
3639

3740
type ServiceRolledbackSubject struct {
@@ -148,6 +151,10 @@ func (e *ServiceRolledbackEvent) SetSubjectEnvironment(environment Reference) {
148151
e.Subject.Content.Environment = environment
149152
}
150153

154+
func (e *ServiceRolledbackEvent) SetSubjectArtifactId(artifactId string) {
155+
e.Subject.Content.ArtifactId = artifactId
156+
}
157+
151158
func NewServiceRolledbackEvent() (*ServiceRolledbackEvent, error) {
152159
e := &ServiceRolledbackEvent{
153160
Context: Context{

pkg/api/serviceupgraded.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ type ServiceUpgradedSubjectContent struct {
3232

3333
// The Environment where the service is deployed
3434
Environment Reference `json:"environment,omitempty"`
35+
36+
// The Id of the target artifact
37+
ArtifactId string `json:"artifactId,omitempty"`
3538
}
3639

3740
type ServiceUpgradedSubject struct {
@@ -148,6 +151,10 @@ func (e *ServiceUpgradedEvent) SetSubjectEnvironment(environment Reference) {
148151
e.Subject.Content.Environment = environment
149152
}
150153

154+
func (e *ServiceUpgradedEvent) SetSubjectArtifactId(artifactId string) {
155+
e.Subject.Content.ArtifactId = artifactId
156+
}
157+
151158
func NewServiceUpgradedEvent() (*ServiceUpgradedEvent, error) {
152159
e := &ServiceUpgradedEvent{
153160
Context: Context{

0 commit comments

Comments
 (0)