Restructured all packages to be more modular

This commit is contained in:
colin-mckibben-sp
2022-09-27 15:55:45 -04:00
parent 647fc3d1fb
commit ae7785d0f3
26 changed files with 148 additions and 149 deletions

View File

@@ -1,4 +1,4 @@
package client package connclient
import ( import (
"bytes" "bytes"
@@ -10,11 +10,13 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"path" "path"
"github.com/sailpoint-oss/sp-cli/client"
) )
// ConnClient is an sp connect client for a specific connector // ConnClient is an sp connect client for a specific connector
type ConnClient struct { type ConnClient struct {
client Client client client.Client
version *int version *int
config json.RawMessage config json.RawMessage
connectorRef string connectorRef string
@@ -22,7 +24,7 @@ type ConnClient struct {
} }
// NewConnClient returns a client for the provided (connectorID, version, config) // NewConnClient returns a client for the provided (connectorID, version, config)
func NewConnClient(client Client, version *int, config json.RawMessage, connectorRef string, endpoint string) *ConnClient { func NewConnClient(client client.Client, version *int, config json.RawMessage, connectorRef string, endpoint string) *ConnClient {
return &ConnClient{ return &ConnClient{
client: client, client: client,
version: version, version: version,
@@ -691,8 +693,6 @@ func (cc *ConnClient) rawInvokeWithConfig(cmdType string, input json.RawMessage,
return json.Marshal(invokeCmd) return json.Marshal(invokeCmd)
} }
const connectorsEndpoint = "/beta/platform-connectors"
func connResourceUrl(endpoint string, resourceParts ...string) string { func connResourceUrl(endpoint string, resourceParts ...string) string {
u, err := url.Parse(endpoint) u, err := url.Parse(endpoint)
if err != nil { if err != nil {

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2022, SailPoint Technologies, Inc. All rights reserved. // Copyright (c) 2022, SailPoint Technologies, Inc. All rights reserved.
package client package connclient
import ( import (
"bytes" "bytes"
@@ -13,18 +13,20 @@ import (
"net/url" "net/url"
"path" "path"
"time" "time"
"github.com/sailpoint-oss/sp-cli/client"
) )
const TimeFormatLocal = `2006-01-02T15:04:05.000-07:00` const TimeFormatLocal = `2006-01-02T15:04:05.000-07:00`
const TimeLocationLocal = "Local" const TimeLocationLocal = "Local"
type LogsClient struct { type LogsClient struct {
client Client client client.Client
endpoint string endpoint string
} }
// NewConnClient returns a client for the provided (connectorID, version, config) // NewConnClient returns a client for the provided (connectorID, version, config)
func NewLogsClient(client Client, endpoint string) *LogsClient { func NewLogsClient(client client.Client, endpoint string) *LogsClient {
return &LogsClient{ return &LogsClient{
client: client, client: client,
endpoint: endpoint, endpoint: endpoint,

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2022, SailPoint Technologies, Inc. All rights reserved. // Copyright (c) 2022, SailPoint Technologies, Inc. All rights reserved.
package client package connclient
import ( import (
"testing" "testing"

View File

@@ -23,8 +23,8 @@ func NewConnCmd(client client.Client) *cobra.Command {
Use: "connectors", Use: "connectors",
Short: "Manage Connectors", Short: "Manage Connectors",
Aliases: []string{"conn"}, Aliases: []string{"conn"},
Run: func(cmd *cobra.Command, args []string) { Run: func(command *cobra.Command, args []string) {
_, _ = fmt.Fprintf(cmd.OutOrStdout(), cmd.UsageString()) _, _ = fmt.Fprintf(command.OutOrStdout(), command.UsageString())
}, },
} }

View File

@@ -8,6 +8,7 @@ import (
"strconv" "strconv"
"github.com/sailpoint-oss/sp-cli/client" "github.com/sailpoint-oss/sp-cli/client"
connclient "github.com/sailpoint-oss/sp-cli/cmd/connector/client"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@@ -69,16 +70,7 @@ func invokeConfig(cmd *cobra.Command) (json.RawMessage, error) {
return os.ReadFile(cmd.Flags().Lookup("config-path").Value.String()) return os.ReadFile(cmd.Flags().Lookup("config-path").Value.String())
} }
type invokeCommand struct { func connClient(cmd *cobra.Command, spClient client.Client) (*connclient.ConnClient, error) {
ConnectorID string `json:"connectorID"`
Version *int `json:"version"`
Type string `json:"type"`
Config json.RawMessage `json:"config"`
Input json.RawMessage `json:"input"`
}
func connClient(cmd *cobra.Command, spClient client.Client) (*client.ConnClient, error) {
connectorRef := cmd.Flags().Lookup("id").Value.String() connectorRef := cmd.Flags().Lookup("id").Value.String()
version := cmd.Flags().Lookup("version").Value.String() version := cmd.Flags().Lookup("version").Value.String()
endpoint := cmd.Flags().Lookup("conn-endpoint").Value.String() endpoint := cmd.Flags().Lookup("conn-endpoint").Value.String()
@@ -96,18 +88,18 @@ func connClient(cmd *cobra.Command, spClient client.Client) (*client.ConnClient,
if err != nil { if err != nil {
return nil, err return nil, err
} }
cc := client.NewConnClient(spClient, v, cfg, connectorRef, endpoint) cc := connclient.NewConnClient(spClient, v, cfg, connectorRef, endpoint)
return cc, nil return cc, nil
} }
func connClientWithCustomParams(spClient client.Client, cfg json.RawMessage, connectorID, version, endpoint string) (*client.ConnClient, error) { func connClientWithCustomParams(spClient client.Client, cfg json.RawMessage, connectorID, version, endpoint string) (*connclient.ConnClient, error) {
v, err := strconv.Atoi(version) v, err := strconv.Atoi(version)
if err != nil { if err != nil {
return nil, err return nil, err
} }
cc := client.NewConnClient(spClient, &v, cfg, connectorID, endpoint) cc := connclient.NewConnClient(spClient, &v, cfg, connectorID, endpoint)
return cc, nil return cc, nil
} }

View File

@@ -7,6 +7,7 @@ import (
"fmt" "fmt"
"github.com/sailpoint-oss/sp-cli/client" "github.com/sailpoint-oss/sp-cli/client"
connclient "github.com/sailpoint-oss/sp-cli/cmd/connector/client"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@@ -24,7 +25,7 @@ func newConnInvokeAccountUpdateCmd(spClient client.Client) *cobra.Command {
} }
changesRaw := cmd.Flags().Lookup("changes").Value.String() changesRaw := cmd.Flags().Lookup("changes").Value.String()
var changes []client.AttributeChange var changes []connclient.AttributeChange
if err := json.Unmarshal([]byte(changesRaw), &changes); err != nil { if err := json.Unmarshal([]byte(changesRaw), &changes); err != nil {
return err return err
} }

View File

@@ -7,11 +7,12 @@ import (
"github.com/fatih/color" "github.com/fatih/color"
"github.com/sailpoint-oss/sp-cli/client" "github.com/sailpoint-oss/sp-cli/client"
connclient "github.com/sailpoint-oss/sp-cli/cmd/connector/client"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
) )
var logInput = client.LogInput{} var logInput = connclient.LogInput{}
func newConnLogsCmd(spClient client.Client) *cobra.Command { func newConnLogsCmd(spClient client.Client) *cobra.Command {
@@ -33,7 +34,7 @@ func newConnLogsCmd(spClient client.Client) *cobra.Command {
return nil return nil
}, },
} }
cmd.PersistentFlags().StringP("logs-endpoint", "o", viper.GetString("baseurl")+client.LogsEndpoint, "Override logs endpoint") cmd.PersistentFlags().StringP("logs-endpoint", "o", viper.GetString("baseurl")+connclient.LogsEndpoint, "Override logs endpoint")
//date filters //date filters
cmd.Flags().StringP("start", "s", "", `start time - get the logs from this point. An absolute timestamp in RFC3339 format, or a relative time (eg. 2h). Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`) cmd.Flags().StringP("start", "s", "", `start time - get the logs from this point. An absolute timestamp in RFC3339 format, or a relative time (eg. 2h). Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`)
cmd.Flags().StringP("stop", "", "", `end time - get the logs upto this point. An absolute timestamp in RFC3339 format, or a relative time (eg. 2h). Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`) cmd.Flags().StringP("stop", "", "", `end time - get the logs upto this point. An absolute timestamp in RFC3339 format, or a relative time (eg. 2h). Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`)
@@ -51,7 +52,7 @@ func newConnLogsCmd(spClient client.Client) *cobra.Command {
return cmd return cmd
} }
func printLogs(logEvents *client.LogEvents, cmd *cobra.Command) error { func printLogs(logEvents *connclient.LogEvents, cmd *cobra.Command) error {
rawPrint, _ := cmd.Flags().GetBool("raw") rawPrint, _ := cmd.Flags().GetBool("raw")
if rawPrint { if rawPrint {
@@ -66,9 +67,9 @@ func printLogs(logEvents *client.LogEvents, cmd *cobra.Command) error {
return nil return nil
} }
func getAllLogs(spClient client.Client, cmd *cobra.Command, fn func(logEvents *client.LogEvents, cmd *cobra.Command) error) error { func getAllLogs(spClient client.Client, cmd *cobra.Command, fn func(logEvents *connclient.LogEvents, cmd *cobra.Command) error) error {
endpoint := cmd.Flags().Lookup("logs-endpoint").Value.String() endpoint := cmd.Flags().Lookup("logs-endpoint").Value.String()
lc := client.NewLogsClient(spClient, endpoint) lc := connclient.NewLogsClient(spClient, endpoint)
logInput.NextToken = "" logInput.NextToken = ""
for { for {
@@ -97,14 +98,14 @@ func formatDates(cmd *cobra.Command) error {
return fmt.Errorf(`must provide a "--start" time when "--stop" specified`) return fmt.Errorf(`must provide a "--start" time when "--stop" specified`)
} }
if startTimeFlag != "" { if startTimeFlag != "" {
retTime, err := client.ParseTime(startTimeFlag, now) retTime, err := connclient.ParseTime(startTimeFlag, now)
if err != nil { if err != nil {
return err return err
} }
logInput.Filter.StartTime = &retTime logInput.Filter.StartTime = &retTime
} }
if stopTimeFlag != "" { if stopTimeFlag != "" {
retTime, err := client.ParseTime(stopTimeFlag, now) retTime, err := connclient.ParseTime(stopTimeFlag, now)
if err != nil { if err != nil {
return err return err
} }
@@ -114,7 +115,7 @@ func formatDates(cmd *cobra.Command) error {
} }
// Format log message for display // Format log message for display
func formatLog(logMessage client.LogMessage) string { func formatLog(logMessage connclient.LogMessage) string {
green := color.New(color.FgGreen).SprintFunc() green := color.New(color.FgGreen).SprintFunc()
yellow := color.New(color.FgYellow).SprintFunc() yellow := color.New(color.FgYellow).SprintFunc()

View File

@@ -5,6 +5,7 @@ import (
"time" "time"
"github.com/sailpoint-oss/sp-cli/client" "github.com/sailpoint-oss/sp-cli/client"
connclient "github.com/sailpoint-oss/sp-cli/cmd/connector/client"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@@ -26,7 +27,7 @@ func newConnLogsTailCmd(client client.Client) *cobra.Command {
} }
func tailLogs(spClient client.Client, cmd *cobra.Command) error { func tailLogs(spClient client.Client, cmd *cobra.Command) error {
handleLogs := func(logEvents *client.LogEvents, cmd *cobra.Command) error { handleLogs := func(logEvents *connclient.LogEvents, cmd *cobra.Command) error {
if err := printLogs(logEvents, cmd); err != nil { if err := printLogs(logEvents, cmd); err != nil {
return err return err
} }

View File

@@ -7,6 +7,7 @@ import (
"github.com/olekukonko/tablewriter" "github.com/olekukonko/tablewriter"
"github.com/sailpoint-oss/sp-cli/client" "github.com/sailpoint-oss/sp-cli/client"
connclient "github.com/sailpoint-oss/sp-cli/cmd/connector/client"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
) )
@@ -36,7 +37,7 @@ func newConnStatsCmd(spClient client.Client) *cobra.Command {
return nil return nil
}, },
} }
cmd.PersistentFlags().StringP("stats-endpoint", "o", viper.GetString("baseurl")+client.StatsEndpoint, "Override stats endpoint") cmd.PersistentFlags().StringP("stats-endpoint", "o", viper.GetString("baseurl")+connclient.StatsEndpoint, "Override stats endpoint")
cmd.Flags().StringP("duration", "d", "", `Length of time represented by an integer(1-9) and a duration unit. Supported duration units: d,w. eg 1d, 3w`) cmd.Flags().StringP("duration", "d", "", `Length of time represented by an integer(1-9) and a duration unit. Supported duration units: d,w. eg 1d, 3w`)
cmd.Flags().StringP("id", "c", "", "Connector ID") cmd.Flags().StringP("id", "c", "", "Connector ID")
return cmd return cmd
@@ -44,7 +45,7 @@ func newConnStatsCmd(spClient client.Client) *cobra.Command {
func getTenantStats(spClient client.Client, cmd *cobra.Command) error { func getTenantStats(spClient client.Client, cmd *cobra.Command) error {
endpoint := cmd.Flags().Lookup("stats-endpoint").Value.String() endpoint := cmd.Flags().Lookup("stats-endpoint").Value.String()
lc := client.NewLogsClient(spClient, endpoint) lc := connclient.NewLogsClient(spClient, endpoint)
connectorID := cmd.Flags().Lookup("id").Value.String() connectorID := cmd.Flags().Lookup("id").Value.String()
durationStr := cmd.Flags().Lookup("duration").Value.String() durationStr := cmd.Flags().Lookup("duration").Value.String()

View File

@@ -9,7 +9,7 @@ import (
"github.com/logrusorgru/aurora" "github.com/logrusorgru/aurora"
"github.com/olekukonko/tablewriter" "github.com/olekukonko/tablewriter"
"github.com/sailpoint-oss/sp-cli/client" "github.com/sailpoint-oss/sp-cli/client"
"github.com/sailpoint-oss/sp-cli/validate" connvalidate "github.com/sailpoint-oss/sp-cli/cmd/connector/validate"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@@ -25,7 +25,7 @@ func newConnValidateCmd(apiClient client.Client) *cobra.Command {
if list { if list {
table := tablewriter.NewWriter(os.Stdout) table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"ID", "Description"}) table.SetHeader([]string{"ID", "Description"})
for _, c := range validate.Checks { for _, c := range connvalidate.Checks {
table.Append([]string{ table.Append([]string{
c.ID, c.ID,
c.Description, c.Description,
@@ -43,7 +43,7 @@ func newConnValidateCmd(apiClient client.Client) *cobra.Command {
check := cmd.Flags().Lookup("check").Value.String() check := cmd.Flags().Lookup("check").Value.String()
isReadOnly, _ := strconv.ParseBool(cmd.Flags().Lookup("read-only").Value.String()) isReadOnly, _ := strconv.ParseBool(cmd.Flags().Lookup("read-only").Value.String())
valid := validate.NewValidator(validate.Config{ valid := connvalidate.NewValidator(connvalidate.Config{
Check: check, Check: check,
ReadOnly: isReadOnly, ReadOnly: isReadOnly,
}, cc) }, cc)

View File

@@ -19,8 +19,8 @@ import (
"github.com/logrusorgru/aurora" "github.com/logrusorgru/aurora"
"github.com/olekukonko/tablewriter" "github.com/olekukonko/tablewriter"
"github.com/sailpoint-oss/sp-cli/client" "github.com/sailpoint-oss/sp-cli/client"
connvalidate "github.com/sailpoint-oss/sp-cli/cmd/connector/validate"
"github.com/sailpoint-oss/sp-cli/util" "github.com/sailpoint-oss/sp-cli/util"
"github.com/sailpoint-oss/sp-cli/validate"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"gopkg.in/alessio/shellescape.v1" "gopkg.in/alessio/shellescape.v1"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
@@ -170,7 +170,7 @@ func validateConnectors(ctx context.Context, apiClient client.Client, source Sou
log.Println(err) log.Println(err)
} }
validator := validate.NewValidator(validate.Config{ validator := connvalidate.NewValidator(connvalidate.Config{
Check: "", Check: "",
ReadOnly: source.ReadOnly, ReadOnly: source.ReadOnly,
}, cc) }, cc)

View File

@@ -1,11 +1,11 @@
package validate package connvalidate
import ( import (
"context" "context"
"time" "time"
"github.com/kr/pretty" "github.com/kr/pretty"
"github.com/sailpoint-oss/sp-cli/client" connclient "github.com/sailpoint-oss/sp-cli/cmd/connector/client"
) )
var accountCreateChecks = []Check{ var accountCreateChecks = []Check{
@@ -16,7 +16,7 @@ var accountCreateChecks = []Check{
RequiredCommands: []string{ RequiredCommands: []string{
"std:account:create", "std:account:create",
}, },
Run: func(ctx context.Context, spec *client.ConnSpec, cc *client.ConnClient, res *CheckResult) { Run: func(ctx context.Context, spec *connclient.ConnSpec, cc *connclient.ConnClient, res *CheckResult) {
input := map[string]interface{}{} input := map[string]interface{}{}
_, _, err := cc.AccountCreate(ctx, nil, input) _, _, err := cc.AccountCreate(ctx, nil, input)
if err == nil { if err == nil {
@@ -33,7 +33,7 @@ var accountCreateChecks = []Check{
"std:account:read", "std:account:read",
"std:account:delete", "std:account:delete",
}, },
Run: func(ctx context.Context, spec *client.ConnSpec, cc *client.ConnClient, res *CheckResult) { Run: func(ctx context.Context, spec *connclient.ConnSpec, cc *connclient.ConnClient, res *CheckResult) {
input := map[string]interface{}{} input := map[string]interface{}{}
for _, field := range spec.AccountCreateTemplate.Fields { for _, field := range spec.AccountCreateTemplate.Fields {
if field.Required { if field.Required {
@@ -79,7 +79,7 @@ var accountCreateChecks = []Check{
"std:account:read", "std:account:read",
"std:account:delete", "std:account:delete",
}, },
Run: func(ctx context.Context, spec *client.ConnSpec, cc *client.ConnClient, res *CheckResult) { Run: func(ctx context.Context, spec *connclient.ConnSpec, cc *connclient.ConnClient, res *CheckResult) {
input := map[string]interface{}{} input := map[string]interface{}{}
for _, field := range spec.AccountCreateTemplate.Fields { for _, field := range spec.AccountCreateTemplate.Fields {
input[getFieldName(field)] = genCreateField(field) input[getFieldName(field)] = genCreateField(field)
@@ -124,7 +124,7 @@ var accountCreateChecks = []Check{
"std:account:delete", "std:account:delete",
"std:account:list", "std:account:list",
}, },
Run: func(ctx context.Context, spec *client.ConnSpec, cc *client.ConnClient, res *CheckResult) { Run: func(ctx context.Context, spec *connclient.ConnSpec, cc *connclient.ConnClient, res *CheckResult) {
accountsPreCreate, _, err := cc.AccountList(ctx) accountsPreCreate, _, err := cc.AccountList(ctx)
if err != nil { if err != nil {
res.err(err) res.err(err)

View File

@@ -1,12 +1,12 @@
package validate package connvalidate
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/kr/pretty"
"strconv" "strconv"
"github.com/sailpoint-oss/sp-cli/client" "github.com/kr/pretty"
connclient "github.com/sailpoint-oss/sp-cli/cmd/connector/client"
) )
var accountReadChecks = []Check{ var accountReadChecks = []Check{
@@ -18,7 +18,7 @@ var accountReadChecks = []Check{
"std:account:read", "std:account:read",
"std:account:list", "std:account:list",
}, },
Run: func(ctx context.Context, spec *client.ConnSpec, cc *client.ConnClient, res *CheckResult) { Run: func(ctx context.Context, spec *connclient.ConnSpec, cc *connclient.ConnClient, res *CheckResult) {
accounts, _, err := cc.AccountList(ctx) accounts, _, err := cc.AccountList(ctx)
if err != nil { if err != nil {
res.err(err) res.err(err)
@@ -55,7 +55,7 @@ var accountReadChecks = []Check{
RequiredCommands: []string{ RequiredCommands: []string{
"std:account:read", "std:account:read",
}, },
Run: func(ctx context.Context, spec *client.ConnSpec, cc *client.ConnClient, res *CheckResult) { Run: func(ctx context.Context, spec *connclient.ConnSpec, cc *connclient.ConnClient, res *CheckResult) {
_, _, err := cc.AccountRead(ctx, "__sailpoint__not__found__", "") _, _, err := cc.AccountRead(ctx, "__sailpoint__not__found__", "")
if err == nil { if err == nil {
res.errf("expected error for non-existant identity") res.errf("expected error for non-existant identity")
@@ -69,10 +69,10 @@ var accountReadChecks = []Check{
RequiredCommands: []string{ RequiredCommands: []string{
"std:account:list", "std:account:list",
}, },
Run: func(ctx context.Context, spec *client.ConnSpec, cc *client.ConnClient, res *CheckResult) { Run: func(ctx context.Context, spec *connclient.ConnSpec, cc *connclient.ConnClient, res *CheckResult) {
additionalAttributes := map[string]string{} additionalAttributes := map[string]string{}
attrsByName := map[string]client.AccountSchemaAttribute{} attrsByName := map[string]connclient.AccountSchemaAttribute{}
for _, value := range spec.AccountSchema.Attributes { for _, value := range spec.AccountSchema.Attributes {
attrsByName[value.Name] = value attrsByName[value.Name] = value
} }

View File

@@ -1,10 +1,10 @@
package validate package connvalidate
import ( import (
"context" "context"
"time" "time"
"github.com/sailpoint-oss/sp-cli/client" connclient "github.com/sailpoint-oss/sp-cli/cmd/connector/client"
) )
var accountUpdateChecks = []Check{ var accountUpdateChecks = []Check{
@@ -17,7 +17,7 @@ var accountUpdateChecks = []Check{
"std:account:list", "std:account:list",
"std:account:update", "std:account:update",
}, },
Run: func(ctx context.Context, spec *client.ConnSpec, cc *client.ConnClient, res *CheckResult) { Run: func(ctx context.Context, spec *connclient.ConnSpec, cc *connclient.ConnClient, res *CheckResult) {
accounts, _, err := cc.AccountList(ctx) accounts, _, err := cc.AccountList(ctx)
if err != nil { if err != nil {
res.err(err) res.err(err)
@@ -38,7 +38,7 @@ var accountUpdateChecks = []Check{
} }
change := attrChange(&acct, &attr) change := attrChange(&acct, &attr)
_, _, err = cc.AccountUpdate(ctx, acct.ID(), acct.UniqueID(), []client.AttributeChange{change}) _, _, err = cc.AccountUpdate(ctx, acct.ID(), acct.UniqueID(), []connclient.AttributeChange{change})
if err != nil { if err != nil {
res.errf("update for %q failed: %s", attr.Name, err.Error()) res.errf("update for %q failed: %s", attr.Name, err.Error())
continue continue
@@ -72,7 +72,7 @@ var accountUpdateChecks = []Check{
"std:account:update", "std:account:update",
"std:account:delete", "std:account:delete",
}, },
Run: func(ctx context.Context, spec *client.ConnSpec, cc *client.ConnClient, res *CheckResult) { Run: func(ctx context.Context, spec *connclient.ConnSpec, cc *connclient.ConnClient, res *CheckResult) {
entitlementAttr := entitlementAttr(spec) entitlementAttr := entitlementAttr(spec)
if entitlementAttr == "" { if entitlementAttr == "" {
res.warnf("no entitlement attribute") res.warnf("no entitlement attribute")
@@ -122,7 +122,7 @@ var accountUpdateChecks = []Check{
} }
if isAvailableForUpdating(accEntitlements, e.ID()) { if isAvailableForUpdating(accEntitlements, e.ID()) {
_, _, err = cc.AccountUpdate(ctx, acct.ID(), acct.UniqueID(), []client.AttributeChange{ _, _, err = cc.AccountUpdate(ctx, acct.ID(), acct.UniqueID(), []connclient.AttributeChange{
{ {
Op: "Add", Op: "Add",
Attribute: entitlementAttr, Attribute: entitlementAttr,
@@ -151,7 +151,7 @@ var accountUpdateChecks = []Check{
res.errf("failed to get acc entitlements") res.errf("failed to get acc entitlements")
} }
if len(accEntitlements) != 1 { if len(accEntitlements) != 1 {
_, _, err = cc.AccountUpdate(ctx, acct.ID(), acct.UniqueID(), []client.AttributeChange{ _, _, err = cc.AccountUpdate(ctx, acct.ID(), acct.UniqueID(), []connclient.AttributeChange{
{ {
Op: "Remove", Op: "Remove",
Attribute: entitlementAttr, Attribute: entitlementAttr,

View File

@@ -1,10 +1,10 @@
package validate package connvalidate
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/sailpoint-oss/sp-cli/client" connclient "github.com/sailpoint-oss/sp-cli/cmd/connector/client"
) )
var Checks = []Check{} var Checks = []Check{}
@@ -24,7 +24,7 @@ type Check struct {
// IsDataModifier determines a checking that will modify connectors data after applying // IsDataModifier determines a checking that will modify connectors data after applying
IsDataModifier bool IsDataModifier bool
Run func(ctx context.Context, spec *client.ConnSpec, cc *client.ConnClient, res *CheckResult) Run func(ctx context.Context, spec *connclient.ConnSpec, cc *connclient.ConnClient, res *CheckResult)
// RequiredCommands represents a list of commands that use for this check // RequiredCommands represents a list of commands that use for this check
RequiredCommands []string RequiredCommands []string
} }

View File

@@ -1,9 +1,10 @@
package validate package connvalidate
import ( import (
"context" "context"
"github.com/kr/pretty" "github.com/kr/pretty"
"github.com/sailpoint-oss/sp-cli/client" connclient "github.com/sailpoint-oss/sp-cli/cmd/connector/client"
) )
var entitlementReadChecks = []Check{ var entitlementReadChecks = []Check{
@@ -14,7 +15,7 @@ var entitlementReadChecks = []Check{
RequiredCommands: []string{ RequiredCommands: []string{
"std:entitlement:read", "std:entitlement:read",
}, },
Run: func(ctx context.Context, spec *client.ConnSpec, cc *client.ConnClient, res *CheckResult) { Run: func(ctx context.Context, spec *connclient.ConnSpec, cc *connclient.ConnClient, res *CheckResult) {
_, _, err := cc.EntitlementRead(ctx, "__sailpoint__not__found__", "", "group") _, _, err := cc.EntitlementRead(ctx, "__sailpoint__not__found__", "", "group")
if err == nil { if err == nil {
res.errf("expected error for non-existant entitlement") res.errf("expected error for non-existant entitlement")
@@ -30,7 +31,7 @@ var entitlementReadChecks = []Check{
"std:entitlement:read", "std:entitlement:read",
"std:entitlement:list", "std:entitlement:list",
}, },
Run: func(ctx context.Context, spec *client.ConnSpec, cc *client.ConnClient, res *CheckResult) { Run: func(ctx context.Context, spec *connclient.ConnSpec, cc *connclient.ConnClient, res *CheckResult) {
entitlements, _, err := cc.EntitlementList(ctx, "group") entitlements, _, err := cc.EntitlementList(ctx, "group")
if err != nil { if err != nil {
res.err(err) res.err(err)
@@ -68,10 +69,10 @@ var entitlementReadChecks = []Check{
RequiredCommands: []string{ RequiredCommands: []string{
"std:entitlement:list", "std:entitlement:list",
}, },
Run: func(ctx context.Context, spec *client.ConnSpec, cc *client.ConnClient, res *CheckResult) { Run: func(ctx context.Context, spec *connclient.ConnSpec, cc *connclient.ConnClient, res *CheckResult) {
additionalAttributes := map[string]string{} additionalAttributes := map[string]string{}
attrsByName := map[string]client.EntitlementSchemaAttribute{} attrsByName := map[string]connclient.EntitlementSchemaAttribute{}
for _, value := range spec.EntitlementSchemas[0].Attributes { for _, value := range spec.EntitlementSchemas[0].Attributes {
attrsByName[value.Name] = value attrsByName[value.Name] = value
} }

View File

@@ -1,10 +1,10 @@
package validate package connvalidate
import ( import (
"context" "context"
"encoding/json" "encoding/json"
"github.com/sailpoint-oss/sp-cli/client" connclient "github.com/sailpoint-oss/sp-cli/cmd/connector/client"
) )
var testConnChecks = []Check{ var testConnChecks = []Check{
@@ -15,7 +15,7 @@ var testConnChecks = []Check{
RequiredCommands: []string{ RequiredCommands: []string{
"std:test-connection", "std:test-connection",
}, },
Run: func(ctx context.Context, spec *client.ConnSpec, cc *client.ConnClient, res *CheckResult) { Run: func(ctx context.Context, spec *connclient.ConnSpec, cc *connclient.ConnClient, res *CheckResult) {
err := cc.TestConnectionWithConfig(ctx, json.RawMessage("{}")) err := cc.TestConnectionWithConfig(ctx, json.RawMessage("{}"))
if err == nil { if err == nil {
res.errf("expected test-connection failure for empty config") res.errf("expected test-connection failure for empty config")
@@ -29,7 +29,7 @@ var testConnChecks = []Check{
RequiredCommands: []string{ RequiredCommands: []string{
"std:test-connection", "std:test-connection",
}, },
Run: func(ctx context.Context, spec *client.ConnSpec, cc *client.ConnClient, res *CheckResult) { Run: func(ctx context.Context, spec *connclient.ConnSpec, cc *connclient.ConnClient, res *CheckResult) {
_, err := cc.TestConnection(ctx) _, err := cc.TestConnection(ctx)
if err != nil { if err != nil {
res.err(err) res.err(err)

View File

@@ -1,4 +1,4 @@
package validate package connvalidate
import ( import (
"fmt" "fmt"
@@ -9,11 +9,11 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/sailpoint-oss/sp-cli/client" connclient "github.com/sailpoint-oss/sp-cli/cmd/connector/client"
) )
// entitlementAttr returns the attribute for entitlements // entitlementAttr returns the attribute for entitlements
func entitlementAttr(spec *client.ConnSpec) string { func entitlementAttr(spec *connclient.ConnSpec) string {
for _, attr := range spec.AccountSchema.Attributes { for _, attr := range spec.AccountSchema.Attributes {
if attr.Entitlement { if attr.Entitlement {
return attr.Name return attr.Name
@@ -23,7 +23,7 @@ func entitlementAttr(spec *client.ConnSpec) string {
} }
// accountEntitlements returns all entitlements on the account // accountEntitlements returns all entitlements on the account
func accountEntitlements(account *client.Account, spec *client.ConnSpec) ([]string, error) { func accountEntitlements(account *connclient.Account, spec *connclient.ConnSpec) ([]string, error) {
entitlementAttr := entitlementAttr(spec) entitlementAttr := entitlementAttr(spec)
if entitlementAttr == "" { if entitlementAttr == "" {
return nil, fmt.Errorf("no entitlement attr found") return nil, fmt.Errorf("no entitlement attr found")
@@ -36,7 +36,7 @@ func accountEntitlements(account *client.Account, spec *client.ConnSpec) ([]stri
} }
// accountHasEntitlement returns whether or not an account has a specific entitlement // accountHasEntitlement returns whether or not an account has a specific entitlement
func accountHasEntitlement(account *client.Account, spec *client.ConnSpec, entitlementID string) bool { func accountHasEntitlement(account *connclient.Account, spec *connclient.ConnSpec, entitlementID string) bool {
entitlements, err := accountEntitlements(account, spec) entitlements, err := accountEntitlements(account, spec)
if err != nil { if err != nil {
panic(err.Error()) panic(err.Error())
@@ -106,7 +106,7 @@ const (
) )
// genCreateField generates a value for the provided account create template field // genCreateField generates a value for the provided account create template field
func genCreateField(field client.AccountCreateTemplateField) interface{} { func genCreateField(field connclient.AccountCreateTemplateField) interface{} {
// Return typed based value if the field is in deprecated format // Return typed based value if the field is in deprecated format
// TODO: Once we move away from the old format, this should also be removed // TODO: Once we move away from the old format, this should also be removed
@@ -144,7 +144,7 @@ func genCreateField(field client.AccountCreateTemplateField) interface{} {
// getFieldName returns the name of the field // getFieldName returns the name of the field
// TODO: This is to support both key and name base field. Once the name based filds are gone, we can remove this helper method // TODO: This is to support both key and name base field. Once the name based filds are gone, we can remove this helper method
func getFieldName(field client.AccountCreateTemplateField) string { func getFieldName(field connclient.AccountCreateTemplateField) string {
if field.Key == "" { if field.Key == "" {
return field.Name return field.Name
} }
@@ -152,7 +152,7 @@ func getFieldName(field client.AccountCreateTemplateField) string {
} }
// genValueByTypeAndName generates attribute values base on field type and name // genValueByTypeAndName generates attribute values base on field type and name
func genValueByTypeAndName(field client.AccountCreateTemplateField) interface{} { func genValueByTypeAndName(field connclient.AccountCreateTemplateField) interface{} {
switch field.Type { switch field.Type {
case "string": case "string":
if getFieldName(field) == "email" || getFieldName(field) == "name" { if getFieldName(field) == "email" || getFieldName(field) == "name" {
@@ -236,7 +236,7 @@ func testSchema(res *CheckResult, attrName string, value interface{}, expectedMu
// attrChange generates an attribute change event for the provided account and // attrChange generates an attribute change event for the provided account and
// attribute. // attribute.
func attrChange(acct *client.Account, attr *client.AccountSchemaAttribute) client.AttributeChange { func attrChange(acct *connclient.Account, attr *connclient.AccountSchemaAttribute) connclient.AttributeChange {
var op string var op string
switch attr.Multi { switch attr.Multi {
case true: case true:
@@ -268,7 +268,7 @@ func attrChange(acct *client.Account, attr *client.AccountSchemaAttribute) clien
} }
} }
return client.AttributeChange{ return connclient.AttributeChange{
Op: op, Op: op,
Attribute: attr.Name, Attribute: attr.Name,
Value: newValue, Value: newValue,

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2021, SailPoint Technologies, Inc. All rights reserved. // Copyright (c) 2021, SailPoint Technologies, Inc. All rights reserved.
package validate package connvalidate
import ( import (
"context" "context"
@@ -9,14 +9,14 @@ import (
"strings" "strings"
"time" "time"
"github.com/sailpoint-oss/sp-cli/client" connclient "github.com/sailpoint-oss/sp-cli/cmd/connector/client"
) )
// Validator runs checks for a specific connector // Validator runs checks for a specific connector
type Validator struct { type Validator struct {
cfg Config cfg Config
cc *client.ConnClient cc *connclient.ConnClient
connSpec *client.ConnSpec connSpec *connclient.ConnSpec
} }
// Config provides options for how the validator runs // Config provides options for how the validator runs
@@ -31,7 +31,7 @@ type Config struct {
} }
// NewValidator creates a new validator with provided config and ConnClient // NewValidator creates a new validator with provided config and ConnClient
func NewValidator(cfg Config, cc *client.ConnClient) *Validator { func NewValidator(cfg Config, cc *connclient.ConnClient) *Validator {
return &Validator{ return &Validator{
cfg: cfg, cfg: cfg,
cc: cc, cc: cc,

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2021, SailPoint Technologies, Inc. All rights reserved. // Copyright (c) 2021, SailPoint Technologies, Inc. All rights reserved.
package cmd package root
import ( import (
"bufio" "bufio"

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2021, SailPoint Technologies, Inc. All rights reserved. // Copyright (c) 2021, SailPoint Technologies, Inc. All rights reserved.
package cmd package root
import ( import (
"fmt" "fmt"

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2021, SailPoint Technologies, Inc. All rights reserved. // Copyright (c) 2021, SailPoint Technologies, Inc. All rights reserved.
package cmd package root
import ( import (
"bytes" "bytes"

View File

@@ -9,6 +9,7 @@ import (
"github.com/olekukonko/tablewriter" "github.com/olekukonko/tablewriter"
"github.com/sailpoint-oss/sp-cli/client" "github.com/sailpoint-oss/sp-cli/client"
transmodel "github.com/sailpoint-oss/sp-cli/cmd/transform/model"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@@ -40,16 +41,16 @@ func newListCmd(client client.Client) *cobra.Command {
return err return err
} }
var transforms []transform var transforms []transmodel.Transform
err = json.Unmarshal(raw, &transforms) err = json.Unmarshal(raw, &transforms)
if err != nil { if err != nil {
return err return err
} }
table := tablewriter.NewWriter(cmd.OutOrStdout()) table := tablewriter.NewWriter(cmd.OutOrStdout())
table.SetHeader(transformColumns) table.SetHeader(transmodel.TransformColumns)
for _, v := range transforms { for _, v := range transforms {
table.Append(v.transformToColumns()) table.Append(v.TransformToColumns())
} }
table.Render() table.Render()

View File

@@ -1,118 +1,115 @@
// Copyright (c) 2021, SailPoint Technologies, Inc. All rights reserved. // Copyright (c) 2021, SailPoint Technologies, Inc. All rights reserved.
package transform package transmodel
type transform struct { type Transform struct {
ID string `json:"id"` ID string `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Type string `json:"type"` Type string `json:"type"`
} }
type operation struct { func (t Transform) TransformToColumns() []string {
}
func (t transform) transformToColumns() []string {
return []string{t.ID, t.Name} return []string{t.ID, t.Name}
} }
var transformColumns = []string{"ID", "Name"} var TransformColumns = []string{"ID", "Name"}
type attributesOfAccount struct { type AttributesOfAccount struct {
AttributeName string `json:"attributeName"` AttributeName string `json:"attributeName"`
SourceName string `json:"sourceName"` SourceName string `json:"sourceName"`
} }
type accountAttribute struct { type AccountAttribute struct {
Type string `json:"type"` Type string `json:"type"`
Attributes attributesOfAccount `json:"attributes"` Attributes AttributesOfAccount `json:"attributes"`
} }
type attributesOfReference struct { type AttributesOfReference struct {
Id string `json:"id"` Id string `json:"id"`
Input accountAttribute `json:"input"` Input AccountAttribute `json:"input"`
} }
type reference struct { type Reference struct {
Type string `json:"type"` Type string `json:"type"`
Attributes attributesOfReference `json:"attributes"` Attributes AttributesOfReference `json:"attributes"`
} }
type transformDefinition struct { type TransformDefinition struct {
Type string `json:"type"` Type string `json:"type"`
Attributes interface{} `json:"attributes"` Attributes interface{} `json:"attributes"`
} }
type attributeTransform struct { type AttributeTransform struct {
IdentityAttributeName string `json:"identityAttributeName"` IdentityAttributeName string `json:"identityAttributeName"`
TransformDefinition transformDefinition `json:"transformDefinition"` TransformDefinition TransformDefinition `json:"transformDefinition"`
} }
type attributeTransformPreview struct { type AttributeTransformPreview struct {
AttributeName string `json:"attributeName"` AttributeName string `json:"attributeName"`
Attributes attributesOfReference `json:"attributes"` Attributes AttributesOfReference `json:"attributes"`
Type string `json:"type"` Type string `json:"type"`
} }
type previewBodyImplicit struct { type PreviewBodyImplicit struct {
AttributeTransforms []attributeTransformPreview `json:"attributeTransforms"` AttributeTransforms []AttributeTransformPreview `json:"attributeTransforms"`
} }
type previewBodyExplicit struct { type PreviewBodyExplicit struct {
AttributeTransforms []map[string]interface{} `json:"attributeTransforms"` AttributeTransforms []map[string]interface{} `json:"attributeTransforms"`
} }
type identityAttributeConfig struct { type IdentityAttributeConfig struct {
AttributeTransforms []attributeTransform `json:"attributeTransforms"` AttributeTransforms []AttributeTransform `json:"attributeTransforms"`
} }
type objectRef struct { type ObjectRef struct {
Type string `json:"type"` Type string `json:"type"`
Id string `json:"id"` Id string `json:"id"`
Name string `json:"name"` Name string `json:"name"`
} }
type identityProfile struct { type IdentityProfile struct {
AuthoritativeSource objectRef `json:"authoritativeSource"` AuthoritativeSource ObjectRef `json:"authoritativeSource"`
IdentityAttributeConfig identityAttributeConfig `json:"identityAttributeConfig"` IdentityAttributeConfig IdentityAttributeConfig `json:"identityAttributeConfig"`
} }
type previewAttribute struct { type PreviewAttribute struct {
Name string `json:"name"` Name string `json:"name"`
PreviousValue string `json:"previousValue"` PreviousValue string `json:"previousValue"`
Value string `json:"value"` Value string `json:"value"`
} }
type previewResponse struct { type PreviewResponse struct {
PreviewAttributes []previewAttribute `json:"previewAttributes"` PreviewAttributes []PreviewAttribute `json:"previewAttributes"`
} }
type user struct { type User struct {
Id string `json:"id"` Id string `json:"id"`
} }
func makeAttributesOfAccount(data interface{}) attributesOfAccount { func MakeAttributesOfAccount(data interface{}) AttributesOfAccount {
m := data.(map[string]interface{}) m := data.(map[string]interface{})
attribute := attributesOfAccount{} attribute := AttributesOfAccount{}
attribute.AttributeName = m["attributeName"].(string) attribute.AttributeName = m["attributeName"].(string)
attribute.SourceName = m["sourceName"].(string) attribute.SourceName = m["sourceName"].(string)
return attribute return attribute
} }
func makeAccountAttribute(data interface{}) accountAttribute { func MakeAccountAttribute(data interface{}) AccountAttribute {
m := data.(map[string]interface{}) m := data.(map[string]interface{})
account := accountAttribute{} account := AccountAttribute{}
account.Type = m["type"].(string) account.Type = m["type"].(string)
account.Attributes = makeAttributesOfAccount(m["attributes"]) account.Attributes = MakeAttributesOfAccount(m["attributes"])
return account return account
} }
func makeReference(data interface{}) attributesOfReference { func MakeReference(data interface{}) AttributesOfReference {
m := data.(map[string]interface{}) m := data.(map[string]interface{})
reference := attributesOfReference{} reference := AttributesOfReference{}
reference.Id = m["id"].(string) reference.Id = m["id"].(string)
reference.Input = makeAccountAttribute(m["input"]) reference.Input = MakeAccountAttribute(m["input"])
return reference return reference
} }
func makePreviewBodyImplicit(identityAttribute string, transformName string, accountAttribute string, sourceName string) previewBodyImplicit { func MakePreviewBodyImplicit(identityAttribute string, transformName string, accountAttribute string, sourceName string) PreviewBodyImplicit {
attributeTransform := attributeTransformPreview{} attributeTransform := AttributeTransformPreview{}
attributeTransform.AttributeName = identityAttribute attributeTransform.AttributeName = identityAttribute
attributeTransform.Attributes.Id = transformName attributeTransform.Attributes.Id = transformName
attributeTransform.Attributes.Input.Type = "accountAttribute" attributeTransform.Attributes.Input.Type = "accountAttribute"
@@ -120,16 +117,16 @@ func makePreviewBodyImplicit(identityAttribute string, transformName string, acc
attributeTransform.Attributes.Input.Attributes.SourceName = sourceName attributeTransform.Attributes.Input.Attributes.SourceName = sourceName
attributeTransform.Type = "reference" attributeTransform.Type = "reference"
previewBody := previewBodyImplicit{} previewBody := PreviewBodyImplicit{}
previewBody.AttributeTransforms = append(previewBody.AttributeTransforms, attributeTransform) previewBody.AttributeTransforms = append(previewBody.AttributeTransforms, attributeTransform)
return previewBody return previewBody
} }
func makePreviewBodyExplicit(identityAttribute string, transformData map[string]interface{}) previewBodyExplicit { func MakePreviewBodyExplicit(identityAttribute string, transformData map[string]interface{}) PreviewBodyExplicit {
transformData["attributeName"] = identityAttribute transformData["attributeName"] = identityAttribute
previewBody := previewBodyExplicit{} previewBody := PreviewBodyExplicit{}
previewBody.AttributeTransforms = append(previewBody.AttributeTransforms, transformData) previewBody.AttributeTransforms = append(previewBody.AttributeTransforms, transformData)
return previewBody return previewBody

View File

@@ -12,6 +12,7 @@ import (
"os" "os"
"github.com/sailpoint-oss/sp-cli/client" "github.com/sailpoint-oss/sp-cli/client"
transmodel "github.com/sailpoint-oss/sp-cli/cmd/transform/model"
"github.com/sailpoint-oss/sp-cli/util" "github.com/sailpoint-oss/sp-cli/util"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
@@ -83,7 +84,7 @@ func newPreviewCmd(client client.Client) *cobra.Command {
return err return err
} }
var profile identityProfile var profile transmodel.IdentityProfile
err = json.Unmarshal(raw, &profile) err = json.Unmarshal(raw, &profile)
if err != nil { if err != nil {
return err return err
@@ -119,7 +120,7 @@ func newPreviewCmd(client client.Client) *cobra.Command {
return err return err
} }
var user []user var user []transmodel.User
err = json.Unmarshal(raw, &user) err = json.Unmarshal(raw, &user)
if err != nil { if err != nil {
return err return err
@@ -141,11 +142,11 @@ func newPreviewCmd(client client.Client) *cobra.Command {
if t.IdentityAttributeName == attribute { if t.IdentityAttributeName == attribute {
transType := t.TransformDefinition.Type transType := t.TransformDefinition.Type
if transType == "accountAttribute" { if transType == "accountAttribute" {
def := makeAttributesOfAccount(t.TransformDefinition.Attributes) def := transmodel.MakeAttributesOfAccount(t.TransformDefinition.Attributes)
accountAttName = def.AttributeName accountAttName = def.AttributeName
sourceName = def.SourceName sourceName = def.SourceName
} else if transType == "reference" { } else if transType == "reference" {
def := makeReference(t.TransformDefinition.Attributes) def := transmodel.MakeReference(t.TransformDefinition.Attributes)
accountAttName = def.Input.Attributes.AttributeName accountAttName = def.Input.Attributes.AttributeName
sourceName = def.Input.Attributes.SourceName sourceName = def.Input.Attributes.SourceName
} else { } else {
@@ -160,14 +161,14 @@ func newPreviewCmd(client client.Client) *cobra.Command {
return fmt.Errorf("The transform name must be specified when previewing with implicit input.") return fmt.Errorf("The transform name must be specified when previewing with implicit input.")
} }
previewBody := makePreviewBodyImplicit(attribute, name, accountAttName, sourceName) previewBody := transmodel.MakePreviewBodyImplicit(attribute, name, accountAttName, sourceName)
previewBodyRaw, err = json.Marshal(previewBody) previewBodyRaw, err = json.Marshal(previewBody)
if err != nil { if err != nil {
return err return err
} }
} else { } else {
previewBody := makePreviewBodyExplicit(attribute, transform) previewBody := transmodel.MakePreviewBodyExplicit(attribute, transform)
previewBodyRaw, err = json.Marshal(previewBody) previewBodyRaw, err = json.Marshal(previewBody)
if err != nil { if err != nil {
@@ -195,7 +196,7 @@ func newPreviewCmd(client client.Client) *cobra.Command {
return err return err
} }
var response previewResponse var response transmodel.PreviewResponse
err = json.Unmarshal(raw, &response) err = json.Unmarshal(raw, &response)
if err != nil { if err != nil {
return err return err

View File

@@ -4,8 +4,9 @@ package main
import ( import (
"os" "os"
"path/filepath" "path/filepath"
"github.com/sailpoint-oss/sp-cli/client" "github.com/sailpoint-oss/sp-cli/client"
"github.com/sailpoint-oss/sp-cli/cmd" "github.com/sailpoint-oss/sp-cli/cmd/root"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
) )
@@ -45,7 +46,7 @@ func init() {
Debug: viper.GetBool("debug"), Debug: viper.GetBool("debug"),
}) })
rootCmd = cmd.NewRootCmd(c) rootCmd = root.NewRootCmd(c)
} }
// main the entry point for commands. Note that we do not need to do cobra.CheckErr(err) // main the entry point for commands. Note that we do not need to do cobra.CheckErr(err)