Skip to content

Commit 2a2167f

Browse files
Waybo26blva
authored andcommitted
Revert "CLOUDP-333877: create stub for atlas cli commands streams workspaces and streams workspaces create" (#4076)
1 parent e0da8d1 commit 2a2167f

File tree

5 files changed

+7
-161
lines changed

5 files changed

+7
-161
lines changed

internal/cli/streams/instance/create.go

Lines changed: 7 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,16 @@ type CreateOpts struct {
3838
cli.ProjectOpts
3939
cli.OutputOpts
4040
cli.InputOpts
41-
name string
42-
provider string
43-
region string
44-
tier string
45-
defaultTier string
46-
maxTierSize string
47-
store StreamsCreator
41+
name string
42+
provider string
43+
region string
44+
tier string
45+
store StreamsCreator
4846
}
4947

5048
const (
51-
createTemplate = "Atlas Streams Processor Instance '{{.Name}}' successfully created.\n"
52-
createWorkspace = "Atlas Streams Processor Workspace '{{.Name}}' successfully created.\n"
53-
defaultTier = "SP30"
49+
createTemplate = "Atlas Streams Processor Instance '{{.Name}}' successfully created.\n"
50+
defaultTier = "SP30"
5451
)
5552

5653
func (opts *CreateOpts) Run() error {
@@ -127,46 +124,3 @@ func CreateBuilder() *cobra.Command {
127124

128125
return cmd
129126
}
130-
131-
func WorkspaceCreateBuilder() *cobra.Command {
132-
opts := &CreateOpts{}
133-
cmd := &cobra.Command{
134-
Use: "create <name>",
135-
Short: "Create an Atlas Stream Processing workspace for your project",
136-
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"),
137-
Example: ` # Deploy an Atlas Stream Processing workspace called myProcessor for the project with the ID 5e2211c17a3e5a48f5497de3:
138-
atlas streams instance create myProcessor --projectId 5e2211c17a3e5a48f5497de3 --provider AWS --region VIRGINIA_USA --tier SP10 --defaultTier SP30 --maxTierSize SP50`,
139-
Args: require.ExactArgs(1),
140-
Annotations: map[string]string{
141-
"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.",
142-
"output": createWorkspace,
143-
},
144-
PreRunE: func(cmd *cobra.Command, args []string) error {
145-
opts.name = args[0]
146-
147-
return opts.PreRunE(
148-
opts.ValidateProjectID,
149-
opts.initStore(cmd.Context()),
150-
opts.InitOutput(cmd.OutOrStdout(), createWorkspace),
151-
)
152-
},
153-
RunE: func(_ *cobra.Command, _ []string) error {
154-
return opts.Run()
155-
},
156-
}
157-
158-
cmd.Flags().StringVar(&opts.provider, flag.Provider, "AWS", usage.StreamsProvider)
159-
cmd.Flags().StringVarP(&opts.region, flag.Region, flag.RegionShort, "", usage.StreamsRegion)
160-
161-
opts.AddProjectOptsFlags(cmd)
162-
opts.AddOutputOptFlags(cmd)
163-
164-
cmd.Flags().StringVar(&opts.tier, flag.Tier, "SP30", usage.StreamsWorkspaceTier)
165-
cmd.Flags().StringVar(&opts.defaultTier, flag.DefaultTier, "", usage.StreamsWorkspaceDefaultTier)
166-
cmd.Flags().StringVar(&opts.maxTierSize, flag.MaxTierSize, "", usage.StreamsWorkspaceMaxTierSize)
167-
168-
_ = cmd.MarkFlagRequired(flag.Provider)
169-
_ = cmd.MarkFlagRequired(flag.Region)
170-
171-
return cmd
172-
}

internal/cli/streams/instance/create_test.go

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -96,73 +96,4 @@ func TestCreateOpts_Run(t *testing.T) {
9696
t.Log(buf.String())
9797
test.VerifyOutputTemplate(t, createTemplate, expected)
9898
})
99-
100-
t.Run("stream workspaces create --tier", func(t *testing.T) {
101-
buf := new(bytes.Buffer)
102-
opts := &CreateOpts{
103-
store: mockStore,
104-
name: "ExampleStreamWorkspaces",
105-
provider: "AWS",
106-
region: "VIRGINIA_USA",
107-
tier: "SP30",
108-
}
109-
opts.ProjectID = testProjectID
110-
111-
expected := &atlasv2.StreamsTenant{
112-
Name: &opts.name,
113-
GroupId: &opts.ProjectID,
114-
DataProcessRegion: &atlasv2.StreamsDataProcessRegion{CloudProvider: "AWS", Region: "VIRGINIA_USA"},
115-
StreamConfig: &atlasv2.StreamConfig{
116-
Tier: &opts.tier,
117-
},
118-
}
119-
120-
mockStore.
121-
EXPECT().
122-
CreateStream(opts.ProjectID, expected).
123-
Return(expected, nil).
124-
Times(1)
125-
126-
if err := opts.Run(); err != nil {
127-
t.Fatalf("Run() unexpected error: %v", err)
128-
}
129-
t.Log(buf.String())
130-
test.VerifyOutputTemplate(t, createWorkspace, expected)
131-
})
132-
133-
// Testing the parsing of flags but not passing into StreamConfig object
134-
t.Run("stream workspaces create --tier --defaultTier --maxTierSize", func(t *testing.T) {
135-
buf := new(bytes.Buffer)
136-
opts := &CreateOpts{
137-
store: mockStore,
138-
name: "ExampleStreamWorkspaces",
139-
provider: "AWS",
140-
region: "VIRGINIA_USA",
141-
tier: "SP30",
142-
defaultTier: "SP30",
143-
maxTierSize: "SP50",
144-
}
145-
opts.ProjectID = testProjectID
146-
147-
expected := &atlasv2.StreamsTenant{
148-
Name: &opts.name,
149-
GroupId: &opts.ProjectID,
150-
DataProcessRegion: &atlasv2.StreamsDataProcessRegion{CloudProvider: "AWS", Region: "VIRGINIA_USA"},
151-
StreamConfig: &atlasv2.StreamConfig{
152-
Tier: &opts.tier,
153-
},
154-
}
155-
156-
mockStore.
157-
EXPECT().
158-
CreateStream(opts.ProjectID, expected).
159-
Return(expected, nil).
160-
Times(1)
161-
162-
if err := opts.Run(); err != nil {
163-
t.Fatalf("Run() unexpected error: %v", err)
164-
}
165-
t.Log(buf.String())
166-
test.VerifyOutputTemplate(t, createWorkspace, expected)
167-
})
16899
}

internal/cli/streams/instance/workspaces.go

Lines changed: 0 additions & 33 deletions
This file was deleted.

internal/flag/flags.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ const (
5151
MembersShort = "m" // MembersShort flag
5252
ShardsShort = "s" // ShardsShort flag
5353
Tier = "tier" // Tier flag
54-
DefaultTier = "defaultTier" // DefaultTier flag
55-
MaxTierSize = "maxTierSize" // MaxTierSize flag
5654
Forever = "forever" // Forever flag
5755
ForeverShort = "F" // ForeverShort flag
5856
DiskSizeGB = "diskSizeGB" // DiskSizeGB flag

internal/usage/usage.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,9 @@ dbName and collection are required only for built-in roles.`
242242
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."
243243
StreamsProvider = "Cloud service provider that applies to the provisioned Atlas Stream Processing instance. Valid values are AWS or AZURE."
244244
StreamsInstance = "Name of your Atlas Stream Processing instance."
245-
StreamsWorkspace = "Name of your Atlas Stream Procesing workspace."
246245
StreamsConnectionFilename = "Path to a JSON configuration file that defines an Atlas Stream Processing connection. Note: Unsupported fields in the JSON file are ignored."
247246
StreamsPrivateLinkFilename = "Path to a JSON configuration file that defines an Atlas Stream Processing PrivateLink endpoint. Note: Unsupported fields in the JSON file are ignored."
248247
StreamsInstanceTier = "Tier for your Stream Instance."
249-
StreamsWorkspaceTier = "Tier for your Stream Workspace."
250-
StreamsWorkspaceDefaultTier = "Default Tier for your Stream Workspace."
251-
StreamsWorkspaceMaxTierSize = "Max Tier Size for your Stream Workspace."
252248
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."
253249
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."
254250
TargetClusterName = "Name of the target cluster. For use only with automated restore jobs. You must specify a targetClusterName for automated restores."

0 commit comments

Comments
 (0)