Skip to content

Commit

Permalink
Revert "[CLI-3313] Support Flink statement resume with updated princi…
Browse files Browse the repository at this point in the history
…pal and computepool id (#2922)" (#2947)
  • Loading branch information
sgagniere authored Nov 19, 2024
1 parent 4a031db commit a76a8df
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 262 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ go.work.sum
.LSOverride

# Icon must end with two \r
Icon
Icon

# Thumbnails
._*
Expand Down
1 change: 0 additions & 1 deletion internal/flink/command_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func (c *command) newStatementCommand() *cobra.Command {
cmd.AddCommand(c.newStatementDescribeCommand())
cmd.AddCommand(c.newStatementExceptionCommand())
cmd.AddCommand(c.newStatementListCommand())
cmd.AddCommand(c.newStatementResumeCommand())
cmd.AddCommand(c.newStatementStopCommand())
cmd.AddCommand(c.newStatementUpdateCommand())

Expand Down
100 changes: 0 additions & 100 deletions internal/flink/command_statement_resume.go

This file was deleted.

24 changes: 3 additions & 21 deletions internal/flink/command_statement_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,9 @@ func (c *command) newStatementUpdateCommand() *cobra.Command {
Code: "confluent flink statement update my-statement --compute-pool lfcp-123456",
},
examples.Example{
Text: `Request to resume statement "my-statement" with original principal id and compute pool.`,
Text: `Request to resume statement "my-statement".`,
Code: "confluent flink statement update my-statement --stopped=false",
},
examples.Example{
Text: `Request to resume statement "my-statement" with service account "sa-123456".`,
Code: "confluent flink statement update my-statement --stopped=false --principal sa-123456",
},
examples.Example{
Text: `Request to resume statement "my-statement" with user account "u-987654".`,
Code: "confluent flink statement update my-statement --stopped=false --principal u-987654",
},
examples.Example{
Text: `Request to resume statement "my-statement" and move to compute pool "lfcp-123456".`,
Code: "confluent flink statement update my-statement --stopped=false --compute-pool lfcp-123456",
},
examples.Example{
Text: `Request to resume statement "my-statement" with service account "sa-123456" and move to compute pool "lfcp-123456".`,
Code: "confluent flink statement update my-statement --stopped=false --principal sa-123456 --compute-pool lfcp-123456",
},
examples.Example{
Text: `Request to stop statement "my-statement".`,
Code: "confluent flink statement update my-statement --stopped=true",
Expand All @@ -56,7 +40,7 @@ func (c *command) newStatementUpdateCommand() *cobra.Command {

c.addPrincipalFlag(cmd)
c.addComputePoolFlag(cmd)
cmd.Flags().Bool("stopped", false, "Request to stop or resume the statement.")
cmd.Flags().Bool("stopped", false, "Request to stop the statement.")
pcmd.AddCloudFlag(cmd)
pcmd.AddRegionFlagFlink(cmd, c.AuthenticatedCLICommand)
pcmd.AddEnvironmentFlag(cmd, c.AuthenticatedCLICommand)
Expand Down Expand Up @@ -136,10 +120,8 @@ func (c *command) statementUpdate(cmd *cobra.Command, args []string) error {
statement.Spec.SetStopped(stopped)
}

// the UPDATE statement is an async API
// An accepted response 202 doesn't necessarily mean the UPDATE will be successful/complete
if err := client.UpdateStatement(environmentId, args[0], c.Context.GetCurrentOrganization(), statement); err != nil {
return fmt.Errorf("failed to update %s \"%s\": %w", resource.FlinkStatement, args[0], err)
return err
}

output.Printf(c.Config.EnableColor, "Requested to update %s \"%s\".\n", resource.FlinkStatement, args[0])
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/output/flink/statement/help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Available Commands:
describe Describe a Flink SQL statement.
exception Manage Flink SQL statement exceptions.
list List Flink SQL statements.
resume Resume a Flink SQL statement.
stop Stop a Flink SQL statement.
update Update a Flink SQL statement.

Expand Down
38 changes: 0 additions & 38 deletions test/fixtures/output/flink/statement/resume-help.golden

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion test/fixtures/output/flink/statement/resume-valid.golden

This file was deleted.

20 changes: 2 additions & 18 deletions test/fixtures/output/flink/statement/update-help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,18 @@ Request to move "my-statement" to compute pool "lfcp-123456".

$ confluent flink statement update my-statement --compute-pool lfcp-123456

Request to resume statement "my-statement" with original principal id and compute pool.
Request to resume statement "my-statement".

$ confluent flink statement update my-statement --stopped=false

Request to resume statement "my-statement" with service account "sa-123456".

$ confluent flink statement update my-statement --stopped=false --principal sa-123456

Request to resume statement "my-statement" with user account "u-987654".

$ confluent flink statement update my-statement --stopped=false --principal u-987654

Request to resume statement "my-statement" and move to compute pool "lfcp-123456".

$ confluent flink statement update my-statement --stopped=false --compute-pool lfcp-123456

Request to resume statement "my-statement" with service account "sa-123456" and move to compute pool "lfcp-123456".

$ confluent flink statement update my-statement --stopped=false --principal sa-123456 --compute-pool lfcp-123456

Request to stop statement "my-statement".

$ confluent flink statement update my-statement --stopped=true

Flags:
--principal string A user or service account the statement runs as.
--compute-pool string Flink compute pool ID.
--stopped Request to stop or resume the statement.
--stopped Request to stop the statement.
--cloud string Specify the cloud provider as "aws", "azure", or "gcp".
--region string Cloud region for Flink (use "confluent flink region list" to see all).
--environment string Environment ID.
Expand Down

This file was deleted.

This file was deleted.

13 changes: 1 addition & 12 deletions test/flink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,9 @@ func (s *CLITestSuite) TestFlinkStatement() {
{args: "flink statement list --cloud aws --region eu-west-1 --compute-pool lfcp-nonexistent", fixture: "flink/statement/list-cp-not-found.golden", exitCode: 1},
{args: "flink statement list --cloud aws --region eu-west-2 --compute-pool lfcp-123456", fixture: "flink/statement/list-cp-incorrect-region.golden", exitCode: 1},
{args: "flink statement stop my-statement --cloud aws --region eu-west-1", fixture: "flink/statement/stop.golden"},
{args: "flink statement resume my-statement --cloud aws --region eu-west-1", fixture: "flink/statement/resume-valid.golden"},
{args: "flink statement resume my-statement --cloud aws --region eu-west-1 --principal u-123456", fixture: "flink/statement/resume-valid.golden"},
{args: "flink statement resume my-statement --cloud aws --region eu-west-1 --compute-pool lfcp-123456", fixture: "flink/statement/resume-valid.golden"},
{args: "flink statement resume my-statement --cloud aws --region eu-west-1 --principal u-123456 --compute-pool lfcp-123456", fixture: "flink/statement/resume-valid.golden"},
{args: "flink statement resume my-statement --cloud aws --region eu-west-1 --principal sa-654321", fixture: "flink/statement/resume-invalid-principal.golden", exitCode: 1},
{args: "flink statement resume my-statement --cloud aws --region eu-west-1 --compute-pool lfcp-654321", fixture: "flink/statement/resume-invalid-compute-pool.golden", exitCode: 1},
{args: "flink statement update my-statement --cloud aws --region eu-west-1 --compute-pool lfcp-123456", fixture: "flink/statement/update-compute-pool.golden"},
{args: "flink statement update my-statement --cloud aws --region eu-west-1 --principal u-123456", fixture: "flink/statement/update-principal.golden"},
{args: "flink statement update my-statement --cloud aws --region eu-west-1 --principal sa-123456", fixture: "flink/statement/update-principal.golden"},
{args: "flink statement update my-statement --cloud aws --region eu-west-1 --stopped=false", fixture: "flink/statement/update-stopped.golden"},
{args: "flink statement update my-statement --cloud aws --region eu-west-1 --stopped=false --principal u-123456", fixture: "flink/statement/update-stopped.golden"},
{args: "flink statement update my-statement --cloud aws --region eu-west-1 --stopped=false --compute-pool lfcp-123456", fixture: "flink/statement/update-stopped.golden"},
{args: "flink statement update my-statement --cloud aws --region eu-west-1 --stopped=false --compute-pool lfcp-123456 --principal u-123456", fixture: "flink/statement/update-stopped.golden"},
{args: "flink statement update my-statement --cloud aws --region eu-west-1 --stopped=false --compute-pool lfcp-654321", fixture: "flink/statement/update-invalid-compute-pool.golden", exitCode: 1},
{args: "flink statement update my-statement --cloud aws --region eu-west-1 --stopped=false --principal u-654321", fixture: "flink/statement/update-invalid-principal.golden", exitCode: 1},
}

for _, test := range tests {
Expand Down
Loading

0 comments on commit a76a8df

Please sign in to comment.