Skip to content

Commit b5bdbb7

Browse files
committed
copilot review feedback
1 parent f7b8172 commit b5bdbb7

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

src/cmd/integration.go

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"encoding/json"
55
"fmt"
6+
"github.com/rs/zerolog/log"
67
"slices"
78

89
"github.com/mitchellh/mapstructure"
@@ -32,9 +33,9 @@ type IntegrationInputType struct {
3233

3334
type IntegrationInput interface {
3435
opslevel.AWSIntegrationInput |
35-
opslevel.AzureResourcesIntegrationInput |
36-
opslevel.EventIntegrationInput |
37-
opslevel.GoogleCloudIntegrationInput
36+
opslevel.AzureResourcesIntegrationInput |
37+
opslevel.EventIntegrationInput |
38+
opslevel.GoogleCloudIntegrationInput
3839
}
3940

4041
func validateIntegrationInput() (*IntegrationInputType, error) {
@@ -246,11 +247,17 @@ EOF
246247
input.Spec["type"] = input.Kind
247248
eventIntegrationInput, err := readIntegrationInput[opslevel.EventIntegrationInput](input)
248249
cobra.CheckErr(err)
249-
result, err = getClientGQL().UpdateEventIntegration(opslevel.EventIntegrationUpdateInput{
250-
Id: opslevel.ID(args[0]),
251-
Name: eventIntegrationInput.Name.Value,
252-
})
253-
cobra.CheckErr(err)
250+
if eventIntegrationInput.Name == nil {
251+
apiInput := opslevel.EventIntegrationUpdateInput{
252+
Id: opslevel.ID(args[0]),
253+
Name: eventIntegrationInput.Name.Value,
254+
}
255+
result, err = getClientGQL().UpdateEventIntegration(apiInput)
256+
cobra.CheckErr(err)
257+
} else {
258+
log.Warn().Msgf("event integration 'name' cannot be updated as no name field was provided")
259+
return
260+
}
254261
} else {
255262
switch input.Kind {
256263
case IntegrationTypeAWS:

0 commit comments

Comments
 (0)