From e4f4cedda7473a284fe9b59729cca5d9b30312e4 Mon Sep 17 00:00:00 2001 From: Andrea Angiolillo Date: Fri, 4 Oct 2024 15:49:20 +0100 Subject: [PATCH] CLOUDP-269965: [Atlas CLI] Documentation needs to be updated for some commands (#3231) --- docs/command/atlas-accessLogs-list.txt | 8 ++++++++ docs/command/atlas-dataFederation-queryLimits-list.txt | 4 ++-- internal/cli/accesslogs/list.go | 9 +++++++-- internal/cli/datafederation/querylimits/list.go | 6 +++--- .../cli/datalakepipelines/availableschedules/list.go | 4 ++-- .../cli/datalakepipelines/availablesnapshots/list.go | 4 ++-- internal/cli/datalakepipelines/runs/list.go | 4 ++-- internal/cli/search/nodes/list.go | 2 +- 8 files changed, 27 insertions(+), 14 deletions(-) diff --git a/docs/command/atlas-accessLogs-list.txt b/docs/command/atlas-accessLogs-list.txt index c762264dc3..c93e3257ba 100644 --- a/docs/command/atlas-accessLogs-list.txt +++ b/docs/command/atlas-accessLogs-list.txt @@ -106,3 +106,11 @@ Examples # Return a JSON-formatted list of all authentication requests made against the cluster named Cluster0 for the project with ID 618d48e05277a606ed2496fe: atlas accesslogs list --output json --projectId 618d48e05277a606ed2496fe --clusterName Cluster0 + + +.. code-block:: + :copyable: false + + # Return a JSON-formatted list of all authentication requests made against the hostname named atlas-dqrlj4-shard-00-00.g1nxq.mongodb-dev.net for the project stored in the profile atlas-dev: + atlas accesslogs list --hostname atlas-dqrlj4-shard-00-00.g1nxq.mongodb-dev.net --profile atlas-dev --output json + diff --git a/docs/command/atlas-dataFederation-queryLimits-list.txt b/docs/command/atlas-dataFederation-queryLimits-list.txt index e76ab8eedd..9f30232375 100644 --- a/docs/command/atlas-dataFederation-queryLimits-list.txt +++ b/docs/command/atlas-dataFederation-queryLimits-list.txt @@ -76,6 +76,6 @@ Examples .. code-block:: :copyable: false - # list all data federation query limits: - atlas dataFederation queryLimits list + # list all data federation query limits for the database federated instance "myInstance": + atlas dataFederation queryLimits list --dataFederation myInstance diff --git a/internal/cli/accesslogs/list.go b/internal/cli/accesslogs/list.go index 1bdb41350f..4f85764c46 100644 --- a/internal/cli/accesslogs/list.go +++ b/internal/cli/accesslogs/list.go @@ -104,7 +104,7 @@ func (opts *ListOpts) ValidateInput() error { return nil } -// atlas accessLogs(s) list|ls [--projectId projectId] [--clusterName clusterName] [--start start] [--end end] [--nLogs nLogs] [--ipAddress ipAddress] [--authResult success|fail]. +// ListBuilder represents atlas accessLogs(s) list|ls [--projectId projectId] [--clusterName clusterName] [--start start] [--end end] [--nLogs nLogs] [--ipAddress ipAddress] [--authResult success|fail]. func ListBuilder() *cobra.Command { opts := &ListOpts{} cmd := &cobra.Command{ @@ -114,7 +114,11 @@ func ListBuilder() *cobra.Command { Long: fmt.Sprintf(usage.RequiredRole, "Project Monitoring Admin"), Args: require.NoArgs, Example: ` # Return a JSON-formatted list of all authentication requests made against the cluster named Cluster0 for the project with ID 618d48e05277a606ed2496fe: - atlas accesslogs list --output json --projectId 618d48e05277a606ed2496fe --clusterName Cluster0`, + atlas accesslogs list --output json --projectId 618d48e05277a606ed2496fe --clusterName Cluster0 + + # Return a JSON-formatted list of all authentication requests made against the hostname named atlas-dqrlj4-shard-00-00.g1nxq.mongodb-dev.net for the project stored in the profile atlas-dev: + atlas accesslogs list --hostname atlas-dqrlj4-shard-00-00.g1nxq.mongodb-dev.net --profile atlas-dev --output json +`, PreRunE: func(cmd *cobra.Command, _ []string) error { return opts.PreRunE( opts.ValidateInput, @@ -136,6 +140,7 @@ func ListBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.authResult, flag.AuthResult, "", usage.AuthResult) cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + cmd.MarkFlagsMutuallyExclusive(flag.ClusterName, flag.Hostname) cmd.MarkFlagsOneRequired(flag.ClusterName, flag.Hostname) diff --git a/internal/cli/datafederation/querylimits/list.go b/internal/cli/datafederation/querylimits/list.go index 4072702966..4dd3df5f0b 100644 --- a/internal/cli/datafederation/querylimits/list.go +++ b/internal/cli/datafederation/querylimits/list.go @@ -58,7 +58,7 @@ func (opts *ListOpts) Run() error { return opts.Print(r) } -// atlas dataFederation queryLimits list [--projectId projectId]. +// ListBuilder represents atlas dataFederation queryLimits list [--projectId projectId]. func ListBuilder() *cobra.Command { opts := &ListOpts{} cmd := &cobra.Command{ @@ -67,8 +67,8 @@ func ListBuilder() *cobra.Command { Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), Aliases: []string{"ls"}, Args: require.NoArgs, - Example: `# list all data federation query limits: - atlas dataFederation queryLimits list + Example: `# list all data federation query limits for the database federated instance "myInstance": + atlas dataFederation queryLimits list --dataFederation myInstance `, PreRunE: func(cmd *cobra.Command, _ []string) error { return opts.PreRunE( diff --git a/internal/cli/datalakepipelines/availableschedules/list.go b/internal/cli/datalakepipelines/availableschedules/list.go index 22a4cf05fc..581b39a5ea 100644 --- a/internal/cli/datalakepipelines/availableschedules/list.go +++ b/internal/cli/datalakepipelines/availableschedules/list.go @@ -57,7 +57,7 @@ func (opts *ListOpts) Run() error { return opts.Print(r) } -// atlas dataLakePipelines availableSchedules list [--projectId projectId]. +// ListBuilder represents atlas dataLakePipelines availableSchedules list [--projectId projectId]. func ListBuilder() *cobra.Command { opts := &ListOpts{} cmd := &cobra.Command{ @@ -67,7 +67,7 @@ func ListBuilder() *cobra.Command { Aliases: []string{"ls"}, Args: require.NoArgs, Example: `# list available schedules for data lake pipeline called 'Pipeline1': - atlas dataLakePipelines availableSchedules list Pipeline1 + atlas dataLakePipelines availableSchedules list --pipeline Pipeline1 `, PreRunE: func(cmd *cobra.Command, _ []string) error { return opts.PreRunE( diff --git a/internal/cli/datalakepipelines/availablesnapshots/list.go b/internal/cli/datalakepipelines/availablesnapshots/list.go index f7dd160443..8610d3adef 100644 --- a/internal/cli/datalakepipelines/availablesnapshots/list.go +++ b/internal/cli/datalakepipelines/availablesnapshots/list.go @@ -79,7 +79,7 @@ func (opts *ListOpts) Run() error { return opts.Print(r) } -// atlas dataLakePipelines availableSnapshots list [--projectId projectId]. +// ListBuilder represents atlas dataLakePipelines availableSnapshots list [--projectId projectId]. func ListBuilder() *cobra.Command { opts := &ListOpts{} cmd := &cobra.Command{ @@ -89,7 +89,7 @@ func ListBuilder() *cobra.Command { Aliases: []string{"ls"}, Args: require.NoArgs, Example: `# list available backup schedules for data lake pipeline called 'Pipeline1': - atlas dataLakePipelines availableSnapshots list Pipeline1 + atlas dataLakePipelines availableSnapshots list --pipeline Pipeline1 `, PreRunE: func(cmd *cobra.Command, _ []string) error { return opts.PreRunE( diff --git a/internal/cli/datalakepipelines/runs/list.go b/internal/cli/datalakepipelines/runs/list.go index 22b6401111..365e130724 100644 --- a/internal/cli/datalakepipelines/runs/list.go +++ b/internal/cli/datalakepipelines/runs/list.go @@ -59,7 +59,7 @@ func (opts *ListOpts) Run() error { return opts.Print(r) } -// atlas dataLakePipelines runs list [--projectId projectId]. +// ListBuilder represents atlas dataLakePipelines runs list [--projectId projectId]. func ListBuilder() *cobra.Command { opts := &ListOpts{} cmd := &cobra.Command{ @@ -69,7 +69,7 @@ func ListBuilder() *cobra.Command { Aliases: []string{"ls"}, Args: require.NoArgs, Example: `# list all pipeline runs: - atlas dataLakePipelines runs list + atlas dataLakePipelines runs list --pipeline Pipeline1 `, PreRunE: func(cmd *cobra.Command, _ []string) error { return opts.PreRunE( diff --git a/internal/cli/search/nodes/list.go b/internal/cli/search/nodes/list.go index 59c8ad67f7..f285809584 100644 --- a/internal/cli/search/nodes/list.go +++ b/internal/cli/search/nodes/list.go @@ -56,7 +56,7 @@ func (opts *ListOpts) Run() error { return opts.Print(r) } -// atlas clusters search nodes list [--projectId projectId] [--clusterName name]. +// ListBuilder represents atlas clusters search nodes list [--projectId projectId] [--clusterName name]. func ListBuilder() *cobra.Command { opts := &ListOpts{} cmd := &cobra.Command{