Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cmd/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"

"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"

"github.com/opslevel/cli/common"

Expand Down
6 changes: 3 additions & 3 deletions src/cmd/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"

"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"

"github.com/opslevel/cli/common"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -58,7 +58,7 @@ EOF`,
cobra.CheckErr(err)
result, err := getClientGQL().CreateWebhookAction(*input)
cobra.CheckErr(err)
fmt.Printf("created webhook action: %s\n", result.Id)
fmt.Printf("created webhook action: %s\n", string(result.CustomActionsId.Id))
default:
err := fmt.Errorf("unknown action type: '%s'", actionType)
cobra.CheckErr(err)
Expand Down Expand Up @@ -94,7 +94,7 @@ var listActionCmd = &cobra.Command{
} else {
w := common.NewTabWriter("ID", "NAME", "HTTP_METHOD", "WEBHOOK_URL")
for _, item := range list {
fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", item.Id, item.Name, item.HTTPMethod, item.WebhookURL)
fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", string(item.CustomActionsId.Id), item.Name, item.HttpMethod, item.WebhookUrl)
}
w.Flush()
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"slices"
"strings"

"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"slices"

"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"

"github.com/opslevel/cli/common"
"github.com/rs/zerolog/log"
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/dependency.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"fmt"

"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"time"

"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"

"github.com/creasty/defaults"
"github.com/go-git/go-git/v5"
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"strings"

"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"

"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"

"github.com/opslevel/cli/common"
"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"encoding/json"

"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"gopkg.in/yaml.v2"
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"

"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"

"github.com/opslevel/cli/common"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -108,7 +108,7 @@ EOF`,
// by adding in the first argument.
updateInput := &opslevel.FilterUpdateInput{
Id: *opslevel.NewID(args[0]),
Name: &input.Name,
Name: opslevel.NewNullableFrom(input.Name),
Predicates: input.Predicates,
Connective: input.Connective,
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strings"

"github.com/itchyny/gojq"
"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"
"github.com/spf13/cobra"
)

Expand Down
6 changes: 3 additions & 3 deletions src/cmd/infra.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"

"github.com/opslevel/cli/common"
"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"gopkg.in/yaml.v3"
Expand Down Expand Up @@ -173,7 +173,7 @@ opslevel list infra -o json | jq 'map(select(.type == "Database") | .data | from
w := csv.NewWriter(os.Stdout)
w.Write([]string{"NAME", "ID", "ALIASES"})
for _, item := range list {
w.Write([]string{item.Name, item.Id, strings.Join(item.Aliases, "/")})
w.Write([]string{item.Name, string(item.Id), strings.Join(item.Aliases, "/")})
Comment thread
rocktavious marked this conversation as resolved.
}
w.Flush()
} else {
Expand Down Expand Up @@ -216,7 +216,7 @@ EOF`,
cobra.CheckErr(err)
result, err := getClientGQL().UpdateInfrastructure(key, *input)
cobra.CheckErr(err)
fmt.Println(result.Id)
fmt.Println(string(result.Id))
},
}

Expand Down
20 changes: 14 additions & 6 deletions src/cmd/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import (
"fmt"
"slices"

"github.com/rs/zerolog/log"

"github.com/mitchellh/mapstructure"

"github.com/opslevel/cli/common"
"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -246,11 +248,17 @@ EOF
input.Spec["type"] = input.Kind
eventIntegrationInput, err := readIntegrationInput[opslevel.EventIntegrationInput](input)
cobra.CheckErr(err)
result, err = getClientGQL().UpdateEventIntegration(opslevel.EventIntegrationUpdateInput{
Id: opslevel.ID(args[0]),
Name: *eventIntegrationInput.Name,
})
cobra.CheckErr(err)
if eventIntegrationInput.Name != nil {
apiInput := opslevel.EventIntegrationUpdateInput{
Id: opslevel.ID(args[0]),
Name: eventIntegrationInput.Name.Value,
}
result, err = getClientGQL().UpdateEventIntegration(apiInput)
cobra.CheckErr(err)
} else {
log.Warn().Msgf("event integration 'name' cannot be updated as no name field was provided")
return
}
} else {
switch input.Kind {
case IntegrationTypeAWS:
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/maturity.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"

"github.com/opslevel/cli/common"
"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/open-policy-agent/opa/ast"
"github.com/open-policy-agent/opa/rego"
"github.com/open-policy-agent/opa/types"
"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"
"github.com/relvacode/iso8601"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
Expand Down
11 changes: 4 additions & 7 deletions src/cmd/property.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"
"strings"

"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"

"github.com/opslevel/cli/common"

Expand Down Expand Up @@ -61,11 +61,7 @@ var listPropertyCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
var service *opslevel.Service
var err error
if opslevel.IsID(args[0]) {
service, err = getClientGQL().GetService(*opslevel.NewID(args[0]))
} else {
service, err = getClientGQL().GetServiceWithAlias(args[0])
}
service, err = getClientGQL().GetService(args[0])
Comment thread
rocktavious marked this conversation as resolved.
cobra.CheckErr(err)
properties, err := service.GetProperties(getClientGQL(), nil)
cobra.CheckErr(err)
Expand Down Expand Up @@ -227,7 +223,8 @@ func readPropertyDefinitionInput() (*opslevel.PropertyDefinitionInput, error) {
propDefInput.Description = opslevel.RefOf(description)
}
if propertyDisplayStatus, ok := data["propertyDisplayStatus"].(string); ok {
propDefInput.PropertyDisplayStatus = opslevel.RefOf(opslevel.PropertyDisplayStatusEnum(propertyDisplayStatus))
status := opslevel.PropertyDisplayStatusEnum(propertyDisplayStatus)
propDefInput.PropertyDisplayStatus = &status
}

return &propDefInput, nil
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"

"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"

"github.com/opslevel/cli/common"
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"

"github.com/go-resty/resty/v2"
"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"

"github.com/opslevel/cli/common"
"github.com/spf13/cobra"
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/rubric.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"

"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"

"github.com/opslevel/cli/common"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -131,13 +131,13 @@ var listLevelCmd = &cobra.Command{
Short: "Lists rubric levels",
Long: `Lists rubric levels`,
Run: func(cmd *cobra.Command, args []string) {
list, err := getClientGQL().ListLevels()
resp, err := getClientGQL().ListLevels(nil)
cobra.CheckErr(err)
if isJsonOutput() {
common.JsonPrint(json.MarshalIndent(list, "", " "))
common.JsonPrint(json.MarshalIndent(resp.Nodes, "", " "))
} else {
w := common.NewTabWriter("NAME", "ALIAS", "ID")
for _, item := range list {
for _, item := range resp.Nodes {
fmt.Fprintf(w, "%s\t%s\t%s\t\n", item.Name, item.Alias, item.Id)
}
w.Flush()
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/scorecard.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"

"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"

"github.com/opslevel/cli/common"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -73,7 +73,7 @@ opslevel list scorecards -o json | jq 'map( {(.Name): (.ServiceCount)} )'
} else {
w := common.NewTabWriter("ID", "NAME", "PASSING_CHECKS", "CHECKS_COUNT", "SERVICE_COUNT")
for _, item := range list {
fmt.Fprintf(w, "%s\t%s\t%d\t%d\t%d\n", item.Id, item.Name, item.PassingChecks, item.ChecksCount, item.ServiceCount)
fmt.Fprintf(w, "%s\t%s\t%d\t%d\t%d\n", item.Id, item.Name, item.PassingChecks, item.TotalChecks, item.ServiceCount)
}
w.Flush()
}
Expand Down
12 changes: 6 additions & 6 deletions src/cmd/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"

"github.com/opslevel/opslevel-go/v2024"
"github.com/opslevel/opslevel-go/v2025"

"github.com/opslevel/cli/common"

Expand Down Expand Up @@ -38,7 +38,7 @@ EOF`,
newSecret, err := getClientGQL().CreateSecret(secretAlias, *input)
cobra.CheckErr(err)

fmt.Println(newSecret.ID)
fmt.Print("%s", string(newSecret.Id))
},
}

Expand All @@ -53,7 +53,7 @@ var getSecretCmd = &cobra.Command{
result, err := getClientGQL().GetSecret(identifier)
cobra.CheckErr(err)

common.WasFound(result.ID == "", identifier)
common.WasFound(result.Id == "", identifier)
if isYamlOutput() {
common.YamlPrint(result)
} else {
Expand All @@ -77,7 +77,7 @@ var listSecretsCmd = &cobra.Command{
} else {
w := common.NewTabWriter("ALIAS", "ID", "OWNER", "UPDATED_AT")
for _, item := range list {
fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", item.Alias, item.ID, item.Owner.Alias, item.Timestamps.UpdatedAt.Time)
fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", item.Alias, item.Id, item.Owner.Alias, item.Timestamps.UpdatedAt.Time)
}
w.Flush()
}
Expand All @@ -102,7 +102,7 @@ EOF`,
cobra.CheckErr(err)
secret, err := getClientGQL().UpdateSecret(secretId, *input)
cobra.CheckErr(err)
fmt.Println(secret.ID)
fmt.Print("%s", string(secret.Id))
},
}

Expand All @@ -116,7 +116,7 @@ var deleteSecretCmd = &cobra.Command{
secretId := args[0]
err := getClientGQL().DeleteSecret(secretId)
cobra.CheckErr(err)
fmt.Printf("deleted '%s' secret\n", secretId)
fmt.Printf("deleted secret: %s\n", secretId)
},
}

Expand Down
Loading
Loading