From 189107892b4c72ac7ee5e6efdea5583141c80e2c Mon Sep 17 00:00:00 2001 From: Wesley Nabo Date: Mon, 28 Jul 2025 16:41:41 -0500 Subject: [PATCH 1/5] CLOUDP-333877: create streams workspaces atlas cli command + workspaces create --- .../atlas-streams-workspaces-create.txt | 122 ++++++++++++++++++ docs/command/atlas-streams-workspaces.txt | 61 +++++++++ docs/command/atlas-streams.txt | 2 + internal/cli/streams/instance/create.go | 66 +++++++++- internal/cli/streams/instance/create_test.go | 37 ++++++ internal/cli/streams/instance/workspaces.go | 33 +++++ internal/cli/streams/streams.go | 1 + internal/flag/flags.go | 2 + internal/usage/usage.go | 4 + 9 files changed, 321 insertions(+), 7 deletions(-) create mode 100644 docs/command/atlas-streams-workspaces-create.txt create mode 100644 docs/command/atlas-streams-workspaces.txt create mode 100644 internal/cli/streams/instance/workspaces.go diff --git a/docs/command/atlas-streams-workspaces-create.txt b/docs/command/atlas-streams-workspaces-create.txt new file mode 100644 index 0000000000..63f5f21161 --- /dev/null +++ b/docs/command/atlas-streams-workspaces-create.txt @@ -0,0 +1,122 @@ +.. _atlas-streams-workspaces-create: + +=============================== +atlas streams workspaces create +=============================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create an Atlas Stream Processing workspace for your project + +To get started quickly, specify a name, a cloud provider, and a region to configure an Atlas Stream Processing workspace.To use this command, you must authenticate with a user account or an API key with the Project Owner role. + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas streams workspaces create [options] + +.. Code end marker, please don't delete this comment + +Arguments +--------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - name + - string + - true + - Name of the Atlas Stream Processing workspace. After creation, you can't change the name of the workspace. The name can contain ASCII letters, numbers, and hyphens. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --defaultTier + - string + - false + - Default Tier for your Stream Workspace. + * - -h, --help + - + - false + - help for create + * - --maxTierSize + - string + - false + - Max Tier Size for your Stream Workspace. + * - -o, --output + - string + - false + - Output format. Valid values are json, json-path, go-template, or go-template-file. To see the full output, use the -o json option. + * - --projectId + - string + - false + - Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable. + * - --provider + - string + - true + - Cloud service provider that applies to the provisioned Atlas Stream Processing instance. Valid values are AWS or AZURE. This value defaults to "AWS". + * - -r, --region + - string + - true + - Human-readable label that identifies the physical location of your Atlas Stream Processing instance. The region can affect network latency and performance if it is far from your source or sink. For AWS, region name must be in the following format: VIRGINIA_USA. For a list of valid values, see https://www.mongodb.com/docs/atlas/reference/amazon-aws/#std-label-aws-stream-processing-regions. For Azure, region name must be in the following format: eastus. For a list of valid values, see https://www.mongodb.com/docs/atlas/reference/microsoft-azure/#std-label-azure-stream-processing-regions. + * - --tier + - string + - false + - Tier for your Stream Workspace. This value defaults to "SP30". + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings. + +Output +------ + +If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values. + +.. code-block:: + + Atlas Streams Processor Workspace '' successfully created. + + +Examples +-------- + +.. code-block:: + :copyable: false + + # Deploy an Atlas Stream Processing workspace called myProcessor for the project with the ID 5e2211c17a3e5a48f5497de3: + atlas streams instance create myProcessor --projectId 5e2211c17a3e5a48f5497de3 --provider AWS --region VIRGINIA_USA --tier SP10 --defaultTier SP30 --maxTierSize SP50 diff --git a/docs/command/atlas-streams-workspaces.txt b/docs/command/atlas-streams-workspaces.txt new file mode 100644 index 0000000000..496435ed77 --- /dev/null +++ b/docs/command/atlas-streams-workspaces.txt @@ -0,0 +1,61 @@ +.. _atlas-streams-workspaces: + +======================== +atlas streams workspaces +======================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Manage Atlas Stream Processing workspaces. + +Create, list, update, and delete your Atlas Stream Processing workspaces. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for workspaces + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings. + +Related Commands +---------------- + +* :ref:`atlas-streams-workspaces-create` - Create an Atlas Stream Processing workspace for your project + + +.. toctree:: + :titlesonly: + + create + diff --git a/docs/command/atlas-streams.txt b/docs/command/atlas-streams.txt index d0a648bac8..fc496bbe36 100644 --- a/docs/command/atlas-streams.txt +++ b/docs/command/atlas-streams.txt @@ -54,6 +54,7 @@ Related Commands * :ref:`atlas-streams-connections` - Manage Atlas Stream Processing connections. * :ref:`atlas-streams-instances` - Manage Atlas Stream Processing instances. * :ref:`atlas-streams-privateLinks` - Manage Atlas Stream Processing PrivateLink endpoints. +* :ref:`atlas-streams-workspaces` - Manage Atlas Stream Processing workspaces. .. toctree:: @@ -62,4 +63,5 @@ Related Commands connections instances privateLinks + workspaces diff --git a/internal/cli/streams/instance/create.go b/internal/cli/streams/instance/create.go index 872f1c5bb7..f1a123e646 100644 --- a/internal/cli/streams/instance/create.go +++ b/internal/cli/streams/instance/create.go @@ -38,16 +38,19 @@ type CreateOpts struct { cli.ProjectOpts cli.OutputOpts cli.InputOpts - name string - provider string - region string - tier string - store StreamsCreator + name string + provider string + region string + tier string + defaultTier string + maxTierSize string + store StreamsCreator } const ( - createTemplate = "Atlas Streams Processor Instance '{{.Name}}' successfully created.\n" - defaultTier = "SP30" + createTemplate = "Atlas Streams Processor Instance '{{.Name}}' successfully created.\n" + createWorkspace = "Atlas Streams Processor Workspace '{{.Name}}' successfully created.\n" + defaultTier = "SP30" ) func (opts *CreateOpts) Run() error { @@ -61,6 +64,12 @@ func (opts *CreateOpts) Run() error { tierOrDefault = opts.tier } streamConfig := streamProcessor.GetStreamConfig() + if opts.defaultTier != "" { + streamConfig.DefaultTier = &opts.defaultTier + } + if opts.maxTierSize != "" { + streamConfig.MaxTierSize = &opts.maxTierSize + } streamConfig.Tier = &tierOrDefault streamProcessor.StreamConfig = &streamConfig @@ -124,3 +133,46 @@ func CreateBuilder() *cobra.Command { return cmd } + +func WorkspaceCreateBuilder() *cobra.Command { + opts := &CreateOpts{} + cmd := &cobra.Command{ + Use: "create ", + Short: "Create an Atlas Stream Processing workspace for your project", + Long: `To get started quickly, specify a name, a cloud provider, and a region to configure an Atlas Stream Processing workspace.` + fmt.Sprintf(usage.RequiredRole, "Project Owner"), + Example: ` # Deploy an Atlas Stream Processing workspace called myProcessor for the project with the ID 5e2211c17a3e5a48f5497de3: + atlas streams instance create myProcessor --projectId 5e2211c17a3e5a48f5497de3 --provider AWS --region VIRGINIA_USA --tier SP10 --defaultTier SP30 --maxTierSize SP50`, + Args: require.ExactArgs(1), + Annotations: map[string]string{ + "nameDesc": "Name of the Atlas Stream Processing workspace. After creation, you can't change the name of the workspace. The name can contain ASCII letters, numbers, and hyphens.", + "output": createWorkspace, + }, + PreRunE: func(cmd *cobra.Command, args []string) error { + opts.name = args[0] + + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), createWorkspace), + ) + }, + RunE: func(_ *cobra.Command, _ []string) error { + return opts.Run() + }, + } + + cmd.Flags().StringVar(&opts.provider, flag.Provider, "AWS", usage.StreamsProvider) + cmd.Flags().StringVarP(&opts.region, flag.Region, flag.RegionShort, "", usage.StreamsRegion) + + opts.AddProjectOptsFlags(cmd) + opts.AddOutputOptFlags(cmd) + + cmd.Flags().StringVar(&opts.tier, flag.Tier, "SP30", usage.StreamsWorkspaceTier) + cmd.Flags().StringVar(&opts.defaultTier, flag.DefaultTier, "", usage.StreamsWorkspaceDefaultTier) + cmd.Flags().StringVar(&opts.maxTierSize, flag.MaxTierSize, "", usage.StreamsWorkspaceMaxTierSize) + + _ = cmd.MarkFlagRequired(flag.Provider) + _ = cmd.MarkFlagRequired(flag.Region) + + return cmd +} diff --git a/internal/cli/streams/instance/create_test.go b/internal/cli/streams/instance/create_test.go index 8b0b71945f..9c5fce902f 100644 --- a/internal/cli/streams/instance/create_test.go +++ b/internal/cli/streams/instance/create_test.go @@ -98,4 +98,41 @@ func TestCreateOpts_Run(t *testing.T) { t.Log(buf.String()) test.VerifyOutputTemplate(t, createTemplate, expected) }) + + t.Run("stream workspaces create --tier --defaultTier --maxTierSize", func(t *testing.T) { + buf := new(bytes.Buffer) + opts := &CreateOpts{ + store: mockStore, + name: "ExampleStreamWorkspaces", + provider: "AWS", + region: "VIRGINIA_USA", + tier: "SP30", + defaultTier: "SP30", + maxTierSize: "SP50", + } + opts.ProjectID = testProjectID + + expected := &atlasv2.StreamsTenant{ + Name: &opts.name, + GroupId: &opts.ProjectID, + DataProcessRegion: &atlasv2.StreamsDataProcessRegion{CloudProvider: "AWS", Region: "VIRGINIA_USA"}, + StreamConfig: &atlasv2.StreamConfig{ + Tier: &opts.tier, + DefaultTier: &opts.defaultTier, + MaxTierSize: &opts.maxTierSize, + }, + } + + mockStore. + EXPECT(). + CreateStream(opts.ProjectID, expected). + Return(expected, nil). + Times(1) + + if err := opts.Run(); err != nil { + t.Fatalf("Run() unexpected error: %v", err) + } + t.Log(buf.String()) + test.VerifyOutputTemplate(t, createWorkspace, expected) + }) } diff --git a/internal/cli/streams/instance/workspaces.go b/internal/cli/streams/instance/workspaces.go new file mode 100644 index 0000000000..ac75216e43 --- /dev/null +++ b/internal/cli/streams/instance/workspaces.go @@ -0,0 +1,33 @@ +// Copyright 2023 MongoDB Inc +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package instance + +import ( + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" + "github.com/spf13/cobra" +) + +func WorkspaceBuilder() *cobra.Command { + const use = "workspaces" + cmd := &cobra.Command{ + Use: use, + Aliases: cli.GenerateAliases(use), + Short: "Manage Atlas Stream Processing workspaces.", + Long: `Create, list, update, and delete your Atlas Stream Processing workspaces.`, + } + cmd.AddCommand(WorkspaceCreateBuilder()) + + return cmd +} diff --git a/internal/cli/streams/streams.go b/internal/cli/streams/streams.go index d70588a985..62eb3e0a97 100644 --- a/internal/cli/streams/streams.go +++ b/internal/cli/streams/streams.go @@ -34,6 +34,7 @@ func Builder() *cobra.Command { instance.Builder(), connection.Builder(), privatelink.Builder(), + instance.WorkspaceBuilder(), ) return cmd diff --git a/internal/flag/flags.go b/internal/flag/flags.go index 3cee4fff9d..3a58edd692 100644 --- a/internal/flag/flags.go +++ b/internal/flag/flags.go @@ -51,6 +51,8 @@ const ( MembersShort = "m" // MembersShort flag ShardsShort = "s" // ShardsShort flag Tier = "tier" // Tier flag + DefaultTier = "defaultTier" // DefaultTier flag + MaxTierSize = "maxTierSize" // MaxTierSize flag Forever = "forever" // Forever flag ForeverShort = "F" // ForeverShort flag DiskSizeGB = "diskSizeGB" // DiskSizeGB flag diff --git a/internal/usage/usage.go b/internal/usage/usage.go index 96f44045b4..460aeb9043 100644 --- a/internal/usage/usage.go +++ b/internal/usage/usage.go @@ -242,9 +242,13 @@ dbName and collection are required only for built-in roles.` StreamsRegion = "Human-readable label that identifies the physical location of your Atlas Stream Processing instance. The region can affect network latency and performance if it is far from your source or sink. For AWS, region name must be in the following format: VIRGINIA_USA. For a list of valid values, see https://www.mongodb.com/docs/atlas/reference/amazon-aws/#std-label-aws-stream-processing-regions. For Azure, region name must be in the following format: eastus. For a list of valid values, see https://www.mongodb.com/docs/atlas/reference/microsoft-azure/#std-label-azure-stream-processing-regions." StreamsProvider = "Cloud service provider that applies to the provisioned Atlas Stream Processing instance. Valid values are AWS or AZURE." StreamsInstance = "Name of your Atlas Stream Processing instance." + StreamsWorkspace = "Name of your Atlas Stream Procesing workspace." StreamsConnectionFilename = "Path to a JSON configuration file that defines an Atlas Stream Processing connection. Note: Unsupported fields in the JSON file are ignored." StreamsPrivateLinkFilename = "Path to a JSON configuration file that defines an Atlas Stream Processing PrivateLink endpoint. Note: Unsupported fields in the JSON file are ignored." StreamsInstanceTier = "Tier for your Stream Instance." + StreamsWorkspaceTier = "Tier for your Stream Workspace." + StreamsWorkspaceDefaultTier = "Default Tier for your Stream Workspace." + StreamsWorkspaceMaxTierSize = "Max Tier Size for your Stream Workspace." WithoutDefaultAlertSettings = "Flag that creates the new project without the default alert settings enabled. This flag defaults to false. This option is useful if you create projects programmatically and want to create your own alerts instead of using the default alert settings." FormatOut = "Output format. Valid values are json, json-path, go-template, or go-template-file. To see the full output, use the -o json option." TargetClusterName = "Name of the target cluster. For use only with automated restore jobs. You must specify a targetClusterName for automated restores." From bf7aed9ead8ec2b77c713e916351222b129ecaae Mon Sep 17 00:00:00 2001 From: Wesley Nabo Date: Mon, 28 Jul 2025 18:13:05 -0500 Subject: [PATCH 2/5] CLOUDP-333877: remove max/default tiers --- .../atlas-streams-workspaces-create.txt | 8 -- .../atlas-streams-workspaces-delete.txt | 112 +++++++++++++++++ .../atlas-streams-workspaces-describe.txt | 109 +++++++++++++++++ .../atlas-streams-workspaces-download.txt | 114 ++++++++++++++++++ .../command/atlas-streams-workspaces-list.txt | 95 +++++++++++++++ .../atlas-streams-workspaces-update.txt | 111 +++++++++++++++++ docs/command/atlas-streams-workspaces.txt | 10 ++ internal/cli/streams/instance/create.go | 20 +-- internal/cli/streams/instance/create_test.go | 18 ++- internal/cli/streams/instance/workspaces.go | 2 +- internal/store/store_test.go | 2 +- 11 files changed, 565 insertions(+), 36 deletions(-) create mode 100644 docs/command/atlas-streams-workspaces-delete.txt create mode 100644 docs/command/atlas-streams-workspaces-describe.txt create mode 100644 docs/command/atlas-streams-workspaces-download.txt create mode 100644 docs/command/atlas-streams-workspaces-list.txt create mode 100644 docs/command/atlas-streams-workspaces-update.txt diff --git a/docs/command/atlas-streams-workspaces-create.txt b/docs/command/atlas-streams-workspaces-create.txt index 63f5f21161..d693beb687 100644 --- a/docs/command/atlas-streams-workspaces-create.txt +++ b/docs/command/atlas-streams-workspaces-create.txt @@ -53,18 +53,10 @@ Options - Type - Required - Description - * - --defaultTier - - string - - false - - Default Tier for your Stream Workspace. * - -h, --help - - false - help for create - * - --maxTierSize - - string - - false - - Max Tier Size for your Stream Workspace. * - -o, --output - string - false diff --git a/docs/command/atlas-streams-workspaces-delete.txt b/docs/command/atlas-streams-workspaces-delete.txt new file mode 100644 index 0000000000..b9248d4301 --- /dev/null +++ b/docs/command/atlas-streams-workspaces-delete.txt @@ -0,0 +1,112 @@ +.. _atlas-streams-workspaces-delete: + +=============================== +atlas streams workspaces delete +=============================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Delete an Atlas Stream Processing instance. + +The command prompts you to confirm the operation when you run the command without the --force option. + +Before deleting an Atlas Streams Processing instance, you must first stop all processes associated with it. +To use this command, you must authenticate with a user account or an API key with the Project Owner role. + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas streams workspaces delete [options] + +.. Code end marker, please don't delete this comment + +Arguments +--------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - name + - string + - true + - Name of the Atlas Streams instance. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --force + - + - false + - Flag that indicates whether to skip the confirmation prompt before proceeding with the requested action. + * - -h, --help + - + - false + - help for delete + * - --projectId + - string + - false + - Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings. + +Output +------ + +If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values. + +.. code-block:: + + Atlas Streams processor instance '' deleted + + +Examples +-------- + +.. code-block:: + :copyable: false + + # Remove an Atlas Stream Processing instance after prompting for a confirmation: + atlas streams instance delete myProcessorInstance + + +.. code-block:: + :copyable: false + + # Remove an Atlas Stream Processing instance named myProcessorInstance without requiring confirmation: + atlas streams instance delete myProcessorInstance --force diff --git a/docs/command/atlas-streams-workspaces-describe.txt b/docs/command/atlas-streams-workspaces-describe.txt new file mode 100644 index 0000000000..782a9ed554 --- /dev/null +++ b/docs/command/atlas-streams-workspaces-describe.txt @@ -0,0 +1,109 @@ +.. _atlas-streams-workspaces-describe: + +================================= +atlas streams workspaces describe +================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Describe an Atlas Stream Processing instance for your project. + +To use this command, you must authenticate with a user account or an API key with the Project Read Only role. + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas streams workspaces describe [options] + +.. Code end marker, please don't delete this comment + +Arguments +--------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - name + - string + - true + - Name of the Atlas Streams processor instance. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for describe + * - -o, --output + - string + - false + - Output format. Valid values are json, json-path, go-template, or go-template-file. To see the full output, use the -o json option. + * - --projectId + - string + - false + - Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings. + +Output +------ + +If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values. + +.. code-block:: + + ID NAME CLOUD REGION + + + +Examples +-------- + +.. code-block:: + :copyable: false + + # Return an Atlas Stream Processing instance with a specific name: + atlas streams instance describe myProcessor + +.. code-block:: + :copyable: false + + # Return a JSON-formatted Atlas Stream Processing instance with a specific name: + atlas streams instance describe myProcessor --output json diff --git a/docs/command/atlas-streams-workspaces-download.txt b/docs/command/atlas-streams-workspaces-download.txt new file mode 100644 index 0000000000..9edd45dcc4 --- /dev/null +++ b/docs/command/atlas-streams-workspaces-download.txt @@ -0,0 +1,114 @@ +.. _atlas-streams-workspaces-download: + +================================= +atlas streams workspaces download +================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Download a compressed file that contains the logs for the specified Atlas Stream Processing instance. + +This command downloads a file with a .gz extension. To use this command, you must authenticate with a user account or an API key with the Project Data Access Read/Write role. + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas streams workspaces download [options] + +.. Code end marker, please don't delete this comment + +Arguments +--------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - tenantName + - string + - true + - Label that identifies the tenant that stores the log files that you want to download. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --end + - int + - false + - Ending date and time for the range of log messages to retrieve, given in UNIX time. Defaults to the start date plus 24 hours, if the start date is set. If start date is not provided, ending time defaults to the current time. + * - --force + - + - false + - Flag that indicates whether to overwrite the destination file. + * - -h, --help + - + - false + - help for download + * - --out + - string + - true + - Output file name. This value defaults to the log name. + * - --projectId + - string + - false + - Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable. + * - --start + - int + - false + - UNIX Epoch-formatted starting date and time for the range of log messages to retrieve. This value defaults to 24 hours prior to the current timestamp. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings. + +Output +------ + +If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values. + +.. code-block:: + + Download of completed. + + +Examples +-------- + +.. code-block:: + :copyable: false + + # Download the audit log file from the instance myProcessor for the project with the ID 5e2211c17a3e5a48f5497de3: + atlas streams instance download myProcessor --projectId 5e2211c17a3e5a48f5497de3 diff --git a/docs/command/atlas-streams-workspaces-list.txt b/docs/command/atlas-streams-workspaces-list.txt new file mode 100644 index 0000000000..779b364198 --- /dev/null +++ b/docs/command/atlas-streams-workspaces-list.txt @@ -0,0 +1,95 @@ +.. _atlas-streams-workspaces-list: + +============================= +atlas streams workspaces list +============================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +List all the Atlas Stream Processing instances for your project. + +To use this command, you must authenticate with a user account or an API key with the Project Read Only role. + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas streams workspaces list [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for list + * - --limit + - int + - false + - Number of items per results page, up to a maximum of 500. If you have more than 500 results, specify the --page option to change the results page. This value defaults to 100. + * - -o, --output + - string + - false + - Output format. Valid values are json, json-path, go-template, or go-template-file. To see the full output, use the -o json option. + * - --page + - int + - false + - Page number that specifies a page of results. This value defaults to 1. + * - --projectId + - string + - false + - Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings. + +Output +------ + +If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values. + +.. code-block:: + + ID NAME CLOUD REGION + + + +Examples +-------- + +.. code-block:: + :copyable: false + + # Return a JSON-formatted list of all Atlas Stream Processing instances for the project with ID 5e2211c17a3e5a48f5497de3: + atlas streams instance list --projectId 5e2211c17a3e5a48f5497de3 --output json diff --git a/docs/command/atlas-streams-workspaces-update.txt b/docs/command/atlas-streams-workspaces-update.txt new file mode 100644 index 0000000000..f36b414f4f --- /dev/null +++ b/docs/command/atlas-streams-workspaces-update.txt @@ -0,0 +1,111 @@ +.. _atlas-streams-workspaces-update: + +=============================== +atlas streams workspaces update +=============================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Updates an Atlas Stream Processing instance for your project. + +Before updating an Atlas Streams Processing instance, you must first stop all processes associated with it. +To use this command, you must authenticate with a user account or an API key with the Project Owner role. + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas streams workspaces update [options] + +.. Code end marker, please don't delete this comment + +Arguments +--------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - name + - string + - true + - Name of the Atlas Stream Processing instance. After creation, you can't change the name of the instance. The name can contain ASCII letters, numbers, and hyphens. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for update + * - -o, --output + - string + - false + - Output format. Valid values are json, json-path, go-template, or go-template-file. To see the full output, use the -o json option. + * - --projectId + - string + - false + - Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable. + * - --provider + - string + - true + - Cloud service provider that applies to the provisioned Atlas Stream Processing instance. Valid values are AWS or AZURE. This value defaults to "AWS". + * - -r, --region + - string + - true + - Human-readable label that identifies the physical location of your Atlas Stream Processing instance. The region can affect network latency and performance if it is far from your source or sink. For AWS, region name must be in the following format: VIRGINIA_USA. For a list of valid values, see https://www.mongodb.com/docs/atlas/reference/amazon-aws/#std-label-aws-stream-processing-regions. For Azure, region name must be in the following format: eastus. For a list of valid values, see https://www.mongodb.com/docs/atlas/reference/microsoft-azure/#std-label-azure-stream-processing-regions. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings. + +Output +------ + +If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values. + +.. code-block:: + + Atlas Streams Processor Instance '' successfully updated. + + +Examples +-------- + +.. code-block:: + :copyable: false + + # Modify the Atlas Stream Processing instance configuration with the name MyInstance: + atlas streams instance update MyInstance --provider AWS --region VIRGINIA_USA diff --git a/docs/command/atlas-streams-workspaces.txt b/docs/command/atlas-streams-workspaces.txt index 496435ed77..8ac3cd64ad 100644 --- a/docs/command/atlas-streams-workspaces.txt +++ b/docs/command/atlas-streams-workspaces.txt @@ -52,10 +52,20 @@ Related Commands ---------------- * :ref:`atlas-streams-workspaces-create` - Create an Atlas Stream Processing workspace for your project +* :ref:`atlas-streams-workspaces-delete` - Delete an Atlas Stream Processing instance. +* :ref:`atlas-streams-workspaces-describe` - Describe an Atlas Stream Processing instance for your project. +* :ref:`atlas-streams-workspaces-download` - Download a compressed file that contains the logs for the specified Atlas Stream Processing instance. +* :ref:`atlas-streams-workspaces-list` - List all the Atlas Stream Processing instances for your project. +* :ref:`atlas-streams-workspaces-update` - Updates an Atlas Stream Processing instance for your project. .. toctree:: :titlesonly: create + delete + describe + download + list + update diff --git a/internal/cli/streams/instance/create.go b/internal/cli/streams/instance/create.go index f1a123e646..cf8b0dae5d 100644 --- a/internal/cli/streams/instance/create.go +++ b/internal/cli/streams/instance/create.go @@ -38,13 +38,11 @@ type CreateOpts struct { cli.ProjectOpts cli.OutputOpts cli.InputOpts - name string - provider string - region string - tier string - defaultTier string - maxTierSize string - store StreamsCreator + name string + provider string + region string + tier string + store StreamsCreator } const ( @@ -64,12 +62,6 @@ func (opts *CreateOpts) Run() error { tierOrDefault = opts.tier } streamConfig := streamProcessor.GetStreamConfig() - if opts.defaultTier != "" { - streamConfig.DefaultTier = &opts.defaultTier - } - if opts.maxTierSize != "" { - streamConfig.MaxTierSize = &opts.maxTierSize - } streamConfig.Tier = &tierOrDefault streamProcessor.StreamConfig = &streamConfig @@ -168,8 +160,6 @@ func WorkspaceCreateBuilder() *cobra.Command { opts.AddOutputOptFlags(cmd) cmd.Flags().StringVar(&opts.tier, flag.Tier, "SP30", usage.StreamsWorkspaceTier) - cmd.Flags().StringVar(&opts.defaultTier, flag.DefaultTier, "", usage.StreamsWorkspaceDefaultTier) - cmd.Flags().StringVar(&opts.maxTierSize, flag.MaxTierSize, "", usage.StreamsWorkspaceMaxTierSize) _ = cmd.MarkFlagRequired(flag.Provider) _ = cmd.MarkFlagRequired(flag.Region) diff --git a/internal/cli/streams/instance/create_test.go b/internal/cli/streams/instance/create_test.go index 9c5fce902f..fb93784336 100644 --- a/internal/cli/streams/instance/create_test.go +++ b/internal/cli/streams/instance/create_test.go @@ -99,16 +99,14 @@ func TestCreateOpts_Run(t *testing.T) { test.VerifyOutputTemplate(t, createTemplate, expected) }) - t.Run("stream workspaces create --tier --defaultTier --maxTierSize", func(t *testing.T) { + t.Run("stream workspaces create --tier", func(t *testing.T) { buf := new(bytes.Buffer) opts := &CreateOpts{ - store: mockStore, - name: "ExampleStreamWorkspaces", - provider: "AWS", - region: "VIRGINIA_USA", - tier: "SP30", - defaultTier: "SP30", - maxTierSize: "SP50", + store: mockStore, + name: "ExampleStreamWorkspaces", + provider: "AWS", + region: "VIRGINIA_USA", + tier: "SP30", } opts.ProjectID = testProjectID @@ -117,9 +115,7 @@ func TestCreateOpts_Run(t *testing.T) { GroupId: &opts.ProjectID, DataProcessRegion: &atlasv2.StreamsDataProcessRegion{CloudProvider: "AWS", Region: "VIRGINIA_USA"}, StreamConfig: &atlasv2.StreamConfig{ - Tier: &opts.tier, - DefaultTier: &opts.defaultTier, - MaxTierSize: &opts.maxTierSize, + Tier: &opts.tier, }, } diff --git a/internal/cli/streams/instance/workspaces.go b/internal/cli/streams/instance/workspaces.go index ac75216e43..d4dafab891 100644 --- a/internal/cli/streams/instance/workspaces.go +++ b/internal/cli/streams/instance/workspaces.go @@ -27,7 +27,7 @@ func WorkspaceBuilder() *cobra.Command { Short: "Manage Atlas Stream Processing workspaces.", Long: `Create, list, update, and delete your Atlas Stream Processing workspaces.`, } - cmd.AddCommand(WorkspaceCreateBuilder()) + cmd.AddCommand(WorkspaceCreateBuilder(), UpdateBuilder(), ListBuilder(), DeleteBuilder(), DescribeBuilder(), DownloadBuilder()) return cmd } diff --git a/internal/store/store_test.go b/internal/store/store_test.go index 3fad2c047a..94920eff6b 100644 --- a/internal/store/store_test.go +++ b/internal/store/store_test.go @@ -128,7 +128,7 @@ func TestWithContext(t *testing.T) { t.Fatalf("New() unexpected error: %v", err) } - if c.ctx != context.Background() { //nolint: usetesting // we test this value + if c.ctx != t.Context() { t.Errorf("New() got %v; expected %v", c.ctx, t.Context()) } From 52a53508c58b661d30d3d74fabfadfffbe351417 Mon Sep 17 00:00:00 2001 From: Wesley Nabo Date: Tue, 29 Jul 2025 03:53:01 -0500 Subject: [PATCH 3/5] CLOUDP-333877: revert store_test.go changes --- internal/store/store_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/store/store_test.go b/internal/store/store_test.go index 94920eff6b..3fad2c047a 100644 --- a/internal/store/store_test.go +++ b/internal/store/store_test.go @@ -128,7 +128,7 @@ func TestWithContext(t *testing.T) { t.Fatalf("New() unexpected error: %v", err) } - if c.ctx != t.Context() { + if c.ctx != context.Background() { //nolint: usetesting // we test this value t.Errorf("New() got %v; expected %v", c.ctx, t.Context()) } From a6e19a9cfefa410d3081642e5f2d0b492b4ded95 Mon Sep 17 00:00:00 2001 From: Wesley Nabo Date: Tue, 29 Jul 2025 11:14:53 -0500 Subject: [PATCH 4/5] CLOUDP-333877: create max + default tier flags for workspace cmd --- .../atlas-streams-workspaces-create.txt | 8 ++++ internal/cli/streams/instance/create.go | 14 ++++--- internal/cli/streams/instance/create_test.go | 38 +++++++++++++++++++ 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/docs/command/atlas-streams-workspaces-create.txt b/docs/command/atlas-streams-workspaces-create.txt index d693beb687..63f5f21161 100644 --- a/docs/command/atlas-streams-workspaces-create.txt +++ b/docs/command/atlas-streams-workspaces-create.txt @@ -53,10 +53,18 @@ Options - Type - Required - Description + * - --defaultTier + - string + - false + - Default Tier for your Stream Workspace. * - -h, --help - - false - help for create + * - --maxTierSize + - string + - false + - Max Tier Size for your Stream Workspace. * - -o, --output - string - false diff --git a/internal/cli/streams/instance/create.go b/internal/cli/streams/instance/create.go index cf8b0dae5d..7f0694d153 100644 --- a/internal/cli/streams/instance/create.go +++ b/internal/cli/streams/instance/create.go @@ -38,11 +38,13 @@ type CreateOpts struct { cli.ProjectOpts cli.OutputOpts cli.InputOpts - name string - provider string - region string - tier string - store StreamsCreator + name string + provider string + region string + tier string + defaultTier string + maxTierSize string + store StreamsCreator } const ( @@ -160,6 +162,8 @@ func WorkspaceCreateBuilder() *cobra.Command { opts.AddOutputOptFlags(cmd) cmd.Flags().StringVar(&opts.tier, flag.Tier, "SP30", usage.StreamsWorkspaceTier) + cmd.Flags().StringVar(&opts.defaultTier, flag.DefaultTier, "", usage.StreamsWorkspaceDefaultTier) + cmd.Flags().StringVar(&opts.maxTierSize, flag.MaxTierSize, "", usage.StreamsWorkspaceMaxTierSize) _ = cmd.MarkFlagRequired(flag.Provider) _ = cmd.MarkFlagRequired(flag.Region) diff --git a/internal/cli/streams/instance/create_test.go b/internal/cli/streams/instance/create_test.go index fb93784336..6d7363c0d3 100644 --- a/internal/cli/streams/instance/create_test.go +++ b/internal/cli/streams/instance/create_test.go @@ -131,4 +131,42 @@ func TestCreateOpts_Run(t *testing.T) { t.Log(buf.String()) test.VerifyOutputTemplate(t, createWorkspace, expected) }) + + t.Run("stream workspaces create --tier --defaultTier --maxTierSize", func(t *testing.T) { + buf := new(bytes.Buffer) + opts := &CreateOpts{ + store: mockStore, + name: "ExampleStreamWorkspaces", + provider: "AWS", + region: "VIRGINIA_USA", + tier: "SP30", + defaultTier: "SP30", + maxTierSize: "SP50", + } + opts.ProjectID = testProjectID + + expected := &atlasv2.StreamsTenant{ + Name: &opts.name, + GroupId: &opts.ProjectID, + DataProcessRegion: &atlasv2.StreamsDataProcessRegion{CloudProvider: "AWS", Region: "VIRGINIA_USA"}, + StreamConfig: &atlasv2.StreamConfig{ + Tier: &opts.tier, + // Testing the parsing of flags but not passing into StreamConfig object + // DefaultTier: &opts.defaultTier, + // MaxTierSize: &opts.maxTierSize, + }, + } + + mockStore. + EXPECT(). + CreateStream(opts.ProjectID, expected). + Return(expected, nil). + Times(1) + + if err := opts.Run(); err != nil { + t.Fatalf("Run() unexpected error: %v", err) + } + t.Log(buf.String()) + test.VerifyOutputTemplate(t, createWorkspace, expected) + }) } From 606293b8011edfb67543b793037603861bcd1327 Mon Sep 17 00:00:00 2001 From: Wesley Nabo Date: Wed, 30 Jul 2025 11:50:00 -0500 Subject: [PATCH 5/5] CLOUDP-333877: Hide workspaces from atlas stream command --- .../atlas-streams-workspaces-create.txt | 122 ------------------ .../atlas-streams-workspaces-delete.txt | 112 ---------------- .../atlas-streams-workspaces-describe.txt | 109 ---------------- .../atlas-streams-workspaces-download.txt | 114 ---------------- .../command/atlas-streams-workspaces-list.txt | 95 -------------- .../atlas-streams-workspaces-update.txt | 111 ---------------- docs/command/atlas-streams-workspaces.txt | 71 ---------- docs/command/atlas-streams.txt | 2 - internal/cli/streams/instance/create_test.go | 4 +- internal/cli/streams/instance/workspaces.go | 2 +- internal/cli/streams/streams.go | 1 - 11 files changed, 2 insertions(+), 741 deletions(-) delete mode 100644 docs/command/atlas-streams-workspaces-create.txt delete mode 100644 docs/command/atlas-streams-workspaces-delete.txt delete mode 100644 docs/command/atlas-streams-workspaces-describe.txt delete mode 100644 docs/command/atlas-streams-workspaces-download.txt delete mode 100644 docs/command/atlas-streams-workspaces-list.txt delete mode 100644 docs/command/atlas-streams-workspaces-update.txt delete mode 100644 docs/command/atlas-streams-workspaces.txt diff --git a/docs/command/atlas-streams-workspaces-create.txt b/docs/command/atlas-streams-workspaces-create.txt deleted file mode 100644 index 63f5f21161..0000000000 --- a/docs/command/atlas-streams-workspaces-create.txt +++ /dev/null @@ -1,122 +0,0 @@ -.. _atlas-streams-workspaces-create: - -=============================== -atlas streams workspaces create -=============================== - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 1 - :class: singlecol - -Create an Atlas Stream Processing workspace for your project - -To get started quickly, specify a name, a cloud provider, and a region to configure an Atlas Stream Processing workspace.To use this command, you must authenticate with a user account or an API key with the Project Owner role. - -Syntax ------- - -.. code-block:: - :caption: Command Syntax - - atlas streams workspaces create [options] - -.. Code end marker, please don't delete this comment - -Arguments ---------- - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - name - - string - - true - - Name of the Atlas Stream Processing workspace. After creation, you can't change the name of the workspace. The name can contain ASCII letters, numbers, and hyphens. - -Options -------- - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - --defaultTier - - string - - false - - Default Tier for your Stream Workspace. - * - -h, --help - - - - false - - help for create - * - --maxTierSize - - string - - false - - Max Tier Size for your Stream Workspace. - * - -o, --output - - string - - false - - Output format. Valid values are json, json-path, go-template, or go-template-file. To see the full output, use the -o json option. - * - --projectId - - string - - false - - Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable. - * - --provider - - string - - true - - Cloud service provider that applies to the provisioned Atlas Stream Processing instance. Valid values are AWS or AZURE. This value defaults to "AWS". - * - -r, --region - - string - - true - - Human-readable label that identifies the physical location of your Atlas Stream Processing instance. The region can affect network latency and performance if it is far from your source or sink. For AWS, region name must be in the following format: VIRGINIA_USA. For a list of valid values, see https://www.mongodb.com/docs/atlas/reference/amazon-aws/#std-label-aws-stream-processing-regions. For Azure, region name must be in the following format: eastus. For a list of valid values, see https://www.mongodb.com/docs/atlas/reference/microsoft-azure/#std-label-azure-stream-processing-regions. - * - --tier - - string - - false - - Tier for your Stream Workspace. This value defaults to "SP30". - -Inherited Options ------------------ - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - -P, --profile - - string - - false - - Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings. - -Output ------- - -If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values. - -.. code-block:: - - Atlas Streams Processor Workspace '' successfully created. - - -Examples --------- - -.. code-block:: - :copyable: false - - # Deploy an Atlas Stream Processing workspace called myProcessor for the project with the ID 5e2211c17a3e5a48f5497de3: - atlas streams instance create myProcessor --projectId 5e2211c17a3e5a48f5497de3 --provider AWS --region VIRGINIA_USA --tier SP10 --defaultTier SP30 --maxTierSize SP50 diff --git a/docs/command/atlas-streams-workspaces-delete.txt b/docs/command/atlas-streams-workspaces-delete.txt deleted file mode 100644 index b9248d4301..0000000000 --- a/docs/command/atlas-streams-workspaces-delete.txt +++ /dev/null @@ -1,112 +0,0 @@ -.. _atlas-streams-workspaces-delete: - -=============================== -atlas streams workspaces delete -=============================== - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 1 - :class: singlecol - -Delete an Atlas Stream Processing instance. - -The command prompts you to confirm the operation when you run the command without the --force option. - -Before deleting an Atlas Streams Processing instance, you must first stop all processes associated with it. -To use this command, you must authenticate with a user account or an API key with the Project Owner role. - -Syntax ------- - -.. code-block:: - :caption: Command Syntax - - atlas streams workspaces delete [options] - -.. Code end marker, please don't delete this comment - -Arguments ---------- - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - name - - string - - true - - Name of the Atlas Streams instance. - -Options -------- - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - --force - - - - false - - Flag that indicates whether to skip the confirmation prompt before proceeding with the requested action. - * - -h, --help - - - - false - - help for delete - * - --projectId - - string - - false - - Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable. - -Inherited Options ------------------ - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - -P, --profile - - string - - false - - Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings. - -Output ------- - -If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values. - -.. code-block:: - - Atlas Streams processor instance '' deleted - - -Examples --------- - -.. code-block:: - :copyable: false - - # Remove an Atlas Stream Processing instance after prompting for a confirmation: - atlas streams instance delete myProcessorInstance - - -.. code-block:: - :copyable: false - - # Remove an Atlas Stream Processing instance named myProcessorInstance without requiring confirmation: - atlas streams instance delete myProcessorInstance --force diff --git a/docs/command/atlas-streams-workspaces-describe.txt b/docs/command/atlas-streams-workspaces-describe.txt deleted file mode 100644 index 782a9ed554..0000000000 --- a/docs/command/atlas-streams-workspaces-describe.txt +++ /dev/null @@ -1,109 +0,0 @@ -.. _atlas-streams-workspaces-describe: - -================================= -atlas streams workspaces describe -================================= - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 1 - :class: singlecol - -Describe an Atlas Stream Processing instance for your project. - -To use this command, you must authenticate with a user account or an API key with the Project Read Only role. - -Syntax ------- - -.. code-block:: - :caption: Command Syntax - - atlas streams workspaces describe [options] - -.. Code end marker, please don't delete this comment - -Arguments ---------- - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - name - - string - - true - - Name of the Atlas Streams processor instance. - -Options -------- - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - -h, --help - - - - false - - help for describe - * - -o, --output - - string - - false - - Output format. Valid values are json, json-path, go-template, or go-template-file. To see the full output, use the -o json option. - * - --projectId - - string - - false - - Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable. - -Inherited Options ------------------ - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - -P, --profile - - string - - false - - Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings. - -Output ------- - -If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values. - -.. code-block:: - - ID NAME CLOUD REGION - - - -Examples --------- - -.. code-block:: - :copyable: false - - # Return an Atlas Stream Processing instance with a specific name: - atlas streams instance describe myProcessor - -.. code-block:: - :copyable: false - - # Return a JSON-formatted Atlas Stream Processing instance with a specific name: - atlas streams instance describe myProcessor --output json diff --git a/docs/command/atlas-streams-workspaces-download.txt b/docs/command/atlas-streams-workspaces-download.txt deleted file mode 100644 index 9edd45dcc4..0000000000 --- a/docs/command/atlas-streams-workspaces-download.txt +++ /dev/null @@ -1,114 +0,0 @@ -.. _atlas-streams-workspaces-download: - -================================= -atlas streams workspaces download -================================= - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 1 - :class: singlecol - -Download a compressed file that contains the logs for the specified Atlas Stream Processing instance. - -This command downloads a file with a .gz extension. To use this command, you must authenticate with a user account or an API key with the Project Data Access Read/Write role. - -Syntax ------- - -.. code-block:: - :caption: Command Syntax - - atlas streams workspaces download [options] - -.. Code end marker, please don't delete this comment - -Arguments ---------- - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - tenantName - - string - - true - - Label that identifies the tenant that stores the log files that you want to download. - -Options -------- - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - --end - - int - - false - - Ending date and time for the range of log messages to retrieve, given in UNIX time. Defaults to the start date plus 24 hours, if the start date is set. If start date is not provided, ending time defaults to the current time. - * - --force - - - - false - - Flag that indicates whether to overwrite the destination file. - * - -h, --help - - - - false - - help for download - * - --out - - string - - true - - Output file name. This value defaults to the log name. - * - --projectId - - string - - false - - Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable. - * - --start - - int - - false - - UNIX Epoch-formatted starting date and time for the range of log messages to retrieve. This value defaults to 24 hours prior to the current timestamp. - -Inherited Options ------------------ - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - -P, --profile - - string - - false - - Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings. - -Output ------- - -If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values. - -.. code-block:: - - Download of completed. - - -Examples --------- - -.. code-block:: - :copyable: false - - # Download the audit log file from the instance myProcessor for the project with the ID 5e2211c17a3e5a48f5497de3: - atlas streams instance download myProcessor --projectId 5e2211c17a3e5a48f5497de3 diff --git a/docs/command/atlas-streams-workspaces-list.txt b/docs/command/atlas-streams-workspaces-list.txt deleted file mode 100644 index 779b364198..0000000000 --- a/docs/command/atlas-streams-workspaces-list.txt +++ /dev/null @@ -1,95 +0,0 @@ -.. _atlas-streams-workspaces-list: - -============================= -atlas streams workspaces list -============================= - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 1 - :class: singlecol - -List all the Atlas Stream Processing instances for your project. - -To use this command, you must authenticate with a user account or an API key with the Project Read Only role. - -Syntax ------- - -.. code-block:: - :caption: Command Syntax - - atlas streams workspaces list [options] - -.. Code end marker, please don't delete this comment - -Options -------- - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - -h, --help - - - - false - - help for list - * - --limit - - int - - false - - Number of items per results page, up to a maximum of 500. If you have more than 500 results, specify the --page option to change the results page. This value defaults to 100. - * - -o, --output - - string - - false - - Output format. Valid values are json, json-path, go-template, or go-template-file. To see the full output, use the -o json option. - * - --page - - int - - false - - Page number that specifies a page of results. This value defaults to 1. - * - --projectId - - string - - false - - Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable. - -Inherited Options ------------------ - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - -P, --profile - - string - - false - - Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings. - -Output ------- - -If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values. - -.. code-block:: - - ID NAME CLOUD REGION - - - -Examples --------- - -.. code-block:: - :copyable: false - - # Return a JSON-formatted list of all Atlas Stream Processing instances for the project with ID 5e2211c17a3e5a48f5497de3: - atlas streams instance list --projectId 5e2211c17a3e5a48f5497de3 --output json diff --git a/docs/command/atlas-streams-workspaces-update.txt b/docs/command/atlas-streams-workspaces-update.txt deleted file mode 100644 index f36b414f4f..0000000000 --- a/docs/command/atlas-streams-workspaces-update.txt +++ /dev/null @@ -1,111 +0,0 @@ -.. _atlas-streams-workspaces-update: - -=============================== -atlas streams workspaces update -=============================== - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 1 - :class: singlecol - -Updates an Atlas Stream Processing instance for your project. - -Before updating an Atlas Streams Processing instance, you must first stop all processes associated with it. -To use this command, you must authenticate with a user account or an API key with the Project Owner role. - -Syntax ------- - -.. code-block:: - :caption: Command Syntax - - atlas streams workspaces update [options] - -.. Code end marker, please don't delete this comment - -Arguments ---------- - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - name - - string - - true - - Name of the Atlas Stream Processing instance. After creation, you can't change the name of the instance. The name can contain ASCII letters, numbers, and hyphens. - -Options -------- - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - -h, --help - - - - false - - help for update - * - -o, --output - - string - - false - - Output format. Valid values are json, json-path, go-template, or go-template-file. To see the full output, use the -o json option. - * - --projectId - - string - - false - - Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable. - * - --provider - - string - - true - - Cloud service provider that applies to the provisioned Atlas Stream Processing instance. Valid values are AWS or AZURE. This value defaults to "AWS". - * - -r, --region - - string - - true - - Human-readable label that identifies the physical location of your Atlas Stream Processing instance. The region can affect network latency and performance if it is far from your source or sink. For AWS, region name must be in the following format: VIRGINIA_USA. For a list of valid values, see https://www.mongodb.com/docs/atlas/reference/amazon-aws/#std-label-aws-stream-processing-regions. For Azure, region name must be in the following format: eastus. For a list of valid values, see https://www.mongodb.com/docs/atlas/reference/microsoft-azure/#std-label-azure-stream-processing-regions. - -Inherited Options ------------------ - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - -P, --profile - - string - - false - - Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings. - -Output ------- - -If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values. - -.. code-block:: - - Atlas Streams Processor Instance '' successfully updated. - - -Examples --------- - -.. code-block:: - :copyable: false - - # Modify the Atlas Stream Processing instance configuration with the name MyInstance: - atlas streams instance update MyInstance --provider AWS --region VIRGINIA_USA diff --git a/docs/command/atlas-streams-workspaces.txt b/docs/command/atlas-streams-workspaces.txt deleted file mode 100644 index 8ac3cd64ad..0000000000 --- a/docs/command/atlas-streams-workspaces.txt +++ /dev/null @@ -1,71 +0,0 @@ -.. _atlas-streams-workspaces: - -======================== -atlas streams workspaces -======================== - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 1 - :class: singlecol - -Manage Atlas Stream Processing workspaces. - -Create, list, update, and delete your Atlas Stream Processing workspaces. - -Options -------- - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - -h, --help - - - - false - - help for workspaces - -Inherited Options ------------------ - -.. list-table:: - :header-rows: 1 - :widths: 20 10 10 60 - - * - Name - - Type - - Required - - Description - * - -P, --profile - - string - - false - - Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings. - -Related Commands ----------------- - -* :ref:`atlas-streams-workspaces-create` - Create an Atlas Stream Processing workspace for your project -* :ref:`atlas-streams-workspaces-delete` - Delete an Atlas Stream Processing instance. -* :ref:`atlas-streams-workspaces-describe` - Describe an Atlas Stream Processing instance for your project. -* :ref:`atlas-streams-workspaces-download` - Download a compressed file that contains the logs for the specified Atlas Stream Processing instance. -* :ref:`atlas-streams-workspaces-list` - List all the Atlas Stream Processing instances for your project. -* :ref:`atlas-streams-workspaces-update` - Updates an Atlas Stream Processing instance for your project. - - -.. toctree:: - :titlesonly: - - create - delete - describe - download - list - update - diff --git a/docs/command/atlas-streams.txt b/docs/command/atlas-streams.txt index fc496bbe36..d0a648bac8 100644 --- a/docs/command/atlas-streams.txt +++ b/docs/command/atlas-streams.txt @@ -54,7 +54,6 @@ Related Commands * :ref:`atlas-streams-connections` - Manage Atlas Stream Processing connections. * :ref:`atlas-streams-instances` - Manage Atlas Stream Processing instances. * :ref:`atlas-streams-privateLinks` - Manage Atlas Stream Processing PrivateLink endpoints. -* :ref:`atlas-streams-workspaces` - Manage Atlas Stream Processing workspaces. .. toctree:: @@ -63,5 +62,4 @@ Related Commands connections instances privateLinks - workspaces diff --git a/internal/cli/streams/instance/create_test.go b/internal/cli/streams/instance/create_test.go index 6d7363c0d3..5cb158851a 100644 --- a/internal/cli/streams/instance/create_test.go +++ b/internal/cli/streams/instance/create_test.go @@ -132,6 +132,7 @@ func TestCreateOpts_Run(t *testing.T) { test.VerifyOutputTemplate(t, createWorkspace, expected) }) + // Testing the parsing of flags but not passing into StreamConfig object t.Run("stream workspaces create --tier --defaultTier --maxTierSize", func(t *testing.T) { buf := new(bytes.Buffer) opts := &CreateOpts{ @@ -151,9 +152,6 @@ func TestCreateOpts_Run(t *testing.T) { DataProcessRegion: &atlasv2.StreamsDataProcessRegion{CloudProvider: "AWS", Region: "VIRGINIA_USA"}, StreamConfig: &atlasv2.StreamConfig{ Tier: &opts.tier, - // Testing the parsing of flags but not passing into StreamConfig object - // DefaultTier: &opts.defaultTier, - // MaxTierSize: &opts.maxTierSize, }, } diff --git a/internal/cli/streams/instance/workspaces.go b/internal/cli/streams/instance/workspaces.go index d4dafab891..ac75216e43 100644 --- a/internal/cli/streams/instance/workspaces.go +++ b/internal/cli/streams/instance/workspaces.go @@ -27,7 +27,7 @@ func WorkspaceBuilder() *cobra.Command { Short: "Manage Atlas Stream Processing workspaces.", Long: `Create, list, update, and delete your Atlas Stream Processing workspaces.`, } - cmd.AddCommand(WorkspaceCreateBuilder(), UpdateBuilder(), ListBuilder(), DeleteBuilder(), DescribeBuilder(), DownloadBuilder()) + cmd.AddCommand(WorkspaceCreateBuilder()) return cmd } diff --git a/internal/cli/streams/streams.go b/internal/cli/streams/streams.go index 62eb3e0a97..d70588a985 100644 --- a/internal/cli/streams/streams.go +++ b/internal/cli/streams/streams.go @@ -34,7 +34,6 @@ func Builder() *cobra.Command { instance.Builder(), connection.Builder(), privatelink.Builder(), - instance.WorkspaceBuilder(), ) return cmd