Rename CLI trust-center commands
Replace the trust-center command tree with compliance-portal so the CLI matches the product and GraphQL rename. Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
@@ -62,13 +62,13 @@ type createResponse struct {
|
||||
|
||||
func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
var (
|
||||
flagOrg string
|
||||
flagFramework string
|
||||
flagName string
|
||||
flagState string
|
||||
flagValidFrom string
|
||||
flagValidUntil string
|
||||
flagTrustCenterVisibility string
|
||||
flagOrg string
|
||||
flagFramework string
|
||||
flagName string
|
||||
flagState string
|
||||
flagValidFrom string
|
||||
flagValidUntil string
|
||||
flagCompliancePortalVisibility string
|
||||
)
|
||||
|
||||
cmd := &cobra.Command{
|
||||
@@ -160,8 +160,8 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
input["validUntil"] = flagValidUntil
|
||||
}
|
||||
|
||||
if flagTrustCenterVisibility != "" {
|
||||
input["trustCenterVisibility"] = flagTrustCenterVisibility
|
||||
if flagCompliancePortalVisibility != "" {
|
||||
input["compliancePortalVisibility"] = flagCompliancePortalVisibility
|
||||
}
|
||||
|
||||
data, err := client.Do(
|
||||
@@ -195,7 +195,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd.Flags().StringVar(&flagState, "state", "", "Audit state: NOT_STARTED, IN_PROGRESS, COMPLETED, REJECTED, OUTDATED")
|
||||
cmd.Flags().StringVar(&flagValidFrom, "valid-from", "", "Valid from date (e.g. 2026-01-01)")
|
||||
cmd.Flags().StringVar(&flagValidUntil, "valid-until", "", "Valid until date (e.g. 2026-12-31)")
|
||||
cmd.Flags().StringVar(&flagTrustCenterVisibility, "trust-center-visibility", "", "Trust center visibility: NONE, PRIVATE, PUBLIC")
|
||||
cmd.Flags().StringVar(&flagCompliancePortalVisibility, "compliance-portal-visibility", "", "Compliance portal visibility: NONE, PRIVATE, PUBLIC")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -57,11 +57,11 @@ type updateResponse struct {
|
||||
|
||||
func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
var (
|
||||
flagName string
|
||||
flagState string
|
||||
flagValidFrom string
|
||||
flagValidUntil string
|
||||
flagTrustCenterVisibility string
|
||||
flagName string
|
||||
flagState string
|
||||
flagValidFrom string
|
||||
flagValidUntil string
|
||||
flagCompliancePortalVisibility string
|
||||
)
|
||||
|
||||
cmd := &cobra.Command{
|
||||
@@ -107,8 +107,8 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
input["validUntil"] = flagValidUntil
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("trust-center-visibility") {
|
||||
input["trustCenterVisibility"] = flagTrustCenterVisibility
|
||||
if cmd.Flags().Changed("compliance-portal-visibility") {
|
||||
input["compliancePortalVisibility"] = flagCompliancePortalVisibility
|
||||
}
|
||||
|
||||
if len(input) == 1 {
|
||||
@@ -144,7 +144,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd.Flags().StringVar(&flagState, "state", "", "Audit state: NOT_STARTED, IN_PROGRESS, COMPLETED, REJECTED, OUTDATED")
|
||||
cmd.Flags().StringVar(&flagValidFrom, "valid-from", "", "Valid from date (e.g. 2026-01-01)")
|
||||
cmd.Flags().StringVar(&flagValidUntil, "valid-until", "", "Valid until date (e.g. 2026-12-31)")
|
||||
cmd.Flags().StringVar(&flagTrustCenterVisibility, "trust-center-visibility", "", "Trust center visibility: NONE, PRIVATE, PUBLIC")
|
||||
cmd.Flags().StringVar(&flagCompliancePortalVisibility, "compliance-portal-visibility", "", "Compliance portal visibility: NONE, PRIVATE, PUBLIC")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -23,10 +23,10 @@ package commitment
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"go.probo.inc/probo/pkg/cmd/cmdutil"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/commitment/create"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/commitment/delete"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/commitment/list"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/commitment/update"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/commitment/create"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/commitment/delete"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/commitment/list"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/commitment/update"
|
||||
)
|
||||
|
||||
func NewCmdCommitment(f *cmdutil.Factory) *cobra.Command {
|
||||
@@ -23,10 +23,10 @@ package commitmentgroup
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"go.probo.inc/probo/pkg/cmd/cmdutil"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/commitmentgroup/create"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/commitmentgroup/delete"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/commitmentgroup/list"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/commitmentgroup/update"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/commitmentgroup/create"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/commitmentgroup/delete"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/commitmentgroup/list"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/commitmentgroup/update"
|
||||
)
|
||||
|
||||
func NewCmdCommitmentGroup(f *cmdutil.Factory) *cobra.Command {
|
||||
@@ -18,23 +18,23 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
package trustcenter
|
||||
package complianceportal
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"go.probo.inc/probo/pkg/cmd/cmdutil"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/commitment"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/commitmentgroup"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/file"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/reference"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/update"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/view"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/commitment"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/commitmentgroup"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/file"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/reference"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/update"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/view"
|
||||
)
|
||||
|
||||
func NewCmdTrustCenter(f *cmdutil.Factory) *cobra.Command {
|
||||
func NewCmdCompliancePortal(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "trust-center <command>",
|
||||
Short: "Manage trust center",
|
||||
Use: "compliance-portal <command>",
|
||||
Short: "Manage compliance portal",
|
||||
Aliases: []string{"tc"},
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ import (
|
||||
)
|
||||
|
||||
const deleteMutation = `
|
||||
mutation($input: DeleteTrustCenterFileInput!) {
|
||||
deleteTrustCenterFile(input: $input) {
|
||||
deletedTrustCenterFileId
|
||||
mutation($input: DeleteCompliancePortalFileInput!) {
|
||||
deleteCompliancePortalFile(input: $input) {
|
||||
deletedCompliancePortalFileId
|
||||
}
|
||||
}
|
||||
`
|
||||
@@ -42,7 +42,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "delete <id>",
|
||||
Short: "Delete a trust center file",
|
||||
Short: "Delete a compliance portal file",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if !flagYes {
|
||||
@@ -53,7 +53,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
var confirmed bool
|
||||
|
||||
err := huh.NewConfirm().
|
||||
Title(fmt.Sprintf("Delete trust center file %s?", args[0])).
|
||||
Title(fmt.Sprintf("Delete compliance portal file %s?", args[0])).
|
||||
Value(&confirmed).
|
||||
Run()
|
||||
if err != nil {
|
||||
@@ -97,7 +97,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
|
||||
_, _ = fmt.Fprintf(
|
||||
f.IOStreams.Out,
|
||||
"Deleted trust center file %s\n",
|
||||
"Deleted compliance portal file %s\n",
|
||||
args[0],
|
||||
)
|
||||
|
||||
@@ -23,14 +23,14 @@ package file
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"go.probo.inc/probo/pkg/cmd/cmdutil"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/file/delete"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/file/list"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/file/delete"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/file/list"
|
||||
)
|
||||
|
||||
func NewCmdFile(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "file <command>",
|
||||
Short: "Manage trust center files",
|
||||
Short: "Manage compliance portal files",
|
||||
}
|
||||
|
||||
cmd.AddCommand(list.NewCmdList(f))
|
||||
@@ -30,18 +30,18 @@ import (
|
||||
)
|
||||
|
||||
const listQuery = `
|
||||
query($id: ID!, $first: Int, $after: CursorKey, $orderBy: TrustCenterFileOrder) {
|
||||
query($id: ID!, $first: Int, $after: CursorKey, $orderBy: CompliancePortalFileOrder) {
|
||||
node(id: $id) {
|
||||
__typename
|
||||
... on Organization {
|
||||
trustCenterFiles(first: $first, after: $after, orderBy: $orderBy) {
|
||||
compliancePortalFiles(first: $first, after: $after, orderBy: $orderBy) {
|
||||
totalCount
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
name
|
||||
category
|
||||
trustCenterVisibility
|
||||
compliancePortalVisibility
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
@@ -55,12 +55,12 @@ query($id: ID!, $first: Int, $after: CursorKey, $orderBy: TrustCenterFileOrder)
|
||||
}
|
||||
`
|
||||
|
||||
type trustCenterFile struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Category string `json:"category"`
|
||||
TrustCenterVisibility string `json:"trustCenterVisibility"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
type compliancePortalFile struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Category string `json:"category"`
|
||||
CompliancePortalVisibility string `json:"compliancePortalVisibility"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
|
||||
func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
@@ -74,13 +74,13 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List trust center files",
|
||||
Short: "List compliance portal files",
|
||||
Aliases: []string{"ls"},
|
||||
Example: ` # List files in the default organization
|
||||
prb trust-center file list
|
||||
prb compliance-portal file list
|
||||
|
||||
# List files sorted by name
|
||||
prb trust-center file ls --order-by NAME`,
|
||||
prb compliance-portal file ls --order-by NAME`,
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if err := cmdutil.ValidateOutputFlag(flagOutput); err != nil {
|
||||
@@ -133,11 +133,11 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
listQuery,
|
||||
variables,
|
||||
flagLimit,
|
||||
func(data json.RawMessage) (*api.Connection[trustCenterFile], error) {
|
||||
func(data json.RawMessage) (*api.Connection[compliancePortalFile], error) {
|
||||
var resp struct {
|
||||
Node *struct {
|
||||
Typename string `json:"__typename"`
|
||||
TrustCenterFiles api.Connection[trustCenterFile] `json:"trustCenterFiles"`
|
||||
Typename string `json:"__typename"`
|
||||
CompliancePortalFiles api.Connection[compliancePortalFile] `json:"compliancePortalFiles"`
|
||||
} `json:"node"`
|
||||
}
|
||||
if err := json.Unmarshal(data, &resp); err != nil {
|
||||
@@ -152,7 +152,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
return nil, fmt.Errorf("expected Organization node, got %s", resp.Node.Typename)
|
||||
}
|
||||
|
||||
return &resp.Node.TrustCenterFiles, nil
|
||||
return &resp.Node.CompliancePortalFiles, nil
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
@@ -174,7 +174,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
file.ID,
|
||||
file.Name,
|
||||
file.Category,
|
||||
file.TrustCenterVisibility,
|
||||
file.CompliancePortalVisibility,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -30,12 +30,12 @@ import (
|
||||
"go.probo.inc/probo/pkg/cmd/cmdutil"
|
||||
)
|
||||
|
||||
const trustCenterQuery = `
|
||||
const compliancePortalQuery = `
|
||||
query($id: ID!) {
|
||||
node(id: $id) {
|
||||
__typename
|
||||
... on Organization {
|
||||
trustCenter {
|
||||
compliancePortal {
|
||||
id
|
||||
}
|
||||
}
|
||||
@@ -44,9 +44,9 @@ query($id: ID!) {
|
||||
`
|
||||
|
||||
const createMutation = `
|
||||
mutation($input: CreateTrustCenterReferenceInput!) {
|
||||
createTrustCenterReference(input: $input) {
|
||||
trustCenterReferenceEdge {
|
||||
mutation($input: CreateCompliancePortalReferenceInput!) {
|
||||
createCompliancePortalReference(input: $input) {
|
||||
compliancePortalReferenceEdge {
|
||||
node {
|
||||
id
|
||||
name
|
||||
@@ -59,18 +59,18 @@ mutation($input: CreateTrustCenterReferenceInput!) {
|
||||
}
|
||||
`
|
||||
|
||||
type trustCenterQueryResponse struct {
|
||||
type compliancePortalQueryResponse struct {
|
||||
Node *struct {
|
||||
Typename string `json:"__typename"`
|
||||
TrustCenter *struct {
|
||||
Typename string `json:"__typename"`
|
||||
CompliancePortal *struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"trustCenter"`
|
||||
} `json:"compliancePortal"`
|
||||
} `json:"node"`
|
||||
}
|
||||
|
||||
type createResponse struct {
|
||||
CreateTrustCenterReference struct {
|
||||
TrustCenterReferenceEdge struct {
|
||||
CreateCompliancePortalReference struct {
|
||||
CompliancePortalReferenceEdge struct {
|
||||
Node struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
@@ -78,8 +78,8 @@ type createResponse struct {
|
||||
WebsiteUrl *string `json:"websiteUrl"`
|
||||
Rank int `json:"rank"`
|
||||
} `json:"node"`
|
||||
} `json:"trustCenterReferenceEdge"`
|
||||
} `json:"createTrustCenterReference"`
|
||||
} `json:"compliancePortalReferenceEdge"`
|
||||
} `json:"createCompliancePortalReference"`
|
||||
}
|
||||
|
||||
func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
@@ -92,12 +92,12 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "create",
|
||||
Short: "Create a trust center reference",
|
||||
Short: "Create a compliance portal reference",
|
||||
Example: ` # Create a reference interactively
|
||||
prb trust-center reference create
|
||||
prb compliance-portal reference create
|
||||
|
||||
# Create a reference non-interactively
|
||||
prb trust-center ref create --name "Acme Corp" --description "Enterprise customer" --website "https://acme.com"`,
|
||||
prb compliance-portal ref create --name "Acme Corp" --description "Enterprise customer" --website "https://acme.com"`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
cfg, err := f.Config()
|
||||
if err != nil {
|
||||
@@ -125,16 +125,16 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
return fmt.Errorf("organization is required; pass --org or set a default with 'prb auth login'")
|
||||
}
|
||||
|
||||
// Fetch trust center ID from organization.
|
||||
// Fetch compliance portal ID from organization.
|
||||
data, err := client.Do(
|
||||
trustCenterQuery,
|
||||
compliancePortalQuery,
|
||||
map[string]any{"id": flagOrg},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var tcResp trustCenterQueryResponse
|
||||
var tcResp compliancePortalQueryResponse
|
||||
if err := json.Unmarshal(data, &tcResp); err != nil {
|
||||
return fmt.Errorf("cannot parse response: %w", err)
|
||||
}
|
||||
@@ -147,8 +147,8 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
return fmt.Errorf("expected Organization node, got %s", tcResp.Node.Typename)
|
||||
}
|
||||
|
||||
if tcResp.Node.TrustCenter == nil {
|
||||
return fmt.Errorf("trust center not found for organization %s", flagOrg)
|
||||
if tcResp.Node.CompliancePortal == nil {
|
||||
return fmt.Errorf("compliance portal not found for organization %s", flagOrg)
|
||||
}
|
||||
|
||||
if f.IOStreams.IsInteractive() {
|
||||
@@ -188,8 +188,8 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
}
|
||||
|
||||
input := map[string]any{
|
||||
"trustCenterId": tcResp.Node.TrustCenter.ID,
|
||||
"name": flagName,
|
||||
"compliancePortalId": tcResp.Node.CompliancePortal.ID,
|
||||
"name": flagName,
|
||||
}
|
||||
|
||||
if flagDescription != "" {
|
||||
@@ -213,7 +213,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
return fmt.Errorf("cannot parse response: %w", err)
|
||||
}
|
||||
|
||||
r := resp.CreateTrustCenterReference.TrustCenterReferenceEdge.Node
|
||||
r := resp.CreateCompliancePortalReference.CompliancePortalReferenceEdge.Node
|
||||
_, _ = fmt.Fprintf(
|
||||
f.IOStreams.Out,
|
||||
"Created reference %s (%s)\n",
|
||||
@@ -30,9 +30,9 @@ import (
|
||||
)
|
||||
|
||||
const deleteMutation = `
|
||||
mutation($input: DeleteTrustCenterReferenceInput!) {
|
||||
deleteTrustCenterReference(input: $input) {
|
||||
deletedTrustCenterReferenceId
|
||||
mutation($input: DeleteCompliancePortalReferenceInput!) {
|
||||
deleteCompliancePortalReference(input: $input) {
|
||||
deletedCompliancePortalReferenceId
|
||||
}
|
||||
}
|
||||
`
|
||||
@@ -42,7 +42,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "delete <id>",
|
||||
Short: "Delete a trust center reference",
|
||||
Short: "Delete a compliance portal reference",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if !flagYes {
|
||||
@@ -30,11 +30,11 @@ import (
|
||||
)
|
||||
|
||||
const listQuery = `
|
||||
query($id: ID!, $first: Int, $after: CursorKey, $orderBy: TrustCenterReferenceOrder) {
|
||||
query($id: ID!, $first: Int, $after: CursorKey, $orderBy: CompliancePortalReferenceOrder) {
|
||||
node(id: $id) {
|
||||
__typename
|
||||
... on Organization {
|
||||
trustCenter {
|
||||
compliancePortal {
|
||||
references(first: $first, after: $after, orderBy: $orderBy) {
|
||||
totalCount
|
||||
edges {
|
||||
@@ -58,7 +58,7 @@ query($id: ID!, $first: Int, $after: CursorKey, $orderBy: TrustCenterReferenceOr
|
||||
}
|
||||
`
|
||||
|
||||
type trustCenterReference struct {
|
||||
type compliancePortalReference struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description *string `json:"description"`
|
||||
@@ -78,13 +78,13 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List trust center references",
|
||||
Short: "List compliance portal references",
|
||||
Aliases: []string{"ls"},
|
||||
Example: ` # List references in the default organization
|
||||
prb trust-center reference list
|
||||
prb compliance-portal reference list
|
||||
|
||||
# List references sorted by rank
|
||||
prb trust-center ref ls --order-by RANK`,
|
||||
prb compliance-portal ref ls --order-by RANK`,
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if err := cmdutil.ValidateOutputFlag(flagOutput); err != nil {
|
||||
@@ -137,13 +137,13 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
listQuery,
|
||||
variables,
|
||||
flagLimit,
|
||||
func(data json.RawMessage) (*api.Connection[trustCenterReference], error) {
|
||||
func(data json.RawMessage) (*api.Connection[compliancePortalReference], error) {
|
||||
var resp struct {
|
||||
Node *struct {
|
||||
Typename string `json:"__typename"`
|
||||
TrustCenter *struct {
|
||||
References api.Connection[trustCenterReference] `json:"references"`
|
||||
} `json:"trustCenter"`
|
||||
Typename string `json:"__typename"`
|
||||
CompliancePortal *struct {
|
||||
References api.Connection[compliancePortalReference] `json:"references"`
|
||||
} `json:"compliancePortal"`
|
||||
} `json:"node"`
|
||||
}
|
||||
if err := json.Unmarshal(data, &resp); err != nil {
|
||||
@@ -158,11 +158,11 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
return nil, fmt.Errorf("expected Organization node, got %s", resp.Node.Typename)
|
||||
}
|
||||
|
||||
if resp.Node.TrustCenter == nil {
|
||||
return nil, fmt.Errorf("trust center not found for organization %s", flagOrg)
|
||||
if resp.Node.CompliancePortal == nil {
|
||||
return nil, fmt.Errorf("compliance portal not found for organization %s", flagOrg)
|
||||
}
|
||||
|
||||
return &resp.Node.TrustCenter.References, nil
|
||||
return &resp.Node.CompliancePortal.References, nil
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
@@ -23,15 +23,15 @@ package reference
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"go.probo.inc/probo/pkg/cmd/cmdutil"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/reference/create"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/reference/delete"
|
||||
"go.probo.inc/probo/pkg/cmd/trust-center/reference/list"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/reference/create"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/reference/delete"
|
||||
"go.probo.inc/probo/pkg/cmd/compliance-portal/reference/list"
|
||||
)
|
||||
|
||||
func NewCmdReference(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "reference <command>",
|
||||
Short: "Manage trust center references",
|
||||
Short: "Manage compliance portal references",
|
||||
Aliases: []string{"ref"},
|
||||
}
|
||||
|
||||
@@ -29,12 +29,12 @@ import (
|
||||
"go.probo.inc/probo/pkg/cmd/cmdutil"
|
||||
)
|
||||
|
||||
const trustCenterQuery = `
|
||||
const compliancePortalQuery = `
|
||||
query($id: ID!) {
|
||||
node(id: $id) {
|
||||
__typename
|
||||
... on Organization {
|
||||
trustCenter {
|
||||
compliancePortal {
|
||||
id
|
||||
}
|
||||
}
|
||||
@@ -43,9 +43,9 @@ query($id: ID!) {
|
||||
`
|
||||
|
||||
const updateMutation = `
|
||||
mutation($input: UpdateTrustCenterInput!) {
|
||||
updateTrustCenter(input: $input) {
|
||||
trustCenter {
|
||||
mutation($input: UpdateCompliancePortalInput!) {
|
||||
updateCompliancePortal(input: $input) {
|
||||
compliancePortal {
|
||||
id
|
||||
active
|
||||
searchEngineIndexing
|
||||
@@ -59,18 +59,18 @@ mutation($input: UpdateTrustCenterInput!) {
|
||||
}
|
||||
`
|
||||
|
||||
type trustCenterQueryResponse struct {
|
||||
type compliancePortalQueryResponse struct {
|
||||
Node *struct {
|
||||
Typename string `json:"__typename"`
|
||||
TrustCenter *struct {
|
||||
Typename string `json:"__typename"`
|
||||
CompliancePortal *struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"trustCenter"`
|
||||
} `json:"compliancePortal"`
|
||||
} `json:"node"`
|
||||
}
|
||||
|
||||
type updateResponse struct {
|
||||
UpdateTrustCenter struct {
|
||||
TrustCenter struct {
|
||||
UpdateCompliancePortal struct {
|
||||
CompliancePortal struct {
|
||||
ID string `json:"id"`
|
||||
Active bool `json:"active"`
|
||||
SearchEngineIndexing string `json:"searchEngineIndexing"`
|
||||
@@ -79,8 +79,8 @@ type updateResponse struct {
|
||||
WebsiteURL *string `json:"websiteUrl"`
|
||||
Email *string `json:"email"`
|
||||
HeadquarterAddress *string `json:"headquarterAddress"`
|
||||
} `json:"trustCenter"`
|
||||
} `json:"updateTrustCenter"`
|
||||
} `json:"compliancePortal"`
|
||||
} `json:"updateCompliancePortal"`
|
||||
}
|
||||
|
||||
func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
@@ -97,12 +97,12 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "update",
|
||||
Short: "Update trust center settings",
|
||||
Example: ` # Enable the trust center
|
||||
prb trust-center update --active
|
||||
Short: "Update compliance portal settings",
|
||||
Example: ` # Enable the compliance portal
|
||||
prb compliance-portal update --active
|
||||
|
||||
# Disable search engine indexing
|
||||
prb trust-center update --search-engine-indexing NOT_INDEXABLE`,
|
||||
prb compliance-portal update --search-engine-indexing NOT_INDEXABLE`,
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
cfg, err := f.Config()
|
||||
@@ -131,16 +131,16 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
return fmt.Errorf("organization is required; pass --org or set a default with 'prb auth login'")
|
||||
}
|
||||
|
||||
// Fetch trust center ID from organization.
|
||||
// Fetch compliance portal ID from organization.
|
||||
data, err := client.Do(
|
||||
trustCenterQuery,
|
||||
compliancePortalQuery,
|
||||
map[string]any{"id": flagOrg},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var tcResp trustCenterQueryResponse
|
||||
var tcResp compliancePortalQueryResponse
|
||||
if err := json.Unmarshal(data, &tcResp); err != nil {
|
||||
return fmt.Errorf("cannot parse response: %w", err)
|
||||
}
|
||||
@@ -153,12 +153,12 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
return fmt.Errorf("expected Organization node, got %s", tcResp.Node.Typename)
|
||||
}
|
||||
|
||||
if tcResp.Node.TrustCenter == nil {
|
||||
return fmt.Errorf("trust center not found for organization %s", flagOrg)
|
||||
if tcResp.Node.CompliancePortal == nil {
|
||||
return fmt.Errorf("compliance portal not found for organization %s", flagOrg)
|
||||
}
|
||||
|
||||
input := map[string]any{
|
||||
"trustCenterId": tcResp.Node.TrustCenter.ID,
|
||||
"compliancePortalId": tcResp.Node.CompliancePortal.ID,
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("active") {
|
||||
@@ -214,10 +214,10 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
return fmt.Errorf("cannot parse response: %w", err)
|
||||
}
|
||||
|
||||
tc := resp.UpdateTrustCenter.TrustCenter
|
||||
tc := resp.UpdateCompliancePortal.CompliancePortal
|
||||
_, _ = fmt.Fprintf(
|
||||
f.IOStreams.Out,
|
||||
"Updated trust center %s\n",
|
||||
"Updated compliance portal %s\n",
|
||||
tc.ID,
|
||||
)
|
||||
|
||||
@@ -226,7 +226,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
}
|
||||
|
||||
cmd.Flags().StringVar(&flagOrg, "org", "", "Organization ID")
|
||||
cmd.Flags().BoolVar(&flagActive, "active", false, "Enable or disable the trust center")
|
||||
cmd.Flags().BoolVar(&flagActive, "active", false, "Enable or disable the compliance portal")
|
||||
cmd.Flags().StringVar(&flagSearchEngineIndexing, "search-engine-indexing", "", "Search engine indexing: INDEXABLE, NOT_INDEXABLE")
|
||||
cmd.Flags().StringVar(&flagDescription, "description", "", "Compliance page description")
|
||||
cmd.Flags().StringVar(&flagWebsiteURL, "website-url", "", "Compliance page website URL")
|
||||
@@ -35,7 +35,7 @@ query($id: ID!) {
|
||||
node(id: $id) {
|
||||
__typename
|
||||
... on Organization {
|
||||
trustCenter {
|
||||
compliancePortal {
|
||||
id
|
||||
active
|
||||
searchEngineIndexing
|
||||
@@ -53,8 +53,8 @@ query($id: ID!) {
|
||||
|
||||
type viewResponse struct {
|
||||
Node *struct {
|
||||
Typename string `json:"__typename"`
|
||||
TrustCenter *struct {
|
||||
Typename string `json:"__typename"`
|
||||
CompliancePortal *struct {
|
||||
ID string `json:"id"`
|
||||
Active bool `json:"active"`
|
||||
SearchEngineIndexing string `json:"searchEngineIndexing"`
|
||||
@@ -64,7 +64,7 @@ type viewResponse struct {
|
||||
NdaFileUrl *string `json:"ndaFileUrl"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
} `json:"trustCenter"`
|
||||
} `json:"compliancePortal"`
|
||||
} `json:"node"`
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "view",
|
||||
Short: "View trust center settings",
|
||||
Short: "View compliance portal settings",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if err := cmdutil.ValidateOutputFlag(flagOutput); err != nil {
|
||||
@@ -130,11 +130,11 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
|
||||
return fmt.Errorf("expected Organization node, got %s", resp.Node.Typename)
|
||||
}
|
||||
|
||||
if resp.Node.TrustCenter == nil {
|
||||
return fmt.Errorf("trust center not found for organization %s", flagOrg)
|
||||
if resp.Node.CompliancePortal == nil {
|
||||
return fmt.Errorf("compliance portal not found for organization %s", flagOrg)
|
||||
}
|
||||
|
||||
tc := resp.Node.TrustCenter
|
||||
tc := resp.Node.CompliancePortal
|
||||
|
||||
if *flagOutput == cmdutil.OutputJSON {
|
||||
return cmdutil.PrintJSON(f.IOStreams.Out, tc)
|
||||
@@ -145,7 +145,7 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
|
||||
bold := lipgloss.NewStyle().Bold(true)
|
||||
label := lipgloss.NewStyle().Foreground(lipgloss.Color("242")).Width(28)
|
||||
|
||||
_, _ = fmt.Fprintf(out, "%s\n\n", bold.Render("Trust Center"))
|
||||
_, _ = fmt.Fprintf(out, "%s\n\n", bold.Render("Compliance Portal"))
|
||||
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("ID:"), tc.ID)
|
||||
_, _ = fmt.Fprintf(out, "%s%v\n", label.Render("Active:"), tc.Active)
|
||||
@@ -68,12 +68,12 @@ type createResponse struct {
|
||||
|
||||
func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
var (
|
||||
flagOrg string
|
||||
flagTitle string
|
||||
flagContent string
|
||||
flagDocumentType string
|
||||
flagClassification string
|
||||
flagTrustCenterVisibility string
|
||||
flagOrg string
|
||||
flagTitle string
|
||||
flagContent string
|
||||
flagDocumentType string
|
||||
flagClassification string
|
||||
flagCompliancePortalVisibility string
|
||||
)
|
||||
|
||||
cmd := &cobra.Command{
|
||||
@@ -199,16 +199,16 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
input["content"] = flagContent
|
||||
}
|
||||
|
||||
if flagTrustCenterVisibility != "" {
|
||||
if flagCompliancePortalVisibility != "" {
|
||||
if err := cmdutil.ValidateEnum(
|
||||
"trust-center-visibility",
|
||||
flagTrustCenterVisibility,
|
||||
"compliance-portal-visibility",
|
||||
flagCompliancePortalVisibility,
|
||||
[]string{"NONE", "PRIVATE", "PUBLIC"},
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
input["trustCenterVisibility"] = flagTrustCenterVisibility
|
||||
input["compliancePortalVisibility"] = flagCompliancePortalVisibility
|
||||
}
|
||||
|
||||
data, err := client.Do(
|
||||
@@ -242,7 +242,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd.Flags().StringVar(&flagContent, "content", "", "Document content")
|
||||
cmd.Flags().StringVar(&flagDocumentType, "document-type", "", "Document type: OTHER, GOVERNANCE, POLICY, PROCEDURE, PLAN, REGISTER, RECORD, REPORT, TEMPLATE")
|
||||
cmd.Flags().StringVar(&flagClassification, "classification", "", "Classification: PUBLIC, INTERNAL, CONFIDENTIAL, SECRET")
|
||||
cmd.Flags().StringVar(&flagTrustCenterVisibility, "trust-center-visibility", "", "Trust center visibility: NONE, PRIVATE, PUBLIC")
|
||||
cmd.Flags().StringVar(&flagCompliancePortalVisibility, "compliance-portal-visibility", "", "Compliance portal visibility: NONE, PRIVATE, PUBLIC")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ query($id: ID!, $first: Int, $after: CursorKey, $orderBy: DocumentOrder, $filter
|
||||
node {
|
||||
id
|
||||
status
|
||||
trustCenterVisibility
|
||||
compliancePortalVisibility
|
||||
versions(first: 1) {
|
||||
edges {
|
||||
node {
|
||||
@@ -63,10 +63,10 @@ query($id: ID!, $first: Int, $after: CursorKey, $orderBy: DocumentOrder, $filter
|
||||
`
|
||||
|
||||
type document struct {
|
||||
ID string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
TrustCenterVisibility string `json:"trustCenterVisibility"`
|
||||
Versions struct {
|
||||
ID string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
CompliancePortalVisibility string `json:"compliancePortalVisibility"`
|
||||
Versions struct {
|
||||
Edges []struct {
|
||||
Node struct {
|
||||
Title string `json:"title"`
|
||||
|
||||
@@ -34,7 +34,7 @@ mutation($input: UpdateDocumentInput!) {
|
||||
updateDocument(input: $input) {
|
||||
document {
|
||||
id
|
||||
trustCenterVisibility
|
||||
compliancePortalVisibility
|
||||
}
|
||||
documentVersion {
|
||||
id
|
||||
@@ -52,8 +52,8 @@ mutation($input: UpdateDocumentInput!) {
|
||||
type updateResponse struct {
|
||||
UpdateDocument struct {
|
||||
Document struct {
|
||||
ID string `json:"id"`
|
||||
TrustCenterVisibility string `json:"trustCenterVisibility"`
|
||||
ID string `json:"id"`
|
||||
CompliancePortalVisibility string `json:"compliancePortalVisibility"`
|
||||
} `json:"document"`
|
||||
DocumentVersion *struct {
|
||||
ID string `json:"id"`
|
||||
@@ -69,11 +69,11 @@ type updateResponse struct {
|
||||
|
||||
func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
var (
|
||||
flagTitle string
|
||||
flagContent string
|
||||
flagDocumentType string
|
||||
flagClassification string
|
||||
flagTrustCenterVisibility string
|
||||
flagTitle string
|
||||
flagContent string
|
||||
flagDocumentType string
|
||||
flagClassification string
|
||||
flagCompliancePortalVisibility string
|
||||
)
|
||||
|
||||
cmd := &cobra.Command{
|
||||
@@ -134,16 +134,16 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
input["classification"] = flagClassification
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("trust-center-visibility") {
|
||||
if cmd.Flags().Changed("compliance-portal-visibility") {
|
||||
if err := cmdutil.ValidateEnum(
|
||||
"trust-center-visibility",
|
||||
flagTrustCenterVisibility,
|
||||
"compliance-portal-visibility",
|
||||
flagCompliancePortalVisibility,
|
||||
[]string{"NONE", "PRIVATE", "PUBLIC"},
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
input["trustCenterVisibility"] = flagTrustCenterVisibility
|
||||
input["compliancePortalVisibility"] = flagCompliancePortalVisibility
|
||||
}
|
||||
|
||||
if len(input) == 1 {
|
||||
@@ -189,7 +189,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd.Flags().StringVar(&flagContent, "content", "", "Document content")
|
||||
cmd.Flags().StringVar(&flagDocumentType, "document-type", "", "Document type: OTHER, GOVERNANCE, POLICY, PROCEDURE, PLAN, REGISTER, RECORD, REPORT, TEMPLATE, STATEMENT_OF_APPLICABILITY")
|
||||
cmd.Flags().StringVar(&flagClassification, "classification", "", "Classification: PUBLIC, INTERNAL, CONFIDENTIAL, SECRET")
|
||||
cmd.Flags().StringVar(&flagTrustCenterVisibility, "trust-center-visibility", "", "Trust center visibility: NONE, PRIVATE, PUBLIC")
|
||||
cmd.Flags().StringVar(&flagCompliancePortalVisibility, "compliance-portal-visibility", "", "Compliance portal visibility: NONE, PRIVATE, PUBLIC")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ query($id: ID!) {
|
||||
... on Document {
|
||||
id
|
||||
status
|
||||
trustCenterVisibility
|
||||
compliancePortalVisibility
|
||||
currentPublishedMajor
|
||||
currentPublishedMinor
|
||||
versions(first: 1) {
|
||||
@@ -61,13 +61,13 @@ query($id: ID!) {
|
||||
|
||||
type viewResponse struct {
|
||||
Node *struct {
|
||||
Typename string `json:"__typename"`
|
||||
ID string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
TrustCenterVisibility string `json:"trustCenterVisibility"`
|
||||
CurrentPublishedMajor *int `json:"currentPublishedMajor"`
|
||||
CurrentPublishedMinor *int `json:"currentPublishedMinor"`
|
||||
Versions struct {
|
||||
Typename string `json:"__typename"`
|
||||
ID string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
CompliancePortalVisibility string `json:"compliancePortalVisibility"`
|
||||
CurrentPublishedMajor *int `json:"currentPublishedMajor"`
|
||||
CurrentPublishedMinor *int `json:"currentPublishedMinor"`
|
||||
Versions struct {
|
||||
Edges []struct {
|
||||
Node struct {
|
||||
Title string `json:"title"`
|
||||
@@ -153,7 +153,7 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
|
||||
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("ID:"), doc.ID)
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Status:"), doc.Status)
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Visibility:"), doc.TrustCenterVisibility)
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Visibility:"), doc.CompliancePortalVisibility)
|
||||
|
||||
if len(doc.Versions.Edges) > 0 {
|
||||
v := doc.Versions.Edges[0].Node
|
||||
|
||||
@@ -31,6 +31,7 @@ import (
|
||||
"go.probo.inc/probo/pkg/cmd/browse"
|
||||
"go.probo.inc/probo/pkg/cmd/cmdutil"
|
||||
"go.probo.inc/probo/pkg/cmd/completion"
|
||||
complianceportal "go.probo.inc/probo/pkg/cmd/compliance-portal"
|
||||
cmdconfig "go.probo.inc/probo/pkg/cmd/config"
|
||||
consentrecord "go.probo.inc/probo/pkg/cmd/consent-record"
|
||||
cmdcontext "go.probo.inc/probo/pkg/cmd/context"
|
||||
@@ -58,7 +59,6 @@ import (
|
||||
"go.probo.inc/probo/pkg/cmd/tia"
|
||||
trackerpattern "go.probo.inc/probo/pkg/cmd/tracker-pattern"
|
||||
trackerresource "go.probo.inc/probo/pkg/cmd/tracker-resource"
|
||||
trustcenter "go.probo.inc/probo/pkg/cmd/trust-center"
|
||||
"go.probo.inc/probo/pkg/cmd/user"
|
||||
"go.probo.inc/probo/pkg/cmd/version"
|
||||
"go.probo.inc/probo/pkg/cmd/webhook"
|
||||
@@ -130,7 +130,7 @@ func NewCmdRoot(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd.AddCommand(soa.NewCmdSoa(f))
|
||||
cmd.AddCommand(task.NewCmdTask(f))
|
||||
cmd.AddCommand(tia.NewCmdTIA(f))
|
||||
cmd.AddCommand(trustcenter.NewCmdTrustCenter(f))
|
||||
cmd.AddCommand(complianceportal.NewCmdCompliancePortal(f))
|
||||
cmd.AddCommand(user.NewCmdUser(f))
|
||||
cmd.AddCommand(thirdpartymgmt.NewCmdThirdParty(f))
|
||||
cmd.AddCommand(version.NewCmdVersion(f))
|
||||
|
||||
Reference in New Issue
Block a user