Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions internal/flink/command_statement_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@
flinkStatementFailedPhases = []string{"FAILED"}
)

// statementsAPICreateTimeout aligns with terraform-provider-confluent's
// statementsAPICreateTimeout in internal/provider/constants.go. CLI users can
// shorten it with --wait-timeout; TF has no equivalent override.
const flinkStatementCreateWaitTimeout = 6 * time.Hour
// flinkStatementCreateWaitTimeout is the default for --wait-timeout. It is kept
// at 1 minute to match the pre-framework `--wait` behavior (a hardcoded
// retry.Retry(time.Second, time.Minute, ...) poll), so customers who scripted
// around that 1-minute timer are not affected by the --wait refactor. Bump to
// 6h in the next major version (aligning with terraform-provider-confluent's
// statementsAPICreateTimeout in internal/provider/constants.go); CLI users can
// already lengthen it with --wait-timeout in the meantime. (APIE-1040)
const flinkStatementCreateWaitTimeout = time.Minute

func (c *command) newStatementCreateCommand() *cobra.Command {
cmd := &cobra.Command{
Expand Down Expand Up @@ -69,7 +73,7 @@
return cmd
}

func (c *command) statementCreate(cmd *cobra.Command, args []string) error {

Check failure on line 76 in internal/flink/command_statement_create.go

View check run for this annotation

SonarQube-Confluent / SonarQube Code Analysis

Refactor this method to reduce its Cognitive Complexity from 36 to the 15 allowed.

[S3776] Cognitive Complexity of functions should not be too high See more on https://sonarqube.confluent.io/project/issues?id=cli&pullRequest=3393&issues=a82072b8-6dd7-4911-909d-bef201b3a076&open=a82072b8-6dd7-4911-909d-bef201b3a076
environmentId, err := c.Context.EnvironmentId()
if err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Flags:
--database string The name of the default database.
--flink-configuration string The file path to hold the Flink configuration for the statement.
--wait Block until the statement reaches a terminal state.
--wait-timeout duration Maximum time to wait when --wait is set. (default 6h0m0s)
--wait-timeout duration Maximum time to wait when --wait is set. (default 1m0s)
--url string Base URL of the Confluent Manager for Apache Flink (CMF). Environment variable "CONFLUENT_CMF_URL" may be set in place of this flag.
--client-key-path string Path to client private key for mTLS authentication. Environment variable "CONFLUENT_CMF_CLIENT_KEY_PATH" may be set in place of this flag.
--client-cert-path string Path to client cert to be verified by Confluent Manager for Apache Flink. Include for mTLS authentication. Environment variable "CONFLUENT_CMF_CLIENT_CERT_PATH" may be set in place of this flag.
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/output/flink/statement/create-help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Flags:
--service-account string Service account ID.
--database string The database which will be used as the default database. When using Kafka, this is the cluster ID.
--wait Block until the statement reaches a terminal state.
--wait-timeout duration Maximum time to wait when --wait is set. (default 6h0m0s)
--wait-timeout duration Maximum time to wait when --wait is set. (default 1m0s)
--property strings A mechanism to pass properties in the form key=value when creating a Flink statement.
--environment string Environment ID.
--context string CLI context name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Flags:
--database string The name of the default database.
--flink-configuration string The file path to hold the Flink configuration for the statement.
--wait Block until the statement reaches a terminal state.
--wait-timeout duration Maximum time to wait when --wait is set. (default 6h0m0s)
--wait-timeout duration Maximum time to wait when --wait is set. (default 1m0s)
--url string Base URL of the Confluent Manager for Apache Flink (CMF). Environment variable "CONFLUENT_CMF_URL" may be set in place of this flag.
--client-key-path string Path to client private key for mTLS authentication. Environment variable "CONFLUENT_CMF_CLIENT_KEY_PATH" may be set in place of this flag.
--client-cert-path string Path to client cert to be verified by Confluent Manager for Apache Flink. Include for mTLS authentication. Environment variable "CONFLUENT_CMF_CLIENT_CERT_PATH" may be set in place of this flag.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Flags:
--database string The name of the default database.
--flink-configuration string The file path to hold the Flink configuration for the statement.
--wait Block until the statement reaches a terminal state.
--wait-timeout duration Maximum time to wait when --wait is set. (default 6h0m0s)
--wait-timeout duration Maximum time to wait when --wait is set. (default 1m0s)
--url string Base URL of the Confluent Manager for Apache Flink (CMF). Environment variable "CONFLUENT_CMF_URL" may be set in place of this flag.
--client-key-path string Path to client private key for mTLS authentication. Environment variable "CONFLUENT_CMF_CLIENT_KEY_PATH" may be set in place of this flag.
--client-cert-path string Path to client cert to be verified by Confluent Manager for Apache Flink. Include for mTLS authentication. Environment variable "CONFLUENT_CMF_CLIENT_CERT_PATH" may be set in place of this flag.
Expand Down
Loading