mirror of
https://github.com/LukeHagar/sailpoint-cli.git
synced 2025-12-06 04:21:15 +00:00
40 lines
947 B
Go
40 lines
947 B
Go
// Copyright (c) 2021, SailPoint Technologies, Inc. All rights reserved.
|
|
package connector
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/sailpoint-oss/sailpoint-cli/client"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func newConnInvokeEntitlementListCmd(client client.Client) *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "entitlement-list [--type <value>]",
|
|
Short: "Invoke a std:entitlement:list command",
|
|
Example: `sp connectors invoke entitlement-list --type group`,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
ctx := cmd.Context()
|
|
cc, err := connClient(cmd, client)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
t := cmd.Flags().Lookup("type").Value.String()
|
|
_, rawResponse, err := cc.EntitlementList(ctx, t)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
_, _ = fmt.Fprintln(cmd.OutOrStdout(), string(rawResponse))
|
|
|
|
return nil
|
|
},
|
|
}
|
|
|
|
cmd.Flags().StringP("type", "t", "", "Entitlement Type")
|
|
_ = cmd.MarkFlagRequired("type")
|
|
|
|
return cmd
|
|
}
|