-
Notifications
You must be signed in to change notification settings - Fork 30
CF-3930 : Return structured savepoint schema from create -o json/yaml to match describe/list #3396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
867744f
915f25f
279dcb2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,7 @@ func convertSdkSavepointToLocalSavepoint(sdkSavepoint cmfsdk.Savepoint) LocalSav | |
| ApiVersion: sdkSavepoint.ApiVersion, | ||
| Kind: sdkSavepoint.Kind, | ||
| Metadata: LocalSavepointMetadata{ | ||
| Name: *sdkSavepoint.Metadata.Name, | ||
| Name: sdkSavepoint.Metadata.GetName(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please check the above comment and see if we can apply the same idea here. |
||
| CreationTimestamp: sdkSavepoint.Metadata.CreationTimestamp, | ||
| Uid: sdkSavepoint.Metadata.Uid, | ||
| Labels: sdkSavepoint.Metadata.Labels, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,16 +113,21 @@ func (c *command) savepointCreate(cmd *cobra.Command, args []string) error { | |
| } | ||
| } | ||
|
|
||
| table := output.NewTable(cmd) | ||
| table.Add(&savepointOut{ | ||
| Name: savepointCreated.Metadata.GetName(), | ||
| Statement: statement, | ||
| Application: application, | ||
| Path: savepointCreated.Spec.GetPath(), | ||
| Format: savepointCreated.Spec.GetFormatType(), | ||
| BackoffLimit: savepointCreated.Spec.GetBackoffLimit(), | ||
| Uid: savepointCreated.Metadata.GetUid(), | ||
| State: savepointCreated.Status.GetState(), | ||
| }) | ||
| return table.Print() | ||
| if output.GetFormat(cmd) == output.Human { | ||
| table := output.NewTable(cmd) | ||
| table.Add(&savepointOut{ | ||
| Name: savepointCreated.Metadata.GetName(), | ||
| Statement: statement, | ||
| Application: application, | ||
| Path: savepointCreated.Spec.GetPath(), | ||
| Format: savepointCreated.Spec.GetFormatType(), | ||
| BackoffLimit: savepointCreated.Spec.GetBackoffLimit(), | ||
| Uid: savepointCreated.Metadata.GetUid(), | ||
| State: savepointCreated.Status.GetState(), | ||
| }) | ||
| return table.Print() | ||
| } | ||
|
|
||
| localSavepoint := convertSdkSavepointToLocalSavepoint(savepointCreated) | ||
| return output.SerializedOutput(cmd, localSavepoint) | ||
|
Comment on lines
+131
to
+132
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please check if the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is handled by the SDK's own getter. Both converters now use |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "apiVersion": "cmf.confluent.io/v1", | ||
| "kind": "Savepoint", | ||
| "metadata": { | ||
| "name": "savepoint1", | ||
| "creationTimestamp": "2025-03-12 23:42:00 +0000 UTC", | ||
| "uid": "id1" | ||
| }, | ||
| "spec": { | ||
| "path": "abc/def", | ||
| "backoffLimit": 10, | ||
| "formatType": "Canonical" | ||
| }, | ||
| "status": { | ||
| "path": "abc/def" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| apiVersion: cmf.confluent.io/v1 | ||
| kind: Savepoint | ||
| metadata: | ||
| name: savepoint1 | ||
| creationTimestamp: 2025-03-12 23:42:00 +0000 UTC | ||
| uid: id1 | ||
| spec: | ||
| path: abc/def | ||
| backoffLimit: 10 | ||
| formatType: Canonical | ||
| status: | ||
| path: abc/def |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "apiVersion": "cmf.confluent.io/v1", | ||
| "kind": "Savepoint", | ||
| "metadata": { | ||
| "name": "savepoint1", | ||
| "creationTimestamp": "2025-03-12 23:42:00 +0000 UTC" | ||
| }, | ||
| "spec": { | ||
| "backoffLimit": 0, | ||
| "formatType": "CANONICAL" | ||
| }, | ||
| "status": { | ||
| "path": "" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "apiVersion": "cmf.confluent.io/v1", | ||
| "kind": "Savepoint", | ||
| "metadata": { | ||
| "name": "", | ||
| "creationTimestamp": "2025-03-12 23:42:00 +0000 UTC" | ||
| }, | ||
| "spec": { | ||
| "backoffLimit": 0, | ||
| "formatType": "CANONICAL" | ||
| }, | ||
| "status": { | ||
| "path": "" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| apiVersion: cmf.confluent.io/v1 | ||
| kind: Savepoint | ||
| metadata: | ||
| name: "" | ||
| creationTimestamp: 2025-03-12 23:42:00 +0000 UTC | ||
| spec: | ||
| backoffLimit: 0 | ||
| formatType: CANONICAL | ||
| status: | ||
| path: "" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "apiVersion": "cmf.confluent.io/v1", | ||
| "kind": "Savepoint", | ||
| "metadata": { | ||
| "name": "savepoint-stmt", | ||
| "creationTimestamp": "2025-03-12 23:42:00 +0000 UTC" | ||
| }, | ||
| "spec": { | ||
| "backoffLimit": 0, | ||
| "formatType": "CANONICAL" | ||
| }, | ||
| "status": { | ||
| "path": "" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| +---------------+------------+ | ||
| | Name | savepointS | | ||
| | Statement | test-stmt | | ||
| | Path | abc/def | | ||
| | Format | NATIVE | | ||
| | Backoff Limit | 10 | | ||
| +---------------+------------+ | ||
| +---------------+----------------+ | ||
| | Name | savepoint-stmt | | ||
| | Statement | test-stmt | | ||
| | Path | abc/def | | ||
| | Format | NATIVE | | ||
| | Backoff Limit | 10 | | ||
| +---------------+----------------+ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| apiVersion: cmf.confluent.io/v1 | ||
| kind: Savepoint | ||
| metadata: | ||
| name: savepoint-stmt | ||
| creationTimestamp: 2025-03-12 23:42:00 +0000 UTC | ||
| spec: | ||
| backoffLimit: 0 | ||
| formatType: CANONICAL | ||
| status: | ||
| path: "" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| +-----------+------------+ | ||
| | Name | savepointS | | ||
| | Statement | test-stmt | | ||
| | Format | CANONICAL | | ||
| +-----------+------------+ | ||
| +-----------+----------------+ | ||
| | Name | savepoint-stmt | | ||
| | Statement | test-stmt | | ||
| | Format | CANONICAL | | ||
| +-----------+----------------+ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| apiVersion: cmf.confluent.io/v1 | ||
| kind: Savepoint | ||
| metadata: | ||
| name: savepoint1 | ||
| creationTimestamp: 2025-03-12 23:42:00 +0000 UTC | ||
| spec: | ||
| backoffLimit: 0 | ||
| formatType: CANONICAL | ||
| status: | ||
| path: "" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Error: failed to detach savepoint in the environment "default": The savepoint is invalid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "apiVersion": "", | ||
| "kind": "", | ||
| "metadata": { | ||
| "name": "savepoint1", | ||
| "creationTimestamp": "2025-03-12 23:42:00 +0000 UTC" | ||
| }, | ||
| "spec": { | ||
| "path": "abc/def", | ||
| "backoffLimit": 10, | ||
| "formatType": "CANONICAL" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: "" | ||
| kind: "" | ||
| metadata: | ||
| name: savepoint1 | ||
| creationTimestamp: 2025-03-12 23:42:00 +0000 UTC | ||
| spec: | ||
| path: abc/def | ||
| backoffLimit: 10 | ||
| formatType: CANONICAL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| +---------------+--------------+ | ||
| | Name | savepoint1 | | ||
| | Application | application1 | | ||
| | Path | abc/def | | ||
| | Format | CANONICAL | | ||
| | Backoff Limit | 10 | | ||
| +---------------+--------------+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not:
CreationTimestamp: sdkSavepoint.Metadata.GetCreationTimestamp()for the line below and similar fields?The idea is try to be consistent across the table everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repo-wide
GetCreationTimestamp()is used where the target is a valuestring(the flat*Outtable structs). Here the target is the structuredLocalSavepointMetadata, where those fields are*string+omitempty, so they're copied as pointers directly — same as theComputePool/Catalog/Statementconverters.