@@ -26,6 +26,11 @@ var AllIntegrationType = []IntegrationType{IntegrationTypeAWS, IntegrationTypeAz
2626
2727var IntegrationConfigCurrentVersion = "1"
2828
29+ type EventIntegrationInputDTO struct {
30+ Name string `json:"name,omitempty" yaml:"name,omitempty"`
31+ Type opslevel.EventIntegrationEnum `json:"type" yaml:"type" example:"apiDoc"`
32+ }
33+
2934type IntegrationInputType struct {
3035 Version string `yaml:"version"`
3136 Kind IntegrationType
@@ -34,9 +39,9 @@ type IntegrationInputType struct {
3439
3540type IntegrationInput interface {
3641 opslevel.AWSIntegrationInput |
37- opslevel.AzureResourcesIntegrationInput |
38- opslevel. EventIntegrationInput |
39- opslevel.GoogleCloudIntegrationInput
42+ opslevel.AzureResourcesIntegrationInput |
43+ EventIntegrationInputDTO |
44+ opslevel.GoogleCloudIntegrationInput
4045}
4146
4247func validateIntegrationInput () (* IntegrationInputType , error ) {
@@ -124,12 +129,11 @@ EOF
124129 var result * opslevel.Integration
125130 if slices .Contains (opslevel .AllEventIntegrationEnum , string (input .Kind )) {
126131 input .Spec ["type" ] = input .Kind
127- eventIntegrationInput , err := readIntegrationInput [opslevel.EventIntegrationInput ](input )
128- integrationTypeEnum := opslevel .EventIntegrationEnum (eventIntegrationInput .Type )
132+ eventIntegrationInput , err := readIntegrationInput [EventIntegrationInputDTO ](input )
129133 cobra .CheckErr (err )
130134 result , err = getClientGQL ().CreateEventIntegration (opslevel.EventIntegrationInput {
131- Name : eventIntegrationInput .Name ,
132- Type : integrationTypeEnum ,
135+ Name : opslevel . NewNullableFrom ( eventIntegrationInput .Name ) ,
136+ Type : eventIntegrationInput . Type ,
133137 })
134138 cobra .CheckErr (err )
135139 } else {
@@ -246,15 +250,17 @@ EOF
246250 var result * opslevel.Integration
247251 if slices .Contains (opslevel .AllEventIntegrationEnum , string (input .Kind )) {
248252 input .Spec ["type" ] = input .Kind
249- eventIntegrationInput , err := readIntegrationInput [opslevel. EventIntegrationInput ](input )
253+ eventIntegrationInput , err := readIntegrationInput [EventIntegrationInputDTO ](input )
250254 cobra .CheckErr (err )
251- if eventIntegrationInput .Name != nil {
255+ if eventIntegrationInput .Name != "" {
252256 apiInput := opslevel.EventIntegrationUpdateInput {
253257 Id : opslevel .ID (args [0 ]),
254- Name : eventIntegrationInput .Name . Value ,
258+ Name : eventIntegrationInput .Name ,
255259 }
256260 result , err = getClientGQL ().UpdateEventIntegration (apiInput )
261+
257262 cobra .CheckErr (err )
263+
258264 } else {
259265 log .Warn ().Msgf ("event integration 'name' cannot be updated as no name field was provided" )
260266 return
0 commit comments