From 36eef7d6c26d495139734830ef5ec92946b7a8c0 Mon Sep 17 00:00:00 2001 From: Alexander Fayad Date: Wed, 12 Aug 2026 15:18:15 -0400 Subject: [PATCH 1/6] Add the six notifications commands Generated by cli-terraform-generator merge mode from the notifications v1 OpenAPI spec: integration, subscription, resource-preference, resource-subscription, notification-type, and user-notification, plus their ccloudv2 wrappers, test-server handlers, integration tests, input fixtures, output goldens, and live tests. The integration command's target is a oneOf. Update leaves --kind optional so an update touching only display-name or description is accepted, and rejects a variant flag supplied without --kind rather than silently dropping it. Verified with go build ./..., go vet, and go test ./test/ -run 'TestCLI/TestNotifications'. Co-Authored-By: Claude Opus 5 (1M context) --- .cli-generation-checksum | 2 +- cmd/lint/main.go | 7 + go.mod | 1 + go.sum | 2 + internal/command.go | 2 + internal/notifications/command.go | 29 + internal/notifications/command_integration.go | 103 ++++ .../command_integration_create.go | 112 ++++ .../command_integration_delete.go | 47 ++ .../command_integration_describe.go | 40 ++ .../notifications/command_integration_list.go | 58 ++ .../command_integration_update.go | 130 +++++ .../command_notification_type.go | 92 ++++ .../command_notification_type_describe.go | 40 ++ .../command_notification_type_list.go | 56 ++ .../command_resource_preference.go | 57 ++ .../command_resource_preference_create.go | 74 +++ .../command_resource_preference_delete.go | 46 ++ .../command_resource_preference_describe.go | 39 ++ .../command_resource_preference_update.go | 82 +++ .../command_resource_subscription.go | 59 ++ .../command_resource_subscription_create.go | 94 ++++ .../command_resource_subscription_delete.go | 46 ++ .../command_resource_subscription_describe.go | 39 ++ .../command_resource_subscription_update.go | 95 ++++ .../notifications/command_subscription.go | 85 +++ .../command_subscription_create.go | 74 +++ .../command_subscription_delete.go | 47 ++ .../command_subscription_describe.go | 40 ++ .../command_subscription_list.go | 46 ++ .../command_subscription_update.go | 74 +++ .../command_user_notification.go | 89 +++ .../command_user_notification_describe.go | 40 ++ .../command_user_notification_list.go | 102 ++++ .../command_user_notification_update.go | 57 ++ pkg/ccloudv2/client.go | 3 + pkg/ccloudv2/notifications.go | 318 +++++++++++ .../integration/create_in_app_target.json | 22 + .../integration/create_ms_teams_target.json | 18 + .../integration/create_role_email_target.json | 18 + .../integration/create_slack_target.json | 18 + .../integration/create_user_email_target.json | 22 + .../integration/create_webhook_target.json | 18 + .../read_created_in_app_target.json | 22 + .../read_created_ms_teams_target.json | 18 + .../read_created_role_email_target.json | 18 + .../read_created_slack_target.json | 18 + .../read_created_user_email_target.json | 22 + .../read_created_webhook_target.json | 18 + .../create_notification_type.json | 18 + .../read_created_notification_type.json | 18 + .../create_resource_preference.json | 15 + .../read_created_resource_preference.json | 15 + .../create_resource_subscription.json | 27 + .../read_created_resource_subscription.json | 27 + .../subscription/create_subscription.json | 25 + .../read_created_subscription.json | 25 + .../create_user_notification.json | 70 +++ .../read_created_user_notification.json | 70 +++ test/fixtures/output/help.golden | 1 + .../fixtures/output/notifications/help.golden | 19 + .../integration/create-help.golden | 17 + .../create/create-description.golden | 6 + .../create/create-ms-teams-target.golden | 6 + .../create/create-slack-target.golden | 6 + .../create/create-webhook-target.golden | 6 + .../integration/delete-help.golden | 13 + .../delete/delete-autocomplete.golden | 3 + .../integration/delete/delete-invalid.golden | 4 + .../integration/delete/delete-multiple.golden | 1 + .../integration/delete/delete-no-force.golden | 1 + .../integration/delete/delete.golden | 1 + .../integration/describe-help.golden | 13 + .../describe/describe-autocomplete.golden | 3 + .../describe/describe-in-app-target.golden | 6 + .../describe/describe-invalid.golden | 1 + .../integration/describe/describe-json.golden | 6 + .../describe/describe-ms-teams-target.golden | 6 + .../describe-role-email-target.golden | 6 + .../describe/describe-slack-target.golden | 6 + .../describe-user-email-target.golden | 6 + .../describe/describe-webhook-target.golden | 6 + .../integration/describe/describe-yaml.golden | 4 + .../notifications/integration/help.golden | 18 + .../integration/list-help.golden | 13 + .../integration/list/list-json.golden | 8 + .../integration/list/list-yaml.golden | 4 + .../integration/list/list.golden | 3 + .../integration/update-help.golden | 18 + .../update/update-description.golden | 7 + .../update/update-display-name.golden | 7 + .../integration/update/update-invalid.golden | 1 + .../update/update-ms-teams-target.golden | 7 + .../update/update-slack-target.golden | 7 + .../update/update-webhook-target.golden | 7 + .../notification-type/describe-help.golden | 13 + .../describe/describe-autocomplete.golden | 3 + .../describe/describe-invalid.golden | 1 + .../describe/describe-json.golden | 9 + .../describe/describe-yaml.golden | 7 + .../describe/describe.golden | 10 + .../notification-type/help.golden | 15 + .../notification-type/list-help.golden | 14 + .../notification-type/list/list-json.golden | 11 + .../list/list-resource-type.golden | 4 + .../notification-type/list/list-yaml.golden | 7 + .../notification-type/list/list.golden | 4 + .../resource-preference/create-help.golden | 16 + .../create/create-current-state.golden | 6 + .../resource-preference/create/create.golden | 6 + .../resource-preference/delete-help.golden | 13 + .../delete/delete-invalid.golden | 4 + .../delete/delete-multiple.golden | 1 + .../delete/delete-no-force.golden | 1 + .../resource-preference/delete/delete.golden | 1 + .../resource-preference/describe-help.golden | 13 + .../describe/describe-invalid.golden | 1 + .../describe/describe-json.golden | 6 + .../describe/describe-yaml.golden | 4 + .../describe/describe.golden | 6 + .../resource-preference/help.golden | 17 + .../resource-preference/update-help.golden | 16 + .../update/update-current-state.golden | 7 + .../update/update-invalid.golden | 1 + .../update/update-resource-type.golden | 7 + .../update/update-resource.golden | 7 + .../resource-subscription/create-help.golden | 18 + .../create/create-current-state.golden | 7 + .../create/create.golden | 7 + .../resource-subscription/delete-help.golden | 13 + .../delete/delete-invalid.golden | 4 + .../delete/delete-multiple.golden | 1 + .../delete/delete-no-force.golden | 1 + .../delete/delete.golden | 1 + .../describe-help.golden | 13 + .../describe/describe-invalid.golden | 1 + .../describe/describe-json.golden | 7 + .../describe/describe-yaml.golden | 5 + .../describe/describe.golden | 7 + .../resource-subscription/help.golden | 17 + .../resource-subscription/update-help.golden | 17 + .../update/update-current-state.golden | 8 + .../update/update-integrations.golden | 8 + .../update/update-invalid.golden | 1 + .../update/update-resource-type.golden | 8 + .../update/update-resource.golden | 8 + .../subscription/create-help.golden | 16 + .../create/create-current-state.golden | 5 + .../subscription/create/create.golden | 5 + .../subscription/delete-help.golden | 13 + .../delete/delete-autocomplete.golden | 3 + .../subscription/delete/delete-invalid.golden | 4 + .../delete/delete-multiple.golden | 1 + .../delete/delete-no-force.golden | 1 + .../subscription/delete/delete.golden | 1 + .../subscription/describe-help.golden | 13 + .../describe/describe-autocomplete.golden | 3 + .../describe/describe-invalid.golden | 1 + .../describe/describe-json.golden | 5 + .../describe/describe-yaml.golden | 3 + .../subscription/describe/describe.golden | 5 + .../notifications/subscription/help.golden | 18 + .../subscription/list-help.golden | 13 + .../subscription/list/list-json.golden | 7 + .../subscription/list/list-yaml.golden | 3 + .../subscription/list/list.golden | 3 + .../subscription/update-help.golden | 15 + .../update/update-current-state.golden | 6 + .../update/update-integrations.golden | 6 + .../subscription/update/update-invalid.golden | 1 + .../user-notification/describe-help.golden | 13 + .../describe/describe-autocomplete.golden | 3 + .../describe/describe-invalid.golden | 1 + .../describe/describe-json.golden | 7 + .../describe/describe-yaml.golden | 5 + .../describe/describe.golden | 7 + .../user-notification/help.golden | 16 + .../user-notification/list-help.golden | 21 + .../user-notification/list/list-crn.golden | 3 + .../list/list-include.golden | 3 + .../user-notification/list/list-json.golden | 9 + .../user-notification/list/list-read.golden | 3 + .../user-notification/list/list-search.golden | 3 + .../list/list-severity.golden | 3 + .../user-notification/list/list-sort.golden | 3 + .../list/list-time-range.golden | 3 + .../user-notification/list/list-type.golden | 3 + .../user-notification/list/list-yaml.golden | 5 + .../user-notification/list/list.golden | 3 + .../user-notification/update-help.golden | 14 + .../update/update-invalid.golden | 1 + .../update/update-read.golden | 8 + .../notifications_integration_live_test.go | 514 ++++++++++++++++++ ...tifications_notification_type_live_test.go | 45 ++ ...fications_resource_preference_live_test.go | 89 +++ ...cations_resource_subscription_live_test.go | 103 ++++ .../notifications_subscription_live_test.go | 91 ++++ ...tifications_user_notification_live_test.go | 56 ++ test/notifications_integration_test.go | 91 ++++ test/notifications_notification_type_test.go | 42 ++ .../notifications_resource_preference_test.go | 57 ++ ...otifications_resource_subscription_test.go | 58 ++ test/notifications_subscription_test.go | 81 +++ test/notifications_user_notification_test.go | 61 +++ test/test-server/ccloudv2_router.go | 12 + .../notifications_integration_handler.go | 94 ++++ ...notifications_notification_type_handler.go | 64 +++ ...tifications_resource_preference_handler.go | 85 +++ ...fications_resource_subscription_handler.go | 85 +++ .../notifications_subscription_handler.go | 94 ++++ ...notifications_user_notification_handler.go | 78 +++ 211 files changed, 5586 insertions(+), 1 deletion(-) create mode 100644 internal/notifications/command.go create mode 100644 internal/notifications/command_integration.go create mode 100644 internal/notifications/command_integration_create.go create mode 100644 internal/notifications/command_integration_delete.go create mode 100644 internal/notifications/command_integration_describe.go create mode 100644 internal/notifications/command_integration_list.go create mode 100644 internal/notifications/command_integration_update.go create mode 100644 internal/notifications/command_notification_type.go create mode 100644 internal/notifications/command_notification_type_describe.go create mode 100644 internal/notifications/command_notification_type_list.go create mode 100644 internal/notifications/command_resource_preference.go create mode 100644 internal/notifications/command_resource_preference_create.go create mode 100644 internal/notifications/command_resource_preference_delete.go create mode 100644 internal/notifications/command_resource_preference_describe.go create mode 100644 internal/notifications/command_resource_preference_update.go create mode 100644 internal/notifications/command_resource_subscription.go create mode 100644 internal/notifications/command_resource_subscription_create.go create mode 100644 internal/notifications/command_resource_subscription_delete.go create mode 100644 internal/notifications/command_resource_subscription_describe.go create mode 100644 internal/notifications/command_resource_subscription_update.go create mode 100644 internal/notifications/command_subscription.go create mode 100644 internal/notifications/command_subscription_create.go create mode 100644 internal/notifications/command_subscription_delete.go create mode 100644 internal/notifications/command_subscription_describe.go create mode 100644 internal/notifications/command_subscription_list.go create mode 100644 internal/notifications/command_subscription_update.go create mode 100644 internal/notifications/command_user_notification.go create mode 100644 internal/notifications/command_user_notification_describe.go create mode 100644 internal/notifications/command_user_notification_list.go create mode 100644 internal/notifications/command_user_notification_update.go create mode 100644 pkg/ccloudv2/notifications.go create mode 100644 test/fixtures/input/notifications/integration/create_in_app_target.json create mode 100644 test/fixtures/input/notifications/integration/create_ms_teams_target.json create mode 100644 test/fixtures/input/notifications/integration/create_role_email_target.json create mode 100644 test/fixtures/input/notifications/integration/create_slack_target.json create mode 100644 test/fixtures/input/notifications/integration/create_user_email_target.json create mode 100644 test/fixtures/input/notifications/integration/create_webhook_target.json create mode 100644 test/fixtures/input/notifications/integration/read_created_in_app_target.json create mode 100644 test/fixtures/input/notifications/integration/read_created_ms_teams_target.json create mode 100644 test/fixtures/input/notifications/integration/read_created_role_email_target.json create mode 100644 test/fixtures/input/notifications/integration/read_created_slack_target.json create mode 100644 test/fixtures/input/notifications/integration/read_created_user_email_target.json create mode 100644 test/fixtures/input/notifications/integration/read_created_webhook_target.json create mode 100644 test/fixtures/input/notifications/notification-type/create_notification_type.json create mode 100644 test/fixtures/input/notifications/notification-type/read_created_notification_type.json create mode 100644 test/fixtures/input/notifications/resource-preference/create_resource_preference.json create mode 100644 test/fixtures/input/notifications/resource-preference/read_created_resource_preference.json create mode 100644 test/fixtures/input/notifications/resource-subscription/create_resource_subscription.json create mode 100644 test/fixtures/input/notifications/resource-subscription/read_created_resource_subscription.json create mode 100644 test/fixtures/input/notifications/subscription/create_subscription.json create mode 100644 test/fixtures/input/notifications/subscription/read_created_subscription.json create mode 100644 test/fixtures/input/notifications/user-notification/create_user_notification.json create mode 100644 test/fixtures/input/notifications/user-notification/read_created_user_notification.json create mode 100644 test/fixtures/output/notifications/help.golden create mode 100644 test/fixtures/output/notifications/integration/create-help.golden create mode 100644 test/fixtures/output/notifications/integration/create/create-description.golden create mode 100644 test/fixtures/output/notifications/integration/create/create-ms-teams-target.golden create mode 100644 test/fixtures/output/notifications/integration/create/create-slack-target.golden create mode 100644 test/fixtures/output/notifications/integration/create/create-webhook-target.golden create mode 100644 test/fixtures/output/notifications/integration/delete-help.golden create mode 100644 test/fixtures/output/notifications/integration/delete/delete-autocomplete.golden create mode 100644 test/fixtures/output/notifications/integration/delete/delete-invalid.golden create mode 100644 test/fixtures/output/notifications/integration/delete/delete-multiple.golden create mode 100644 test/fixtures/output/notifications/integration/delete/delete-no-force.golden create mode 100644 test/fixtures/output/notifications/integration/delete/delete.golden create mode 100644 test/fixtures/output/notifications/integration/describe-help.golden create mode 100644 test/fixtures/output/notifications/integration/describe/describe-autocomplete.golden create mode 100644 test/fixtures/output/notifications/integration/describe/describe-in-app-target.golden create mode 100644 test/fixtures/output/notifications/integration/describe/describe-invalid.golden create mode 100644 test/fixtures/output/notifications/integration/describe/describe-json.golden create mode 100644 test/fixtures/output/notifications/integration/describe/describe-ms-teams-target.golden create mode 100644 test/fixtures/output/notifications/integration/describe/describe-role-email-target.golden create mode 100644 test/fixtures/output/notifications/integration/describe/describe-slack-target.golden create mode 100644 test/fixtures/output/notifications/integration/describe/describe-user-email-target.golden create mode 100644 test/fixtures/output/notifications/integration/describe/describe-webhook-target.golden create mode 100644 test/fixtures/output/notifications/integration/describe/describe-yaml.golden create mode 100644 test/fixtures/output/notifications/integration/help.golden create mode 100644 test/fixtures/output/notifications/integration/list-help.golden create mode 100644 test/fixtures/output/notifications/integration/list/list-json.golden create mode 100644 test/fixtures/output/notifications/integration/list/list-yaml.golden create mode 100644 test/fixtures/output/notifications/integration/list/list.golden create mode 100644 test/fixtures/output/notifications/integration/update-help.golden create mode 100644 test/fixtures/output/notifications/integration/update/update-description.golden create mode 100644 test/fixtures/output/notifications/integration/update/update-display-name.golden create mode 100644 test/fixtures/output/notifications/integration/update/update-invalid.golden create mode 100644 test/fixtures/output/notifications/integration/update/update-ms-teams-target.golden create mode 100644 test/fixtures/output/notifications/integration/update/update-slack-target.golden create mode 100644 test/fixtures/output/notifications/integration/update/update-webhook-target.golden create mode 100644 test/fixtures/output/notifications/notification-type/describe-help.golden create mode 100644 test/fixtures/output/notifications/notification-type/describe/describe-autocomplete.golden create mode 100644 test/fixtures/output/notifications/notification-type/describe/describe-invalid.golden create mode 100644 test/fixtures/output/notifications/notification-type/describe/describe-json.golden create mode 100644 test/fixtures/output/notifications/notification-type/describe/describe-yaml.golden create mode 100644 test/fixtures/output/notifications/notification-type/describe/describe.golden create mode 100644 test/fixtures/output/notifications/notification-type/help.golden create mode 100644 test/fixtures/output/notifications/notification-type/list-help.golden create mode 100644 test/fixtures/output/notifications/notification-type/list/list-json.golden create mode 100644 test/fixtures/output/notifications/notification-type/list/list-resource-type.golden create mode 100644 test/fixtures/output/notifications/notification-type/list/list-yaml.golden create mode 100644 test/fixtures/output/notifications/notification-type/list/list.golden create mode 100644 test/fixtures/output/notifications/resource-preference/create-help.golden create mode 100644 test/fixtures/output/notifications/resource-preference/create/create-current-state.golden create mode 100644 test/fixtures/output/notifications/resource-preference/create/create.golden create mode 100644 test/fixtures/output/notifications/resource-preference/delete-help.golden create mode 100644 test/fixtures/output/notifications/resource-preference/delete/delete-invalid.golden create mode 100644 test/fixtures/output/notifications/resource-preference/delete/delete-multiple.golden create mode 100644 test/fixtures/output/notifications/resource-preference/delete/delete-no-force.golden create mode 100644 test/fixtures/output/notifications/resource-preference/delete/delete.golden create mode 100644 test/fixtures/output/notifications/resource-preference/describe-help.golden create mode 100644 test/fixtures/output/notifications/resource-preference/describe/describe-invalid.golden create mode 100644 test/fixtures/output/notifications/resource-preference/describe/describe-json.golden create mode 100644 test/fixtures/output/notifications/resource-preference/describe/describe-yaml.golden create mode 100644 test/fixtures/output/notifications/resource-preference/describe/describe.golden create mode 100644 test/fixtures/output/notifications/resource-preference/help.golden create mode 100644 test/fixtures/output/notifications/resource-preference/update-help.golden create mode 100644 test/fixtures/output/notifications/resource-preference/update/update-current-state.golden create mode 100644 test/fixtures/output/notifications/resource-preference/update/update-invalid.golden create mode 100644 test/fixtures/output/notifications/resource-preference/update/update-resource-type.golden create mode 100644 test/fixtures/output/notifications/resource-preference/update/update-resource.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/create-help.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/create/create-current-state.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/create/create.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/delete-help.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/delete/delete-invalid.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/delete/delete-multiple.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/delete/delete-no-force.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/delete/delete.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/describe-help.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/describe/describe-invalid.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/describe/describe-json.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/describe/describe-yaml.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/describe/describe.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/help.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/update-help.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/update/update-current-state.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/update/update-integrations.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/update/update-invalid.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/update/update-resource-type.golden create mode 100644 test/fixtures/output/notifications/resource-subscription/update/update-resource.golden create mode 100644 test/fixtures/output/notifications/subscription/create-help.golden create mode 100644 test/fixtures/output/notifications/subscription/create/create-current-state.golden create mode 100644 test/fixtures/output/notifications/subscription/create/create.golden create mode 100644 test/fixtures/output/notifications/subscription/delete-help.golden create mode 100644 test/fixtures/output/notifications/subscription/delete/delete-autocomplete.golden create mode 100644 test/fixtures/output/notifications/subscription/delete/delete-invalid.golden create mode 100644 test/fixtures/output/notifications/subscription/delete/delete-multiple.golden create mode 100644 test/fixtures/output/notifications/subscription/delete/delete-no-force.golden create mode 100644 test/fixtures/output/notifications/subscription/delete/delete.golden create mode 100644 test/fixtures/output/notifications/subscription/describe-help.golden create mode 100644 test/fixtures/output/notifications/subscription/describe/describe-autocomplete.golden create mode 100644 test/fixtures/output/notifications/subscription/describe/describe-invalid.golden create mode 100644 test/fixtures/output/notifications/subscription/describe/describe-json.golden create mode 100644 test/fixtures/output/notifications/subscription/describe/describe-yaml.golden create mode 100644 test/fixtures/output/notifications/subscription/describe/describe.golden create mode 100644 test/fixtures/output/notifications/subscription/help.golden create mode 100644 test/fixtures/output/notifications/subscription/list-help.golden create mode 100644 test/fixtures/output/notifications/subscription/list/list-json.golden create mode 100644 test/fixtures/output/notifications/subscription/list/list-yaml.golden create mode 100644 test/fixtures/output/notifications/subscription/list/list.golden create mode 100644 test/fixtures/output/notifications/subscription/update-help.golden create mode 100644 test/fixtures/output/notifications/subscription/update/update-current-state.golden create mode 100644 test/fixtures/output/notifications/subscription/update/update-integrations.golden create mode 100644 test/fixtures/output/notifications/subscription/update/update-invalid.golden create mode 100644 test/fixtures/output/notifications/user-notification/describe-help.golden create mode 100644 test/fixtures/output/notifications/user-notification/describe/describe-autocomplete.golden create mode 100644 test/fixtures/output/notifications/user-notification/describe/describe-invalid.golden create mode 100644 test/fixtures/output/notifications/user-notification/describe/describe-json.golden create mode 100644 test/fixtures/output/notifications/user-notification/describe/describe-yaml.golden create mode 100644 test/fixtures/output/notifications/user-notification/describe/describe.golden create mode 100644 test/fixtures/output/notifications/user-notification/help.golden create mode 100644 test/fixtures/output/notifications/user-notification/list-help.golden create mode 100644 test/fixtures/output/notifications/user-notification/list/list-crn.golden create mode 100644 test/fixtures/output/notifications/user-notification/list/list-include.golden create mode 100644 test/fixtures/output/notifications/user-notification/list/list-json.golden create mode 100644 test/fixtures/output/notifications/user-notification/list/list-read.golden create mode 100644 test/fixtures/output/notifications/user-notification/list/list-search.golden create mode 100644 test/fixtures/output/notifications/user-notification/list/list-severity.golden create mode 100644 test/fixtures/output/notifications/user-notification/list/list-sort.golden create mode 100644 test/fixtures/output/notifications/user-notification/list/list-time-range.golden create mode 100644 test/fixtures/output/notifications/user-notification/list/list-type.golden create mode 100644 test/fixtures/output/notifications/user-notification/list/list-yaml.golden create mode 100644 test/fixtures/output/notifications/user-notification/list/list.golden create mode 100644 test/fixtures/output/notifications/user-notification/update-help.golden create mode 100644 test/fixtures/output/notifications/user-notification/update/update-invalid.golden create mode 100644 test/fixtures/output/notifications/user-notification/update/update-read.golden create mode 100644 test/live/notifications_integration_live_test.go create mode 100644 test/live/notifications_notification_type_live_test.go create mode 100644 test/live/notifications_resource_preference_live_test.go create mode 100644 test/live/notifications_resource_subscription_live_test.go create mode 100644 test/live/notifications_subscription_live_test.go create mode 100644 test/live/notifications_user_notification_live_test.go create mode 100644 test/notifications_integration_test.go create mode 100644 test/notifications_notification_type_test.go create mode 100644 test/notifications_resource_preference_test.go create mode 100644 test/notifications_resource_subscription_test.go create mode 100644 test/notifications_subscription_test.go create mode 100644 test/notifications_user_notification_test.go create mode 100644 test/test-server/notifications_integration_handler.go create mode 100644 test/test-server/notifications_notification_type_handler.go create mode 100644 test/test-server/notifications_resource_preference_handler.go create mode 100644 test/test-server/notifications_resource_subscription_handler.go create mode 100644 test/test-server/notifications_subscription_handler.go create mode 100644 test/test-server/notifications_user_notification_handler.go diff --git a/.cli-generation-checksum b/.cli-generation-checksum index 6a0241bba7..f59527ef69 100644 --- a/.cli-generation-checksum +++ b/.cli-generation-checksum @@ -1 +1 @@ -9718fbea03e66da34d1d17c21ee7185db56d828bfba06e384663254fbe5ec924 +ae0141a873b6520a9ae2664bea6fea78d1446726a316530fe01a175feee48e57 diff --git a/cmd/lint/main.go b/cmd/lint/main.go index ed6eb1e539..b9c30c67bf 100644 --- a/cmd/lint/main.go +++ b/cmd/lint/main.go @@ -216,6 +216,9 @@ var properNouns = []string{ // vocabWords are words that don't appear in the US dictionary, but are Confluent-related words. var vocabWords = []string{ + "24h", + "30d", + "7d", "a2a", "ack", "acks", @@ -295,7 +298,10 @@ var vocabWords = []string{ "jsonschema", "jwks", "JWT", + "crns", + "eg", "enum", + "integrations", "kafka", "kek", "keychain", @@ -334,6 +340,7 @@ var vocabWords = []string{ "rbac", "readonly", "readwrite", + "recieve", "recv", "rescale", "rest", diff --git a/go.mod b/go.mod index eb1b2910af..04e712fee1 100644 --- a/go.mod +++ b/go.mod @@ -15,6 +15,7 @@ require ( github.com/charmbracelet/lipgloss v0.11.0 github.com/client9/gospell v0.0.0-20160306015952-90dfc71015df github.com/confluentinc/ccloud-sdk-go-v1-public v0.0.0-20250521223017-0e8f6f971b52 + github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications v0.1.0 github.com/confluentinc/ccloud-sdk-go-v2/ai v0.1.0 github.com/confluentinc/ccloud-sdk-go-v2/apikeys v0.4.0 github.com/confluentinc/ccloud-sdk-go-v2/billing v0.3.0 diff --git a/go.sum b/go.sum index 671273f4ef..1a375f1054 100644 --- a/go.sum +++ b/go.sum @@ -165,6 +165,8 @@ github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/confluentinc/ccloud-sdk-go-v1-public v0.0.0-20250521223017-0e8f6f971b52 h1:19qEGhkbZa5fopKCe0VPIV+Sasby4Pv10z9ZaktwWso= github.com/confluentinc/ccloud-sdk-go-v1-public v0.0.0-20250521223017-0e8f6f971b52/go.mod h1:62EMf+5uFEt1BJ2q8WMrUoI9VUSxAbDnmZCGRt/MbA0= +github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications v0.1.0 h1:AGs1k07kekZDIeHHrqiBKYNJdaEGoLlEq4uJa4ChANI= +github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications v0.1.0/go.mod h1:2TF8hUgz/FHKneN1ikvLKHjpN7uzLioN375TF6chbq0= github.com/confluentinc/ccloud-sdk-go-v2/ai v0.1.0 h1:zSF4OQUJXWH2JeAo9rsq13ibk+JFdzITGR8S7cFMpzw= github.com/confluentinc/ccloud-sdk-go-v2/ai v0.1.0/go.mod h1:DoxqzzF3JzvJr3fWkvCiOHFlE0GoYpozWxFZ1Ud9ntA= github.com/confluentinc/ccloud-sdk-go-v2/apikeys v0.4.0 h1:8fWyLwMuy8ec0MVF5Avd54UvbIxhDFhZzanHBVwgxdw= diff --git a/internal/command.go b/internal/command.go index 567f057871..245ffb91f3 100644 --- a/internal/command.go +++ b/internal/command.go @@ -36,6 +36,7 @@ import ( "github.com/confluentinc/cli/v4/internal/login" "github.com/confluentinc/cli/v4/internal/logout" "github.com/confluentinc/cli/v4/internal/network" + "github.com/confluentinc/cli/v4/internal/notifications" "github.com/confluentinc/cli/v4/internal/organization" "github.com/confluentinc/cli/v4/internal/plugin" "github.com/confluentinc/cli/v4/internal/prompt" @@ -128,6 +129,7 @@ func NewConfluentCommand(cfg *config.Config) *cobra.Command { cmd.AddCommand(login.New(cfg, prerunner, ccloudClientFactory, mdsClientManager, loginCredentialsManager, loginOrganizationManager, authTokenHandler)) cmd.AddCommand(logout.New(cfg, prerunner, authTokenHandler)) cmd.AddCommand(network.New(cfg, prerunner)) + cmd.AddCommand(notifications.New(cfg, prerunner)) cmd.AddCommand(organization.New(cfg, prerunner)) cmd.AddCommand(plugin.New(cfg, prerunner)) cmd.AddCommand(prompt.New(cfg)) diff --git a/internal/notifications/command.go b/internal/notifications/command.go new file mode 100644 index 0000000000..2948854a1b --- /dev/null +++ b/internal/notifications/command.go @@ -0,0 +1,29 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/config" +) + +func New(cfg *config.Config, prerunner pcmd.PreRunner) *cobra.Command { + cmd := &cobra.Command{ + Use: "notifications", + Short: "Manage Cloud Notifications.", + } + + cmd.AddCommand( + newIntegrationCommand(cfg, prerunner), + newNotificationTypeCommand(cfg, prerunner), + newResourcePreferenceCommand(cfg, prerunner), + newResourceSubscriptionCommand(cfg, prerunner), + newSubscriptionCommand(cfg, prerunner), + newUserNotificationCommand(cfg, prerunner), + // cli-tfgen:cli-subcommands + ) + + return cmd +} diff --git a/internal/notifications/command_integration.go b/internal/notifications/command_integration.go new file mode 100644 index 0000000000..2d8bb6c87d --- /dev/null +++ b/internal/notifications/command_integration.go @@ -0,0 +1,103 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "fmt" + + "github.com/spf13/cobra" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/config" + "github.com/confluentinc/cli/v4/pkg/output" +) + +type integrationCommand struct { + *pcmd.AuthenticatedCLICommand +} + +type integrationOut struct { + ID string `human:"ID" serialized:"id"` + DisplayName string `human:"Display Name" serialized:"display_name"` + Description string `human:"Description" serialized:"description"` + SlackTargetWebhookUrl string `human:"Slack Target Webhook Url,omitempty" serialized:"slack_target_webhook_url,omitempty"` + RoleEmailTargetRoleName string `human:"Role Email Target Role Name,omitempty" serialized:"role_email_target_role_name,omitempty"` + WebhookTargetUrl string `human:"Webhook Target Url,omitempty" serialized:"webhook_target_url,omitempty"` + MsTeamsTargetWebhookUrl string `human:"Ms Teams Target Webhook Url,omitempty" serialized:"ms_teams_target_webhook_url,omitempty"` +} + +func newIntegrationCommand(cfg *config.Config, prerunner pcmd.PreRunner) *cobra.Command { //nolint:unparam + cmd := &cobra.Command{ + Use: "integration", + Short: "Manage Confluent Cloud notifications integrations.", + Annotations: map[string]string{pcmd.RunRequirement: pcmd.RequireNonAPIKeyCloudLogin}, + } + + c := &integrationCommand{ + AuthenticatedCLICommand: pcmd.NewAuthenticatedCLICommand(cmd, prerunner), + } + + cmd.AddCommand( + c.newCreateCommand(), + c.newDeleteCommand(), + c.newDescribeCommand(), + c.newListCommand(), + c.newUpdateCommand(), + ) + + return cmd +} + +func printIntegration(cmd *cobra.Command, integration notificationsv1.NotificationsV1Integration) error { + table := output.NewTable(cmd) + out := &integrationOut{ + ID: integration.GetId(), + DisplayName: integration.GetDisplayName(), + Description: integration.GetDescription(), + } + if integration.Target.NotificationsV1SlackTarget != nil { + out.SlackTargetWebhookUrl = integration.Target.NotificationsV1SlackTarget.GetWebhookUrl() + } + if integration.Target.NotificationsV1RoleEmailTarget != nil { + out.RoleEmailTargetRoleName = integration.Target.NotificationsV1RoleEmailTarget.GetRoleName() + } + if integration.Target.NotificationsV1WebhookTarget != nil { + out.WebhookTargetUrl = integration.Target.NotificationsV1WebhookTarget.GetUrl() + } + if integration.Target.NotificationsV1MsTeamsTarget != nil { + out.MsTeamsTargetWebhookUrl = integration.Target.NotificationsV1MsTeamsTarget.GetWebhookUrl() + } + table.Add(out) + return table.Print() +} + +func (c *integrationCommand) validArgs(cmd *cobra.Command, args []string) []string { + if len(args) > 0 { + return nil + } + + return c.validArgsMultiple(cmd, args) +} + +func (c *integrationCommand) validArgsMultiple(cmd *cobra.Command, args []string) []string { + if err := c.PersistentPreRunE(cmd, args); err != nil { + return nil + } + + return c.autocompleteIntegrations() +} + +func (c *integrationCommand) autocompleteIntegrations() []string { + integrations, err := c.V2Client.ListNotificationsIntegrations() + if err != nil { + return nil + } + + suggestions := make([]string, len(integrations)) + for i, integration := range integrations { + suggestions[i] = fmt.Sprintf("%s\t%s", integration.GetId(), integration.GetDisplayName()) + } + return suggestions +} diff --git a/internal/notifications/command_integration_create.go b/internal/notifications/command_integration_create.go new file mode 100644 index 0000000000..3bd144b5f1 --- /dev/null +++ b/internal/notifications/command_integration_create.go @@ -0,0 +1,112 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "fmt" + "strings" + + "github.com/spf13/cobra" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/errors" +) + +func (c *integrationCommand) newCreateCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "create ", + Short: "Create a notifications integration.", + Args: cobra.ExactArgs(1), + RunE: c.create, + } + + // Required flags + cmd.Flags().String("kind", "", "") + cobra.CheckErr(cmd.MarkFlagRequired("kind")) + + // Optional flags + cmd.Flags().String("webhook-url", "", "") + cmd.Flags().String("url", "", "") + cmd.Flags().String("description", "", "A human readable description for the particular integration.") + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *integrationCommand) create(cmd *cobra.Command, args []string) error { + name := args[0] + + createReq := notificationsv1.NotificationsV1Integration{} + + createReq.DisplayName = notificationsv1.PtrString(name) + description, err := cmd.Flags().GetString("description") + if err != nil { + return err + } + if description != "" { + createReq.Description = notificationsv1.PtrString(description) + } + + // oneOf: target + kind, err := cmd.Flags().GetString("kind") + if err != nil { + return err + } + + switch strings.ToLower(kind) { + case "slack": + if !cmd.Flags().Changed("webhook-url") { + return fmt.Errorf(`required flag "--%s" not set for %s`, "webhook-url", "Slack") + } + slackTarget := notificationsv1.NotificationsV1SlackTarget{ + Kind: "Slack", + } + webhookUrl, err := cmd.Flags().GetString("webhook-url") + if err != nil { + return err + } + slackTarget.WebhookUrl = webhookUrl + slackTargetOneOf := notificationsv1.NotificationsV1SlackTargetAsNotificationsV1Target(&slackTarget) + createReq.Target = &slackTargetOneOf + case "webhook": + if !cmd.Flags().Changed("url") { + return fmt.Errorf(`required flag "--%s" not set for %s`, "url", "Webhook") + } + webhookTarget := notificationsv1.NotificationsV1WebhookTarget{ + Kind: "Webhook", + } + url, err := cmd.Flags().GetString("url") + if err != nil { + return err + } + webhookTarget.Url = url + webhookTargetOneOf := notificationsv1.NotificationsV1WebhookTargetAsNotificationsV1Target(&webhookTarget) + createReq.Target = &webhookTargetOneOf + case "msteams": + if !cmd.Flags().Changed("webhook-url") { + return fmt.Errorf(`required flag "--%s" not set for %s`, "webhook-url", "MsTeams") + } + msTeamsTarget := notificationsv1.NotificationsV1MsTeamsTarget{ + Kind: "MsTeams", + } + webhookUrl, err := cmd.Flags().GetString("webhook-url") + if err != nil { + return err + } + msTeamsTarget.WebhookUrl = webhookUrl + msTeamsTargetOneOf := notificationsv1.NotificationsV1MsTeamsTargetAsNotificationsV1Target(&msTeamsTarget) + createReq.Target = &msTeamsTargetOneOf + default: + return fmt.Errorf("unrecognized target type: %s", kind) + } + integration, httpResp, err := c.V2Client.CreateNotificationsIntegration(createReq) + if err != nil { + return errors.CatchCCloudV2Error(err, httpResp) + } + + return printIntegration(cmd, integration) +} diff --git a/internal/notifications/command_integration_delete.go b/internal/notifications/command_integration_delete.go new file mode 100644 index 0000000000..141bb7897a --- /dev/null +++ b/internal/notifications/command_integration_delete.go @@ -0,0 +1,47 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/deletion" +) + +func (c *integrationCommand) newDeleteCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "delete [id-2] ... [id-n]", + Short: "Delete one or more notifications integrations.", + Args: cobra.MinimumNArgs(1), + ValidArgsFunction: pcmd.NewValidArgsFunction(c.validArgsMultiple), + RunE: c.delete, + } + + // Required flags + + // Optional flags + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddForceFlag(cmd) + + return cmd +} + +func (c *integrationCommand) delete(cmd *cobra.Command, args []string) error { + existenceFunc := func(primaryId string) bool { + _, _, err := c.V2Client.GetNotificationsIntegration(primaryId) + return err == nil + } + + if err := deletion.ValidateAndConfirm(cmd, args, existenceFunc, "notifications integration"); err != nil { + return err + } + + deleteFunc := func(primaryId string) error { + return c.V2Client.DeleteNotificationsIntegration(primaryId) + } + + _, err := deletion.Delete(cmd, args, deleteFunc, "notifications integration") + return err +} diff --git a/internal/notifications/command_integration_describe.go b/internal/notifications/command_integration_describe.go new file mode 100644 index 0000000000..4fac534ca7 --- /dev/null +++ b/internal/notifications/command_integration_describe.go @@ -0,0 +1,40 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/errors" +) + +func (c *integrationCommand) newDescribeCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "describe ", + Short: "Describe a notifications integration.", + Args: cobra.ExactArgs(1), + ValidArgsFunction: pcmd.NewValidArgsFunction(c.validArgs), + RunE: c.describe, + } + + // Required flags + + // Optional flags + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *integrationCommand) describe(cmd *cobra.Command, args []string) error { + id := args[0] + + integration, httpResp, err := c.V2Client.GetNotificationsIntegration(id) + if err != nil { + return errors.CatchCCloudV2Error(err, httpResp) + } + + return printIntegration(cmd, integration) +} diff --git a/internal/notifications/command_integration_list.go b/internal/notifications/command_integration_list.go new file mode 100644 index 0000000000..d93bc9e6b9 --- /dev/null +++ b/internal/notifications/command_integration_list.go @@ -0,0 +1,58 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/output" +) + +func (c *integrationCommand) newListCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "List notifications integrations.", + Args: cobra.NoArgs, + RunE: c.list, + } + + // Required flags + + // Optional flags + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *integrationCommand) list(cmd *cobra.Command, _ []string) error { + integrations, err := c.V2Client.ListNotificationsIntegrations() + if err != nil { + return err + } + + list := output.NewList(cmd) + for _, integration := range integrations { + out := &integrationOut{ + ID: integration.GetId(), + DisplayName: integration.GetDisplayName(), + Description: integration.GetDescription(), + } + if integration.Target.NotificationsV1SlackTarget != nil { + out.SlackTargetWebhookUrl = integration.Target.NotificationsV1SlackTarget.GetWebhookUrl() + } + if integration.Target.NotificationsV1RoleEmailTarget != nil { + out.RoleEmailTargetRoleName = integration.Target.NotificationsV1RoleEmailTarget.GetRoleName() + } + if integration.Target.NotificationsV1WebhookTarget != nil { + out.WebhookTargetUrl = integration.Target.NotificationsV1WebhookTarget.GetUrl() + } + if integration.Target.NotificationsV1MsTeamsTarget != nil { + out.MsTeamsTargetWebhookUrl = integration.Target.NotificationsV1MsTeamsTarget.GetWebhookUrl() + } + list.Add(out) + } + return list.Print() +} diff --git a/internal/notifications/command_integration_update.go b/internal/notifications/command_integration_update.go new file mode 100644 index 0000000000..72b80e1d2e --- /dev/null +++ b/internal/notifications/command_integration_update.go @@ -0,0 +1,130 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "fmt" + "strings" + + "github.com/spf13/cobra" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/errors" + "github.com/confluentinc/cli/v4/pkg/output" +) + +func (c *integrationCommand) newUpdateCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "update ", + Short: "Update an existing notifications integration.", + Args: cobra.ExactArgs(1), + ValidArgsFunction: pcmd.NewValidArgsFunction(c.validArgs), + RunE: c.update, + } + + // Required flags + + // Optional flags + cmd.Flags().String("kind", "", "") + cmd.Flags().String("webhook-url", "", "") + cmd.Flags().String("url", "", "") + cmd.Flags().String("display-name", "", "A human readable name for the particular integration.") + cmd.Flags().String("description", "", "A human readable description for the particular integration.") + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *integrationCommand) update(cmd *cobra.Command, args []string) error { + id := args[0] + + updateReq := notificationsv1.NotificationsV1Integration{} + + if cmd.Flags().Changed("display-name") { + displayName, err := cmd.Flags().GetString("display-name") + if err != nil { + return err + } + updateReq.DisplayName = notificationsv1.PtrString(displayName) + } + + if cmd.Flags().Changed("description") { + description, err := cmd.Flags().GetString("description") + if err != nil { + return err + } + updateReq.Description = notificationsv1.PtrString(description) + } + + // oneOf: target + kind, err := cmd.Flags().GetString("kind") + if err != nil { + return err + } + if !cmd.Flags().Changed("kind") { + for _, flag := range []string{"webhook-url", "url"} { + if cmd.Flags().Changed(flag) { + return fmt.Errorf("--%s requires --kind", flag) + } + } + } + if cmd.Flags().Changed("kind") { + + switch strings.ToLower(kind) { + case "slack": + slackTarget := notificationsv1.NotificationsV1SlackTarget{ + Kind: "Slack", + } + webhookUrl, err := cmd.Flags().GetString("webhook-url") + if err != nil { + return err + } + if cmd.Flags().Changed("webhook-url") { + slackTarget.WebhookUrl = webhookUrl + } + slackTargetOneOf := notificationsv1.NotificationsV1SlackTargetAsNotificationsV1Target(&slackTarget) + updateReq.Target = &slackTargetOneOf + case "webhook": + webhookTarget := notificationsv1.NotificationsV1WebhookTarget{ + Kind: "Webhook", + } + url, err := cmd.Flags().GetString("url") + if err != nil { + return err + } + if cmd.Flags().Changed("url") { + webhookTarget.Url = url + } + webhookTargetOneOf := notificationsv1.NotificationsV1WebhookTargetAsNotificationsV1Target(&webhookTarget) + updateReq.Target = &webhookTargetOneOf + case "msteams": + msTeamsTarget := notificationsv1.NotificationsV1MsTeamsTarget{ + Kind: "MsTeams", + } + webhookUrl, err := cmd.Flags().GetString("webhook-url") + if err != nil { + return err + } + if cmd.Flags().Changed("webhook-url") { + msTeamsTarget.WebhookUrl = webhookUrl + } + msTeamsTargetOneOf := notificationsv1.NotificationsV1MsTeamsTargetAsNotificationsV1Target(&msTeamsTarget) + updateReq.Target = &msTeamsTargetOneOf + default: + return fmt.Errorf("unrecognized target type: %s", kind) + } + } + integration, httpResp, err := c.V2Client.UpdateNotificationsIntegration(id, updateReq) + if err != nil { + return errors.CatchCCloudV2Error(err, httpResp) + } + + if output.GetFormat(cmd) == output.Human { + output.Printf(c.Config.EnableColor, "Updated notifications integration \"%s\".\n", id) + } + return printIntegration(cmd, integration) +} diff --git a/internal/notifications/command_notification_type.go b/internal/notifications/command_notification_type.go new file mode 100644 index 0000000000..9660ba8161 --- /dev/null +++ b/internal/notifications/command_notification_type.go @@ -0,0 +1,92 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "fmt" + + "github.com/spf13/cobra" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/config" + "github.com/confluentinc/cli/v4/pkg/output" +) + +type notificationTypeCommand struct { + *pcmd.AuthenticatedCLICommand +} + +type notificationTypeOut struct { + ID string `human:"ID" serialized:"id"` + DisplayName string `human:"Display Name" serialized:"display_name"` + Category string `human:"Category" serialized:"category"` + Description string `human:"Description" serialized:"description"` + SubscriptionPriority string `human:"Subscription Priority" serialized:"subscription_priority"` + IsIncludedInPlan bool `human:"Is Included In Plan" serialized:"is_included_in_plan"` + Severity string `human:"Severity" serialized:"severity"` +} + +func newNotificationTypeCommand(cfg *config.Config, prerunner pcmd.PreRunner) *cobra.Command { //nolint:unparam + cmd := &cobra.Command{ + Use: "notification-type", + Short: "Manage Confluent Cloud notifications notification types.", + Annotations: map[string]string{pcmd.RunRequirement: pcmd.RequireNonAPIKeyCloudLogin}, + } + + c := ¬ificationTypeCommand{ + AuthenticatedCLICommand: pcmd.NewAuthenticatedCLICommand(cmd, prerunner), + } + + cmd.AddCommand( + c.newDescribeCommand(), + c.newListCommand(), + ) + + return cmd +} + +func printNotificationType(cmd *cobra.Command, notificationType notificationsv1.NotificationsV1NotificationType) error { + table := output.NewTable(cmd) + out := ¬ificationTypeOut{ + ID: notificationType.GetId(), + DisplayName: notificationType.GetDisplayName(), + Category: notificationType.GetCategory(), + Description: notificationType.GetDescription(), + SubscriptionPriority: notificationType.GetSubscriptionPriority(), + IsIncludedInPlan: notificationType.GetIsIncludedInPlan(), + Severity: notificationType.GetSeverity(), + } + table.Add(out) + return table.Print() +} + +func (c *notificationTypeCommand) validArgs(cmd *cobra.Command, args []string) []string { + if len(args) > 0 { + return nil + } + + return c.validArgsMultiple(cmd, args) +} + +func (c *notificationTypeCommand) validArgsMultiple(cmd *cobra.Command, args []string) []string { + if err := c.PersistentPreRunE(cmd, args); err != nil { + return nil + } + + return c.autocompleteNotificationTypes() +} + +func (c *notificationTypeCommand) autocompleteNotificationTypes() []string { + notificationTypes, err := c.V2Client.ListNotificationsNotificationTypes("") + if err != nil { + return nil + } + + suggestions := make([]string, len(notificationTypes)) + for i, notificationType := range notificationTypes { + suggestions[i] = fmt.Sprintf("%s\t%s", notificationType.GetId(), notificationType.GetDisplayName()) + } + return suggestions +} diff --git a/internal/notifications/command_notification_type_describe.go b/internal/notifications/command_notification_type_describe.go new file mode 100644 index 0000000000..6756d3143f --- /dev/null +++ b/internal/notifications/command_notification_type_describe.go @@ -0,0 +1,40 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/errors" +) + +func (c *notificationTypeCommand) newDescribeCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "describe ", + Short: "Describe a notifications notification type.", + Args: cobra.ExactArgs(1), + ValidArgsFunction: pcmd.NewValidArgsFunction(c.validArgs), + RunE: c.describe, + } + + // Required flags + + // Optional flags + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *notificationTypeCommand) describe(cmd *cobra.Command, args []string) error { + id := args[0] + + notificationType, httpResp, err := c.V2Client.GetNotificationsNotificationType(id) + if err != nil { + return errors.CatchCCloudV2Error(err, httpResp) + } + + return printNotificationType(cmd, notificationType) +} diff --git a/internal/notifications/command_notification_type_list.go b/internal/notifications/command_notification_type_list.go new file mode 100644 index 0000000000..690f668e22 --- /dev/null +++ b/internal/notifications/command_notification_type_list.go @@ -0,0 +1,56 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/output" +) + +func (c *notificationTypeCommand) newListCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "List notifications notification types.", + Args: cobra.NoArgs, + RunE: c.list, + } + + // Required flags + + // Optional flags + cmd.Flags().String("resource-type", "", "Confluent Cloud resource type") + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *notificationTypeCommand) list(cmd *cobra.Command, _ []string) error { + resourceType, err := cmd.Flags().GetString("resource-type") + if err != nil { + return err + } + + notificationTypes, err := c.V2Client.ListNotificationsNotificationTypes(resourceType) + if err != nil { + return err + } + + list := output.NewList(cmd) + for _, notificationType := range notificationTypes { + out := ¬ificationTypeOut{ + ID: notificationType.GetId(), + DisplayName: notificationType.GetDisplayName(), + Category: notificationType.GetCategory(), + Description: notificationType.GetDescription(), + SubscriptionPriority: notificationType.GetSubscriptionPriority(), + IsIncludedInPlan: notificationType.GetIsIncludedInPlan(), + Severity: notificationType.GetSeverity(), + } + list.Add(out) + } + return list.Print() +} diff --git a/internal/notifications/command_resource_preference.go b/internal/notifications/command_resource_preference.go new file mode 100644 index 0000000000..b473c29cd3 --- /dev/null +++ b/internal/notifications/command_resource_preference.go @@ -0,0 +1,57 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/config" + "github.com/confluentinc/cli/v4/pkg/output" +) + +type resourcePreferenceCommand struct { + *pcmd.AuthenticatedCLICommand +} + +type resourcePreferenceOut struct { + ID string `human:"ID" serialized:"id"` + Resource string `human:"Resource" serialized:"resource"` + ResourceType string `human:"Resource Type" serialized:"resource_type"` + CurrentState string `human:"Current State" serialized:"current_state"` +} + +func newResourcePreferenceCommand(cfg *config.Config, prerunner pcmd.PreRunner) *cobra.Command { //nolint:unparam + cmd := &cobra.Command{ + Use: "resource-preference", + Short: "Manage Confluent Cloud notifications resource preferences.", + Annotations: map[string]string{pcmd.RunRequirement: pcmd.RequireNonAPIKeyCloudLogin}, + } + + c := &resourcePreferenceCommand{ + AuthenticatedCLICommand: pcmd.NewAuthenticatedCLICommand(cmd, prerunner), + } + + cmd.AddCommand( + c.newCreateCommand(), + c.newDeleteCommand(), + c.newDescribeCommand(), + c.newUpdateCommand(), + ) + + return cmd +} + +func printResourcePreference(cmd *cobra.Command, resourcePreference notificationsv1.NotificationsV1ResourcePreference) error { + table := output.NewTable(cmd) + out := &resourcePreferenceOut{ + ID: resourcePreference.GetId(), + Resource: resourcePreference.GetResource(), + ResourceType: resourcePreference.GetResourceType(), + CurrentState: resourcePreference.GetCurrentState(), + } + table.Add(out) + return table.Print() +} diff --git a/internal/notifications/command_resource_preference_create.go b/internal/notifications/command_resource_preference_create.go new file mode 100644 index 0000000000..5e322323b1 --- /dev/null +++ b/internal/notifications/command_resource_preference_create.go @@ -0,0 +1,74 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "strings" + + "github.com/spf13/cobra" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/errors" +) + +func (c *resourcePreferenceCommand) newCreateCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "create", + Short: "Create a notifications resource preference.", + Args: cobra.NoArgs, + RunE: c.create, + } + + // Required flags + cmd.Flags().String("resource", "", "Denotes the Confluent Cloud resource definition.") + cmd.Flags().String("resource-type", "", "Denotes the Confluent Cloud resource type.") + pcmd.RegisterFlagCompletionFunc(cmd, "resource-type", func(_ *cobra.Command, _ []string) []string { + return []string{"ORGANIZATION", "ENVIRONMENT", "CLUSTER", "CONNECTOR", "FLINK_COMPUTE_POOL", "FLINK_STATEMENT"} + }) + cobra.CheckErr(cmd.MarkFlagRequired("resource")) + cobra.CheckErr(cmd.MarkFlagRequired("resource-type")) + + // Optional flags + cmd.Flags().String("current-state", "", "Denotes the state of the resource preference. When the resource preference is ENABLED, the user will receive notifications for the Confluent Cloud resource. If the resource preference is DISABLED, the user will not receive any notification for the resource. Note that, you will still receive notifications for `REQUIRED` notification type even when it is DISABLED.") + pcmd.RegisterFlagCompletionFunc(cmd, "current-state", func(_ *cobra.Command, _ []string) []string { return []string{"ENABLED", "DISABLED"} }) + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *resourcePreferenceCommand) create(cmd *cobra.Command, args []string) error { + createReq := notificationsv1.NotificationsV1ResourcePreference{} + + resource, err := cmd.Flags().GetString("resource") + if err != nil { + return err + } + createReq.Resource = notificationsv1.PtrString(resource) + + resourceType, err := cmd.Flags().GetString("resource-type") + if err != nil { + return err + } + resourceType = strings.ToUpper(resourceType) + createReq.ResourceType = notificationsv1.PtrString(resourceType) + + currentState, err := cmd.Flags().GetString("current-state") + if err != nil { + return err + } + currentState = strings.ToUpper(currentState) + if currentState != "" { + createReq.CurrentState = notificationsv1.PtrString(currentState) + } + + resourcePreference, httpResp, err := c.V2Client.CreateNotificationsResourcePreference(createReq) + if err != nil { + return errors.CatchCCloudV2Error(err, httpResp) + } + + return printResourcePreference(cmd, resourcePreference) +} diff --git a/internal/notifications/command_resource_preference_delete.go b/internal/notifications/command_resource_preference_delete.go new file mode 100644 index 0000000000..b6d4167bcd --- /dev/null +++ b/internal/notifications/command_resource_preference_delete.go @@ -0,0 +1,46 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/deletion" +) + +func (c *resourcePreferenceCommand) newDeleteCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "delete [id-2] ... [id-n]", + Short: "Delete one or more notifications resource preferences.", + Args: cobra.MinimumNArgs(1), + RunE: c.delete, + } + + // Required flags + + // Optional flags + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddForceFlag(cmd) + + return cmd +} + +func (c *resourcePreferenceCommand) delete(cmd *cobra.Command, args []string) error { + existenceFunc := func(primaryId string) bool { + _, _, err := c.V2Client.GetNotificationsResourcePreference(primaryId) + return err == nil + } + + if err := deletion.ValidateAndConfirm(cmd, args, existenceFunc, "notifications resource preference"); err != nil { + return err + } + + deleteFunc := func(primaryId string) error { + return c.V2Client.DeleteNotificationsResourcePreference(primaryId) + } + + _, err := deletion.Delete(cmd, args, deleteFunc, "notifications resource preference") + return err +} diff --git a/internal/notifications/command_resource_preference_describe.go b/internal/notifications/command_resource_preference_describe.go new file mode 100644 index 0000000000..9243744ac4 --- /dev/null +++ b/internal/notifications/command_resource_preference_describe.go @@ -0,0 +1,39 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/errors" +) + +func (c *resourcePreferenceCommand) newDescribeCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "describe ", + Short: "Describe a notifications resource preference.", + Args: cobra.ExactArgs(1), + RunE: c.describe, + } + + // Required flags + + // Optional flags + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *resourcePreferenceCommand) describe(cmd *cobra.Command, args []string) error { + id := args[0] + + resourcePreference, httpResp, err := c.V2Client.GetNotificationsResourcePreference(id) + if err != nil { + return errors.CatchCCloudV2Error(err, httpResp) + } + + return printResourcePreference(cmd, resourcePreference) +} diff --git a/internal/notifications/command_resource_preference_update.go b/internal/notifications/command_resource_preference_update.go new file mode 100644 index 0000000000..685e00a9b8 --- /dev/null +++ b/internal/notifications/command_resource_preference_update.go @@ -0,0 +1,82 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "strings" + + "github.com/spf13/cobra" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/errors" + "github.com/confluentinc/cli/v4/pkg/output" +) + +func (c *resourcePreferenceCommand) newUpdateCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "update ", + Short: "Update an existing notifications resource preference.", + Args: cobra.ExactArgs(1), + RunE: c.update, + } + + // Required flags + + // Optional flags + cmd.Flags().String("resource", "", "Denotes the Confluent Cloud resource definition.") + cmd.Flags().String("resource-type", "", "Denotes the Confluent Cloud resource type.") + pcmd.RegisterFlagCompletionFunc(cmd, "resource-type", func(_ *cobra.Command, _ []string) []string { + return []string{"ORGANIZATION", "ENVIRONMENT", "CLUSTER", "CONNECTOR", "FLINK_COMPUTE_POOL", "FLINK_STATEMENT"} + }) + cmd.Flags().String("current-state", "", "Denotes the state of the resource preference. When the resource preference is ENABLED, the user will receive notifications for the Confluent Cloud resource. If the resource preference is DISABLED, the user will not receive any notification for the resource. Note that, you will still receive notifications for `REQUIRED` notification type even when it is DISABLED.") + pcmd.RegisterFlagCompletionFunc(cmd, "current-state", func(_ *cobra.Command, _ []string) []string { return []string{"ENABLED", "DISABLED"} }) + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *resourcePreferenceCommand) update(cmd *cobra.Command, args []string) error { + id := args[0] + + updateReq := notificationsv1.NotificationsV1ResourcePreference{} + + if cmd.Flags().Changed("resource") { + resource, err := cmd.Flags().GetString("resource") + if err != nil { + return err + } + updateReq.Resource = notificationsv1.PtrString(resource) + } + + if cmd.Flags().Changed("resource-type") { + resourceType, err := cmd.Flags().GetString("resource-type") + if err != nil { + return err + } + resourceType = strings.ToUpper(resourceType) + updateReq.ResourceType = notificationsv1.PtrString(resourceType) + } + + if cmd.Flags().Changed("current-state") { + currentState, err := cmd.Flags().GetString("current-state") + if err != nil { + return err + } + currentState = strings.ToUpper(currentState) + updateReq.CurrentState = notificationsv1.PtrString(currentState) + } + + resourcePreference, httpResp, err := c.V2Client.UpdateNotificationsResourcePreference(id, updateReq) + if err != nil { + return errors.CatchCCloudV2Error(err, httpResp) + } + + if output.GetFormat(cmd) == output.Human { + output.Printf(c.Config.EnableColor, "Updated notifications resource preference \"%s\".\n", id) + } + return printResourcePreference(cmd, resourcePreference) +} diff --git a/internal/notifications/command_resource_subscription.go b/internal/notifications/command_resource_subscription.go new file mode 100644 index 0000000000..0b1366d647 --- /dev/null +++ b/internal/notifications/command_resource_subscription.go @@ -0,0 +1,59 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/config" + "github.com/confluentinc/cli/v4/pkg/output" +) + +type resourceSubscriptionCommand struct { + *pcmd.AuthenticatedCLICommand +} + +type resourceSubscriptionOut struct { + ID string `human:"ID" serialized:"id"` + Resource string `human:"Resource" serialized:"resource"` + ResourceType string `human:"Resource Type" serialized:"resource_type"` + NotificationType string `human:"Notification Type" serialized:"notification_type"` + CurrentState string `human:"Current State" serialized:"current_state"` +} + +func newResourceSubscriptionCommand(cfg *config.Config, prerunner pcmd.PreRunner) *cobra.Command { //nolint:unparam + cmd := &cobra.Command{ + Use: "resource-subscription", + Short: "Manage Confluent Cloud notifications resource subscriptions.", + Annotations: map[string]string{pcmd.RunRequirement: pcmd.RequireNonAPIKeyCloudLogin}, + } + + c := &resourceSubscriptionCommand{ + AuthenticatedCLICommand: pcmd.NewAuthenticatedCLICommand(cmd, prerunner), + } + + cmd.AddCommand( + c.newCreateCommand(), + c.newDeleteCommand(), + c.newDescribeCommand(), + c.newUpdateCommand(), + ) + + return cmd +} + +func printResourceSubscription(cmd *cobra.Command, resourceSubscription notificationsv1.NotificationsV1ResourceSubscription) error { + table := output.NewTable(cmd) + out := &resourceSubscriptionOut{ + ID: resourceSubscription.GetId(), + Resource: resourceSubscription.GetResource(), + ResourceType: resourceSubscription.GetResourceType(), + NotificationType: resourceSubscription.NotificationType.GetId(), + CurrentState: resourceSubscription.GetCurrentState(), + } + table.Add(out) + return table.Print() +} diff --git a/internal/notifications/command_resource_subscription_create.go b/internal/notifications/command_resource_subscription_create.go new file mode 100644 index 0000000000..8c3497365e --- /dev/null +++ b/internal/notifications/command_resource_subscription_create.go @@ -0,0 +1,94 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "strings" + + "github.com/spf13/cobra" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/errors" +) + +func (c *resourceSubscriptionCommand) newCreateCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "create", + Short: "Create a notifications resource subscription.", + Args: cobra.NoArgs, + RunE: c.create, + } + + // Required flags + cmd.Flags().String("resource", "", "Denotes the Confluent Cloud resource definition.") + cmd.Flags().String("resource-type", "", "Denotes the Confluent Cloud resource type.") + pcmd.RegisterFlagCompletionFunc(cmd, "resource-type", func(_ *cobra.Command, _ []string) []string { + return []string{"ENVIRONMENT", "CLUSTER", "CONNECTOR", "FLINK_COMPUTE_POOL", "FLINK_STATEMENT"} + }) + cmd.Flags().String("notification-type", "", "The type of notification to subscribe to.") + cmd.Flags().StringSlice("integrations", nil, "Integrations to which notifications are to be sent.") + cobra.CheckErr(cmd.MarkFlagRequired("integrations")) + cobra.CheckErr(cmd.MarkFlagRequired("notification-type")) + cobra.CheckErr(cmd.MarkFlagRequired("resource")) + cobra.CheckErr(cmd.MarkFlagRequired("resource-type")) + + // Optional flags + cmd.Flags().String("current-state", "", "Denotes the state of the resource preference. When the resource preference is ENABLED, the user will receive notifications for the Confluent Cloud resource. If the resource preference is DISABLED, the user will not receive any notification for the resource. Note that, you will still receive notifications for `REQUIRED` notification type even when it is DISABLED.") + pcmd.RegisterFlagCompletionFunc(cmd, "current-state", func(_ *cobra.Command, _ []string) []string { return []string{"ENABLED", "DISABLED"} }) + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *resourceSubscriptionCommand) create(cmd *cobra.Command, args []string) error { + createReq := notificationsv1.NotificationsV1ResourceSubscription{} + + resource, err := cmd.Flags().GetString("resource") + if err != nil { + return err + } + createReq.Resource = notificationsv1.PtrString(resource) + + resourceType, err := cmd.Flags().GetString("resource-type") + if err != nil { + return err + } + resourceType = strings.ToUpper(resourceType) + createReq.ResourceType = notificationsv1.PtrString(resourceType) + + currentState, err := cmd.Flags().GetString("current-state") + if err != nil { + return err + } + currentState = strings.ToUpper(currentState) + if currentState != "" { + createReq.CurrentState = notificationsv1.PtrString(currentState) + } + + notificationTypeId, err := cmd.Flags().GetString("notification-type") + if err != nil { + return err + } + createReq.NotificationType = ¬ificationsv1.GlobalObjectReference{Id: notificationTypeId} + + integrations, err := cmd.Flags().GetStringSlice("integrations") + if err != nil { + return err + } + integrationsRefs := make([]notificationsv1.GlobalObjectReference, len(integrations)) + for i, id := range integrations { + integrationsRefs[i] = notificationsv1.GlobalObjectReference{Id: id} + } + createReq.Integrations = &integrationsRefs + + resourceSubscription, httpResp, err := c.V2Client.CreateNotificationsResourceSubscription(createReq) + if err != nil { + return errors.CatchCCloudV2Error(err, httpResp) + } + + return printResourceSubscription(cmd, resourceSubscription) +} diff --git a/internal/notifications/command_resource_subscription_delete.go b/internal/notifications/command_resource_subscription_delete.go new file mode 100644 index 0000000000..e51222b213 --- /dev/null +++ b/internal/notifications/command_resource_subscription_delete.go @@ -0,0 +1,46 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/deletion" +) + +func (c *resourceSubscriptionCommand) newDeleteCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "delete [id-2] ... [id-n]", + Short: "Delete one or more notifications resource subscriptions.", + Args: cobra.MinimumNArgs(1), + RunE: c.delete, + } + + // Required flags + + // Optional flags + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddForceFlag(cmd) + + return cmd +} + +func (c *resourceSubscriptionCommand) delete(cmd *cobra.Command, args []string) error { + existenceFunc := func(primaryId string) bool { + _, _, err := c.V2Client.GetNotificationsResourceSubscription(primaryId) + return err == nil + } + + if err := deletion.ValidateAndConfirm(cmd, args, existenceFunc, "notifications resource subscription"); err != nil { + return err + } + + deleteFunc := func(primaryId string) error { + return c.V2Client.DeleteNotificationsResourceSubscription(primaryId) + } + + _, err := deletion.Delete(cmd, args, deleteFunc, "notifications resource subscription") + return err +} diff --git a/internal/notifications/command_resource_subscription_describe.go b/internal/notifications/command_resource_subscription_describe.go new file mode 100644 index 0000000000..bdf8527f26 --- /dev/null +++ b/internal/notifications/command_resource_subscription_describe.go @@ -0,0 +1,39 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/errors" +) + +func (c *resourceSubscriptionCommand) newDescribeCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "describe ", + Short: "Describe a notifications resource subscription.", + Args: cobra.ExactArgs(1), + RunE: c.describe, + } + + // Required flags + + // Optional flags + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *resourceSubscriptionCommand) describe(cmd *cobra.Command, args []string) error { + id := args[0] + + resourceSubscription, httpResp, err := c.V2Client.GetNotificationsResourceSubscription(id) + if err != nil { + return errors.CatchCCloudV2Error(err, httpResp) + } + + return printResourceSubscription(cmd, resourceSubscription) +} diff --git a/internal/notifications/command_resource_subscription_update.go b/internal/notifications/command_resource_subscription_update.go new file mode 100644 index 0000000000..5766471c91 --- /dev/null +++ b/internal/notifications/command_resource_subscription_update.go @@ -0,0 +1,95 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "strings" + + "github.com/spf13/cobra" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/errors" + "github.com/confluentinc/cli/v4/pkg/output" +) + +func (c *resourceSubscriptionCommand) newUpdateCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "update ", + Short: "Update an existing notifications resource subscription.", + Args: cobra.ExactArgs(1), + RunE: c.update, + } + + // Required flags + + // Optional flags + cmd.Flags().String("resource", "", "Denotes the Confluent Cloud resource definition.") + cmd.Flags().String("resource-type", "", "Denotes the Confluent Cloud resource type.") + pcmd.RegisterFlagCompletionFunc(cmd, "resource-type", func(_ *cobra.Command, _ []string) []string { + return []string{"ENVIRONMENT", "CLUSTER", "CONNECTOR", "FLINK_COMPUTE_POOL", "FLINK_STATEMENT"} + }) + cmd.Flags().String("current-state", "", "Denotes the state of the resource preference. When the resource preference is ENABLED, the user will receive notifications for the Confluent Cloud resource. If the resource preference is DISABLED, the user will not receive any notification for the resource. Note that, you will still receive notifications for `REQUIRED` notification type even when it is DISABLED.") + pcmd.RegisterFlagCompletionFunc(cmd, "current-state", func(_ *cobra.Command, _ []string) []string { return []string{"ENABLED", "DISABLED"} }) + cmd.Flags().StringSlice("integrations", nil, "Integrations to which notifications are to be sent.") + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *resourceSubscriptionCommand) update(cmd *cobra.Command, args []string) error { + id := args[0] + + updateReq := notificationsv1.NotificationsV1ResourceSubscriptionUpdate{} + + if cmd.Flags().Changed("resource") { + resource, err := cmd.Flags().GetString("resource") + if err != nil { + return err + } + updateReq.Resource = notificationsv1.PtrString(resource) + } + + if cmd.Flags().Changed("resource-type") { + resourceType, err := cmd.Flags().GetString("resource-type") + if err != nil { + return err + } + resourceType = strings.ToUpper(resourceType) + updateReq.ResourceType = notificationsv1.PtrString(resourceType) + } + + if cmd.Flags().Changed("current-state") { + currentState, err := cmd.Flags().GetString("current-state") + if err != nil { + return err + } + currentState = strings.ToUpper(currentState) + updateReq.CurrentState = notificationsv1.PtrString(currentState) + } + + integrations, err := cmd.Flags().GetStringSlice("integrations") + if err != nil { + return err + } + if len(integrations) > 0 { + integrationsRefs := make([]notificationsv1.GlobalObjectReference, len(integrations)) + for i, id := range integrations { + integrationsRefs[i] = notificationsv1.GlobalObjectReference{Id: id} + } + updateReq.Integrations = &integrationsRefs + } + + resourceSubscription, httpResp, err := c.V2Client.UpdateNotificationsResourceSubscription(id, updateReq) + if err != nil { + return errors.CatchCCloudV2Error(err, httpResp) + } + + if output.GetFormat(cmd) == output.Human { + output.Printf(c.Config.EnableColor, "Updated notifications resource subscription \"%s\".\n", id) + } + return printResourceSubscription(cmd, resourceSubscription) +} diff --git a/internal/notifications/command_subscription.go b/internal/notifications/command_subscription.go new file mode 100644 index 0000000000..b801bc6d1e --- /dev/null +++ b/internal/notifications/command_subscription.go @@ -0,0 +1,85 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/config" + "github.com/confluentinc/cli/v4/pkg/output" +) + +type subscriptionCommand struct { + *pcmd.AuthenticatedCLICommand +} + +type subscriptionOut struct { + ID string `human:"ID" serialized:"id"` + NotificationType string `human:"Notification Type" serialized:"notification_type"` + CurrentState string `human:"Current State" serialized:"current_state"` +} + +func newSubscriptionCommand(cfg *config.Config, prerunner pcmd.PreRunner) *cobra.Command { //nolint:unparam + cmd := &cobra.Command{ + Use: "subscription", + Short: "Manage Confluent Cloud notifications subscriptions.", + Annotations: map[string]string{pcmd.RunRequirement: pcmd.RequireNonAPIKeyCloudLogin}, + } + + c := &subscriptionCommand{ + AuthenticatedCLICommand: pcmd.NewAuthenticatedCLICommand(cmd, prerunner), + } + + cmd.AddCommand( + c.newCreateCommand(), + c.newDeleteCommand(), + c.newDescribeCommand(), + c.newListCommand(), + c.newUpdateCommand(), + ) + + return cmd +} + +func printSubscription(cmd *cobra.Command, subscription notificationsv1.NotificationsV1Subscription) error { + table := output.NewTable(cmd) + out := &subscriptionOut{ + ID: subscription.GetId(), + NotificationType: subscription.NotificationType.GetId(), + CurrentState: subscription.GetCurrentState(), + } + table.Add(out) + return table.Print() +} + +func (c *subscriptionCommand) validArgs(cmd *cobra.Command, args []string) []string { + if len(args) > 0 { + return nil + } + + return c.validArgsMultiple(cmd, args) +} + +func (c *subscriptionCommand) validArgsMultiple(cmd *cobra.Command, args []string) []string { + if err := c.PersistentPreRunE(cmd, args); err != nil { + return nil + } + + return c.autocompleteSubscriptions() +} + +func (c *subscriptionCommand) autocompleteSubscriptions() []string { + subscriptions, err := c.V2Client.ListNotificationsSubscriptions() + if err != nil { + return nil + } + + suggestions := make([]string, len(subscriptions)) + for i, subscription := range subscriptions { + suggestions[i] = subscription.GetId() + } + return suggestions +} diff --git a/internal/notifications/command_subscription_create.go b/internal/notifications/command_subscription_create.go new file mode 100644 index 0000000000..5524998f7c --- /dev/null +++ b/internal/notifications/command_subscription_create.go @@ -0,0 +1,74 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "strings" + + "github.com/spf13/cobra" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/errors" +) + +func (c *subscriptionCommand) newCreateCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "create", + Short: "Create a notifications subscription.", + Args: cobra.NoArgs, + RunE: c.create, + } + + // Required flags + cmd.Flags().String("notification-type", "", "The type of notification to subscribe to.") + cmd.Flags().StringSlice("integrations", nil, "Integrations to which notifications are to be sent.") + cobra.CheckErr(cmd.MarkFlagRequired("integrations")) + cobra.CheckErr(cmd.MarkFlagRequired("notification-type")) + + // Optional flags + cmd.Flags().String("current-state", "", "Denotes the state of the subscription. When the subscription is ENABLED, the user will receive notification on the configured Integrations. If the subscription is DISABLED, the user will not recieve any notification for the configured notification type. Note that, you cannot disable a subscription for `REQUIRED` notification type.") + pcmd.RegisterFlagCompletionFunc(cmd, "current-state", func(_ *cobra.Command, _ []string) []string { return []string{"ENABLED", "DISABLED"} }) + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *subscriptionCommand) create(cmd *cobra.Command, args []string) error { + createReq := notificationsv1.NotificationsV1Subscription{} + + currentState, err := cmd.Flags().GetString("current-state") + if err != nil { + return err + } + currentState = strings.ToUpper(currentState) + if currentState != "" { + createReq.CurrentState = notificationsv1.PtrString(currentState) + } + + notificationTypeId, err := cmd.Flags().GetString("notification-type") + if err != nil { + return err + } + createReq.NotificationType = ¬ificationsv1.GlobalObjectReference{Id: notificationTypeId} + + integrations, err := cmd.Flags().GetStringSlice("integrations") + if err != nil { + return err + } + integrationsRefs := make([]notificationsv1.GlobalObjectReference, len(integrations)) + for i, id := range integrations { + integrationsRefs[i] = notificationsv1.GlobalObjectReference{Id: id} + } + createReq.Integrations = &integrationsRefs + + subscription, httpResp, err := c.V2Client.CreateNotificationsSubscription(createReq) + if err != nil { + return errors.CatchCCloudV2Error(err, httpResp) + } + + return printSubscription(cmd, subscription) +} diff --git a/internal/notifications/command_subscription_delete.go b/internal/notifications/command_subscription_delete.go new file mode 100644 index 0000000000..3361d3bb83 --- /dev/null +++ b/internal/notifications/command_subscription_delete.go @@ -0,0 +1,47 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/deletion" +) + +func (c *subscriptionCommand) newDeleteCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "delete [id-2] ... [id-n]", + Short: "Delete one or more notifications subscriptions.", + Args: cobra.MinimumNArgs(1), + ValidArgsFunction: pcmd.NewValidArgsFunction(c.validArgsMultiple), + RunE: c.delete, + } + + // Required flags + + // Optional flags + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddForceFlag(cmd) + + return cmd +} + +func (c *subscriptionCommand) delete(cmd *cobra.Command, args []string) error { + existenceFunc := func(primaryId string) bool { + _, _, err := c.V2Client.GetNotificationsSubscription(primaryId) + return err == nil + } + + if err := deletion.ValidateAndConfirm(cmd, args, existenceFunc, "notifications subscription"); err != nil { + return err + } + + deleteFunc := func(primaryId string) error { + return c.V2Client.DeleteNotificationsSubscription(primaryId) + } + + _, err := deletion.Delete(cmd, args, deleteFunc, "notifications subscription") + return err +} diff --git a/internal/notifications/command_subscription_describe.go b/internal/notifications/command_subscription_describe.go new file mode 100644 index 0000000000..1afddc53db --- /dev/null +++ b/internal/notifications/command_subscription_describe.go @@ -0,0 +1,40 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/errors" +) + +func (c *subscriptionCommand) newDescribeCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "describe ", + Short: "Describe a notifications subscription.", + Args: cobra.ExactArgs(1), + ValidArgsFunction: pcmd.NewValidArgsFunction(c.validArgs), + RunE: c.describe, + } + + // Required flags + + // Optional flags + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *subscriptionCommand) describe(cmd *cobra.Command, args []string) error { + id := args[0] + + subscription, httpResp, err := c.V2Client.GetNotificationsSubscription(id) + if err != nil { + return errors.CatchCCloudV2Error(err, httpResp) + } + + return printSubscription(cmd, subscription) +} diff --git a/internal/notifications/command_subscription_list.go b/internal/notifications/command_subscription_list.go new file mode 100644 index 0000000000..ac3087b71d --- /dev/null +++ b/internal/notifications/command_subscription_list.go @@ -0,0 +1,46 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/output" +) + +func (c *subscriptionCommand) newListCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "List notifications subscriptions.", + Args: cobra.NoArgs, + RunE: c.list, + } + + // Required flags + + // Optional flags + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *subscriptionCommand) list(cmd *cobra.Command, _ []string) error { + subscriptions, err := c.V2Client.ListNotificationsSubscriptions() + if err != nil { + return err + } + + list := output.NewList(cmd) + for _, subscription := range subscriptions { + out := &subscriptionOut{ + ID: subscription.GetId(), + NotificationType: subscription.NotificationType.GetId(), + CurrentState: subscription.GetCurrentState(), + } + list.Add(out) + } + return list.Print() +} diff --git a/internal/notifications/command_subscription_update.go b/internal/notifications/command_subscription_update.go new file mode 100644 index 0000000000..8cff5f44d0 --- /dev/null +++ b/internal/notifications/command_subscription_update.go @@ -0,0 +1,74 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "strings" + + "github.com/spf13/cobra" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/errors" + "github.com/confluentinc/cli/v4/pkg/output" +) + +func (c *subscriptionCommand) newUpdateCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "update ", + Short: "Update an existing notifications subscription.", + Args: cobra.ExactArgs(1), + ValidArgsFunction: pcmd.NewValidArgsFunction(c.validArgs), + RunE: c.update, + } + + // Required flags + + // Optional flags + cmd.Flags().String("current-state", "", "Denotes the state of the subscription. When the subscription is ENABLED, the user will receive notification on the configured Integrations. If the subscription is DISABLED, the user will not recieve any notification for the configured notification type. Note that, you cannot disable a subscription for `REQUIRED` notification type.") + pcmd.RegisterFlagCompletionFunc(cmd, "current-state", func(_ *cobra.Command, _ []string) []string { return []string{"ENABLED", "DISABLED"} }) + cmd.Flags().StringSlice("integrations", nil, "Integrations to which notifications are to be sent.") + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *subscriptionCommand) update(cmd *cobra.Command, args []string) error { + id := args[0] + + updateReq := notificationsv1.NotificationsV1SubscriptionUpdate{} + + if cmd.Flags().Changed("current-state") { + currentState, err := cmd.Flags().GetString("current-state") + if err != nil { + return err + } + currentState = strings.ToUpper(currentState) + updateReq.CurrentState = notificationsv1.PtrString(currentState) + } + + integrations, err := cmd.Flags().GetStringSlice("integrations") + if err != nil { + return err + } + if len(integrations) > 0 { + integrationsRefs := make([]notificationsv1.GlobalObjectReference, len(integrations)) + for i, id := range integrations { + integrationsRefs[i] = notificationsv1.GlobalObjectReference{Id: id} + } + updateReq.Integrations = &integrationsRefs + } + + subscription, httpResp, err := c.V2Client.UpdateNotificationsSubscription(id, updateReq) + if err != nil { + return errors.CatchCCloudV2Error(err, httpResp) + } + + if output.GetFormat(cmd) == output.Human { + output.Printf(c.Config.EnableColor, "Updated notifications subscription \"%s\".\n", id) + } + return printSubscription(cmd, subscription) +} diff --git a/internal/notifications/command_user_notification.go b/internal/notifications/command_user_notification.go new file mode 100644 index 0000000000..4e8861eae1 --- /dev/null +++ b/internal/notifications/command_user_notification.go @@ -0,0 +1,89 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "time" + + "github.com/spf13/cobra" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/config" + "github.com/confluentinc/cli/v4/pkg/output" +) + +type userNotificationCommand struct { + *pcmd.AuthenticatedCLICommand +} + +type userNotificationOut struct { + ID string `human:"ID" serialized:"id"` + ReadAt string `human:"Read At" serialized:"read_at"` + Severity string `human:"Severity" serialized:"severity"` + ReceivedAt string `human:"Received At" serialized:"received_at"` + Read bool `human:"Read" serialized:"read"` +} + +func newUserNotificationCommand(cfg *config.Config, prerunner pcmd.PreRunner) *cobra.Command { //nolint:unparam + cmd := &cobra.Command{ + Use: "user-notification", + Short: "Manage Confluent Cloud notifications user notifications.", + Annotations: map[string]string{pcmd.RunRequirement: pcmd.RequireNonAPIKeyCloudLogin}, + } + + c := &userNotificationCommand{ + AuthenticatedCLICommand: pcmd.NewAuthenticatedCLICommand(cmd, prerunner), + } + + cmd.AddCommand( + c.newDescribeCommand(), + c.newListCommand(), + c.newUpdateCommand(), + ) + + return cmd +} + +func printUserNotification(cmd *cobra.Command, userNotification notificationsv1.NotificationsV1UserNotification) error { + table := output.NewTable(cmd) + out := &userNotificationOut{ + ID: userNotification.GetId(), + ReadAt: userNotification.GetReadAt().Format(time.RFC3339), + Severity: userNotification.GetSeverity(), + ReceivedAt: userNotification.GetReceivedAt().Format(time.RFC3339), + Read: userNotification.GetRead(), + } + table.Add(out) + return table.Print() +} + +func (c *userNotificationCommand) validArgs(cmd *cobra.Command, args []string) []string { + if len(args) > 0 { + return nil + } + + return c.validArgsMultiple(cmd, args) +} + +func (c *userNotificationCommand) validArgsMultiple(cmd *cobra.Command, args []string) []string { + if err := c.PersistentPreRunE(cmd, args); err != nil { + return nil + } + + return c.autocompleteUserNotifications() +} + +func (c *userNotificationCommand) autocompleteUserNotifications() []string { + userNotifications, err := c.V2Client.ListNotificationsUserNotifications(nil, nil, "", nil, nil, "", "", nil) + if err != nil { + return nil + } + + suggestions := make([]string, len(userNotifications)) + for i, userNotification := range userNotifications { + suggestions[i] = userNotification.GetId() + } + return suggestions +} diff --git a/internal/notifications/command_user_notification_describe.go b/internal/notifications/command_user_notification_describe.go new file mode 100644 index 0000000000..2f530e25dc --- /dev/null +++ b/internal/notifications/command_user_notification_describe.go @@ -0,0 +1,40 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/errors" +) + +func (c *userNotificationCommand) newDescribeCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "describe ", + Short: "Describe a notifications user notification.", + Args: cobra.ExactArgs(1), + ValidArgsFunction: pcmd.NewValidArgsFunction(c.validArgs), + RunE: c.describe, + } + + // Required flags + + // Optional flags + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *userNotificationCommand) describe(cmd *cobra.Command, args []string) error { + id := args[0] + + userNotification, httpResp, err := c.V2Client.GetNotificationsUserNotification(id) + if err != nil { + return errors.CatchCCloudV2Error(err, httpResp) + } + + return printUserNotification(cmd, userNotification) +} diff --git a/internal/notifications/command_user_notification_list.go b/internal/notifications/command_user_notification_list.go new file mode 100644 index 0000000000..df1f1e5c76 --- /dev/null +++ b/internal/notifications/command_user_notification_list.go @@ -0,0 +1,102 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "time" + + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/output" +) + +func (c *userNotificationCommand) newListCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "List notifications user notifications.", + Args: cobra.NoArgs, + RunE: c.list, + } + + // Required flags + + // Optional flags + cmd.Flags().Bool("read", false, "Filter the results where read is true or false.") + cmd.Flags().StringSlice("severity", nil, "Filter notifications by severity. Pass the parameter multiple times to match any of the given values (`?severity=CRITICAL&severity=WARN`). A notification matches if its `severity` equals any of the listed values.") + cmd.Flags().String("include", "", "Comma-separated list of optional fields to populate in the response items. Allowed values: `integrations`, `recommended_actions`. By default these fields are omitted from list responses to keep collection payloads slim; set this parameter to opt in. This is a partial-response selector, not a value filter.") + cmd.Flags().StringSlice("type", nil, "Filter notifications by the Confluent Cloud resource type they relate to. Pass the parameter multiple times to match any of the given values (`?resource.type=CLUSTER&resource.type=CONNECTOR`). A notification matches if its `resource.type` equals any of the listed values.") + cmd.Flags().StringSlice("crn", nil, "Filter notifications by the CRN of the Confluent Cloud resource they relate to. Pass the parameter multiple times to match any of the given CRNs; a notification matches if its `resource.crn` equals any of the listed values.") + cmd.Flags().String("search", "", "Free-text partial-match search across the embedded notification type's `display_name` and `description`.") + cmd.Flags().String("time-range", "", "Filter notifications by a preset time window relative to now. Allowed values: `PAST_24H` (last 24 hours), `PAST_7D` (last 7 days), `PAST_30D` (last 30 days).") + cmd.Flags().StringSlice("sort", nil, "The list of fields and directions that are used to sort the collection.") + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *userNotificationCommand) list(cmd *cobra.Command, _ []string) error { + var read *bool + if cmd.Flags().Changed("read") { + v, err := cmd.Flags().GetBool("read") + if err != nil { + return err + } + read = &v + } + + severity, err := cmd.Flags().GetStringSlice("severity") + if err != nil { + return err + } + + include, err := cmd.Flags().GetString("include") + if err != nil { + return err + } + + typeValue, err := cmd.Flags().GetStringSlice("type") + if err != nil { + return err + } + + crn, err := cmd.Flags().GetStringSlice("crn") + if err != nil { + return err + } + + search, err := cmd.Flags().GetString("search") + if err != nil { + return err + } + + timeRange, err := cmd.Flags().GetString("time-range") + if err != nil { + return err + } + + sort, err := cmd.Flags().GetStringSlice("sort") + if err != nil { + return err + } + + userNotifications, err := c.V2Client.ListNotificationsUserNotifications(read, severity, include, typeValue, crn, search, timeRange, sort) + if err != nil { + return err + } + + list := output.NewList(cmd) + for _, userNotification := range userNotifications { + out := &userNotificationOut{ + ID: userNotification.GetId(), + ReadAt: userNotification.GetReadAt().Format(time.RFC3339), + Severity: userNotification.GetSeverity(), + ReceivedAt: userNotification.GetReceivedAt().Format(time.RFC3339), + Read: userNotification.GetRead(), + } + list.Add(out) + } + return list.Print() +} diff --git a/internal/notifications/command_user_notification_update.go b/internal/notifications/command_user_notification_update.go new file mode 100644 index 0000000000..a6f8d5776f --- /dev/null +++ b/internal/notifications/command_user_notification_update.go @@ -0,0 +1,57 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package notifications + +import ( + "github.com/spf13/cobra" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" + "github.com/confluentinc/cli/v4/pkg/errors" + "github.com/confluentinc/cli/v4/pkg/output" +) + +func (c *userNotificationCommand) newUpdateCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "update ", + Short: "Update an existing notifications user notification.", + Args: cobra.ExactArgs(1), + ValidArgsFunction: pcmd.NewValidArgsFunction(c.validArgs), + RunE: c.update, + } + + // Required flags + + // Optional flags + cmd.Flags().Bool("read", false, "Whether the notification has been read by the user.") + + pcmd.AddContextFlag(cmd, c.CLICommand) + pcmd.AddOutputFlag(cmd) + + return cmd +} + +func (c *userNotificationCommand) update(cmd *cobra.Command, args []string) error { + id := args[0] + + updateReq := notificationsv1.NotificationsV1UserNotification{} + + if cmd.Flags().Changed("read") { + read, err := cmd.Flags().GetBool("read") + if err != nil { + return err + } + updateReq.Read = notificationsv1.PtrBool(read) + } + + userNotification, httpResp, err := c.V2Client.UpdateNotificationsUserNotification(id, updateReq) + if err != nil { + return errors.CatchCCloudV2Error(err, httpResp) + } + + if output.GetFormat(cmd) == output.Human { + output.Printf(c.Config.EnableColor, "Updated notifications user notification \"%s\".\n", id) + } + return printUserNotification(cmd, userNotification) +} diff --git a/pkg/ccloudv2/client.go b/pkg/ccloudv2/client.go index a736857f5b..a71b17c938 100644 --- a/pkg/ccloudv2/client.go +++ b/pkg/ccloudv2/client.go @@ -1,6 +1,7 @@ package ccloudv2 import ( + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" aiv1 "github.com/confluentinc/ccloud-sdk-go-v2/ai/v1" apikeysv2 "github.com/confluentinc/ccloud-sdk-go-v2/apikeys/v2" billingv1 "github.com/confluentinc/ccloud-sdk-go-v2/billing/v1" @@ -73,6 +74,7 @@ type Client struct { NetworkingGatewayClient *networkinggatewayv1.APIClient NetworkingIpClient *networkingipv1.APIClient NetworkingPrivateLinkClient *networkingprivatelinkv1.APIClient + NotificationsClient *notificationsv1.APIClient OrgClient *orgv2.APIClient ProviderIntegrationClient *pi.APIClient ProviderIntegrationV2Client *piv2.APIClient @@ -125,6 +127,7 @@ func NewClient(cfg *config.Config, unsafeTrace bool) *Client { NetworkingGatewayClient: newNetworkingGatewayClient(httpClient, url, userAgent, unsafeTrace), NetworkingIpClient: newNetworkingIpClient(httpClient, url, userAgent, unsafeTrace), NetworkingPrivateLinkClient: newNetworkingPrivateLinkClient(httpClient, url, userAgent, unsafeTrace), + NotificationsClient: newNotificationsClient(httpClient, url, userAgent, unsafeTrace), OrgClient: newOrgClient(httpClient, url, userAgent, unsafeTrace), ProviderIntegrationClient: newProviderIntegrationClient(httpClient, url, userAgent, unsafeTrace), ProviderIntegrationV2Client: newProviderIntegrationV2Client(httpClient, url, userAgent, unsafeTrace), diff --git a/pkg/ccloudv2/notifications.go b/pkg/ccloudv2/notifications.go new file mode 100644 index 0000000000..19931865b1 --- /dev/null +++ b/pkg/ccloudv2/notifications.go @@ -0,0 +1,318 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package ccloudv2 + +import ( + "context" + "net/http" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + + "github.com/confluentinc/cli/v4/pkg/errors" +) + +// ===== API group client bootstrap ===== + +func newNotificationsClient(httpClient *http.Client, url, userAgent string, unsafeTrace bool) *notificationsv1.APIClient { + cfg := notificationsv1.NewConfiguration() + cfg.Debug = unsafeTrace + cfg.HTTPClient = httpClient + cfg.Servers = notificationsv1.ServerConfigurations{{URL: url}} + cfg.UserAgent = userAgent + + return notificationsv1.NewAPIClient(cfg) +} + +func (c *Client) notificationsApiContext() context.Context { + return context.WithValue(context.Background(), notificationsv1.ContextAccessToken, c.cfg.Context().GetAuthToken()) +} + +// ===== notifications integrations API calls ===== + +func (c *Client) CreateNotificationsIntegration(req notificationsv1.NotificationsV1Integration) (notificationsv1.NotificationsV1Integration, *http.Response, error) { + createReq := c.NotificationsClient.IntegrationsNotificationsV1Api. + CreateNotificationsV1Integration(c.notificationsApiContext()). + NotificationsV1Integration(req) + return createReq.Execute() +} + +func (c *Client) GetNotificationsIntegration(id string) (notificationsv1.NotificationsV1Integration, *http.Response, error) { + getReq := c.NotificationsClient.IntegrationsNotificationsV1Api. + GetNotificationsV1Integration(c.notificationsApiContext(), id) + return getReq.Execute() +} + +func (c *Client) UpdateNotificationsIntegration(id string, update notificationsv1.NotificationsV1Integration) (notificationsv1.NotificationsV1Integration, *http.Response, error) { + updateReq := c.NotificationsClient.IntegrationsNotificationsV1Api. + UpdateNotificationsV1Integration(c.notificationsApiContext(), id). + NotificationsV1Integration(update) + return updateReq.Execute() +} + +func (c *Client) DeleteNotificationsIntegration(id string) error { + deleteReq := c.NotificationsClient.IntegrationsNotificationsV1Api. + DeleteNotificationsV1Integration(c.notificationsApiContext(), id) + httpResp, err := deleteReq.Execute() + return errors.CatchCCloudV2Error(err, httpResp) +} + +func (c *Client) ListNotificationsIntegrations() ([]notificationsv1.NotificationsV1Integration, error) { + var list []notificationsv1.NotificationsV1Integration + + done := false + pageToken := "" + for !done { + page, httpResp, err := c.executeListNotificationsIntegrations(pageToken) + if err != nil { + return nil, errors.CatchCCloudV2Error(err, httpResp) + } + list = append(list, page.GetData()...) + + pageToken, done, err = extractNextPageToken(page.GetMetadata().Next) + if err != nil { + return nil, err + } + } + + return list, nil +} + +func (c *Client) executeListNotificationsIntegrations(pageToken string) (notificationsv1.NotificationsV1IntegrationList, *http.Response, error) { + req := c.NotificationsClient.IntegrationsNotificationsV1Api. + ListNotificationsV1Integrations(c.notificationsApiContext()). + PageSize(ccloudV2ListPageSize) + if pageToken != "" { + req = req.PageToken(pageToken) + } + return req.Execute() +} + +// ===== notifications notification types API calls ===== + +func (c *Client) GetNotificationsNotificationType(id string) (notificationsv1.NotificationsV1NotificationType, *http.Response, error) { + getReq := c.NotificationsClient.NotificationTypesNotificationsV1Api. + GetNotificationsV1NotificationType(c.notificationsApiContext(), id) + return getReq.Execute() +} + +func (c *Client) ListNotificationsNotificationTypes(resourceType string) ([]notificationsv1.NotificationsV1NotificationType, error) { + var list []notificationsv1.NotificationsV1NotificationType + + done := false + pageToken := "" + for !done { + page, httpResp, err := c.executeListNotificationsNotificationTypes(resourceType, pageToken) + if err != nil { + return nil, errors.CatchCCloudV2Error(err, httpResp) + } + list = append(list, page.GetData()...) + + pageToken, done, err = extractNextPageToken(page.GetMetadata().Next) + if err != nil { + return nil, err + } + } + + return list, nil +} + +func (c *Client) executeListNotificationsNotificationTypes(resourceType string, pageToken string) (notificationsv1.NotificationsV1NotificationTypeList, *http.Response, error) { + req := c.NotificationsClient.NotificationTypesNotificationsV1Api. + ListNotificationsV1NotificationTypes(c.notificationsApiContext()). + PageSize(ccloudV2ListPageSize) + if resourceType != "" { + req = req.ResourceType(resourceType) + } + if pageToken != "" { + req = req.PageToken(pageToken) + } + return req.Execute() +} + +// ===== notifications resource preferences API calls ===== + +func (c *Client) CreateNotificationsResourcePreference(req notificationsv1.NotificationsV1ResourcePreference) (notificationsv1.NotificationsV1ResourcePreference, *http.Response, error) { + createReq := c.NotificationsClient.ResourcePreferencesNotificationsV1Api. + CreateNotificationsV1ResourcePreference(c.notificationsApiContext()). + NotificationsV1ResourcePreference(req) + return createReq.Execute() +} + +func (c *Client) GetNotificationsResourcePreference(id string) (notificationsv1.NotificationsV1ResourcePreference, *http.Response, error) { + getReq := c.NotificationsClient.ResourcePreferencesNotificationsV1Api. + GetNotificationsV1ResourcePreference(c.notificationsApiContext(), id) + return getReq.Execute() +} + +func (c *Client) UpdateNotificationsResourcePreference(id string, update notificationsv1.NotificationsV1ResourcePreference) (notificationsv1.NotificationsV1ResourcePreference, *http.Response, error) { + updateReq := c.NotificationsClient.ResourcePreferencesNotificationsV1Api. + UpdateNotificationsV1ResourcePreference(c.notificationsApiContext(), id). + NotificationsV1ResourcePreference(update) + return updateReq.Execute() +} + +func (c *Client) DeleteNotificationsResourcePreference(id string) error { + deleteReq := c.NotificationsClient.ResourcePreferencesNotificationsV1Api. + DeleteNotificationsV1ResourcePreference(c.notificationsApiContext(), id) + httpResp, err := deleteReq.Execute() + return errors.CatchCCloudV2Error(err, httpResp) +} + +// ===== notifications resource subscriptions API calls ===== + +func (c *Client) CreateNotificationsResourceSubscription(req notificationsv1.NotificationsV1ResourceSubscription) (notificationsv1.NotificationsV1ResourceSubscription, *http.Response, error) { + createReq := c.NotificationsClient.ResourceSubscriptionsNotificationsV1Api. + CreateNotificationsV1ResourceSubscription(c.notificationsApiContext()). + NotificationsV1ResourceSubscription(req) + return createReq.Execute() +} + +func (c *Client) GetNotificationsResourceSubscription(id string) (notificationsv1.NotificationsV1ResourceSubscription, *http.Response, error) { + getReq := c.NotificationsClient.ResourceSubscriptionsNotificationsV1Api. + GetNotificationsV1ResourceSubscription(c.notificationsApiContext(), id) + return getReq.Execute() +} + +func (c *Client) UpdateNotificationsResourceSubscription(id string, update notificationsv1.NotificationsV1ResourceSubscriptionUpdate) (notificationsv1.NotificationsV1ResourceSubscription, *http.Response, error) { + updateReq := c.NotificationsClient.ResourceSubscriptionsNotificationsV1Api. + UpdateNotificationsV1ResourceSubscription(c.notificationsApiContext(), id). + NotificationsV1ResourceSubscriptionUpdate(update) + return updateReq.Execute() +} + +func (c *Client) DeleteNotificationsResourceSubscription(id string) error { + deleteReq := c.NotificationsClient.ResourceSubscriptionsNotificationsV1Api. + DeleteNotificationsV1ResourceSubscription(c.notificationsApiContext(), id) + httpResp, err := deleteReq.Execute() + return errors.CatchCCloudV2Error(err, httpResp) +} + +// ===== notifications subscriptions API calls ===== + +func (c *Client) CreateNotificationsSubscription(req notificationsv1.NotificationsV1Subscription) (notificationsv1.NotificationsV1Subscription, *http.Response, error) { + createReq := c.NotificationsClient.SubscriptionsNotificationsV1Api. + CreateNotificationsV1Subscription(c.notificationsApiContext()). + NotificationsV1Subscription(req) + return createReq.Execute() +} + +func (c *Client) GetNotificationsSubscription(id string) (notificationsv1.NotificationsV1Subscription, *http.Response, error) { + getReq := c.NotificationsClient.SubscriptionsNotificationsV1Api. + GetNotificationsV1Subscription(c.notificationsApiContext(), id) + return getReq.Execute() +} + +func (c *Client) UpdateNotificationsSubscription(id string, update notificationsv1.NotificationsV1SubscriptionUpdate) (notificationsv1.NotificationsV1Subscription, *http.Response, error) { + updateReq := c.NotificationsClient.SubscriptionsNotificationsV1Api. + UpdateNotificationsV1Subscription(c.notificationsApiContext(), id). + NotificationsV1SubscriptionUpdate(update) + return updateReq.Execute() +} + +func (c *Client) DeleteNotificationsSubscription(id string) error { + deleteReq := c.NotificationsClient.SubscriptionsNotificationsV1Api. + DeleteNotificationsV1Subscription(c.notificationsApiContext(), id) + httpResp, err := deleteReq.Execute() + return errors.CatchCCloudV2Error(err, httpResp) +} + +func (c *Client) ListNotificationsSubscriptions() ([]notificationsv1.NotificationsV1Subscription, error) { + var list []notificationsv1.NotificationsV1Subscription + + done := false + pageToken := "" + for !done { + page, httpResp, err := c.executeListNotificationsSubscriptions(pageToken) + if err != nil { + return nil, errors.CatchCCloudV2Error(err, httpResp) + } + list = append(list, page.GetData()...) + + pageToken, done, err = extractNextPageToken(page.GetMetadata().Next) + if err != nil { + return nil, err + } + } + + return list, nil +} + +func (c *Client) executeListNotificationsSubscriptions(pageToken string) (notificationsv1.NotificationsV1SubscriptionList, *http.Response, error) { + req := c.NotificationsClient.SubscriptionsNotificationsV1Api. + ListNotificationsV1Subscriptions(c.notificationsApiContext()). + PageSize(ccloudV2ListPageSize) + if pageToken != "" { + req = req.PageToken(pageToken) + } + return req.Execute() +} + +// ===== notifications user notifications API calls ===== + +func (c *Client) GetNotificationsUserNotification(id string) (notificationsv1.NotificationsV1UserNotification, *http.Response, error) { + getReq := c.NotificationsClient.UserNotificationsNotificationsV1Api. + GetNotificationsV1UserNotification(c.notificationsApiContext(), id) + return getReq.Execute() +} + +func (c *Client) UpdateNotificationsUserNotification(id string, update notificationsv1.NotificationsV1UserNotification) (notificationsv1.NotificationsV1UserNotification, *http.Response, error) { + updateReq := c.NotificationsClient.UserNotificationsNotificationsV1Api. + UpdateNotificationsV1UserNotification(c.notificationsApiContext(), id). + NotificationsV1UserNotification(update) + return updateReq.Execute() +} + +func (c *Client) ListNotificationsUserNotifications(read *bool, severity []string, include string, resourceType []string, resourceCrn []string, search string, timeRange string, sort []string) ([]notificationsv1.NotificationsV1UserNotification, error) { + var list []notificationsv1.NotificationsV1UserNotification + + done := false + pageToken := "" + for !done { + page, httpResp, err := c.executeListNotificationsUserNotifications(read, severity, include, resourceType, resourceCrn, search, timeRange, sort, pageToken) + if err != nil { + return nil, errors.CatchCCloudV2Error(err, httpResp) + } + list = append(list, page.GetData()...) + + pageToken, done, err = extractNextPageToken(page.GetMetadata().Next) + if err != nil { + return nil, err + } + } + + return list, nil +} + +func (c *Client) executeListNotificationsUserNotifications(read *bool, severity []string, include string, resourceType []string, resourceCrn []string, search string, timeRange string, sort []string, pageToken string) (notificationsv1.NotificationsV1UserNotificationList, *http.Response, error) { + req := c.NotificationsClient.UserNotificationsNotificationsV1Api. + ListNotificationsV1UserNotifications(c.notificationsApiContext()). + PageSize(ccloudV2ListPageSize) + if read != nil { + req = req.Read(*read) + } + if severity != nil { + req = req.Severity(notificationsv1.MultipleSearchFilter{Items: severity}) + } + if include != "" { + req = req.Include(include) + } + if resourceType != nil { + req = req.ResourceType(notificationsv1.MultipleSearchFilter{Items: resourceType}) + } + if resourceCrn != nil { + req = req.ResourceCrn(notificationsv1.MultipleSearchFilter{Items: resourceCrn}) + } + if search != "" { + req = req.Search(search) + } + if timeRange != "" { + req = req.TimeRange(timeRange) + } + if sort != nil { + req = req.Sort(sort) + } + if pageToken != "" { + req = req.PageToken(pageToken) + } + return req.Execute() +} diff --git a/test/fixtures/input/notifications/integration/create_in_app_target.json b/test/fixtures/input/notifications/integration/create_in_app_target.json new file mode 100644 index 0000000000..75af35f0ba --- /dev/null +++ b/test/fixtures/input/notifications/integration/create_in_app_target.json @@ -0,0 +1,22 @@ +{ + "api_version": "notifications/v1", + "description": "A Slack channel integration", + "display_name": "Slack integration", + "id": "dlz-f3a90de", + "kind": "Integration", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/integration=i-12345", + "self": "https://api.confluent.cloud/notifications/v1/integrations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "target": { + "kind": "InApp", + "user": { + "id": "u-abc123", + "related": "https://example.com", + "resource_name": "https://example.com" + } + } +} diff --git a/test/fixtures/input/notifications/integration/create_ms_teams_target.json b/test/fixtures/input/notifications/integration/create_ms_teams_target.json new file mode 100644 index 0000000000..7aa87edaf9 --- /dev/null +++ b/test/fixtures/input/notifications/integration/create_ms_teams_target.json @@ -0,0 +1,18 @@ +{ + "api_version": "notifications/v1", + "description": "A Slack channel integration", + "display_name": "Slack integration", + "id": "dlz-f3a90de", + "kind": "Integration", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/integration=i-12345", + "self": "https://api.confluent.cloud/notifications/v1/integrations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "target": { + "kind": "MsTeams", + "webhook_url": "https://admin.webhook.office.com/webhookb2/{id}/IncomingWebhook/{id}" + } +} diff --git a/test/fixtures/input/notifications/integration/create_role_email_target.json b/test/fixtures/input/notifications/integration/create_role_email_target.json new file mode 100644 index 0000000000..fd800145b5 --- /dev/null +++ b/test/fixtures/input/notifications/integration/create_role_email_target.json @@ -0,0 +1,18 @@ +{ + "api_version": "notifications/v1", + "description": "A Slack channel integration", + "display_name": "Slack integration", + "id": "dlz-f3a90de", + "kind": "Integration", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/integration=i-12345", + "self": "https://api.confluent.cloud/notifications/v1/integrations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "target": { + "kind": "RoleEmail", + "role_name": "OrganizationAdmin" + } +} diff --git a/test/fixtures/input/notifications/integration/create_slack_target.json b/test/fixtures/input/notifications/integration/create_slack_target.json new file mode 100644 index 0000000000..efe075737f --- /dev/null +++ b/test/fixtures/input/notifications/integration/create_slack_target.json @@ -0,0 +1,18 @@ +{ + "api_version": "notifications/v1", + "description": "A Slack channel integration", + "display_name": "Slack integration", + "id": "dlz-f3a90de", + "kind": "Integration", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/integration=i-12345", + "self": "https://api.confluent.cloud/notifications/v1/integrations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "target": { + "kind": "Slack", + "webhook_url": "https://hooks.slack.com/services/{id}/{id}/{id}" + } +} diff --git a/test/fixtures/input/notifications/integration/create_user_email_target.json b/test/fixtures/input/notifications/integration/create_user_email_target.json new file mode 100644 index 0000000000..be6b4710fa --- /dev/null +++ b/test/fixtures/input/notifications/integration/create_user_email_target.json @@ -0,0 +1,22 @@ +{ + "api_version": "notifications/v1", + "description": "A Slack channel integration", + "display_name": "Slack integration", + "id": "dlz-f3a90de", + "kind": "Integration", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/integration=i-12345", + "self": "https://api.confluent.cloud/notifications/v1/integrations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "target": { + "kind": "UserEmail", + "user": { + "id": "u-abc123", + "related": "https://example.com", + "resource_name": "https://example.com" + } + } +} diff --git a/test/fixtures/input/notifications/integration/create_webhook_target.json b/test/fixtures/input/notifications/integration/create_webhook_target.json new file mode 100644 index 0000000000..d69b9ec4f1 --- /dev/null +++ b/test/fixtures/input/notifications/integration/create_webhook_target.json @@ -0,0 +1,18 @@ +{ + "api_version": "notifications/v1", + "description": "A Slack channel integration", + "display_name": "Slack integration", + "id": "dlz-f3a90de", + "kind": "Integration", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/integration=i-12345", + "self": "https://api.confluent.cloud/notifications/v1/integrations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "target": { + "kind": "Webhook", + "url": "https://my.webhook.url/{id}" + } +} diff --git a/test/fixtures/input/notifications/integration/read_created_in_app_target.json b/test/fixtures/input/notifications/integration/read_created_in_app_target.json new file mode 100644 index 0000000000..75af35f0ba --- /dev/null +++ b/test/fixtures/input/notifications/integration/read_created_in_app_target.json @@ -0,0 +1,22 @@ +{ + "api_version": "notifications/v1", + "description": "A Slack channel integration", + "display_name": "Slack integration", + "id": "dlz-f3a90de", + "kind": "Integration", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/integration=i-12345", + "self": "https://api.confluent.cloud/notifications/v1/integrations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "target": { + "kind": "InApp", + "user": { + "id": "u-abc123", + "related": "https://example.com", + "resource_name": "https://example.com" + } + } +} diff --git a/test/fixtures/input/notifications/integration/read_created_ms_teams_target.json b/test/fixtures/input/notifications/integration/read_created_ms_teams_target.json new file mode 100644 index 0000000000..7aa87edaf9 --- /dev/null +++ b/test/fixtures/input/notifications/integration/read_created_ms_teams_target.json @@ -0,0 +1,18 @@ +{ + "api_version": "notifications/v1", + "description": "A Slack channel integration", + "display_name": "Slack integration", + "id": "dlz-f3a90de", + "kind": "Integration", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/integration=i-12345", + "self": "https://api.confluent.cloud/notifications/v1/integrations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "target": { + "kind": "MsTeams", + "webhook_url": "https://admin.webhook.office.com/webhookb2/{id}/IncomingWebhook/{id}" + } +} diff --git a/test/fixtures/input/notifications/integration/read_created_role_email_target.json b/test/fixtures/input/notifications/integration/read_created_role_email_target.json new file mode 100644 index 0000000000..fd800145b5 --- /dev/null +++ b/test/fixtures/input/notifications/integration/read_created_role_email_target.json @@ -0,0 +1,18 @@ +{ + "api_version": "notifications/v1", + "description": "A Slack channel integration", + "display_name": "Slack integration", + "id": "dlz-f3a90de", + "kind": "Integration", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/integration=i-12345", + "self": "https://api.confluent.cloud/notifications/v1/integrations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "target": { + "kind": "RoleEmail", + "role_name": "OrganizationAdmin" + } +} diff --git a/test/fixtures/input/notifications/integration/read_created_slack_target.json b/test/fixtures/input/notifications/integration/read_created_slack_target.json new file mode 100644 index 0000000000..efe075737f --- /dev/null +++ b/test/fixtures/input/notifications/integration/read_created_slack_target.json @@ -0,0 +1,18 @@ +{ + "api_version": "notifications/v1", + "description": "A Slack channel integration", + "display_name": "Slack integration", + "id": "dlz-f3a90de", + "kind": "Integration", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/integration=i-12345", + "self": "https://api.confluent.cloud/notifications/v1/integrations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "target": { + "kind": "Slack", + "webhook_url": "https://hooks.slack.com/services/{id}/{id}/{id}" + } +} diff --git a/test/fixtures/input/notifications/integration/read_created_user_email_target.json b/test/fixtures/input/notifications/integration/read_created_user_email_target.json new file mode 100644 index 0000000000..be6b4710fa --- /dev/null +++ b/test/fixtures/input/notifications/integration/read_created_user_email_target.json @@ -0,0 +1,22 @@ +{ + "api_version": "notifications/v1", + "description": "A Slack channel integration", + "display_name": "Slack integration", + "id": "dlz-f3a90de", + "kind": "Integration", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/integration=i-12345", + "self": "https://api.confluent.cloud/notifications/v1/integrations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "target": { + "kind": "UserEmail", + "user": { + "id": "u-abc123", + "related": "https://example.com", + "resource_name": "https://example.com" + } + } +} diff --git a/test/fixtures/input/notifications/integration/read_created_webhook_target.json b/test/fixtures/input/notifications/integration/read_created_webhook_target.json new file mode 100644 index 0000000000..d69b9ec4f1 --- /dev/null +++ b/test/fixtures/input/notifications/integration/read_created_webhook_target.json @@ -0,0 +1,18 @@ +{ + "api_version": "notifications/v1", + "description": "A Slack channel integration", + "display_name": "Slack integration", + "id": "dlz-f3a90de", + "kind": "Integration", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/integration=i-12345", + "self": "https://api.confluent.cloud/notifications/v1/integrations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "target": { + "kind": "Webhook", + "url": "https://my.webhook.url/{id}" + } +} diff --git a/test/fixtures/input/notifications/notification-type/create_notification_type.json b/test/fixtures/input/notifications/notification-type/create_notification_type.json new file mode 100644 index 0000000000..0a5e6064c4 --- /dev/null +++ b/test/fixtures/input/notifications/notification-type/create_notification_type.json @@ -0,0 +1,18 @@ +{ + "api_version": "notifications/v1", + "category": "BILLING_LICENSING", + "description": "Cluster shrink operation is completed", + "display_name": "Cluster Shrink", + "id": "dlz-f3a90de", + "is_included_in_plan": false, + "kind": "NotificationType", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/notification-type=nt-12345", + "self": "https://api.confluent.cloud/notifications/v1/notification-types/nt-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "severity": "INFO", + "subscription_priority": "REQUIRED" +} diff --git a/test/fixtures/input/notifications/notification-type/read_created_notification_type.json b/test/fixtures/input/notifications/notification-type/read_created_notification_type.json new file mode 100644 index 0000000000..0a5e6064c4 --- /dev/null +++ b/test/fixtures/input/notifications/notification-type/read_created_notification_type.json @@ -0,0 +1,18 @@ +{ + "api_version": "notifications/v1", + "category": "BILLING_LICENSING", + "description": "Cluster shrink operation is completed", + "display_name": "Cluster Shrink", + "id": "dlz-f3a90de", + "is_included_in_plan": false, + "kind": "NotificationType", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/notification-type=nt-12345", + "self": "https://api.confluent.cloud/notifications/v1/notification-types/nt-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "severity": "INFO", + "subscription_priority": "REQUIRED" +} diff --git a/test/fixtures/input/notifications/resource-preference/create_resource_preference.json b/test/fixtures/input/notifications/resource-preference/create_resource_preference.json new file mode 100644 index 0000000000..afc9424b10 --- /dev/null +++ b/test/fixtures/input/notifications/resource-preference/create_resource_preference.json @@ -0,0 +1,15 @@ +{ + "api_version": "notifications/v1", + "current_state": "ENABLED", + "id": "dlz-f3a90de", + "kind": "ResourcePreference", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/resource-preference=rp-12345", + "self": "https://api.confluent.cloud/notifications/v1/resource-preferences/rp-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "resource": "environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector", + "resource_type": "CONNECTOR" +} diff --git a/test/fixtures/input/notifications/resource-preference/read_created_resource_preference.json b/test/fixtures/input/notifications/resource-preference/read_created_resource_preference.json new file mode 100644 index 0000000000..afc9424b10 --- /dev/null +++ b/test/fixtures/input/notifications/resource-preference/read_created_resource_preference.json @@ -0,0 +1,15 @@ +{ + "api_version": "notifications/v1", + "current_state": "ENABLED", + "id": "dlz-f3a90de", + "kind": "ResourcePreference", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/resource-preference=rp-12345", + "self": "https://api.confluent.cloud/notifications/v1/resource-preferences/rp-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "resource": "environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector", + "resource_type": "CONNECTOR" +} diff --git a/test/fixtures/input/notifications/resource-subscription/create_resource_subscription.json b/test/fixtures/input/notifications/resource-subscription/create_resource_subscription.json new file mode 100644 index 0000000000..a76734546c --- /dev/null +++ b/test/fixtures/input/notifications/resource-subscription/create_resource_subscription.json @@ -0,0 +1,27 @@ +{ + "api_version": "notifications/v1", + "current_state": "ENABLED", + "id": "dlz-f3a90de", + "integrations": [ + { + "id": "", + "related": "https://example.com", + "resource_name": "https://example.com" + } + ], + "kind": "ResourceSubscription", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/resource-subscription=rs-12345", + "self": "https://api.confluent.cloud/notifications/v1/resource-subscriptions/rs-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "notification_type": { + "id": "not-abc123", + "related": "https://example.com", + "resource_name": "https://example.com" + }, + "resource": "environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector", + "resource_type": "CONNECTOR" +} diff --git a/test/fixtures/input/notifications/resource-subscription/read_created_resource_subscription.json b/test/fixtures/input/notifications/resource-subscription/read_created_resource_subscription.json new file mode 100644 index 0000000000..a76734546c --- /dev/null +++ b/test/fixtures/input/notifications/resource-subscription/read_created_resource_subscription.json @@ -0,0 +1,27 @@ +{ + "api_version": "notifications/v1", + "current_state": "ENABLED", + "id": "dlz-f3a90de", + "integrations": [ + { + "id": "", + "related": "https://example.com", + "resource_name": "https://example.com" + } + ], + "kind": "ResourceSubscription", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/resource-subscription=rs-12345", + "self": "https://api.confluent.cloud/notifications/v1/resource-subscriptions/rs-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "notification_type": { + "id": "not-abc123", + "related": "https://example.com", + "resource_name": "https://example.com" + }, + "resource": "environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector", + "resource_type": "CONNECTOR" +} diff --git a/test/fixtures/input/notifications/subscription/create_subscription.json b/test/fixtures/input/notifications/subscription/create_subscription.json new file mode 100644 index 0000000000..7cb3995708 --- /dev/null +++ b/test/fixtures/input/notifications/subscription/create_subscription.json @@ -0,0 +1,25 @@ +{ + "api_version": "notifications/v1", + "current_state": "ENABLED", + "id": "dlz-f3a90de", + "integrations": [ + { + "id": "", + "related": "https://example.com", + "resource_name": "https://example.com" + } + ], + "kind": "Subscription", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/subscription=s-12345", + "self": "https://api.confluent.cloud/notifications/v1/subscriptions/s-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "notification_type": { + "id": "not-abc123", + "related": "https://example.com", + "resource_name": "https://example.com" + } +} diff --git a/test/fixtures/input/notifications/subscription/read_created_subscription.json b/test/fixtures/input/notifications/subscription/read_created_subscription.json new file mode 100644 index 0000000000..7cb3995708 --- /dev/null +++ b/test/fixtures/input/notifications/subscription/read_created_subscription.json @@ -0,0 +1,25 @@ +{ + "api_version": "notifications/v1", + "current_state": "ENABLED", + "id": "dlz-f3a90de", + "integrations": [ + { + "id": "", + "related": "https://example.com", + "resource_name": "https://example.com" + } + ], + "kind": "Subscription", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/subscription=s-12345", + "self": "https://api.confluent.cloud/notifications/v1/subscriptions/s-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "notification_type": { + "id": "not-abc123", + "related": "https://example.com", + "resource_name": "https://example.com" + } +} diff --git a/test/fixtures/input/notifications/user-notification/create_user_notification.json b/test/fixtures/input/notifications/user-notification/create_user_notification.json new file mode 100644 index 0000000000..98133fd506 --- /dev/null +++ b/test/fixtures/input/notifications/user-notification/create_user_notification.json @@ -0,0 +1,70 @@ +{ + "actions": [ + { + "identifier": "manage_cluster_settings", + "role": "PRIMARY", + "url": "https://confluent.cloud/environments/env-xyz/clusters/lkc-ds23ad/settings" + } + ], + "api_version": "notifications/v1", + "id": "dlz-f3a90de", + "integrations": [ + { + "api_version": "notifications/v1", + "description": "A Slack channel integration", + "display_name": "Slack integration", + "id": "dlz-f3a90de", + "kind": "Integration", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/integration=i-12345", + "self": "https://api.confluent.cloud/notifications/v1/integrations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "target": { + "kind": "Slack", + "webhook_url": "https://hooks.slack.com/services/{id}/{id}/{id}" + } + } + ], + "kind": "UserNotification", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/user-notification=un-12345", + "self": "https://api.confluent.cloud/notifications/v1/user-notifications/un-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "notification_type": { + "api_version": "notifications/v1", + "category": "BILLING_LICENSING", + "description": "Cluster shrink operation is completed", + "display_name": "Cluster Shrink", + "id": "dlz-f3a90de", + "is_included_in_plan": false, + "kind": "NotificationType", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/notification-type=nt-12345", + "self": "https://api.confluent.cloud/notifications/v1/notification-types/nt-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "severity": "INFO", + "subscription_priority": "REQUIRED" + }, + "read": false, + "read_at": "2026-01-31T11:00:00Z", + "received_at": "2026-01-31T10:35:00Z", + "recommended_actions": { + "content": "Restart the cluster from the Confluent Cloud console.", + "version": 1 + }, + "resource": { + "crn": "crn://confluent.cloud/organization=org-abc/environment=env-xyz/kafka-cluster=lkc-ds23ad", + "display_name": "prod-kafka-cluster", + "type": "CLUSTER" + }, + "severity": "CRITICAL" +} diff --git a/test/fixtures/input/notifications/user-notification/read_created_user_notification.json b/test/fixtures/input/notifications/user-notification/read_created_user_notification.json new file mode 100644 index 0000000000..98133fd506 --- /dev/null +++ b/test/fixtures/input/notifications/user-notification/read_created_user_notification.json @@ -0,0 +1,70 @@ +{ + "actions": [ + { + "identifier": "manage_cluster_settings", + "role": "PRIMARY", + "url": "https://confluent.cloud/environments/env-xyz/clusters/lkc-ds23ad/settings" + } + ], + "api_version": "notifications/v1", + "id": "dlz-f3a90de", + "integrations": [ + { + "api_version": "notifications/v1", + "description": "A Slack channel integration", + "display_name": "Slack integration", + "id": "dlz-f3a90de", + "kind": "Integration", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/integration=i-12345", + "self": "https://api.confluent.cloud/notifications/v1/integrations/i-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "target": { + "kind": "Slack", + "webhook_url": "https://hooks.slack.com/services/{id}/{id}/{id}" + } + } + ], + "kind": "UserNotification", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/user-notification=un-12345", + "self": "https://api.confluent.cloud/notifications/v1/user-notifications/un-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "notification_type": { + "api_version": "notifications/v1", + "category": "BILLING_LICENSING", + "description": "Cluster shrink operation is completed", + "display_name": "Cluster Shrink", + "id": "dlz-f3a90de", + "is_included_in_plan": false, + "kind": "NotificationType", + "metadata": { + "created_at": "2006-01-02T15:04:05-07:00", + "deleted_at": "2006-01-02T15:04:05-07:00", + "resource_name": "crn://confluent.cloud/organization=9bb441c4-edef-46ac-8a41-c49e44a3fd9a/notification-type=nt-12345", + "self": "https://api.confluent.cloud/notifications/v1/notification-types/nt-12345", + "updated_at": "2006-01-02T15:04:05-07:00" + }, + "severity": "INFO", + "subscription_priority": "REQUIRED" + }, + "read": false, + "read_at": "2026-01-31T11:00:00Z", + "received_at": "2026-01-31T10:35:00Z", + "recommended_actions": { + "content": "Restart the cluster from the Confluent Cloud console.", + "version": 1 + }, + "resource": { + "crn": "crn://confluent.cloud/organization=org-abc/environment=env-xyz/kafka-cluster=lkc-ds23ad", + "display_name": "prod-kafka-cluster", + "type": "CLUSTER" + }, + "severity": "CRITICAL" +} diff --git a/test/fixtures/output/help.golden b/test/fixtures/output/help.golden index eccf7c1ef3..3bd5861086 100644 --- a/test/fixtures/output/help.golden +++ b/test/fixtures/output/help.golden @@ -28,6 +28,7 @@ Available Commands: login Log in to Confluent Cloud or Confluent Platform. logout Log out of Confluent Cloud. network Manage Confluent Cloud networks. + notifications Manage Cloud Notifications. organization Manage Confluent Cloud organizations. plugin Manage Confluent plugins. prompt Add Confluent CLI context to your terminal prompt. diff --git a/test/fixtures/output/notifications/help.golden b/test/fixtures/output/notifications/help.golden new file mode 100644 index 0000000000..f8b25c3658 --- /dev/null +++ b/test/fixtures/output/notifications/help.golden @@ -0,0 +1,19 @@ +Manage Cloud Notifications. + +Usage: + confluent notifications [command] + +Available Commands: + integration Manage Confluent Cloud notifications integrations. + notification-type Manage Confluent Cloud notifications notification types. + resource-preference Manage Confluent Cloud notifications resource preferences. + resource-subscription Manage Confluent Cloud notifications resource subscriptions. + subscription Manage Confluent Cloud notifications subscriptions. + user-notification Manage Confluent Cloud notifications user notifications. + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). + +Use "confluent notifications [command] --help" for more information about a command. diff --git a/test/fixtures/output/notifications/integration/create-help.golden b/test/fixtures/output/notifications/integration/create-help.golden new file mode 100644 index 0000000000..688b041321 --- /dev/null +++ b/test/fixtures/output/notifications/integration/create-help.golden @@ -0,0 +1,17 @@ +Create a notifications integration. + +Usage: + confluent notifications integration create [flags] + +Flags: + --kind string REQUIRED: + --webhook-url string + --url string + --description string A human readable description for the particular integration. + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/integration/create/create-description.golden b/test/fixtures/output/notifications/integration/create/create-description.golden new file mode 100644 index 0000000000..2a2a79b932 --- /dev/null +++ b/test/fixtures/output/notifications/integration/create/create-description.golden @@ -0,0 +1,6 @@ ++--------------------------+-------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | test-name | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | ++--------------------------+-------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/create/create-ms-teams-target.golden b/test/fixtures/output/notifications/integration/create/create-ms-teams-target.golden new file mode 100644 index 0000000000..3b19850d56 --- /dev/null +++ b/test/fixtures/output/notifications/integration/create/create-ms-teams-target.golden @@ -0,0 +1,6 @@ ++-----------------------------+----------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | test-name | +| Description | A Slack channel integration | +| Ms Teams Target Webhook Url | https://admin.webhook.office.com/webhookb2/{id}/IncomingWebhook/{id} | ++-----------------------------+----------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/create/create-slack-target.golden b/test/fixtures/output/notifications/integration/create/create-slack-target.golden new file mode 100644 index 0000000000..2a2a79b932 --- /dev/null +++ b/test/fixtures/output/notifications/integration/create/create-slack-target.golden @@ -0,0 +1,6 @@ ++--------------------------+-------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | test-name | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | ++--------------------------+-------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/create/create-webhook-target.golden b/test/fixtures/output/notifications/integration/create/create-webhook-target.golden new file mode 100644 index 0000000000..2a2a79b932 --- /dev/null +++ b/test/fixtures/output/notifications/integration/create/create-webhook-target.golden @@ -0,0 +1,6 @@ ++--------------------------+-------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | test-name | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | ++--------------------------+-------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/delete-help.golden b/test/fixtures/output/notifications/integration/delete-help.golden new file mode 100644 index 0000000000..65daaab269 --- /dev/null +++ b/test/fixtures/output/notifications/integration/delete-help.golden @@ -0,0 +1,13 @@ +Delete one or more notifications integrations. + +Usage: + confluent notifications integration delete [id-2] ... [id-n] [flags] + +Flags: + --context string CLI context name. + --force Skip the deletion confirmation prompt. + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/integration/delete/delete-autocomplete.golden b/test/fixtures/output/notifications/integration/delete/delete-autocomplete.golden new file mode 100644 index 0000000000..f3cfeb73be --- /dev/null +++ b/test/fixtures/output/notifications/integration/delete/delete-autocomplete.golden @@ -0,0 +1,3 @@ +dlz-f3a90de Slack integration +:4 +Completion ended with directive: ShellCompDirectiveNoFileComp diff --git a/test/fixtures/output/notifications/integration/delete/delete-invalid.golden b/test/fixtures/output/notifications/integration/delete/delete-invalid.golden new file mode 100644 index 0000000000..6d3c64140e --- /dev/null +++ b/test/fixtures/output/notifications/integration/delete/delete-invalid.golden @@ -0,0 +1,4 @@ +Error: notifications integration "invalid" not found + +Suggestions: + List available notifications integrations with `confluent notifications integration list`. diff --git a/test/fixtures/output/notifications/integration/delete/delete-multiple.golden b/test/fixtures/output/notifications/integration/delete/delete-multiple.golden new file mode 100644 index 0000000000..c7288d050c --- /dev/null +++ b/test/fixtures/output/notifications/integration/delete/delete-multiple.golden @@ -0,0 +1 @@ +Are you sure you want to delete notifications integrations "integration-1" and "integration-2"? (y/n): Deleted notifications integrations "integration-1" and "integration-2". diff --git a/test/fixtures/output/notifications/integration/delete/delete-no-force.golden b/test/fixtures/output/notifications/integration/delete/delete-no-force.golden new file mode 100644 index 0000000000..65df01b0fb --- /dev/null +++ b/test/fixtures/output/notifications/integration/delete/delete-no-force.golden @@ -0,0 +1 @@ +Are you sure you want to delete notifications integration "integration-1"? (y/n): Deleted notifications integration "integration-1". diff --git a/test/fixtures/output/notifications/integration/delete/delete.golden b/test/fixtures/output/notifications/integration/delete/delete.golden new file mode 100644 index 0000000000..2ae58fe834 --- /dev/null +++ b/test/fixtures/output/notifications/integration/delete/delete.golden @@ -0,0 +1 @@ +Deleted notifications integration "integration-1". diff --git a/test/fixtures/output/notifications/integration/describe-help.golden b/test/fixtures/output/notifications/integration/describe-help.golden new file mode 100644 index 0000000000..1bface2867 --- /dev/null +++ b/test/fixtures/output/notifications/integration/describe-help.golden @@ -0,0 +1,13 @@ +Describe a notifications integration. + +Usage: + confluent notifications integration describe [flags] + +Flags: + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/integration/describe/describe-autocomplete.golden b/test/fixtures/output/notifications/integration/describe/describe-autocomplete.golden new file mode 100644 index 0000000000..f3cfeb73be --- /dev/null +++ b/test/fixtures/output/notifications/integration/describe/describe-autocomplete.golden @@ -0,0 +1,3 @@ +dlz-f3a90de Slack integration +:4 +Completion ended with directive: ShellCompDirectiveNoFileComp diff --git a/test/fixtures/output/notifications/integration/describe/describe-in-app-target.golden b/test/fixtures/output/notifications/integration/describe/describe-in-app-target.golden new file mode 100644 index 0000000000..7e0a0c40a7 --- /dev/null +++ b/test/fixtures/output/notifications/integration/describe/describe-in-app-target.golden @@ -0,0 +1,6 @@ ++--------------------------+-------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | ++--------------------------+-------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/describe/describe-invalid.golden b/test/fixtures/output/notifications/integration/describe/describe-invalid.golden new file mode 100644 index 0000000000..716b863527 --- /dev/null +++ b/test/fixtures/output/notifications/integration/describe/describe-invalid.golden @@ -0,0 +1 @@ +Error: 404 Not Found diff --git a/test/fixtures/output/notifications/integration/describe/describe-json.golden b/test/fixtures/output/notifications/integration/describe/describe-json.golden new file mode 100644 index 0000000000..eb0544685c --- /dev/null +++ b/test/fixtures/output/notifications/integration/describe/describe-json.golden @@ -0,0 +1,6 @@ +{ + "id": "dlz-f3a90de", + "display_name": "Slack integration", + "description": "A Slack channel integration", + "slack_target_webhook_url": "https://hooks.slack.com/services/{id}/{id}/{id}" +} diff --git a/test/fixtures/output/notifications/integration/describe/describe-ms-teams-target.golden b/test/fixtures/output/notifications/integration/describe/describe-ms-teams-target.golden new file mode 100644 index 0000000000..7e0a0c40a7 --- /dev/null +++ b/test/fixtures/output/notifications/integration/describe/describe-ms-teams-target.golden @@ -0,0 +1,6 @@ ++--------------------------+-------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | ++--------------------------+-------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/describe/describe-role-email-target.golden b/test/fixtures/output/notifications/integration/describe/describe-role-email-target.golden new file mode 100644 index 0000000000..7e0a0c40a7 --- /dev/null +++ b/test/fixtures/output/notifications/integration/describe/describe-role-email-target.golden @@ -0,0 +1,6 @@ ++--------------------------+-------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | ++--------------------------+-------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/describe/describe-slack-target.golden b/test/fixtures/output/notifications/integration/describe/describe-slack-target.golden new file mode 100644 index 0000000000..7e0a0c40a7 --- /dev/null +++ b/test/fixtures/output/notifications/integration/describe/describe-slack-target.golden @@ -0,0 +1,6 @@ ++--------------------------+-------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | ++--------------------------+-------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/describe/describe-user-email-target.golden b/test/fixtures/output/notifications/integration/describe/describe-user-email-target.golden new file mode 100644 index 0000000000..7e0a0c40a7 --- /dev/null +++ b/test/fixtures/output/notifications/integration/describe/describe-user-email-target.golden @@ -0,0 +1,6 @@ ++--------------------------+-------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | ++--------------------------+-------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/describe/describe-webhook-target.golden b/test/fixtures/output/notifications/integration/describe/describe-webhook-target.golden new file mode 100644 index 0000000000..7e0a0c40a7 --- /dev/null +++ b/test/fixtures/output/notifications/integration/describe/describe-webhook-target.golden @@ -0,0 +1,6 @@ ++--------------------------+-------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | ++--------------------------+-------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/describe/describe-yaml.golden b/test/fixtures/output/notifications/integration/describe/describe-yaml.golden new file mode 100644 index 0000000000..6c3a8e2629 --- /dev/null +++ b/test/fixtures/output/notifications/integration/describe/describe-yaml.golden @@ -0,0 +1,4 @@ +id: dlz-f3a90de +display_name: Slack integration +description: A Slack channel integration +slack_target_webhook_url: https://hooks.slack.com/services/{id}/{id}/{id} diff --git a/test/fixtures/output/notifications/integration/help.golden b/test/fixtures/output/notifications/integration/help.golden new file mode 100644 index 0000000000..2bc14abee4 --- /dev/null +++ b/test/fixtures/output/notifications/integration/help.golden @@ -0,0 +1,18 @@ +Manage Confluent Cloud notifications integrations. + +Usage: + confluent notifications integration [command] + +Available Commands: + create Create a notifications integration. + delete Delete one or more notifications integrations. + describe Describe a notifications integration. + list List notifications integrations. + update Update an existing notifications integration. + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). + +Use "confluent notifications integration [command] --help" for more information about a command. diff --git a/test/fixtures/output/notifications/integration/list-help.golden b/test/fixtures/output/notifications/integration/list-help.golden new file mode 100644 index 0000000000..d06c8d9269 --- /dev/null +++ b/test/fixtures/output/notifications/integration/list-help.golden @@ -0,0 +1,13 @@ +List notifications integrations. + +Usage: + confluent notifications integration list [flags] + +Flags: + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/integration/list/list-json.golden b/test/fixtures/output/notifications/integration/list/list-json.golden new file mode 100644 index 0000000000..edb0520fbf --- /dev/null +++ b/test/fixtures/output/notifications/integration/list/list-json.golden @@ -0,0 +1,8 @@ +[ + { + "id": "dlz-f3a90de", + "display_name": "Slack integration", + "description": "A Slack channel integration", + "slack_target_webhook_url": "https://hooks.slack.com/services/{id}/{id}/{id}" + } +] diff --git a/test/fixtures/output/notifications/integration/list/list-yaml.golden b/test/fixtures/output/notifications/integration/list/list-yaml.golden new file mode 100644 index 0000000000..f3a8d92161 --- /dev/null +++ b/test/fixtures/output/notifications/integration/list/list-yaml.golden @@ -0,0 +1,4 @@ +- id: dlz-f3a90de + display_name: Slack integration + description: A Slack channel integration + slack_target_webhook_url: https://hooks.slack.com/services/{id}/{id}/{id} diff --git a/test/fixtures/output/notifications/integration/list/list.golden b/test/fixtures/output/notifications/integration/list/list.golden new file mode 100644 index 0000000000..f13514cd0c --- /dev/null +++ b/test/fixtures/output/notifications/integration/list/list.golden @@ -0,0 +1,3 @@ + ID | Display Name | Description | Slack Target Webhook Url | Role Email Target Role Name | Webhook Target Url | Ms Teams Target Webhook Url +--------------+-------------------+-----------------------------+-------------------------------------------------+-----------------------------+--------------------+------------------------------ + dlz-f3a90de | Slack integration | A Slack channel integration | https://hooks.slack.com/services/{id}/{id}/{id} | | | diff --git a/test/fixtures/output/notifications/integration/update-help.golden b/test/fixtures/output/notifications/integration/update-help.golden new file mode 100644 index 0000000000..7663a96011 --- /dev/null +++ b/test/fixtures/output/notifications/integration/update-help.golden @@ -0,0 +1,18 @@ +Update an existing notifications integration. + +Usage: + confluent notifications integration update [flags] + +Flags: + --kind string + --webhook-url string + --url string + --display-name string A human readable name for the particular integration. + --description string A human readable description for the particular integration. + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/integration/update/update-description.golden b/test/fixtures/output/notifications/integration/update/update-description.golden new file mode 100644 index 0000000000..44d0518563 --- /dev/null +++ b/test/fixtures/output/notifications/integration/update/update-description.golden @@ -0,0 +1,7 @@ +Updated notifications integration "integration-1". ++--------------------------+-------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | ++--------------------------+-------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/update/update-display-name.golden b/test/fixtures/output/notifications/integration/update/update-display-name.golden new file mode 100644 index 0000000000..44d0518563 --- /dev/null +++ b/test/fixtures/output/notifications/integration/update/update-display-name.golden @@ -0,0 +1,7 @@ +Updated notifications integration "integration-1". ++--------------------------+-------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | ++--------------------------+-------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/update/update-invalid.golden b/test/fixtures/output/notifications/integration/update/update-invalid.golden new file mode 100644 index 0000000000..716b863527 --- /dev/null +++ b/test/fixtures/output/notifications/integration/update/update-invalid.golden @@ -0,0 +1 @@ +Error: 404 Not Found diff --git a/test/fixtures/output/notifications/integration/update/update-ms-teams-target.golden b/test/fixtures/output/notifications/integration/update/update-ms-teams-target.golden new file mode 100644 index 0000000000..5114fc7659 --- /dev/null +++ b/test/fixtures/output/notifications/integration/update/update-ms-teams-target.golden @@ -0,0 +1,7 @@ +Updated notifications integration "integration-1". ++-----------------------------+----------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Ms Teams Target Webhook Url | https://admin.webhook.office.com/webhookb2/{id}/IncomingWebhook/{id} | ++-----------------------------+----------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/update/update-slack-target.golden b/test/fixtures/output/notifications/integration/update/update-slack-target.golden new file mode 100644 index 0000000000..44d0518563 --- /dev/null +++ b/test/fixtures/output/notifications/integration/update/update-slack-target.golden @@ -0,0 +1,7 @@ +Updated notifications integration "integration-1". ++--------------------------+-------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | ++--------------------------+-------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/update/update-webhook-target.golden b/test/fixtures/output/notifications/integration/update/update-webhook-target.golden new file mode 100644 index 0000000000..44d0518563 --- /dev/null +++ b/test/fixtures/output/notifications/integration/update/update-webhook-target.golden @@ -0,0 +1,7 @@ +Updated notifications integration "integration-1". ++--------------------------+-------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | ++--------------------------+-------------------------------------------------+ diff --git a/test/fixtures/output/notifications/notification-type/describe-help.golden b/test/fixtures/output/notifications/notification-type/describe-help.golden new file mode 100644 index 0000000000..bb60d8ba9c --- /dev/null +++ b/test/fixtures/output/notifications/notification-type/describe-help.golden @@ -0,0 +1,13 @@ +Describe a notifications notification type. + +Usage: + confluent notifications notification-type describe [flags] + +Flags: + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/notification-type/describe/describe-autocomplete.golden b/test/fixtures/output/notifications/notification-type/describe/describe-autocomplete.golden new file mode 100644 index 0000000000..12c06ba7f5 --- /dev/null +++ b/test/fixtures/output/notifications/notification-type/describe/describe-autocomplete.golden @@ -0,0 +1,3 @@ +dlz-f3a90de Cluster Shrink +:4 +Completion ended with directive: ShellCompDirectiveNoFileComp diff --git a/test/fixtures/output/notifications/notification-type/describe/describe-invalid.golden b/test/fixtures/output/notifications/notification-type/describe/describe-invalid.golden new file mode 100644 index 0000000000..716b863527 --- /dev/null +++ b/test/fixtures/output/notifications/notification-type/describe/describe-invalid.golden @@ -0,0 +1 @@ +Error: 404 Not Found diff --git a/test/fixtures/output/notifications/notification-type/describe/describe-json.golden b/test/fixtures/output/notifications/notification-type/describe/describe-json.golden new file mode 100644 index 0000000000..ee3d98094d --- /dev/null +++ b/test/fixtures/output/notifications/notification-type/describe/describe-json.golden @@ -0,0 +1,9 @@ +{ + "id": "dlz-f3a90de", + "display_name": "Cluster Shrink", + "category": "BILLING_LICENSING", + "description": "Cluster shrink operation is completed", + "subscription_priority": "REQUIRED", + "is_included_in_plan": false, + "severity": "INFO" +} diff --git a/test/fixtures/output/notifications/notification-type/describe/describe-yaml.golden b/test/fixtures/output/notifications/notification-type/describe/describe-yaml.golden new file mode 100644 index 0000000000..3f3cccb005 --- /dev/null +++ b/test/fixtures/output/notifications/notification-type/describe/describe-yaml.golden @@ -0,0 +1,7 @@ +id: dlz-f3a90de +display_name: Cluster Shrink +category: BILLING_LICENSING +description: Cluster shrink operation is completed +subscription_priority: REQUIRED +is_included_in_plan: false +severity: INFO diff --git a/test/fixtures/output/notifications/notification-type/describe/describe.golden b/test/fixtures/output/notifications/notification-type/describe/describe.golden new file mode 100644 index 0000000000..ad1c4e9d71 --- /dev/null +++ b/test/fixtures/output/notifications/notification-type/describe/describe.golden @@ -0,0 +1,10 @@ ++-----------------------+--------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Cluster Shrink | +| Category | BILLING_LICENSING | +| Description | Cluster shrink operation is | +| | completed | +| Subscription Priority | REQUIRED | +| Is Included In Plan | false | +| Severity | INFO | ++-----------------------+--------------------------------+ diff --git a/test/fixtures/output/notifications/notification-type/help.golden b/test/fixtures/output/notifications/notification-type/help.golden new file mode 100644 index 0000000000..04753d850e --- /dev/null +++ b/test/fixtures/output/notifications/notification-type/help.golden @@ -0,0 +1,15 @@ +Manage Confluent Cloud notifications notification types. + +Usage: + confluent notifications notification-type [command] + +Available Commands: + describe Describe a notifications notification type. + list List notifications notification types. + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). + +Use "confluent notifications notification-type [command] --help" for more information about a command. diff --git a/test/fixtures/output/notifications/notification-type/list-help.golden b/test/fixtures/output/notifications/notification-type/list-help.golden new file mode 100644 index 0000000000..3ea282f8f5 --- /dev/null +++ b/test/fixtures/output/notifications/notification-type/list-help.golden @@ -0,0 +1,14 @@ +List notifications notification types. + +Usage: + confluent notifications notification-type list [flags] + +Flags: + --resource-type string Confluent Cloud resource type + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/notification-type/list/list-json.golden b/test/fixtures/output/notifications/notification-type/list/list-json.golden new file mode 100644 index 0000000000..2bed26dbf7 --- /dev/null +++ b/test/fixtures/output/notifications/notification-type/list/list-json.golden @@ -0,0 +1,11 @@ +[ + { + "id": "dlz-f3a90de", + "display_name": "Cluster Shrink", + "category": "BILLING_LICENSING", + "description": "Cluster shrink operation is completed", + "subscription_priority": "REQUIRED", + "is_included_in_plan": false, + "severity": "INFO" + } +] diff --git a/test/fixtures/output/notifications/notification-type/list/list-resource-type.golden b/test/fixtures/output/notifications/notification-type/list/list-resource-type.golden new file mode 100644 index 0000000000..fcea44cd65 --- /dev/null +++ b/test/fixtures/output/notifications/notification-type/list/list-resource-type.golden @@ -0,0 +1,4 @@ + ID | Display Name | Category | Description | Subscription Priority | Is Included In Plan | Severity +--------------+----------------+-------------------+--------------------------------+-----------------------+---------------------+----------- + dlz-f3a90de | Cluster Shrink | BILLING_LICENSING | Cluster shrink operation is | REQUIRED | false | INFO + | | | completed | | | diff --git a/test/fixtures/output/notifications/notification-type/list/list-yaml.golden b/test/fixtures/output/notifications/notification-type/list/list-yaml.golden new file mode 100644 index 0000000000..a7e65948ac --- /dev/null +++ b/test/fixtures/output/notifications/notification-type/list/list-yaml.golden @@ -0,0 +1,7 @@ +- id: dlz-f3a90de + display_name: Cluster Shrink + category: BILLING_LICENSING + description: Cluster shrink operation is completed + subscription_priority: REQUIRED + is_included_in_plan: false + severity: INFO diff --git a/test/fixtures/output/notifications/notification-type/list/list.golden b/test/fixtures/output/notifications/notification-type/list/list.golden new file mode 100644 index 0000000000..fcea44cd65 --- /dev/null +++ b/test/fixtures/output/notifications/notification-type/list/list.golden @@ -0,0 +1,4 @@ + ID | Display Name | Category | Description | Subscription Priority | Is Included In Plan | Severity +--------------+----------------+-------------------+--------------------------------+-----------------------+---------------------+----------- + dlz-f3a90de | Cluster Shrink | BILLING_LICENSING | Cluster shrink operation is | REQUIRED | false | INFO + | | | completed | | | diff --git a/test/fixtures/output/notifications/resource-preference/create-help.golden b/test/fixtures/output/notifications/resource-preference/create-help.golden new file mode 100644 index 0000000000..31136ca94a --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/create-help.golden @@ -0,0 +1,16 @@ +Create a notifications resource preference. + +Usage: + confluent notifications resource-preference create [flags] + +Flags: + --resource string REQUIRED: Denotes the Confluent Cloud resource definition. + --resource-type string REQUIRED: Denotes the Confluent Cloud resource type. + --current-state REQUIRED Denotes the state of the resource preference. When the resource preference is ENABLED, the user will receive notifications for the Confluent Cloud resource. If the resource preference is DISABLED, the user will not receive any notification for the resource. Note that, you will still receive notifications for REQUIRED notification type even when it is DISABLED. + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/resource-preference/create/create-current-state.golden b/test/fixtures/output/notifications/resource-preference/create/create-current-state.golden new file mode 100644 index 0000000000..7d7b28287c --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/create/create-current-state.golden @@ -0,0 +1,6 @@ ++---------------+------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Resource | environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector | +| Resource Type | ORGANIZATION | +| Current State | ENABLED | ++---------------+------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/resource-preference/create/create.golden b/test/fixtures/output/notifications/resource-preference/create/create.golden new file mode 100644 index 0000000000..7d7b28287c --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/create/create.golden @@ -0,0 +1,6 @@ ++---------------+------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Resource | environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector | +| Resource Type | ORGANIZATION | +| Current State | ENABLED | ++---------------+------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/resource-preference/delete-help.golden b/test/fixtures/output/notifications/resource-preference/delete-help.golden new file mode 100644 index 0000000000..536758ee31 --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/delete-help.golden @@ -0,0 +1,13 @@ +Delete one or more notifications resource preferences. + +Usage: + confluent notifications resource-preference delete [id-2] ... [id-n] [flags] + +Flags: + --context string CLI context name. + --force Skip the deletion confirmation prompt. + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/resource-preference/delete/delete-invalid.golden b/test/fixtures/output/notifications/resource-preference/delete/delete-invalid.golden new file mode 100644 index 0000000000..2a3b5088d2 --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/delete/delete-invalid.golden @@ -0,0 +1,4 @@ +Error: notifications resource preference "invalid" not found + +Suggestions: + List available notifications resource preferences with `confluent notifications resource-preference list`. diff --git a/test/fixtures/output/notifications/resource-preference/delete/delete-multiple.golden b/test/fixtures/output/notifications/resource-preference/delete/delete-multiple.golden new file mode 100644 index 0000000000..5a06767d97 --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/delete/delete-multiple.golden @@ -0,0 +1 @@ +Are you sure you want to delete notifications resource preferences "resource-preference-1" and "resource-preference-2"? (y/n): Deleted notifications resource preferences "resource-preference-1" and "resource-preference-2". diff --git a/test/fixtures/output/notifications/resource-preference/delete/delete-no-force.golden b/test/fixtures/output/notifications/resource-preference/delete/delete-no-force.golden new file mode 100644 index 0000000000..c367cef022 --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/delete/delete-no-force.golden @@ -0,0 +1 @@ +Are you sure you want to delete notifications resource preference "resource-preference-1"? (y/n): Deleted notifications resource preference "resource-preference-1". diff --git a/test/fixtures/output/notifications/resource-preference/delete/delete.golden b/test/fixtures/output/notifications/resource-preference/delete/delete.golden new file mode 100644 index 0000000000..22010dc143 --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/delete/delete.golden @@ -0,0 +1 @@ +Deleted notifications resource preference "resource-preference-1". diff --git a/test/fixtures/output/notifications/resource-preference/describe-help.golden b/test/fixtures/output/notifications/resource-preference/describe-help.golden new file mode 100644 index 0000000000..5226573d7f --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/describe-help.golden @@ -0,0 +1,13 @@ +Describe a notifications resource preference. + +Usage: + confluent notifications resource-preference describe [flags] + +Flags: + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/resource-preference/describe/describe-invalid.golden b/test/fixtures/output/notifications/resource-preference/describe/describe-invalid.golden new file mode 100644 index 0000000000..716b863527 --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/describe/describe-invalid.golden @@ -0,0 +1 @@ +Error: 404 Not Found diff --git a/test/fixtures/output/notifications/resource-preference/describe/describe-json.golden b/test/fixtures/output/notifications/resource-preference/describe/describe-json.golden new file mode 100644 index 0000000000..48484a7246 --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/describe/describe-json.golden @@ -0,0 +1,6 @@ +{ + "id": "dlz-f3a90de", + "resource": "environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector", + "resource_type": "CONNECTOR", + "current_state": "ENABLED" +} diff --git a/test/fixtures/output/notifications/resource-preference/describe/describe-yaml.golden b/test/fixtures/output/notifications/resource-preference/describe/describe-yaml.golden new file mode 100644 index 0000000000..9fb30d040e --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/describe/describe-yaml.golden @@ -0,0 +1,4 @@ +id: dlz-f3a90de +resource: environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector +resource_type: CONNECTOR +current_state: ENABLED diff --git a/test/fixtures/output/notifications/resource-preference/describe/describe.golden b/test/fixtures/output/notifications/resource-preference/describe/describe.golden new file mode 100644 index 0000000000..4b133e183f --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/describe/describe.golden @@ -0,0 +1,6 @@ ++---------------+------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Resource | environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector | +| Resource Type | CONNECTOR | +| Current State | ENABLED | ++---------------+------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/resource-preference/help.golden b/test/fixtures/output/notifications/resource-preference/help.golden new file mode 100644 index 0000000000..7b4658f3fd --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/help.golden @@ -0,0 +1,17 @@ +Manage Confluent Cloud notifications resource preferences. + +Usage: + confluent notifications resource-preference [command] + +Available Commands: + create Create a notifications resource preference. + delete Delete one or more notifications resource preferences. + describe Describe a notifications resource preference. + update Update an existing notifications resource preference. + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). + +Use "confluent notifications resource-preference [command] --help" for more information about a command. diff --git a/test/fixtures/output/notifications/resource-preference/update-help.golden b/test/fixtures/output/notifications/resource-preference/update-help.golden new file mode 100644 index 0000000000..c28717b8e0 --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/update-help.golden @@ -0,0 +1,16 @@ +Update an existing notifications resource preference. + +Usage: + confluent notifications resource-preference update [flags] + +Flags: + --resource string Denotes the Confluent Cloud resource definition. + --resource-type string Denotes the Confluent Cloud resource type. + --current-state REQUIRED Denotes the state of the resource preference. When the resource preference is ENABLED, the user will receive notifications for the Confluent Cloud resource. If the resource preference is DISABLED, the user will not receive any notification for the resource. Note that, you will still receive notifications for REQUIRED notification type even when it is DISABLED. + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/resource-preference/update/update-current-state.golden b/test/fixtures/output/notifications/resource-preference/update/update-current-state.golden new file mode 100644 index 0000000000..1ba653427a --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/update/update-current-state.golden @@ -0,0 +1,7 @@ +Updated notifications resource preference "resource-preference-1". ++---------------+------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Resource | environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector | +| Resource Type | CONNECTOR | +| Current State | ENABLED | ++---------------+------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/resource-preference/update/update-invalid.golden b/test/fixtures/output/notifications/resource-preference/update/update-invalid.golden new file mode 100644 index 0000000000..716b863527 --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/update/update-invalid.golden @@ -0,0 +1 @@ +Error: 404 Not Found diff --git a/test/fixtures/output/notifications/resource-preference/update/update-resource-type.golden b/test/fixtures/output/notifications/resource-preference/update/update-resource-type.golden new file mode 100644 index 0000000000..1ac5c7c302 --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/update/update-resource-type.golden @@ -0,0 +1,7 @@ +Updated notifications resource preference "resource-preference-1". ++---------------+------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Resource | environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector | +| Resource Type | ORGANIZATION | +| Current State | ENABLED | ++---------------+------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/resource-preference/update/update-resource.golden b/test/fixtures/output/notifications/resource-preference/update/update-resource.golden new file mode 100644 index 0000000000..1ba653427a --- /dev/null +++ b/test/fixtures/output/notifications/resource-preference/update/update-resource.golden @@ -0,0 +1,7 @@ +Updated notifications resource preference "resource-preference-1". ++---------------+------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Resource | environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector | +| Resource Type | CONNECTOR | +| Current State | ENABLED | ++---------------+------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/resource-subscription/create-help.golden b/test/fixtures/output/notifications/resource-subscription/create-help.golden new file mode 100644 index 0000000000..957069c049 --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/create-help.golden @@ -0,0 +1,18 @@ +Create a notifications resource subscription. + +Usage: + confluent notifications resource-subscription create [flags] + +Flags: + --resource string REQUIRED: Denotes the Confluent Cloud resource definition. + --resource-type string REQUIRED: Denotes the Confluent Cloud resource type. + --notification-type string REQUIRED: The type of notification to subscribe to. + --integrations strings REQUIRED: Integrations to which notifications are to be sent. + --current-state REQUIRED Denotes the state of the resource preference. When the resource preference is ENABLED, the user will receive notifications for the Confluent Cloud resource. If the resource preference is DISABLED, the user will not receive any notification for the resource. Note that, you will still receive notifications for REQUIRED notification type even when it is DISABLED. + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/resource-subscription/create/create-current-state.golden b/test/fixtures/output/notifications/resource-subscription/create/create-current-state.golden new file mode 100644 index 0000000000..8386333e0b --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/create/create-current-state.golden @@ -0,0 +1,7 @@ ++-------------------+------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Resource | environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector | +| Resource Type | ENVIRONMENT | +| Notification Type | notification-type-value | +| Current State | ENABLED | ++-------------------+------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/resource-subscription/create/create.golden b/test/fixtures/output/notifications/resource-subscription/create/create.golden new file mode 100644 index 0000000000..8386333e0b --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/create/create.golden @@ -0,0 +1,7 @@ ++-------------------+------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Resource | environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector | +| Resource Type | ENVIRONMENT | +| Notification Type | notification-type-value | +| Current State | ENABLED | ++-------------------+------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/resource-subscription/delete-help.golden b/test/fixtures/output/notifications/resource-subscription/delete-help.golden new file mode 100644 index 0000000000..f898d77b01 --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/delete-help.golden @@ -0,0 +1,13 @@ +Delete one or more notifications resource subscriptions. + +Usage: + confluent notifications resource-subscription delete [id-2] ... [id-n] [flags] + +Flags: + --context string CLI context name. + --force Skip the deletion confirmation prompt. + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/resource-subscription/delete/delete-invalid.golden b/test/fixtures/output/notifications/resource-subscription/delete/delete-invalid.golden new file mode 100644 index 0000000000..bb27ce59a4 --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/delete/delete-invalid.golden @@ -0,0 +1,4 @@ +Error: notifications resource subscription "invalid" not found + +Suggestions: + List available notifications resource subscriptions with `confluent notifications resource-subscription list`. diff --git a/test/fixtures/output/notifications/resource-subscription/delete/delete-multiple.golden b/test/fixtures/output/notifications/resource-subscription/delete/delete-multiple.golden new file mode 100644 index 0000000000..cfd7a4c1a7 --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/delete/delete-multiple.golden @@ -0,0 +1 @@ +Are you sure you want to delete notifications resource subscriptions "resource-subscription-1" and "resource-subscription-2"? (y/n): Deleted notifications resource subscriptions "resource-subscription-1" and "resource-subscription-2". diff --git a/test/fixtures/output/notifications/resource-subscription/delete/delete-no-force.golden b/test/fixtures/output/notifications/resource-subscription/delete/delete-no-force.golden new file mode 100644 index 0000000000..6389e4bcb3 --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/delete/delete-no-force.golden @@ -0,0 +1 @@ +Are you sure you want to delete notifications resource subscription "resource-subscription-1"? (y/n): Deleted notifications resource subscription "resource-subscription-1". diff --git a/test/fixtures/output/notifications/resource-subscription/delete/delete.golden b/test/fixtures/output/notifications/resource-subscription/delete/delete.golden new file mode 100644 index 0000000000..a6b0c44d7e --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/delete/delete.golden @@ -0,0 +1 @@ +Deleted notifications resource subscription "resource-subscription-1". diff --git a/test/fixtures/output/notifications/resource-subscription/describe-help.golden b/test/fixtures/output/notifications/resource-subscription/describe-help.golden new file mode 100644 index 0000000000..b7b217027f --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/describe-help.golden @@ -0,0 +1,13 @@ +Describe a notifications resource subscription. + +Usage: + confluent notifications resource-subscription describe [flags] + +Flags: + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/resource-subscription/describe/describe-invalid.golden b/test/fixtures/output/notifications/resource-subscription/describe/describe-invalid.golden new file mode 100644 index 0000000000..716b863527 --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/describe/describe-invalid.golden @@ -0,0 +1 @@ +Error: 404 Not Found diff --git a/test/fixtures/output/notifications/resource-subscription/describe/describe-json.golden b/test/fixtures/output/notifications/resource-subscription/describe/describe-json.golden new file mode 100644 index 0000000000..b7d706febe --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/describe/describe-json.golden @@ -0,0 +1,7 @@ +{ + "id": "dlz-f3a90de", + "resource": "environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector", + "resource_type": "CONNECTOR", + "notification_type": "not-abc123", + "current_state": "ENABLED" +} diff --git a/test/fixtures/output/notifications/resource-subscription/describe/describe-yaml.golden b/test/fixtures/output/notifications/resource-subscription/describe/describe-yaml.golden new file mode 100644 index 0000000000..a1745b290c --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/describe/describe-yaml.golden @@ -0,0 +1,5 @@ +id: dlz-f3a90de +resource: environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector +resource_type: CONNECTOR +notification_type: not-abc123 +current_state: ENABLED diff --git a/test/fixtures/output/notifications/resource-subscription/describe/describe.golden b/test/fixtures/output/notifications/resource-subscription/describe/describe.golden new file mode 100644 index 0000000000..123e6ba837 --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/describe/describe.golden @@ -0,0 +1,7 @@ ++-------------------+------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Resource | environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector | +| Resource Type | CONNECTOR | +| Notification Type | not-abc123 | +| Current State | ENABLED | ++-------------------+------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/resource-subscription/help.golden b/test/fixtures/output/notifications/resource-subscription/help.golden new file mode 100644 index 0000000000..776741a549 --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/help.golden @@ -0,0 +1,17 @@ +Manage Confluent Cloud notifications resource subscriptions. + +Usage: + confluent notifications resource-subscription [command] + +Available Commands: + create Create a notifications resource subscription. + delete Delete one or more notifications resource subscriptions. + describe Describe a notifications resource subscription. + update Update an existing notifications resource subscription. + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). + +Use "confluent notifications resource-subscription [command] --help" for more information about a command. diff --git a/test/fixtures/output/notifications/resource-subscription/update-help.golden b/test/fixtures/output/notifications/resource-subscription/update-help.golden new file mode 100644 index 0000000000..22fb0f3a54 --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/update-help.golden @@ -0,0 +1,17 @@ +Update an existing notifications resource subscription. + +Usage: + confluent notifications resource-subscription update [flags] + +Flags: + --resource string Denotes the Confluent Cloud resource definition. + --resource-type string Denotes the Confluent Cloud resource type. + --current-state REQUIRED Denotes the state of the resource preference. When the resource preference is ENABLED, the user will receive notifications for the Confluent Cloud resource. If the resource preference is DISABLED, the user will not receive any notification for the resource. Note that, you will still receive notifications for REQUIRED notification type even when it is DISABLED. + --integrations strings Integrations to which notifications are to be sent. + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/resource-subscription/update/update-current-state.golden b/test/fixtures/output/notifications/resource-subscription/update/update-current-state.golden new file mode 100644 index 0000000000..8f87d9c89f --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/update/update-current-state.golden @@ -0,0 +1,8 @@ +Updated notifications resource subscription "resource-subscription-1". ++-------------------+------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Resource | environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector | +| Resource Type | CONNECTOR | +| Notification Type | not-abc123 | +| Current State | ENABLED | ++-------------------+------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/resource-subscription/update/update-integrations.golden b/test/fixtures/output/notifications/resource-subscription/update/update-integrations.golden new file mode 100644 index 0000000000..8f87d9c89f --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/update/update-integrations.golden @@ -0,0 +1,8 @@ +Updated notifications resource subscription "resource-subscription-1". ++-------------------+------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Resource | environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector | +| Resource Type | CONNECTOR | +| Notification Type | not-abc123 | +| Current State | ENABLED | ++-------------------+------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/resource-subscription/update/update-invalid.golden b/test/fixtures/output/notifications/resource-subscription/update/update-invalid.golden new file mode 100644 index 0000000000..716b863527 --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/update/update-invalid.golden @@ -0,0 +1 @@ +Error: 404 Not Found diff --git a/test/fixtures/output/notifications/resource-subscription/update/update-resource-type.golden b/test/fixtures/output/notifications/resource-subscription/update/update-resource-type.golden new file mode 100644 index 0000000000..ff7e9c3cb8 --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/update/update-resource-type.golden @@ -0,0 +1,8 @@ +Updated notifications resource subscription "resource-subscription-1". ++-------------------+------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Resource | environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector | +| Resource Type | ENVIRONMENT | +| Notification Type | not-abc123 | +| Current State | ENABLED | ++-------------------+------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/resource-subscription/update/update-resource.golden b/test/fixtures/output/notifications/resource-subscription/update/update-resource.golden new file mode 100644 index 0000000000..8f87d9c89f --- /dev/null +++ b/test/fixtures/output/notifications/resource-subscription/update/update-resource.golden @@ -0,0 +1,8 @@ +Updated notifications resource subscription "resource-subscription-1". ++-------------------+------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Resource | environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector | +| Resource Type | CONNECTOR | +| Notification Type | not-abc123 | +| Current State | ENABLED | ++-------------------+------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/subscription/create-help.golden b/test/fixtures/output/notifications/subscription/create-help.golden new file mode 100644 index 0000000000..e1c733d3de --- /dev/null +++ b/test/fixtures/output/notifications/subscription/create-help.golden @@ -0,0 +1,16 @@ +Create a notifications subscription. + +Usage: + confluent notifications subscription create [flags] + +Flags: + --notification-type string REQUIRED: The type of notification to subscribe to. + --integrations strings REQUIRED: Integrations to which notifications are to be sent. + --current-state REQUIRED Denotes the state of the subscription. When the subscription is ENABLED, the user will receive notification on the configured Integrations. If the subscription is DISABLED, the user will not recieve any notification for the configured notification type. Note that, you cannot disable a subscription for REQUIRED notification type. + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/subscription/create/create-current-state.golden b/test/fixtures/output/notifications/subscription/create/create-current-state.golden new file mode 100644 index 0000000000..1ceb1571f4 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/create/create-current-state.golden @@ -0,0 +1,5 @@ ++-------------------+-------------------------+ +| ID | dlz-f3a90de | +| Notification Type | notification-type-value | +| Current State | ENABLED | ++-------------------+-------------------------+ diff --git a/test/fixtures/output/notifications/subscription/create/create.golden b/test/fixtures/output/notifications/subscription/create/create.golden new file mode 100644 index 0000000000..1ceb1571f4 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/create/create.golden @@ -0,0 +1,5 @@ ++-------------------+-------------------------+ +| ID | dlz-f3a90de | +| Notification Type | notification-type-value | +| Current State | ENABLED | ++-------------------+-------------------------+ diff --git a/test/fixtures/output/notifications/subscription/delete-help.golden b/test/fixtures/output/notifications/subscription/delete-help.golden new file mode 100644 index 0000000000..cecb70a44c --- /dev/null +++ b/test/fixtures/output/notifications/subscription/delete-help.golden @@ -0,0 +1,13 @@ +Delete one or more notifications subscriptions. + +Usage: + confluent notifications subscription delete [id-2] ... [id-n] [flags] + +Flags: + --context string CLI context name. + --force Skip the deletion confirmation prompt. + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/subscription/delete/delete-autocomplete.golden b/test/fixtures/output/notifications/subscription/delete/delete-autocomplete.golden new file mode 100644 index 0000000000..675ab91838 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/delete/delete-autocomplete.golden @@ -0,0 +1,3 @@ +dlz-f3a90de +:4 +Completion ended with directive: ShellCompDirectiveNoFileComp diff --git a/test/fixtures/output/notifications/subscription/delete/delete-invalid.golden b/test/fixtures/output/notifications/subscription/delete/delete-invalid.golden new file mode 100644 index 0000000000..7d9ed5e044 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/delete/delete-invalid.golden @@ -0,0 +1,4 @@ +Error: notifications subscription "invalid" not found + +Suggestions: + List available notifications subscriptions with `confluent notifications subscription list`. diff --git a/test/fixtures/output/notifications/subscription/delete/delete-multiple.golden b/test/fixtures/output/notifications/subscription/delete/delete-multiple.golden new file mode 100644 index 0000000000..45ccb959bb --- /dev/null +++ b/test/fixtures/output/notifications/subscription/delete/delete-multiple.golden @@ -0,0 +1 @@ +Are you sure you want to delete notifications subscriptions "subscription-1" and "subscription-2"? (y/n): Deleted notifications subscriptions "subscription-1" and "subscription-2". diff --git a/test/fixtures/output/notifications/subscription/delete/delete-no-force.golden b/test/fixtures/output/notifications/subscription/delete/delete-no-force.golden new file mode 100644 index 0000000000..3fcb5cc2ea --- /dev/null +++ b/test/fixtures/output/notifications/subscription/delete/delete-no-force.golden @@ -0,0 +1 @@ +Are you sure you want to delete notifications subscription "subscription-1"? (y/n): Deleted notifications subscription "subscription-1". diff --git a/test/fixtures/output/notifications/subscription/delete/delete.golden b/test/fixtures/output/notifications/subscription/delete/delete.golden new file mode 100644 index 0000000000..8540007984 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/delete/delete.golden @@ -0,0 +1 @@ +Deleted notifications subscription "subscription-1". diff --git a/test/fixtures/output/notifications/subscription/describe-help.golden b/test/fixtures/output/notifications/subscription/describe-help.golden new file mode 100644 index 0000000000..4cacd73fa4 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/describe-help.golden @@ -0,0 +1,13 @@ +Describe a notifications subscription. + +Usage: + confluent notifications subscription describe [flags] + +Flags: + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/subscription/describe/describe-autocomplete.golden b/test/fixtures/output/notifications/subscription/describe/describe-autocomplete.golden new file mode 100644 index 0000000000..675ab91838 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/describe/describe-autocomplete.golden @@ -0,0 +1,3 @@ +dlz-f3a90de +:4 +Completion ended with directive: ShellCompDirectiveNoFileComp diff --git a/test/fixtures/output/notifications/subscription/describe/describe-invalid.golden b/test/fixtures/output/notifications/subscription/describe/describe-invalid.golden new file mode 100644 index 0000000000..716b863527 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/describe/describe-invalid.golden @@ -0,0 +1 @@ +Error: 404 Not Found diff --git a/test/fixtures/output/notifications/subscription/describe/describe-json.golden b/test/fixtures/output/notifications/subscription/describe/describe-json.golden new file mode 100644 index 0000000000..645327c353 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/describe/describe-json.golden @@ -0,0 +1,5 @@ +{ + "id": "dlz-f3a90de", + "notification_type": "not-abc123", + "current_state": "ENABLED" +} diff --git a/test/fixtures/output/notifications/subscription/describe/describe-yaml.golden b/test/fixtures/output/notifications/subscription/describe/describe-yaml.golden new file mode 100644 index 0000000000..8b662e123e --- /dev/null +++ b/test/fixtures/output/notifications/subscription/describe/describe-yaml.golden @@ -0,0 +1,3 @@ +id: dlz-f3a90de +notification_type: not-abc123 +current_state: ENABLED diff --git a/test/fixtures/output/notifications/subscription/describe/describe.golden b/test/fixtures/output/notifications/subscription/describe/describe.golden new file mode 100644 index 0000000000..5f6fd415a5 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/describe/describe.golden @@ -0,0 +1,5 @@ ++-------------------+-------------+ +| ID | dlz-f3a90de | +| Notification Type | not-abc123 | +| Current State | ENABLED | ++-------------------+-------------+ diff --git a/test/fixtures/output/notifications/subscription/help.golden b/test/fixtures/output/notifications/subscription/help.golden new file mode 100644 index 0000000000..ae9d23a354 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/help.golden @@ -0,0 +1,18 @@ +Manage Confluent Cloud notifications subscriptions. + +Usage: + confluent notifications subscription [command] + +Available Commands: + create Create a notifications subscription. + delete Delete one or more notifications subscriptions. + describe Describe a notifications subscription. + list List notifications subscriptions. + update Update an existing notifications subscription. + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). + +Use "confluent notifications subscription [command] --help" for more information about a command. diff --git a/test/fixtures/output/notifications/subscription/list-help.golden b/test/fixtures/output/notifications/subscription/list-help.golden new file mode 100644 index 0000000000..1b74e7e006 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/list-help.golden @@ -0,0 +1,13 @@ +List notifications subscriptions. + +Usage: + confluent notifications subscription list [flags] + +Flags: + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/subscription/list/list-json.golden b/test/fixtures/output/notifications/subscription/list/list-json.golden new file mode 100644 index 0000000000..f96d2b6c04 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/list/list-json.golden @@ -0,0 +1,7 @@ +[ + { + "id": "dlz-f3a90de", + "notification_type": "not-abc123", + "current_state": "ENABLED" + } +] diff --git a/test/fixtures/output/notifications/subscription/list/list-yaml.golden b/test/fixtures/output/notifications/subscription/list/list-yaml.golden new file mode 100644 index 0000000000..f084192e2a --- /dev/null +++ b/test/fixtures/output/notifications/subscription/list/list-yaml.golden @@ -0,0 +1,3 @@ +- id: dlz-f3a90de + notification_type: not-abc123 + current_state: ENABLED diff --git a/test/fixtures/output/notifications/subscription/list/list.golden b/test/fixtures/output/notifications/subscription/list/list.golden new file mode 100644 index 0000000000..9c47adad23 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/list/list.golden @@ -0,0 +1,3 @@ + ID | Notification Type | Current State +--------------+-------------------+---------------- + dlz-f3a90de | not-abc123 | ENABLED diff --git a/test/fixtures/output/notifications/subscription/update-help.golden b/test/fixtures/output/notifications/subscription/update-help.golden new file mode 100644 index 0000000000..4b02be45e1 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/update-help.golden @@ -0,0 +1,15 @@ +Update an existing notifications subscription. + +Usage: + confluent notifications subscription update [flags] + +Flags: + --current-state REQUIRED Denotes the state of the subscription. When the subscription is ENABLED, the user will receive notification on the configured Integrations. If the subscription is DISABLED, the user will not recieve any notification for the configured notification type. Note that, you cannot disable a subscription for REQUIRED notification type. + --integrations strings Integrations to which notifications are to be sent. + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/subscription/update/update-current-state.golden b/test/fixtures/output/notifications/subscription/update/update-current-state.golden new file mode 100644 index 0000000000..20ee7b5a5a --- /dev/null +++ b/test/fixtures/output/notifications/subscription/update/update-current-state.golden @@ -0,0 +1,6 @@ +Updated notifications subscription "subscription-1". ++-------------------+-------------+ +| ID | dlz-f3a90de | +| Notification Type | not-abc123 | +| Current State | ENABLED | ++-------------------+-------------+ diff --git a/test/fixtures/output/notifications/subscription/update/update-integrations.golden b/test/fixtures/output/notifications/subscription/update/update-integrations.golden new file mode 100644 index 0000000000..20ee7b5a5a --- /dev/null +++ b/test/fixtures/output/notifications/subscription/update/update-integrations.golden @@ -0,0 +1,6 @@ +Updated notifications subscription "subscription-1". ++-------------------+-------------+ +| ID | dlz-f3a90de | +| Notification Type | not-abc123 | +| Current State | ENABLED | ++-------------------+-------------+ diff --git a/test/fixtures/output/notifications/subscription/update/update-invalid.golden b/test/fixtures/output/notifications/subscription/update/update-invalid.golden new file mode 100644 index 0000000000..716b863527 --- /dev/null +++ b/test/fixtures/output/notifications/subscription/update/update-invalid.golden @@ -0,0 +1 @@ +Error: 404 Not Found diff --git a/test/fixtures/output/notifications/user-notification/describe-help.golden b/test/fixtures/output/notifications/user-notification/describe-help.golden new file mode 100644 index 0000000000..532322269e --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/describe-help.golden @@ -0,0 +1,13 @@ +Describe a notifications user notification. + +Usage: + confluent notifications user-notification describe [flags] + +Flags: + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/user-notification/describe/describe-autocomplete.golden b/test/fixtures/output/notifications/user-notification/describe/describe-autocomplete.golden new file mode 100644 index 0000000000..675ab91838 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/describe/describe-autocomplete.golden @@ -0,0 +1,3 @@ +dlz-f3a90de +:4 +Completion ended with directive: ShellCompDirectiveNoFileComp diff --git a/test/fixtures/output/notifications/user-notification/describe/describe-invalid.golden b/test/fixtures/output/notifications/user-notification/describe/describe-invalid.golden new file mode 100644 index 0000000000..716b863527 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/describe/describe-invalid.golden @@ -0,0 +1 @@ +Error: 404 Not Found diff --git a/test/fixtures/output/notifications/user-notification/describe/describe-json.golden b/test/fixtures/output/notifications/user-notification/describe/describe-json.golden new file mode 100644 index 0000000000..56ff11d9e8 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/describe/describe-json.golden @@ -0,0 +1,7 @@ +{ + "id": "dlz-f3a90de", + "read_at": "2026-01-31T11:00:00Z", + "severity": "CRITICAL", + "received_at": "2026-01-31T10:35:00Z", + "read": false +} diff --git a/test/fixtures/output/notifications/user-notification/describe/describe-yaml.golden b/test/fixtures/output/notifications/user-notification/describe/describe-yaml.golden new file mode 100644 index 0000000000..0b6a26f37c --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/describe/describe-yaml.golden @@ -0,0 +1,5 @@ +id: dlz-f3a90de +read_at: "2026-01-31T11:00:00Z" +severity: CRITICAL +received_at: "2026-01-31T10:35:00Z" +read: false diff --git a/test/fixtures/output/notifications/user-notification/describe/describe.golden b/test/fixtures/output/notifications/user-notification/describe/describe.golden new file mode 100644 index 0000000000..6b619eaeac --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/describe/describe.golden @@ -0,0 +1,7 @@ ++-------------+----------------------+ +| ID | dlz-f3a90de | +| Read At | 2026-01-31T11:00:00Z | +| Severity | CRITICAL | +| Received At | 2026-01-31T10:35:00Z | +| Read | false | ++-------------+----------------------+ diff --git a/test/fixtures/output/notifications/user-notification/help.golden b/test/fixtures/output/notifications/user-notification/help.golden new file mode 100644 index 0000000000..b63486e8c3 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/help.golden @@ -0,0 +1,16 @@ +Manage Confluent Cloud notifications user notifications. + +Usage: + confluent notifications user-notification [command] + +Available Commands: + describe Describe a notifications user notification. + list List notifications user notifications. + update Update an existing notifications user notification. + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). + +Use "confluent notifications user-notification [command] --help" for more information about a command. diff --git a/test/fixtures/output/notifications/user-notification/list-help.golden b/test/fixtures/output/notifications/user-notification/list-help.golden new file mode 100644 index 0000000000..0cb3d09cba --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/list-help.golden @@ -0,0 +1,21 @@ +List notifications user notifications. + +Usage: + confluent notifications user-notification list [flags] + +Flags: + --read Filter the results where read is true or false. + --severity ?severity=CRITICAL&severity=WARN Filter notifications by severity. Pass the parameter multiple times to match any of the given values (?severity=CRITICAL&severity=WARN). A notification matches if its `severity` equals any of the listed values. + --include integrations Comma-separated list of optional fields to populate in the response items. Allowed values: integrations, `recommended_actions`. By default these fields are omitted from list responses to keep collection payloads slim; set this parameter to opt in. This is a partial-response selector, not a value filter. + --type ?resource.type=CLUSTER&resource.type=CONNECTOR Filter notifications by the Confluent Cloud resource type they relate to. Pass the parameter multiple times to match any of the given values (?resource.type=CLUSTER&resource.type=CONNECTOR). A notification matches if its `resource.type` equals any of the listed values. + --crn resource.crn Filter notifications by the CRN of the Confluent Cloud resource they relate to. Pass the parameter multiple times to match any of the given CRNs; a notification matches if its resource.crn equals any of the listed values. + --search display_name Free-text partial-match search across the embedded notification type's display_name and `description`. + --time-range PAST_24H Filter notifications by a preset time window relative to now. Allowed values: PAST_24H (last 24 hours), `PAST_7D` (last 7 days), `PAST_30D` (last 30 days). + --sort strings The list of fields and directions that are used to sort the collection. + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/user-notification/list/list-crn.golden b/test/fixtures/output/notifications/user-notification/list/list-crn.golden new file mode 100644 index 0000000000..ac8af4eb40 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/list/list-crn.golden @@ -0,0 +1,3 @@ + ID | Read At | Severity | Received At | Read +--------------+----------------------+----------+----------------------+-------- + dlz-f3a90de | 2026-01-31T11:00:00Z | CRITICAL | 2026-01-31T10:35:00Z | false diff --git a/test/fixtures/output/notifications/user-notification/list/list-include.golden b/test/fixtures/output/notifications/user-notification/list/list-include.golden new file mode 100644 index 0000000000..ac8af4eb40 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/list/list-include.golden @@ -0,0 +1,3 @@ + ID | Read At | Severity | Received At | Read +--------------+----------------------+----------+----------------------+-------- + dlz-f3a90de | 2026-01-31T11:00:00Z | CRITICAL | 2026-01-31T10:35:00Z | false diff --git a/test/fixtures/output/notifications/user-notification/list/list-json.golden b/test/fixtures/output/notifications/user-notification/list/list-json.golden new file mode 100644 index 0000000000..37b2256b74 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/list/list-json.golden @@ -0,0 +1,9 @@ +[ + { + "id": "dlz-f3a90de", + "read_at": "2026-01-31T11:00:00Z", + "severity": "CRITICAL", + "received_at": "2026-01-31T10:35:00Z", + "read": false + } +] diff --git a/test/fixtures/output/notifications/user-notification/list/list-read.golden b/test/fixtures/output/notifications/user-notification/list/list-read.golden new file mode 100644 index 0000000000..ac8af4eb40 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/list/list-read.golden @@ -0,0 +1,3 @@ + ID | Read At | Severity | Received At | Read +--------------+----------------------+----------+----------------------+-------- + dlz-f3a90de | 2026-01-31T11:00:00Z | CRITICAL | 2026-01-31T10:35:00Z | false diff --git a/test/fixtures/output/notifications/user-notification/list/list-search.golden b/test/fixtures/output/notifications/user-notification/list/list-search.golden new file mode 100644 index 0000000000..ac8af4eb40 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/list/list-search.golden @@ -0,0 +1,3 @@ + ID | Read At | Severity | Received At | Read +--------------+----------------------+----------+----------------------+-------- + dlz-f3a90de | 2026-01-31T11:00:00Z | CRITICAL | 2026-01-31T10:35:00Z | false diff --git a/test/fixtures/output/notifications/user-notification/list/list-severity.golden b/test/fixtures/output/notifications/user-notification/list/list-severity.golden new file mode 100644 index 0000000000..ac8af4eb40 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/list/list-severity.golden @@ -0,0 +1,3 @@ + ID | Read At | Severity | Received At | Read +--------------+----------------------+----------+----------------------+-------- + dlz-f3a90de | 2026-01-31T11:00:00Z | CRITICAL | 2026-01-31T10:35:00Z | false diff --git a/test/fixtures/output/notifications/user-notification/list/list-sort.golden b/test/fixtures/output/notifications/user-notification/list/list-sort.golden new file mode 100644 index 0000000000..ac8af4eb40 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/list/list-sort.golden @@ -0,0 +1,3 @@ + ID | Read At | Severity | Received At | Read +--------------+----------------------+----------+----------------------+-------- + dlz-f3a90de | 2026-01-31T11:00:00Z | CRITICAL | 2026-01-31T10:35:00Z | false diff --git a/test/fixtures/output/notifications/user-notification/list/list-time-range.golden b/test/fixtures/output/notifications/user-notification/list/list-time-range.golden new file mode 100644 index 0000000000..ac8af4eb40 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/list/list-time-range.golden @@ -0,0 +1,3 @@ + ID | Read At | Severity | Received At | Read +--------------+----------------------+----------+----------------------+-------- + dlz-f3a90de | 2026-01-31T11:00:00Z | CRITICAL | 2026-01-31T10:35:00Z | false diff --git a/test/fixtures/output/notifications/user-notification/list/list-type.golden b/test/fixtures/output/notifications/user-notification/list/list-type.golden new file mode 100644 index 0000000000..ac8af4eb40 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/list/list-type.golden @@ -0,0 +1,3 @@ + ID | Read At | Severity | Received At | Read +--------------+----------------------+----------+----------------------+-------- + dlz-f3a90de | 2026-01-31T11:00:00Z | CRITICAL | 2026-01-31T10:35:00Z | false diff --git a/test/fixtures/output/notifications/user-notification/list/list-yaml.golden b/test/fixtures/output/notifications/user-notification/list/list-yaml.golden new file mode 100644 index 0000000000..fcc48424c0 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/list/list-yaml.golden @@ -0,0 +1,5 @@ +- id: dlz-f3a90de + read_at: "2026-01-31T11:00:00Z" + severity: CRITICAL + received_at: "2026-01-31T10:35:00Z" + read: false diff --git a/test/fixtures/output/notifications/user-notification/list/list.golden b/test/fixtures/output/notifications/user-notification/list/list.golden new file mode 100644 index 0000000000..ac8af4eb40 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/list/list.golden @@ -0,0 +1,3 @@ + ID | Read At | Severity | Received At | Read +--------------+----------------------+----------+----------------------+-------- + dlz-f3a90de | 2026-01-31T11:00:00Z | CRITICAL | 2026-01-31T10:35:00Z | false diff --git a/test/fixtures/output/notifications/user-notification/update-help.golden b/test/fixtures/output/notifications/user-notification/update-help.golden new file mode 100644 index 0000000000..4c57f383f4 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/update-help.golden @@ -0,0 +1,14 @@ +Update an existing notifications user notification. + +Usage: + confluent notifications user-notification update [flags] + +Flags: + --read Whether the notification has been read by the user. + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + +Global Flags: + -h, --help Show help for this command. + --unsafe-trace Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets. + -v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace). diff --git a/test/fixtures/output/notifications/user-notification/update/update-invalid.golden b/test/fixtures/output/notifications/user-notification/update/update-invalid.golden new file mode 100644 index 0000000000..716b863527 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/update/update-invalid.golden @@ -0,0 +1 @@ +Error: 404 Not Found diff --git a/test/fixtures/output/notifications/user-notification/update/update-read.golden b/test/fixtures/output/notifications/user-notification/update/update-read.golden new file mode 100644 index 0000000000..18e1772312 --- /dev/null +++ b/test/fixtures/output/notifications/user-notification/update/update-read.golden @@ -0,0 +1,8 @@ +Updated notifications user notification "user-notification-1". ++-------------+----------------------+ +| ID | dlz-f3a90de | +| Read At | 2026-01-31T11:00:00Z | +| Severity | CRITICAL | +| Received At | 2026-01-31T10:35:00Z | +| Read | true | ++-------------+----------------------+ diff --git a/test/live/notifications_integration_live_test.go b/test/live/notifications_integration_live_test.go new file mode 100644 index 0000000000..0227120922 --- /dev/null +++ b/test/live/notifications_integration_live_test.go @@ -0,0 +1,514 @@ +//go:build live_test && (all || notifications) + +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package live + +import ( + "os" + "testing" +) + +func (s *CLILiveTestSuite) TestNotificationsIntegrationSlackTargetCRUDLive() { + t := s.T() + t.Parallel() + state := s.setupTestContext(t) + + // Variables + integrationName := uniqueName("integr") + kindVariant := "slack" + webhookUrl := "https://hooks.slack.com/services/{id}/{id}/{id}" + updatedDescription := "updated-live-test-description" + + // Cleanup (LIFO — execution is reverse-registration order) + s.registerCleanup(t, "notifications integration delete {{.integration_id}} --force", state) + + steps := []CLILiveTest{ + { + Name: "Create notifications integration (slack_target)", + Args: "notifications integration create " + integrationName + " --kind " + kindVariant + " --webhook-url " + webhookUrl + " -o json", + ExitCode: 0, + JSONFields: map[string]string{ + "name": integrationName, + }, + JSONFieldsExist: []string{"id"}, + CaptureID: "integration_id", + }, + { + Name: "Describe notifications integration", + Args: "notifications integration describe {{.integration_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "name": integrationName, + }, + }, + { + Name: "List notifications integrations", + Args: "notifications integration list", + UseStateVars: true, + ExitCode: 0, + Contains: []string{integrationName}, + }, + { + Name: "Update notifications integration name", + Args: "notifications integration update {{.integration_id}} --display-name " + integrationName + "-updated", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Update notifications integration description", + Args: "notifications integration update {{.integration_id}} --description " + updatedDescription, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify notifications integration update", + Args: "notifications integration describe {{.integration_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "description": updatedDescription, + }, + }, + { + Name: "Delete notifications integration", + Args: "notifications integration delete {{.integration_id}} --force", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify deletion", + Args: "notifications integration describe {{.integration_id}}", + UseStateVars: true, + ExitCode: 1, + }, + } + + for _, step := range steps { + t.Run(step.Name, func(t *testing.T) { + s.runLiveCommand(t, step, state) + }) + } +} + +func (s *CLILiveTestSuite) TestNotificationsIntegrationRoleEmailTargetCRUDLive() { + t := s.T() + t.Parallel() + state := s.setupTestContext(t) + + // Variables + integrationName := uniqueName("integr") + kindVariant := "roleemail" + roleName := "OrganizationAdmin" + updatedDescription := "updated-live-test-description" + + // Cleanup (LIFO — execution is reverse-registration order) + s.registerCleanup(t, "notifications integration delete {{.integration_id}} --force", state) + + steps := []CLILiveTest{ + { + Name: "Create notifications integration (role_email_target)", + Args: "notifications integration create " + integrationName + " --kind " + kindVariant + " --role-name " + roleName + " -o json", + ExitCode: 0, + JSONFields: map[string]string{ + "name": integrationName, + }, + JSONFieldsExist: []string{"id"}, + CaptureID: "integration_id", + }, + { + Name: "Describe notifications integration", + Args: "notifications integration describe {{.integration_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "name": integrationName, + }, + }, + { + Name: "List notifications integrations", + Args: "notifications integration list", + UseStateVars: true, + ExitCode: 0, + Contains: []string{integrationName}, + }, + { + Name: "Update notifications integration name", + Args: "notifications integration update {{.integration_id}} --display-name " + integrationName + "-updated", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Update notifications integration description", + Args: "notifications integration update {{.integration_id}} --description " + updatedDescription, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify notifications integration update", + Args: "notifications integration describe {{.integration_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "description": updatedDescription, + }, + }, + { + Name: "Delete notifications integration", + Args: "notifications integration delete {{.integration_id}} --force", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify deletion", + Args: "notifications integration describe {{.integration_id}}", + UseStateVars: true, + ExitCode: 1, + }, + } + + for _, step := range steps { + t.Run(step.Name, func(t *testing.T) { + s.runLiveCommand(t, step, state) + }) + } +} + +func (s *CLILiveTestSuite) TestNotificationsIntegrationUserEmailTargetCRUDLive() { + t := s.T() + t.Parallel() + state := s.setupTestContext(t) + + // Variables + integrationName := uniqueName("integr") + kindVariant := "useremail" + updatedDescription := "updated-live-test-description" + user := os.Getenv("CONFLUENT_LIVE_TEST_USER_ID") + if user == "" { + t.Skipf("%s must be set to run this live test (user ID)", "CONFLUENT_LIVE_TEST_USER_ID") + } + + // Cleanup (LIFO — execution is reverse-registration order) + s.registerCleanup(t, "notifications integration delete {{.integration_id}} --force", state) + + steps := []CLILiveTest{ + { + Name: "Create notifications integration (user_email_target)", + Args: "notifications integration create " + integrationName + " --kind " + kindVariant + " --user " + user + " -o json", + ExitCode: 0, + JSONFields: map[string]string{ + "name": integrationName, + }, + JSONFieldsExist: []string{"id"}, + CaptureID: "integration_id", + }, + { + Name: "Describe notifications integration", + Args: "notifications integration describe {{.integration_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "name": integrationName, + }, + }, + { + Name: "List notifications integrations", + Args: "notifications integration list", + UseStateVars: true, + ExitCode: 0, + Contains: []string{integrationName}, + }, + { + Name: "Update notifications integration name", + Args: "notifications integration update {{.integration_id}} --display-name " + integrationName + "-updated", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Update notifications integration description", + Args: "notifications integration update {{.integration_id}} --description " + updatedDescription, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify notifications integration update", + Args: "notifications integration describe {{.integration_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "description": updatedDescription, + }, + }, + { + Name: "Delete notifications integration", + Args: "notifications integration delete {{.integration_id}} --force", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify deletion", + Args: "notifications integration describe {{.integration_id}}", + UseStateVars: true, + ExitCode: 1, + }, + } + + for _, step := range steps { + t.Run(step.Name, func(t *testing.T) { + s.runLiveCommand(t, step, state) + }) + } +} + +func (s *CLILiveTestSuite) TestNotificationsIntegrationWebhookTargetCRUDLive() { + t := s.T() + t.Parallel() + state := s.setupTestContext(t) + + // Variables + integrationName := uniqueName("integr") + kindVariant := "webhook" + url := "https://my.webhook.url/{id}" + updatedDescription := "updated-live-test-description" + + // Cleanup (LIFO — execution is reverse-registration order) + s.registerCleanup(t, "notifications integration delete {{.integration_id}} --force", state) + + steps := []CLILiveTest{ + { + Name: "Create notifications integration (webhook_target)", + Args: "notifications integration create " + integrationName + " --kind " + kindVariant + " --url " + url + " -o json", + ExitCode: 0, + JSONFields: map[string]string{ + "name": integrationName, + }, + JSONFieldsExist: []string{"id"}, + CaptureID: "integration_id", + }, + { + Name: "Describe notifications integration", + Args: "notifications integration describe {{.integration_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "name": integrationName, + }, + }, + { + Name: "List notifications integrations", + Args: "notifications integration list", + UseStateVars: true, + ExitCode: 0, + Contains: []string{integrationName}, + }, + { + Name: "Update notifications integration name", + Args: "notifications integration update {{.integration_id}} --display-name " + integrationName + "-updated", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Update notifications integration description", + Args: "notifications integration update {{.integration_id}} --description " + updatedDescription, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify notifications integration update", + Args: "notifications integration describe {{.integration_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "description": updatedDescription, + }, + }, + { + Name: "Delete notifications integration", + Args: "notifications integration delete {{.integration_id}} --force", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify deletion", + Args: "notifications integration describe {{.integration_id}}", + UseStateVars: true, + ExitCode: 1, + }, + } + + for _, step := range steps { + t.Run(step.Name, func(t *testing.T) { + s.runLiveCommand(t, step, state) + }) + } +} + +func (s *CLILiveTestSuite) TestNotificationsIntegrationMsTeamsTargetCRUDLive() { + t := s.T() + t.Parallel() + state := s.setupTestContext(t) + + // Variables + integrationName := uniqueName("integr") + kindVariant := "msteams" + webhookUrl := "https://admin.webhook.office.com/webhookb2/{id}/IncomingWebhook/{id}" + updatedDescription := "updated-live-test-description" + + // Cleanup (LIFO — execution is reverse-registration order) + s.registerCleanup(t, "notifications integration delete {{.integration_id}} --force", state) + + steps := []CLILiveTest{ + { + Name: "Create notifications integration (ms_teams_target)", + Args: "notifications integration create " + integrationName + " --kind " + kindVariant + " --webhook-url " + webhookUrl + " -o json", + ExitCode: 0, + JSONFields: map[string]string{ + "name": integrationName, + }, + JSONFieldsExist: []string{"id"}, + CaptureID: "integration_id", + }, + { + Name: "Describe notifications integration", + Args: "notifications integration describe {{.integration_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "name": integrationName, + }, + }, + { + Name: "List notifications integrations", + Args: "notifications integration list", + UseStateVars: true, + ExitCode: 0, + Contains: []string{integrationName}, + }, + { + Name: "Update notifications integration name", + Args: "notifications integration update {{.integration_id}} --display-name " + integrationName + "-updated", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Update notifications integration description", + Args: "notifications integration update {{.integration_id}} --description " + updatedDescription, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify notifications integration update", + Args: "notifications integration describe {{.integration_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "description": updatedDescription, + }, + }, + { + Name: "Delete notifications integration", + Args: "notifications integration delete {{.integration_id}} --force", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify deletion", + Args: "notifications integration describe {{.integration_id}}", + UseStateVars: true, + ExitCode: 1, + }, + } + + for _, step := range steps { + t.Run(step.Name, func(t *testing.T) { + s.runLiveCommand(t, step, state) + }) + } +} + +func (s *CLILiveTestSuite) TestNotificationsIntegrationInAppTargetCRUDLive() { + t := s.T() + t.Parallel() + state := s.setupTestContext(t) + + // Variables + integrationName := uniqueName("integr") + kindVariant := "inapp" + updatedDescription := "updated-live-test-description" + user := os.Getenv("CONFLUENT_LIVE_TEST_USER_ID") + if user == "" { + t.Skipf("%s must be set to run this live test (user ID)", "CONFLUENT_LIVE_TEST_USER_ID") + } + + // Cleanup (LIFO — execution is reverse-registration order) + s.registerCleanup(t, "notifications integration delete {{.integration_id}} --force", state) + + steps := []CLILiveTest{ + { + Name: "Create notifications integration (in_app_target)", + Args: "notifications integration create " + integrationName + " --kind " + kindVariant + " --user " + user + " -o json", + ExitCode: 0, + JSONFields: map[string]string{ + "name": integrationName, + }, + JSONFieldsExist: []string{"id"}, + CaptureID: "integration_id", + }, + { + Name: "Describe notifications integration", + Args: "notifications integration describe {{.integration_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "name": integrationName, + }, + }, + { + Name: "List notifications integrations", + Args: "notifications integration list", + UseStateVars: true, + ExitCode: 0, + Contains: []string{integrationName}, + }, + { + Name: "Update notifications integration name", + Args: "notifications integration update {{.integration_id}} --display-name " + integrationName + "-updated", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Update notifications integration description", + Args: "notifications integration update {{.integration_id}} --description " + updatedDescription, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify notifications integration update", + Args: "notifications integration describe {{.integration_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "description": updatedDescription, + }, + }, + { + Name: "Delete notifications integration", + Args: "notifications integration delete {{.integration_id}} --force", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify deletion", + Args: "notifications integration describe {{.integration_id}}", + UseStateVars: true, + ExitCode: 1, + }, + } + + for _, step := range steps { + t.Run(step.Name, func(t *testing.T) { + s.runLiveCommand(t, step, state) + }) + } +} diff --git a/test/live/notifications_notification_type_live_test.go b/test/live/notifications_notification_type_live_test.go new file mode 100644 index 0000000000..e7c5903137 --- /dev/null +++ b/test/live/notifications_notification_type_live_test.go @@ -0,0 +1,45 @@ +//go:build live_test && (all || notifications) + +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package live + +import ( + "testing" +) + +func (s *CLILiveTestSuite) TestNotificationsNotificationTypeCRUDLive() { + t := s.T() + t.Parallel() + state := s.setupTestContext(t) + + // Variables + notificationTypeName := uniqueName("notifi") + + // Cleanup (LIFO — execution is reverse-registration order) + + steps := []CLILiveTest{ + { + Name: "Describe notifications notification type", + Args: "notifications notification-type describe {{.notification_type_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "name": notificationTypeName, + }, + }, + { + Name: "List notifications notification types", + Args: "notifications notification-type list", + UseStateVars: true, + ExitCode: 0, + Contains: []string{notificationTypeName}, + }, + } + + for _, step := range steps { + t.Run(step.Name, func(t *testing.T) { + s.runLiveCommand(t, step, state) + }) + } +} diff --git a/test/live/notifications_resource_preference_live_test.go b/test/live/notifications_resource_preference_live_test.go new file mode 100644 index 0000000000..1690438f65 --- /dev/null +++ b/test/live/notifications_resource_preference_live_test.go @@ -0,0 +1,89 @@ +//go:build live_test && (all || notifications) + +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package live + +import ( + "testing" +) + +func (s *CLILiveTestSuite) TestNotificationsResourcePreferenceCRUDLive() { + t := s.T() + t.Parallel() + state := s.setupTestContext(t) + + // Variables + resource := "environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector" + resourceType := "CONNECTOR" + updatedResource := "environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector-updated" + updatedResourceType := "CONNECTOR-updated" + updatedCurrentState := "ENABLED-updated" + + // Cleanup (LIFO — execution is reverse-registration order) + s.registerCleanup(t, "notifications resource-preference delete {{.resource_preference_id}} --force", state) + + steps := []CLILiveTest{ + { + Name: "Create notifications resource preference", + Args: "notifications resource-preference create --resource " + resource + " --resource-type " + resourceType + " -o json", + ExitCode: 0, + JSONFieldsExist: []string{"id", "resource", "resource_type"}, + CaptureID: "resource_preference_id", + }, + { + Name: "Describe notifications resource preference", + Args: "notifications resource-preference describe {{.resource_preference_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFieldsExist: []string{"resource", "resource_type"}, + }, + { + Name: "Update notifications resource preference resource", + Args: "notifications resource-preference update {{.resource_preference_id}} --resource " + updatedResource, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Update notifications resource preference resource-type", + Args: "notifications resource-preference update {{.resource_preference_id}} --resource-type " + updatedResourceType, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Update notifications resource preference current-state", + Args: "notifications resource-preference update {{.resource_preference_id}} --current-state " + updatedCurrentState, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify notifications resource preference update", + Args: "notifications resource-preference describe {{.resource_preference_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "resource": updatedResource, + "resource_type": updatedResourceType, + "current_state": updatedCurrentState, + }, + }, + { + Name: "Delete notifications resource preference", + Args: "notifications resource-preference delete {{.resource_preference_id}} --force", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify deletion", + Args: "notifications resource-preference describe {{.resource_preference_id}}", + UseStateVars: true, + ExitCode: 1, + }, + } + + for _, step := range steps { + t.Run(step.Name, func(t *testing.T) { + s.runLiveCommand(t, step, state) + }) + } +} diff --git a/test/live/notifications_resource_subscription_live_test.go b/test/live/notifications_resource_subscription_live_test.go new file mode 100644 index 0000000000..fdd16de15f --- /dev/null +++ b/test/live/notifications_resource_subscription_live_test.go @@ -0,0 +1,103 @@ +//go:build live_test && (all || notifications) + +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package live + +import ( + "os" + "testing" +) + +func (s *CLILiveTestSuite) TestNotificationsResourceSubscriptionCRUDLive() { + t := s.T() + t.Parallel() + state := s.setupTestContext(t) + + // Variables + resource := "environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector" + resourceType := "CONNECTOR" + integrations := "live-test-integrations" + updatedResource := "environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector-updated" + updatedResourceType := "CONNECTOR-updated" + updatedCurrentState := "ENABLED-updated" + updatedIntegrations := "updated-live-test-integrations" + notificationType := os.Getenv("CONFLUENT_LIVE_TEST_NOTIFICATION_TYPE_ID") + if notificationType == "" { + t.Skipf("%s must be set to run this live test (notification type ID)", "CONFLUENT_LIVE_TEST_NOTIFICATION_TYPE_ID") + } + + // Cleanup (LIFO — execution is reverse-registration order) + s.registerCleanup(t, "notifications resource-subscription delete {{.resource_subscription_id}} --force", state) + + steps := []CLILiveTest{ + { + Name: "Create notifications resource subscription", + Args: "notifications resource-subscription create --resource " + resource + " --resource-type " + resourceType + " --notification-type " + notificationType + " --integrations " + integrations + " -o json", + ExitCode: 0, + JSONFieldsExist: []string{"id", "resource", "resource_type", "integrations"}, + CaptureID: "resource_subscription_id", + }, + { + Name: "Describe notifications resource subscription", + Args: "notifications resource-subscription describe {{.resource_subscription_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFieldsExist: []string{"resource", "resource_type", "integrations"}, + }, + { + Name: "Update notifications resource subscription resource", + Args: "notifications resource-subscription update {{.resource_subscription_id}} --resource " + updatedResource, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Update notifications resource subscription resource-type", + Args: "notifications resource-subscription update {{.resource_subscription_id}} --resource-type " + updatedResourceType, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Update notifications resource subscription current-state", + Args: "notifications resource-subscription update {{.resource_subscription_id}} --current-state " + updatedCurrentState, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Update notifications resource subscription integrations", + Args: "notifications resource-subscription update {{.resource_subscription_id}} --integrations " + updatedIntegrations, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify notifications resource subscription update", + Args: "notifications resource-subscription describe {{.resource_subscription_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "resource": updatedResource, + "resource_type": updatedResourceType, + "current_state": updatedCurrentState, + "integrations": updatedIntegrations, + }, + }, + { + Name: "Delete notifications resource subscription", + Args: "notifications resource-subscription delete {{.resource_subscription_id}} --force", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify deletion", + Args: "notifications resource-subscription describe {{.resource_subscription_id}}", + UseStateVars: true, + ExitCode: 1, + }, + } + + for _, step := range steps { + t.Run(step.Name, func(t *testing.T) { + s.runLiveCommand(t, step, state) + }) + } +} diff --git a/test/live/notifications_subscription_live_test.go b/test/live/notifications_subscription_live_test.go new file mode 100644 index 0000000000..2eba066ec6 --- /dev/null +++ b/test/live/notifications_subscription_live_test.go @@ -0,0 +1,91 @@ +//go:build live_test && (all || notifications) + +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package live + +import ( + "os" + "testing" +) + +func (s *CLILiveTestSuite) TestNotificationsSubscriptionCRUDLive() { + t := s.T() + t.Parallel() + state := s.setupTestContext(t) + + // Variables + integrations := "live-test-integrations" + updatedCurrentState := "ENABLED-updated" + updatedIntegrations := "updated-live-test-integrations" + notificationType := os.Getenv("CONFLUENT_LIVE_TEST_NOTIFICATION_TYPE_ID") + if notificationType == "" { + t.Skipf("%s must be set to run this live test (notification type ID)", "CONFLUENT_LIVE_TEST_NOTIFICATION_TYPE_ID") + } + + // Cleanup (LIFO — execution is reverse-registration order) + s.registerCleanup(t, "notifications subscription delete {{.subscription_id}} --force", state) + + steps := []CLILiveTest{ + { + Name: "Create notifications subscription", + Args: "notifications subscription create --notification-type " + notificationType + " --integrations " + integrations + " -o json", + ExitCode: 0, + JSONFieldsExist: []string{"id", "integrations"}, + CaptureID: "subscription_id", + }, + { + Name: "Describe notifications subscription", + Args: "notifications subscription describe {{.subscription_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFieldsExist: []string{"integrations"}, + }, + { + Name: "List notifications subscriptions", + Args: "notifications subscription list", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Update notifications subscription current-state", + Args: "notifications subscription update {{.subscription_id}} --current-state " + updatedCurrentState, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Update notifications subscription integrations", + Args: "notifications subscription update {{.subscription_id}} --integrations " + updatedIntegrations, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify notifications subscription update", + Args: "notifications subscription describe {{.subscription_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "current_state": updatedCurrentState, + "integrations": updatedIntegrations, + }, + }, + { + Name: "Delete notifications subscription", + Args: "notifications subscription delete {{.subscription_id}} --force", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify deletion", + Args: "notifications subscription describe {{.subscription_id}}", + UseStateVars: true, + ExitCode: 1, + }, + } + + for _, step := range steps { + t.Run(step.Name, func(t *testing.T) { + s.runLiveCommand(t, step, state) + }) + } +} diff --git a/test/live/notifications_user_notification_live_test.go b/test/live/notifications_user_notification_live_test.go new file mode 100644 index 0000000000..a685dd53ad --- /dev/null +++ b/test/live/notifications_user_notification_live_test.go @@ -0,0 +1,56 @@ +//go:build live_test && (all || notifications) + +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package live + +import ( + "testing" +) + +func (s *CLILiveTestSuite) TestNotificationsUserNotificationCRUDLive() { + t := s.T() + t.Parallel() + state := s.setupTestContext(t) + + // Variables + updatedRead := "true" + + // Cleanup (LIFO — execution is reverse-registration order) + + steps := []CLILiveTest{ + { + Name: "Describe notifications user notification", + Args: "notifications user-notification describe {{.user_notification_id}} -o json", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "List notifications user notifications", + Args: "notifications user-notification list", + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Update notifications user notification read", + Args: "notifications user-notification update {{.user_notification_id}} --read=" + updatedRead, + UseStateVars: true, + ExitCode: 0, + }, + { + Name: "Verify notifications user notification update", + Args: "notifications user-notification describe {{.user_notification_id}} -o json", + UseStateVars: true, + ExitCode: 0, + JSONFields: map[string]string{ + "read": updatedRead, + }, + }, + } + + for _, step := range steps { + t.Run(step.Name, func(t *testing.T) { + s.runLiveCommand(t, step, state) + }) + } +} diff --git a/test/notifications_integration_test.go b/test/notifications_integration_test.go new file mode 100644 index 0000000000..1c9f3a00da --- /dev/null +++ b/test/notifications_integration_test.go @@ -0,0 +1,91 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package test + +func (s *CLITestSuite) TestNotificationsIntegrationCreate() { + tests := []CLITest{ + {args: "notifications integration create test-name --kind slack --webhook-url https://hooks.slack.com/services/{id}/{id}/{id} --description \"A Slack channel integration\"", fixture: "notifications/integration/create/create-description.golden"}, + {args: "notifications integration create test-name --kind slack --webhook-url https://hooks.slack.com/services/{id}/{id}/{id}", fixture: "notifications/integration/create/create-slack-target.golden"}, + {args: "notifications integration create test-name --kind webhook --url https://my.webhook.url/{id}", fixture: "notifications/integration/create/create-webhook-target.golden"}, + {args: "notifications integration create test-name --kind msteams --webhook-url https://admin.webhook.office.com/webhookb2/{id}/IncomingWebhook/{id}", fixture: "notifications/integration/create/create-ms-teams-target.golden"}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsIntegrationDelete() { + tests := []CLITest{ + {args: "notifications integration delete integration-1 --force", fixture: "notifications/integration/delete/delete.golden"}, + {args: "notifications integration delete integration-1", input: "y\n", fixture: "notifications/integration/delete/delete-no-force.golden"}, + {args: "notifications integration delete integration-1 integration-2", input: "y\n", fixture: "notifications/integration/delete/delete-multiple.golden"}, + {args: "notifications integration delete invalid", fixture: "notifications/integration/delete/delete-invalid.golden", exitCode: 1}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsIntegrationDescribe() { + tests := []CLITest{ + {args: "notifications integration describe integration-1", fixture: "notifications/integration/describe/describe-slack-target.golden"}, + {args: "notifications integration describe integration-2", fixture: "notifications/integration/describe/describe-role-email-target.golden"}, + {args: "notifications integration describe integration-3", fixture: "notifications/integration/describe/describe-user-email-target.golden"}, + {args: "notifications integration describe integration-4", fixture: "notifications/integration/describe/describe-webhook-target.golden"}, + {args: "notifications integration describe integration-5", fixture: "notifications/integration/describe/describe-ms-teams-target.golden"}, + {args: "notifications integration describe integration-6", fixture: "notifications/integration/describe/describe-in-app-target.golden"}, + {args: "notifications integration describe integration-1 -o json", fixture: "notifications/integration/describe/describe-json.golden"}, + {args: "notifications integration describe integration-1 -o yaml", fixture: "notifications/integration/describe/describe-yaml.golden"}, + {args: "notifications integration describe invalid", fixture: "notifications/integration/describe/describe-invalid.golden", exitCode: 1}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsIntegrationList() { + tests := []CLITest{ + {args: "notifications integration list", fixture: "notifications/integration/list/list.golden"}, + {args: "notifications integration list -o json", fixture: "notifications/integration/list/list-json.golden"}, + {args: "notifications integration list -o yaml", fixture: "notifications/integration/list/list-yaml.golden"}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsIntegrationUpdate() { + tests := []CLITest{ + {args: "notifications integration update integration-1 --display-name \"Slack integration\"", fixture: "notifications/integration/update/update-display-name.golden"}, + {args: "notifications integration update integration-1 --description \"A Slack channel integration\"", fixture: "notifications/integration/update/update-description.golden"}, + {args: "notifications integration update integration-1 --kind slack --webhook-url https://hooks.slack.com/services/{id}/{id}/{id}", fixture: "notifications/integration/update/update-slack-target.golden"}, + {args: "notifications integration update integration-1 --kind webhook --url https://my.webhook.url/{id}", fixture: "notifications/integration/update/update-webhook-target.golden"}, + {args: "notifications integration update integration-1 --kind msteams --webhook-url https://admin.webhook.office.com/webhookb2/{id}/IncomingWebhook/{id}", fixture: "notifications/integration/update/update-ms-teams-target.golden"}, + {args: "notifications integration update invalid", fixture: "notifications/integration/update/update-invalid.golden", exitCode: 1}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsIntegration_Autocomplete() { + tests := []CLITest{ + {args: "__complete notifications integration delete \"\"", fixture: "notifications/integration/delete/delete-autocomplete.golden"}, + {args: "__complete notifications integration describe \"\"", fixture: "notifications/integration/describe/describe-autocomplete.golden"}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} diff --git a/test/notifications_notification_type_test.go b/test/notifications_notification_type_test.go new file mode 100644 index 0000000000..8d88a60c97 --- /dev/null +++ b/test/notifications_notification_type_test.go @@ -0,0 +1,42 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package test + +func (s *CLITestSuite) TestNotificationsNotificationTypeDescribe() { + tests := []CLITest{ + {args: "notifications notification-type describe notification-type-1", fixture: "notifications/notification-type/describe/describe.golden"}, + {args: "notifications notification-type describe notification-type-1 -o json", fixture: "notifications/notification-type/describe/describe-json.golden"}, + {args: "notifications notification-type describe notification-type-1 -o yaml", fixture: "notifications/notification-type/describe/describe-yaml.golden"}, + {args: "notifications notification-type describe invalid", fixture: "notifications/notification-type/describe/describe-invalid.golden", exitCode: 1}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsNotificationTypeList() { + tests := []CLITest{ + {args: "notifications notification-type list", fixture: "notifications/notification-type/list/list.golden"}, + {args: "notifications notification-type list --resource-type resource-type-value", fixture: "notifications/notification-type/list/list-resource-type.golden"}, + {args: "notifications notification-type list -o json", fixture: "notifications/notification-type/list/list-json.golden"}, + {args: "notifications notification-type list -o yaml", fixture: "notifications/notification-type/list/list-yaml.golden"}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsNotificationType_Autocomplete() { + tests := []CLITest{ + {args: "__complete notifications notification-type describe \"\"", fixture: "notifications/notification-type/describe/describe-autocomplete.golden"}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} diff --git a/test/notifications_resource_preference_test.go b/test/notifications_resource_preference_test.go new file mode 100644 index 0000000000..f32c21d757 --- /dev/null +++ b/test/notifications_resource_preference_test.go @@ -0,0 +1,57 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package test + +func (s *CLITestSuite) TestNotificationsResourcePreferenceCreate() { + tests := []CLITest{ + {args: "notifications resource-preference create --resource environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector --resource-type organization", fixture: "notifications/resource-preference/create/create.golden"}, + {args: "notifications resource-preference create --resource environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector --resource-type organization --current-state enabled", fixture: "notifications/resource-preference/create/create-current-state.golden"}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsResourcePreferenceDelete() { + tests := []CLITest{ + {args: "notifications resource-preference delete resource-preference-1 --force", fixture: "notifications/resource-preference/delete/delete.golden"}, + {args: "notifications resource-preference delete resource-preference-1", input: "y\n", fixture: "notifications/resource-preference/delete/delete-no-force.golden"}, + {args: "notifications resource-preference delete resource-preference-1 resource-preference-2", input: "y\n", fixture: "notifications/resource-preference/delete/delete-multiple.golden"}, + {args: "notifications resource-preference delete invalid", fixture: "notifications/resource-preference/delete/delete-invalid.golden", exitCode: 1}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsResourcePreferenceDescribe() { + tests := []CLITest{ + {args: "notifications resource-preference describe resource-preference-1", fixture: "notifications/resource-preference/describe/describe.golden"}, + {args: "notifications resource-preference describe resource-preference-1 -o json", fixture: "notifications/resource-preference/describe/describe-json.golden"}, + {args: "notifications resource-preference describe resource-preference-1 -o yaml", fixture: "notifications/resource-preference/describe/describe-yaml.golden"}, + {args: "notifications resource-preference describe invalid", fixture: "notifications/resource-preference/describe/describe-invalid.golden", exitCode: 1}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsResourcePreferenceUpdate() { + tests := []CLITest{ + {args: "notifications resource-preference update resource-preference-1 --resource environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector", fixture: "notifications/resource-preference/update/update-resource.golden"}, + {args: "notifications resource-preference update resource-preference-1 --resource-type organization", fixture: "notifications/resource-preference/update/update-resource-type.golden"}, + {args: "notifications resource-preference update resource-preference-1 --current-state enabled", fixture: "notifications/resource-preference/update/update-current-state.golden"}, + {args: "notifications resource-preference update invalid", fixture: "notifications/resource-preference/update/update-invalid.golden", exitCode: 1}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} diff --git a/test/notifications_resource_subscription_test.go b/test/notifications_resource_subscription_test.go new file mode 100644 index 0000000000..9b3cd870e0 --- /dev/null +++ b/test/notifications_resource_subscription_test.go @@ -0,0 +1,58 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package test + +func (s *CLITestSuite) TestNotificationsResourceSubscriptionCreate() { + tests := []CLITest{ + {args: "notifications resource-subscription create --integrations val1,val2 --notification-type notification-type-value --resource environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector --resource-type environment", fixture: "notifications/resource-subscription/create/create.golden"}, + {args: "notifications resource-subscription create --integrations val1,val2 --notification-type notification-type-value --resource environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector --resource-type environment --current-state enabled", fixture: "notifications/resource-subscription/create/create-current-state.golden"}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsResourceSubscriptionDelete() { + tests := []CLITest{ + {args: "notifications resource-subscription delete resource-subscription-1 --force", fixture: "notifications/resource-subscription/delete/delete.golden"}, + {args: "notifications resource-subscription delete resource-subscription-1", input: "y\n", fixture: "notifications/resource-subscription/delete/delete-no-force.golden"}, + {args: "notifications resource-subscription delete resource-subscription-1 resource-subscription-2", input: "y\n", fixture: "notifications/resource-subscription/delete/delete-multiple.golden"}, + {args: "notifications resource-subscription delete invalid", fixture: "notifications/resource-subscription/delete/delete-invalid.golden", exitCode: 1}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsResourceSubscriptionDescribe() { + tests := []CLITest{ + {args: "notifications resource-subscription describe resource-subscription-1", fixture: "notifications/resource-subscription/describe/describe.golden"}, + {args: "notifications resource-subscription describe resource-subscription-1 -o json", fixture: "notifications/resource-subscription/describe/describe-json.golden"}, + {args: "notifications resource-subscription describe resource-subscription-1 -o yaml", fixture: "notifications/resource-subscription/describe/describe-yaml.golden"}, + {args: "notifications resource-subscription describe invalid", fixture: "notifications/resource-subscription/describe/describe-invalid.golden", exitCode: 1}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsResourceSubscriptionUpdate() { + tests := []CLITest{ + {args: "notifications resource-subscription update resource-subscription-1 --resource environment=env-456xy/cloud-cluster=lkc-df123/connector=my_datagen_connector", fixture: "notifications/resource-subscription/update/update-resource.golden"}, + {args: "notifications resource-subscription update resource-subscription-1 --resource-type environment", fixture: "notifications/resource-subscription/update/update-resource-type.golden"}, + {args: "notifications resource-subscription update resource-subscription-1 --current-state enabled", fixture: "notifications/resource-subscription/update/update-current-state.golden"}, + {args: "notifications resource-subscription update resource-subscription-1 --integrations val1,val2", fixture: "notifications/resource-subscription/update/update-integrations.golden"}, + {args: "notifications resource-subscription update invalid", fixture: "notifications/resource-subscription/update/update-invalid.golden", exitCode: 1}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} diff --git a/test/notifications_subscription_test.go b/test/notifications_subscription_test.go new file mode 100644 index 0000000000..c695d43015 --- /dev/null +++ b/test/notifications_subscription_test.go @@ -0,0 +1,81 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package test + +func (s *CLITestSuite) TestNotificationsSubscriptionCreate() { + tests := []CLITest{ + {args: "notifications subscription create --integrations val1,val2 --notification-type notification-type-value", fixture: "notifications/subscription/create/create.golden"}, + {args: "notifications subscription create --integrations val1,val2 --notification-type notification-type-value --current-state enabled", fixture: "notifications/subscription/create/create-current-state.golden"}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsSubscriptionDelete() { + tests := []CLITest{ + {args: "notifications subscription delete subscription-1 --force", fixture: "notifications/subscription/delete/delete.golden"}, + {args: "notifications subscription delete subscription-1", input: "y\n", fixture: "notifications/subscription/delete/delete-no-force.golden"}, + {args: "notifications subscription delete subscription-1 subscription-2", input: "y\n", fixture: "notifications/subscription/delete/delete-multiple.golden"}, + {args: "notifications subscription delete invalid", fixture: "notifications/subscription/delete/delete-invalid.golden", exitCode: 1}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsSubscriptionDescribe() { + tests := []CLITest{ + {args: "notifications subscription describe subscription-1", fixture: "notifications/subscription/describe/describe.golden"}, + {args: "notifications subscription describe subscription-1 -o json", fixture: "notifications/subscription/describe/describe-json.golden"}, + {args: "notifications subscription describe subscription-1 -o yaml", fixture: "notifications/subscription/describe/describe-yaml.golden"}, + {args: "notifications subscription describe invalid", fixture: "notifications/subscription/describe/describe-invalid.golden", exitCode: 1}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsSubscriptionList() { + tests := []CLITest{ + {args: "notifications subscription list", fixture: "notifications/subscription/list/list.golden"}, + {args: "notifications subscription list -o json", fixture: "notifications/subscription/list/list-json.golden"}, + {args: "notifications subscription list -o yaml", fixture: "notifications/subscription/list/list-yaml.golden"}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsSubscriptionUpdate() { + tests := []CLITest{ + {args: "notifications subscription update subscription-1 --current-state enabled", fixture: "notifications/subscription/update/update-current-state.golden"}, + {args: "notifications subscription update subscription-1 --integrations val1,val2", fixture: "notifications/subscription/update/update-integrations.golden"}, + {args: "notifications subscription update invalid", fixture: "notifications/subscription/update/update-invalid.golden", exitCode: 1}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsSubscription_Autocomplete() { + tests := []CLITest{ + {args: "__complete notifications subscription delete \"\"", fixture: "notifications/subscription/delete/delete-autocomplete.golden"}, + {args: "__complete notifications subscription describe \"\"", fixture: "notifications/subscription/describe/describe-autocomplete.golden"}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} diff --git a/test/notifications_user_notification_test.go b/test/notifications_user_notification_test.go new file mode 100644 index 0000000000..199663c095 --- /dev/null +++ b/test/notifications_user_notification_test.go @@ -0,0 +1,61 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package test + +func (s *CLITestSuite) TestNotificationsUserNotificationDescribe() { + tests := []CLITest{ + {args: "notifications user-notification describe user-notification-1", fixture: "notifications/user-notification/describe/describe.golden"}, + {args: "notifications user-notification describe user-notification-1 -o json", fixture: "notifications/user-notification/describe/describe-json.golden"}, + {args: "notifications user-notification describe user-notification-1 -o yaml", fixture: "notifications/user-notification/describe/describe-yaml.golden"}, + {args: "notifications user-notification describe invalid", fixture: "notifications/user-notification/describe/describe-invalid.golden", exitCode: 1}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsUserNotificationList() { + tests := []CLITest{ + {args: "notifications user-notification list", fixture: "notifications/user-notification/list/list.golden"}, + {args: "notifications user-notification list --read", fixture: "notifications/user-notification/list/list-read.golden"}, + {args: "notifications user-notification list --severity CRITICAL,WARN", fixture: "notifications/user-notification/list/list-severity.golden"}, + {args: "notifications user-notification list --include integrations,recommended_actions", fixture: "notifications/user-notification/list/list-include.golden"}, + {args: "notifications user-notification list --type CLUSTER,CONNECTOR", fixture: "notifications/user-notification/list/list-type.golden"}, + {args: "notifications user-notification list --crn crn://confluent.cloud/organization=org-abc/environment=env-xyz/cloud-cluster=lkc-ds23ad,crn://confluent.cloud/organization=org-abc/environment=env-mx05q", fixture: "notifications/user-notification/list/list-crn.golden"}, + {args: "notifications user-notification list --search \"cluster failure\"", fixture: "notifications/user-notification/list/list-search.golden"}, + {args: "notifications user-notification list --time-range PAST_24H", fixture: "notifications/user-notification/list/list-time-range.golden"}, + {args: "notifications user-notification list --sort val1,val2", fixture: "notifications/user-notification/list/list-sort.golden"}, + {args: "notifications user-notification list -o json", fixture: "notifications/user-notification/list/list-json.golden"}, + {args: "notifications user-notification list -o yaml", fixture: "notifications/user-notification/list/list-yaml.golden"}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsUserNotificationUpdate() { + tests := []CLITest{ + {args: "notifications user-notification update user-notification-1 --read", fixture: "notifications/user-notification/update/update-read.golden"}, + {args: "notifications user-notification update invalid", fixture: "notifications/user-notification/update/update-invalid.golden", exitCode: 1}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} + +func (s *CLITestSuite) TestNotificationsUserNotification_Autocomplete() { + tests := []CLITest{ + {args: "__complete notifications user-notification describe \"\"", fixture: "notifications/user-notification/describe/describe-autocomplete.golden"}, + } + + for _, test := range tests { + test.login = "cloud" + s.runIntegrationTest(test) + } +} diff --git a/test/test-server/ccloudv2_router.go b/test/test-server/ccloudv2_router.go index a5aa9ed980..a9e78673ce 100644 --- a/test/test-server/ccloudv2_router.go +++ b/test/test-server/ccloudv2_router.go @@ -112,6 +112,18 @@ var ccloudV2Routes = []route{ {"/networking/v1/private-link-attachment-connections/{id}", handleNetworkingPrivateLinkAttachmentConnection}, {"/networking/v1/transit-gateway-attachments", handleNetworkingTransitGatewayAttachments}, {"/networking/v1/transit-gateway-attachments/{id}", handleNetworkingTransitGatewayAttachment}, + {"/notifications/v1/integrations", handleNotificationsV1Integrations}, + {"/notifications/v1/integrations/{id}", handleNotificationsV1IntegrationsId}, + {"/notifications/v1/notification-types", handleNotificationsV1NotificationTypes}, + {"/notifications/v1/notification-types/{id}", handleNotificationsV1NotificationTypesId}, + {"/notifications/v1/resource-preferences", handleNotificationsV1ResourcePreferences}, + {"/notifications/v1/resource-preferences/{id}", handleNotificationsV1ResourcePreferencesId}, + {"/notifications/v1/resource-subscriptions", handleNotificationsV1ResourceSubscriptions}, + {"/notifications/v1/resource-subscriptions/{id}", handleNotificationsV1ResourceSubscriptionsId}, + {"/notifications/v1/subscriptions", handleNotificationsV1Subscriptions}, + {"/notifications/v1/subscriptions/{id}", handleNotificationsV1SubscriptionsId}, + {"/notifications/v1/user-notifications", handleNotificationsV1UserNotifications}, + {"/notifications/v1/user-notifications/{id}", handleNotificationsV1UserNotificationsId}, {"/org/v2/environments", handleOrgEnvironments}, {"/org/v2/environments/{id}", handleOrgEnvironment}, {"/org/v2/organizations", handleOrgOrganizations}, diff --git a/test/test-server/notifications_integration_handler.go b/test/test-server/notifications_integration_handler.go new file mode 100644 index 0000000000..68f9322f83 --- /dev/null +++ b/test/test-server/notifications_integration_handler.go @@ -0,0 +1,94 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package testserver + +import ( + "encoding/json" + "net/http" + "os" + "path/filepath" + "testing" + + "github.com/gorilla/mux" + "github.com/stretchr/testify/require" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" +) + +// Handler for "/notifications/v1/integrations" +func handleNotificationsV1Integrations(t *testing.T) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case http.MethodGet: + integration := readNotificationsV1IntegrationFile(t, "read_created_slack_target.json") + + integrationList := ¬ificationsv1.NotificationsV1IntegrationList{ + Data: []notificationsv1.NotificationsV1Integration{integration}, + } + + err := json.NewEncoder(w).Encode(integrationList) + require.NoError(t, err) + case http.MethodPost: + integration := readNotificationsV1IntegrationFile(t, "create_slack_target.json") + + // Overwrite updated fields using the request body + err := json.NewDecoder(r.Body).Decode(&integration) + require.NoError(t, err) + + err = json.NewEncoder(w).Encode(integration) + require.NoError(t, err) + } + } +} + +// Handler for "/notifications/v1/integrations/{id}" +func handleNotificationsV1IntegrationsId(t *testing.T) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + id := mux.Vars(r)["id"] + switch r.Method { + case http.MethodGet: + switch id { + case "invalid": + w.WriteHeader(http.StatusNotFound) + default: + integration := readNotificationsV1IntegrationFile(t, "read_created_slack_target.json") + + err := json.NewEncoder(w).Encode(&integration) + require.NoError(t, err) + } + case http.MethodPatch: + switch id { + case "invalid": + w.WriteHeader(http.StatusNotFound) + default: + integration := readNotificationsV1IntegrationFile(t, "read_created_slack_target.json") + + // Overwrite updated fields using the request body + err := json.NewDecoder(r.Body).Decode(&integration) + require.NoError(t, err) + + err = json.NewEncoder(w).Encode(integration) + require.NoError(t, err) + } + case http.MethodDelete: + switch id { + case "invalid": + w.WriteHeader(http.StatusNotFound) + default: + w.WriteHeader(http.StatusNoContent) + } + } + } +} + +func readNotificationsV1IntegrationFile(t *testing.T, filename string) notificationsv1.NotificationsV1Integration { + jsonPath := filepath.Join("test", "fixtures", "input", "notifications", "integration", filename) + jsonData, err := os.ReadFile(jsonPath) + require.NoError(t, err) + + integration := notificationsv1.NotificationsV1Integration{} + err = json.Unmarshal(jsonData, &integration) + require.NoError(t, err) + + return integration +} diff --git a/test/test-server/notifications_notification_type_handler.go b/test/test-server/notifications_notification_type_handler.go new file mode 100644 index 0000000000..b5c3478867 --- /dev/null +++ b/test/test-server/notifications_notification_type_handler.go @@ -0,0 +1,64 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package testserver + +import ( + "encoding/json" + "net/http" + "os" + "path/filepath" + "testing" + + "github.com/gorilla/mux" + "github.com/stretchr/testify/require" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" +) + +// Handler for "/notifications/v1/notification-types" +func handleNotificationsV1NotificationTypes(t *testing.T) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case http.MethodGet: + notificationType := readNotificationsV1NotificationTypeFile(t, "read_created_notification_type.json") + + notificationTypeList := ¬ificationsv1.NotificationsV1NotificationTypeList{ + Data: []notificationsv1.NotificationsV1NotificationType{notificationType}, + } + + err := json.NewEncoder(w).Encode(notificationTypeList) + require.NoError(t, err) + } + } +} + +// Handler for "/notifications/v1/notification-types/{id}" +func handleNotificationsV1NotificationTypesId(t *testing.T) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + id := mux.Vars(r)["id"] + switch r.Method { + case http.MethodGet: + switch id { + case "invalid": + w.WriteHeader(http.StatusNotFound) + default: + notificationType := readNotificationsV1NotificationTypeFile(t, "read_created_notification_type.json") + + err := json.NewEncoder(w).Encode(¬ificationType) + require.NoError(t, err) + } + } + } +} + +func readNotificationsV1NotificationTypeFile(t *testing.T, filename string) notificationsv1.NotificationsV1NotificationType { + jsonPath := filepath.Join("test", "fixtures", "input", "notifications", "notification-type", filename) + jsonData, err := os.ReadFile(jsonPath) + require.NoError(t, err) + + notificationType := notificationsv1.NotificationsV1NotificationType{} + err = json.Unmarshal(jsonData, ¬ificationType) + require.NoError(t, err) + + return notificationType +} diff --git a/test/test-server/notifications_resource_preference_handler.go b/test/test-server/notifications_resource_preference_handler.go new file mode 100644 index 0000000000..9337161e28 --- /dev/null +++ b/test/test-server/notifications_resource_preference_handler.go @@ -0,0 +1,85 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package testserver + +import ( + "encoding/json" + "net/http" + "os" + "path/filepath" + "testing" + + "github.com/gorilla/mux" + "github.com/stretchr/testify/require" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" +) + +// Handler for "/notifications/v1/resource-preferences" +func handleNotificationsV1ResourcePreferences(t *testing.T) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case http.MethodPost: + resourcePreference := readNotificationsV1ResourcePreferenceFile(t, "create_resource_preference.json") + + // Overwrite updated fields using the request body + err := json.NewDecoder(r.Body).Decode(&resourcePreference) + require.NoError(t, err) + + err = json.NewEncoder(w).Encode(resourcePreference) + require.NoError(t, err) + } + } +} + +// Handler for "/notifications/v1/resource-preferences/{id}" +func handleNotificationsV1ResourcePreferencesId(t *testing.T) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + id := mux.Vars(r)["id"] + switch r.Method { + case http.MethodGet: + switch id { + case "invalid": + w.WriteHeader(http.StatusNotFound) + default: + resourcePreference := readNotificationsV1ResourcePreferenceFile(t, "read_created_resource_preference.json") + + err := json.NewEncoder(w).Encode(&resourcePreference) + require.NoError(t, err) + } + case http.MethodPatch: + switch id { + case "invalid": + w.WriteHeader(http.StatusNotFound) + default: + resourcePreference := readNotificationsV1ResourcePreferenceFile(t, "read_created_resource_preference.json") + + // Overwrite updated fields using the request body + err := json.NewDecoder(r.Body).Decode(&resourcePreference) + require.NoError(t, err) + + err = json.NewEncoder(w).Encode(resourcePreference) + require.NoError(t, err) + } + case http.MethodDelete: + switch id { + case "invalid": + w.WriteHeader(http.StatusNotFound) + default: + w.WriteHeader(http.StatusNoContent) + } + } + } +} + +func readNotificationsV1ResourcePreferenceFile(t *testing.T, filename string) notificationsv1.NotificationsV1ResourcePreference { + jsonPath := filepath.Join("test", "fixtures", "input", "notifications", "resource-preference", filename) + jsonData, err := os.ReadFile(jsonPath) + require.NoError(t, err) + + resourcePreference := notificationsv1.NotificationsV1ResourcePreference{} + err = json.Unmarshal(jsonData, &resourcePreference) + require.NoError(t, err) + + return resourcePreference +} diff --git a/test/test-server/notifications_resource_subscription_handler.go b/test/test-server/notifications_resource_subscription_handler.go new file mode 100644 index 0000000000..56ddfb3938 --- /dev/null +++ b/test/test-server/notifications_resource_subscription_handler.go @@ -0,0 +1,85 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package testserver + +import ( + "encoding/json" + "net/http" + "os" + "path/filepath" + "testing" + + "github.com/gorilla/mux" + "github.com/stretchr/testify/require" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" +) + +// Handler for "/notifications/v1/resource-subscriptions" +func handleNotificationsV1ResourceSubscriptions(t *testing.T) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case http.MethodPost: + resourceSubscription := readNotificationsV1ResourceSubscriptionFile(t, "create_resource_subscription.json") + + // Overwrite updated fields using the request body + err := json.NewDecoder(r.Body).Decode(&resourceSubscription) + require.NoError(t, err) + + err = json.NewEncoder(w).Encode(resourceSubscription) + require.NoError(t, err) + } + } +} + +// Handler for "/notifications/v1/resource-subscriptions/{id}" +func handleNotificationsV1ResourceSubscriptionsId(t *testing.T) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + id := mux.Vars(r)["id"] + switch r.Method { + case http.MethodGet: + switch id { + case "invalid": + w.WriteHeader(http.StatusNotFound) + default: + resourceSubscription := readNotificationsV1ResourceSubscriptionFile(t, "read_created_resource_subscription.json") + + err := json.NewEncoder(w).Encode(&resourceSubscription) + require.NoError(t, err) + } + case http.MethodPatch: + switch id { + case "invalid": + w.WriteHeader(http.StatusNotFound) + default: + resourceSubscription := readNotificationsV1ResourceSubscriptionFile(t, "read_created_resource_subscription.json") + + // Overwrite updated fields using the request body + err := json.NewDecoder(r.Body).Decode(&resourceSubscription) + require.NoError(t, err) + + err = json.NewEncoder(w).Encode(resourceSubscription) + require.NoError(t, err) + } + case http.MethodDelete: + switch id { + case "invalid": + w.WriteHeader(http.StatusNotFound) + default: + w.WriteHeader(http.StatusNoContent) + } + } + } +} + +func readNotificationsV1ResourceSubscriptionFile(t *testing.T, filename string) notificationsv1.NotificationsV1ResourceSubscription { + jsonPath := filepath.Join("test", "fixtures", "input", "notifications", "resource-subscription", filename) + jsonData, err := os.ReadFile(jsonPath) + require.NoError(t, err) + + resourceSubscription := notificationsv1.NotificationsV1ResourceSubscription{} + err = json.Unmarshal(jsonData, &resourceSubscription) + require.NoError(t, err) + + return resourceSubscription +} diff --git a/test/test-server/notifications_subscription_handler.go b/test/test-server/notifications_subscription_handler.go new file mode 100644 index 0000000000..423c0c68f3 --- /dev/null +++ b/test/test-server/notifications_subscription_handler.go @@ -0,0 +1,94 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package testserver + +import ( + "encoding/json" + "net/http" + "os" + "path/filepath" + "testing" + + "github.com/gorilla/mux" + "github.com/stretchr/testify/require" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" +) + +// Handler for "/notifications/v1/subscriptions" +func handleNotificationsV1Subscriptions(t *testing.T) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case http.MethodGet: + subscription := readNotificationsV1SubscriptionFile(t, "read_created_subscription.json") + + subscriptionList := ¬ificationsv1.NotificationsV1SubscriptionList{ + Data: []notificationsv1.NotificationsV1Subscription{subscription}, + } + + err := json.NewEncoder(w).Encode(subscriptionList) + require.NoError(t, err) + case http.MethodPost: + subscription := readNotificationsV1SubscriptionFile(t, "create_subscription.json") + + // Overwrite updated fields using the request body + err := json.NewDecoder(r.Body).Decode(&subscription) + require.NoError(t, err) + + err = json.NewEncoder(w).Encode(subscription) + require.NoError(t, err) + } + } +} + +// Handler for "/notifications/v1/subscriptions/{id}" +func handleNotificationsV1SubscriptionsId(t *testing.T) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + id := mux.Vars(r)["id"] + switch r.Method { + case http.MethodGet: + switch id { + case "invalid": + w.WriteHeader(http.StatusNotFound) + default: + subscription := readNotificationsV1SubscriptionFile(t, "read_created_subscription.json") + + err := json.NewEncoder(w).Encode(&subscription) + require.NoError(t, err) + } + case http.MethodPatch: + switch id { + case "invalid": + w.WriteHeader(http.StatusNotFound) + default: + subscription := readNotificationsV1SubscriptionFile(t, "read_created_subscription.json") + + // Overwrite updated fields using the request body + err := json.NewDecoder(r.Body).Decode(&subscription) + require.NoError(t, err) + + err = json.NewEncoder(w).Encode(subscription) + require.NoError(t, err) + } + case http.MethodDelete: + switch id { + case "invalid": + w.WriteHeader(http.StatusNotFound) + default: + w.WriteHeader(http.StatusNoContent) + } + } + } +} + +func readNotificationsV1SubscriptionFile(t *testing.T, filename string) notificationsv1.NotificationsV1Subscription { + jsonPath := filepath.Join("test", "fixtures", "input", "notifications", "subscription", filename) + jsonData, err := os.ReadFile(jsonPath) + require.NoError(t, err) + + subscription := notificationsv1.NotificationsV1Subscription{} + err = json.Unmarshal(jsonData, &subscription) + require.NoError(t, err) + + return subscription +} diff --git a/test/test-server/notifications_user_notification_handler.go b/test/test-server/notifications_user_notification_handler.go new file mode 100644 index 0000000000..372d72bf5d --- /dev/null +++ b/test/test-server/notifications_user_notification_handler.go @@ -0,0 +1,78 @@ +// Code generated by cli-terraform-generator; DO NOT EDIT. + +package testserver + +import ( + "encoding/json" + "net/http" + "os" + "path/filepath" + "testing" + + "github.com/gorilla/mux" + "github.com/stretchr/testify/require" + + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" +) + +// Handler for "/notifications/v1/user-notifications" +func handleNotificationsV1UserNotifications(t *testing.T) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case http.MethodGet: + userNotification := readNotificationsV1UserNotificationFile(t, "read_created_user_notification.json") + + userNotificationList := ¬ificationsv1.NotificationsV1UserNotificationList{ + Data: []notificationsv1.NotificationsV1UserNotification{userNotification}, + } + + err := json.NewEncoder(w).Encode(userNotificationList) + require.NoError(t, err) + } + } +} + +// Handler for "/notifications/v1/user-notifications/{id}" +func handleNotificationsV1UserNotificationsId(t *testing.T) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + id := mux.Vars(r)["id"] + switch r.Method { + case http.MethodGet: + switch id { + case "invalid": + w.WriteHeader(http.StatusNotFound) + default: + userNotification := readNotificationsV1UserNotificationFile(t, "read_created_user_notification.json") + + err := json.NewEncoder(w).Encode(&userNotification) + require.NoError(t, err) + } + case http.MethodPatch: + switch id { + case "invalid": + w.WriteHeader(http.StatusNotFound) + default: + userNotification := readNotificationsV1UserNotificationFile(t, "read_created_user_notification.json") + + // Overwrite updated fields using the request body + err := json.NewDecoder(r.Body).Decode(&userNotification) + require.NoError(t, err) + + err = json.NewEncoder(w).Encode(userNotification) + require.NoError(t, err) + } + } + } +} + +func readNotificationsV1UserNotificationFile(t *testing.T, filename string) notificationsv1.NotificationsV1UserNotification { + jsonPath := filepath.Join("test", "fixtures", "input", "notifications", "user-notification", filename) + jsonData, err := os.ReadFile(jsonPath) + require.NoError(t, err) + + userNotification := notificationsv1.NotificationsV1UserNotification{} + err = json.Unmarshal(jsonData, &userNotification) + require.NoError(t, err) + + return userNotification +} From ccc3483dc44c9d4bbbeb64cd7c339fd4e8efbd25 Mon Sep 17 00:00:00 2001 From: Alexander Fayad Date: Fri, 14 Aug 2026 12:22:06 -0400 Subject: [PATCH 2/6] Regenerate the notifications commands with the CLI lint fixes Picks up cli-terraform-generator's allow-list remedy fix. Eight stringSlice flags now carry the CLI's own comma-separated-list wording instead of the spec's HTTP-shape prose, the notifications parent command's Short registers "Cloud Notifications", and one capitalized common noun is fixed in the spec. Removes "Integrations" from properNouns: it was registered by an earlier merge to satisfy one flag's help text, and RequireCapitalizeProperNouns then mandated that capitalization across the whole CLI, failing three descriptions in `confluent provider-integration`. "recieve" goes with the spec typo it covered. `make lint-cli` passes. Co-Authored-By: Claude Opus 5 (1M context) --- .cli-generation-checksum | 2 +- cmd/lint/main.go | 4 +++- .../command_integration_create.go | 6 +++--- .../command_integration_update.go | 6 +++--- .../command_notification_type_list.go | 2 +- .../command_resource_subscription_create.go | 4 ++-- .../command_resource_subscription_update.go | 4 ++-- .../command_subscription_create.go | 4 ++-- .../command_subscription_update.go | 4 ++-- .../command_user_notification_list.go | 8 ++++---- .../integration/create-help.golden | 6 +++--- .../integration/update-help.golden | 6 +++--- .../notification-type/list-help.golden | 2 +- .../resource-subscription/create-help.golden | 4 ++-- .../resource-subscription/update-help.golden | 4 ++-- .../subscription/create-help.golden | 4 ++-- .../subscription/update-help.golden | 4 ++-- .../user-notification/list-help.golden | 20 +++++++++---------- 18 files changed, 48 insertions(+), 46 deletions(-) diff --git a/.cli-generation-checksum b/.cli-generation-checksum index f59527ef69..f65f6ded8e 100644 --- a/.cli-generation-checksum +++ b/.cli-generation-checksum @@ -1 +1 @@ -ae0141a873b6520a9ae2664bea6fea78d1446726a316530fe01a175feee48e57 +297234ba1310522de3b498a7f2c6b088688e40f12ff78c7c557d629ff7ed79c3 diff --git a/cmd/lint/main.go b/cmd/lint/main.go index c072e51747..20148522ff 100644 --- a/cmd/lint/main.go +++ b/cmd/lint/main.go @@ -184,6 +184,7 @@ var properNouns = []string{ "Connect", "Control Center", "CRL", + "Cloud Notifications", "Data Encryption Key", "Databricks", "DEK", @@ -214,6 +215,7 @@ var properNouns = []string{ "Tableflow", "Unified Stream Manager", "USM", + "Webhook", "ZooKeeper™", // cli-tfgen:lint-properNouns — DO NOT REMOVE (verified by TestCliTfgenMarkers) } @@ -344,7 +346,6 @@ var vocabWords = []string{ "rbac", "readonly", "readwrite", - "recieve", "recv", "rescale", "rest", @@ -394,6 +395,7 @@ var vocabWords = []string{ "vv", "vvv", "vvvv", + "webhook", "whitelist", "wikipedia", "workspace", diff --git a/internal/notifications/command_integration_create.go b/internal/notifications/command_integration_create.go index 3bd144b5f1..a8fefc5afe 100644 --- a/internal/notifications/command_integration_create.go +++ b/internal/notifications/command_integration_create.go @@ -23,12 +23,12 @@ func (c *integrationCommand) newCreateCommand() *cobra.Command { } // Required flags - cmd.Flags().String("kind", "", "") + cmd.Flags().String("kind", "", "Integration-specific details (integration targets). One of: Slack, Webhook, MsTeams.") cobra.CheckErr(cmd.MarkFlagRequired("kind")) // Optional flags - cmd.Flags().String("webhook-url", "", "") - cmd.Flags().String("url", "", "") + cmd.Flags().String("webhook-url", "", "Slack: Slack Webhook URL for the particular Slack channel. MsTeams: MS Teams Webhook URL for the particular team channel.") + cmd.Flags().String("url", "", "URL endpoint for the webhook.") cmd.Flags().String("description", "", "A human readable description for the particular integration.") pcmd.AddContextFlag(cmd, c.CLICommand) diff --git a/internal/notifications/command_integration_update.go b/internal/notifications/command_integration_update.go index 72b80e1d2e..d824d8523a 100644 --- a/internal/notifications/command_integration_update.go +++ b/internal/notifications/command_integration_update.go @@ -27,9 +27,9 @@ func (c *integrationCommand) newUpdateCommand() *cobra.Command { // Required flags // Optional flags - cmd.Flags().String("kind", "", "") - cmd.Flags().String("webhook-url", "", "") - cmd.Flags().String("url", "", "") + cmd.Flags().String("kind", "", "Integration-specific details (integration targets). One of: Slack, Webhook, MsTeams.") + cmd.Flags().String("webhook-url", "", "Slack: Slack Webhook URL for the particular Slack channel. MsTeams: MS Teams Webhook URL for the particular team channel.") + cmd.Flags().String("url", "", "URL endpoint for the webhook.") cmd.Flags().String("display-name", "", "A human readable name for the particular integration.") cmd.Flags().String("description", "", "A human readable description for the particular integration.") diff --git a/internal/notifications/command_notification_type_list.go b/internal/notifications/command_notification_type_list.go index 690f668e22..ec76490cfe 100644 --- a/internal/notifications/command_notification_type_list.go +++ b/internal/notifications/command_notification_type_list.go @@ -20,7 +20,7 @@ func (c *notificationTypeCommand) newListCommand() *cobra.Command { // Required flags // Optional flags - cmd.Flags().String("resource-type", "", "Confluent Cloud resource type") + cmd.Flags().String("resource-type", "", "Confluent Cloud resource type.") pcmd.AddContextFlag(cmd, c.CLICommand) pcmd.AddOutputFlag(cmd) diff --git a/internal/notifications/command_resource_subscription_create.go b/internal/notifications/command_resource_subscription_create.go index 8c3497365e..a1c2ebe455 100644 --- a/internal/notifications/command_resource_subscription_create.go +++ b/internal/notifications/command_resource_subscription_create.go @@ -28,14 +28,14 @@ func (c *resourceSubscriptionCommand) newCreateCommand() *cobra.Command { return []string{"ENVIRONMENT", "CLUSTER", "CONNECTOR", "FLINK_COMPUTE_POOL", "FLINK_STATEMENT"} }) cmd.Flags().String("notification-type", "", "The type of notification to subscribe to.") - cmd.Flags().StringSlice("integrations", nil, "Integrations to which notifications are to be sent.") + cmd.Flags().StringSlice("integrations", nil, "A comma-separated list of integration IDs to notify.") cobra.CheckErr(cmd.MarkFlagRequired("integrations")) cobra.CheckErr(cmd.MarkFlagRequired("notification-type")) cobra.CheckErr(cmd.MarkFlagRequired("resource")) cobra.CheckErr(cmd.MarkFlagRequired("resource-type")) // Optional flags - cmd.Flags().String("current-state", "", "Denotes the state of the resource preference. When the resource preference is ENABLED, the user will receive notifications for the Confluent Cloud resource. If the resource preference is DISABLED, the user will not receive any notification for the resource. Note that, you will still receive notifications for `REQUIRED` notification type even when it is DISABLED.") + cmd.Flags().String("current-state", "", "Denotes the state of the resource subscription. When the resource subscription is ENABLED, the user will receive notifications of the configured notification type for the Confluent Cloud resource. If the resource subscription is DISABLED, the user will not receive them. Note that, you will still receive notifications for `REQUIRED` notification type even when it is DISABLED.") pcmd.RegisterFlagCompletionFunc(cmd, "current-state", func(_ *cobra.Command, _ []string) []string { return []string{"ENABLED", "DISABLED"} }) pcmd.AddContextFlag(cmd, c.CLICommand) diff --git a/internal/notifications/command_resource_subscription_update.go b/internal/notifications/command_resource_subscription_update.go index 5766471c91..aee8c51441 100644 --- a/internal/notifications/command_resource_subscription_update.go +++ b/internal/notifications/command_resource_subscription_update.go @@ -30,9 +30,9 @@ func (c *resourceSubscriptionCommand) newUpdateCommand() *cobra.Command { pcmd.RegisterFlagCompletionFunc(cmd, "resource-type", func(_ *cobra.Command, _ []string) []string { return []string{"ENVIRONMENT", "CLUSTER", "CONNECTOR", "FLINK_COMPUTE_POOL", "FLINK_STATEMENT"} }) - cmd.Flags().String("current-state", "", "Denotes the state of the resource preference. When the resource preference is ENABLED, the user will receive notifications for the Confluent Cloud resource. If the resource preference is DISABLED, the user will not receive any notification for the resource. Note that, you will still receive notifications for `REQUIRED` notification type even when it is DISABLED.") + cmd.Flags().String("current-state", "", "Denotes the state of the resource subscription. When the resource subscription is ENABLED, the user will receive notifications of the configured notification type for the Confluent Cloud resource. If the resource subscription is DISABLED, the user will not receive them. Note that, you will still receive notifications for `REQUIRED` notification type even when it is DISABLED.") pcmd.RegisterFlagCompletionFunc(cmd, "current-state", func(_ *cobra.Command, _ []string) []string { return []string{"ENABLED", "DISABLED"} }) - cmd.Flags().StringSlice("integrations", nil, "Integrations to which notifications are to be sent.") + cmd.Flags().StringSlice("integrations", nil, "A comma-separated list of integration IDs to notify.") pcmd.AddContextFlag(cmd, c.CLICommand) pcmd.AddOutputFlag(cmd) diff --git a/internal/notifications/command_subscription_create.go b/internal/notifications/command_subscription_create.go index 5524998f7c..655b94988f 100644 --- a/internal/notifications/command_subscription_create.go +++ b/internal/notifications/command_subscription_create.go @@ -23,12 +23,12 @@ func (c *subscriptionCommand) newCreateCommand() *cobra.Command { // Required flags cmd.Flags().String("notification-type", "", "The type of notification to subscribe to.") - cmd.Flags().StringSlice("integrations", nil, "Integrations to which notifications are to be sent.") + cmd.Flags().StringSlice("integrations", nil, "A comma-separated list of integration IDs to notify.") cobra.CheckErr(cmd.MarkFlagRequired("integrations")) cobra.CheckErr(cmd.MarkFlagRequired("notification-type")) // Optional flags - cmd.Flags().String("current-state", "", "Denotes the state of the subscription. When the subscription is ENABLED, the user will receive notification on the configured Integrations. If the subscription is DISABLED, the user will not recieve any notification for the configured notification type. Note that, you cannot disable a subscription for `REQUIRED` notification type.") + cmd.Flags().String("current-state", "", "Denotes the state of the subscription. When the subscription is ENABLED, the user will receive notification on the configured integrations. If the subscription is DISABLED, the user will not receive any notification for the configured notification type. Note that, you cannot disable a subscription for `REQUIRED` notification type.") pcmd.RegisterFlagCompletionFunc(cmd, "current-state", func(_ *cobra.Command, _ []string) []string { return []string{"ENABLED", "DISABLED"} }) pcmd.AddContextFlag(cmd, c.CLICommand) diff --git a/internal/notifications/command_subscription_update.go b/internal/notifications/command_subscription_update.go index 8cff5f44d0..c141fca43b 100644 --- a/internal/notifications/command_subscription_update.go +++ b/internal/notifications/command_subscription_update.go @@ -26,9 +26,9 @@ func (c *subscriptionCommand) newUpdateCommand() *cobra.Command { // Required flags // Optional flags - cmd.Flags().String("current-state", "", "Denotes the state of the subscription. When the subscription is ENABLED, the user will receive notification on the configured Integrations. If the subscription is DISABLED, the user will not recieve any notification for the configured notification type. Note that, you cannot disable a subscription for `REQUIRED` notification type.") + cmd.Flags().String("current-state", "", "Denotes the state of the subscription. When the subscription is ENABLED, the user will receive notification on the configured integrations. If the subscription is DISABLED, the user will not receive any notification for the configured notification type. Note that, you cannot disable a subscription for `REQUIRED` notification type.") pcmd.RegisterFlagCompletionFunc(cmd, "current-state", func(_ *cobra.Command, _ []string) []string { return []string{"ENABLED", "DISABLED"} }) - cmd.Flags().StringSlice("integrations", nil, "Integrations to which notifications are to be sent.") + cmd.Flags().StringSlice("integrations", nil, "A comma-separated list of integration IDs to notify.") pcmd.AddContextFlag(cmd, c.CLICommand) pcmd.AddOutputFlag(cmd) diff --git a/internal/notifications/command_user_notification_list.go b/internal/notifications/command_user_notification_list.go index df1f1e5c76..4a27befaa7 100644 --- a/internal/notifications/command_user_notification_list.go +++ b/internal/notifications/command_user_notification_list.go @@ -23,13 +23,13 @@ func (c *userNotificationCommand) newListCommand() *cobra.Command { // Optional flags cmd.Flags().Bool("read", false, "Filter the results where read is true or false.") - cmd.Flags().StringSlice("severity", nil, "Filter notifications by severity. Pass the parameter multiple times to match any of the given values (`?severity=CRITICAL&severity=WARN`). A notification matches if its `severity` equals any of the listed values.") + cmd.Flags().StringSlice("severity", nil, "A comma-separated list of severity levels to filter by.") cmd.Flags().String("include", "", "Comma-separated list of optional fields to populate in the response items. Allowed values: `integrations`, `recommended_actions`. By default these fields are omitted from list responses to keep collection payloads slim; set this parameter to opt in. This is a partial-response selector, not a value filter.") - cmd.Flags().StringSlice("type", nil, "Filter notifications by the Confluent Cloud resource type they relate to. Pass the parameter multiple times to match any of the given values (`?resource.type=CLUSTER&resource.type=CONNECTOR`). A notification matches if its `resource.type` equals any of the listed values.") - cmd.Flags().StringSlice("crn", nil, "Filter notifications by the CRN of the Confluent Cloud resource they relate to. Pass the parameter multiple times to match any of the given CRNs; a notification matches if its `resource.crn` equals any of the listed values.") + cmd.Flags().StringSlice("type", nil, "A comma-separated list of Confluent Cloud resource types to filter by.") + cmd.Flags().StringSlice("crn", nil, "A comma-separated list of Confluent Cloud resource CRNs to filter by.") cmd.Flags().String("search", "", "Free-text partial-match search across the embedded notification type's `display_name` and `description`.") cmd.Flags().String("time-range", "", "Filter notifications by a preset time window relative to now. Allowed values: `PAST_24H` (last 24 hours), `PAST_7D` (last 7 days), `PAST_30D` (last 30 days).") - cmd.Flags().StringSlice("sort", nil, "The list of fields and directions that are used to sort the collection.") + cmd.Flags().StringSlice("sort", nil, "A comma-separated list of fields and directions to sort by.") pcmd.AddContextFlag(cmd, c.CLICommand) pcmd.AddOutputFlag(cmd) diff --git a/test/fixtures/output/notifications/integration/create-help.golden b/test/fixtures/output/notifications/integration/create-help.golden index 688b041321..ab3a834abf 100644 --- a/test/fixtures/output/notifications/integration/create-help.golden +++ b/test/fixtures/output/notifications/integration/create-help.golden @@ -4,9 +4,9 @@ Usage: confluent notifications integration create [flags] Flags: - --kind string REQUIRED: - --webhook-url string - --url string + --kind string REQUIRED: Integration-specific details (integration targets). One of: Slack, Webhook, MsTeams. + --webhook-url string Slack: Slack Webhook URL for the particular Slack channel. MsTeams: MS Teams Webhook URL for the particular team channel. + --url string URL endpoint for the webhook. --description string A human readable description for the particular integration. --context string CLI context name. -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") diff --git a/test/fixtures/output/notifications/integration/update-help.golden b/test/fixtures/output/notifications/integration/update-help.golden index 7663a96011..95e173fa65 100644 --- a/test/fixtures/output/notifications/integration/update-help.golden +++ b/test/fixtures/output/notifications/integration/update-help.golden @@ -4,9 +4,9 @@ Usage: confluent notifications integration update [flags] Flags: - --kind string - --webhook-url string - --url string + --kind string Integration-specific details (integration targets). One of: Slack, Webhook, MsTeams. + --webhook-url string Slack: Slack Webhook URL for the particular Slack channel. MsTeams: MS Teams Webhook URL for the particular team channel. + --url string URL endpoint for the webhook. --display-name string A human readable name for the particular integration. --description string A human readable description for the particular integration. --context string CLI context name. diff --git a/test/fixtures/output/notifications/notification-type/list-help.golden b/test/fixtures/output/notifications/notification-type/list-help.golden index 3ea282f8f5..2f19ce3a45 100644 --- a/test/fixtures/output/notifications/notification-type/list-help.golden +++ b/test/fixtures/output/notifications/notification-type/list-help.golden @@ -4,7 +4,7 @@ Usage: confluent notifications notification-type list [flags] Flags: - --resource-type string Confluent Cloud resource type + --resource-type string Confluent Cloud resource type. --context string CLI context name. -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") diff --git a/test/fixtures/output/notifications/resource-subscription/create-help.golden b/test/fixtures/output/notifications/resource-subscription/create-help.golden index 957069c049..d9b9c8da98 100644 --- a/test/fixtures/output/notifications/resource-subscription/create-help.golden +++ b/test/fixtures/output/notifications/resource-subscription/create-help.golden @@ -7,8 +7,8 @@ Flags: --resource string REQUIRED: Denotes the Confluent Cloud resource definition. --resource-type string REQUIRED: Denotes the Confluent Cloud resource type. --notification-type string REQUIRED: The type of notification to subscribe to. - --integrations strings REQUIRED: Integrations to which notifications are to be sent. - --current-state REQUIRED Denotes the state of the resource preference. When the resource preference is ENABLED, the user will receive notifications for the Confluent Cloud resource. If the resource preference is DISABLED, the user will not receive any notification for the resource. Note that, you will still receive notifications for REQUIRED notification type even when it is DISABLED. + --integrations strings REQUIRED: A comma-separated list of integration IDs to notify. + --current-state REQUIRED Denotes the state of the resource subscription. When the resource subscription is ENABLED, the user will receive notifications of the configured notification type for the Confluent Cloud resource. If the resource subscription is DISABLED, the user will not receive them. Note that, you will still receive notifications for REQUIRED notification type even when it is DISABLED. --context string CLI context name. -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") diff --git a/test/fixtures/output/notifications/resource-subscription/update-help.golden b/test/fixtures/output/notifications/resource-subscription/update-help.golden index 22fb0f3a54..ec76696b69 100644 --- a/test/fixtures/output/notifications/resource-subscription/update-help.golden +++ b/test/fixtures/output/notifications/resource-subscription/update-help.golden @@ -6,8 +6,8 @@ Usage: Flags: --resource string Denotes the Confluent Cloud resource definition. --resource-type string Denotes the Confluent Cloud resource type. - --current-state REQUIRED Denotes the state of the resource preference. When the resource preference is ENABLED, the user will receive notifications for the Confluent Cloud resource. If the resource preference is DISABLED, the user will not receive any notification for the resource. Note that, you will still receive notifications for REQUIRED notification type even when it is DISABLED. - --integrations strings Integrations to which notifications are to be sent. + --current-state REQUIRED Denotes the state of the resource subscription. When the resource subscription is ENABLED, the user will receive notifications of the configured notification type for the Confluent Cloud resource. If the resource subscription is DISABLED, the user will not receive them. Note that, you will still receive notifications for REQUIRED notification type even when it is DISABLED. + --integrations strings A comma-separated list of integration IDs to notify. --context string CLI context name. -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") diff --git a/test/fixtures/output/notifications/subscription/create-help.golden b/test/fixtures/output/notifications/subscription/create-help.golden index e1c733d3de..efb96f70dc 100644 --- a/test/fixtures/output/notifications/subscription/create-help.golden +++ b/test/fixtures/output/notifications/subscription/create-help.golden @@ -5,8 +5,8 @@ Usage: Flags: --notification-type string REQUIRED: The type of notification to subscribe to. - --integrations strings REQUIRED: Integrations to which notifications are to be sent. - --current-state REQUIRED Denotes the state of the subscription. When the subscription is ENABLED, the user will receive notification on the configured Integrations. If the subscription is DISABLED, the user will not recieve any notification for the configured notification type. Note that, you cannot disable a subscription for REQUIRED notification type. + --integrations strings REQUIRED: A comma-separated list of integration IDs to notify. + --current-state REQUIRED Denotes the state of the subscription. When the subscription is ENABLED, the user will receive notification on the configured integrations. If the subscription is DISABLED, the user will not receive any notification for the configured notification type. Note that, you cannot disable a subscription for REQUIRED notification type. --context string CLI context name. -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") diff --git a/test/fixtures/output/notifications/subscription/update-help.golden b/test/fixtures/output/notifications/subscription/update-help.golden index 4b02be45e1..4ff87bc794 100644 --- a/test/fixtures/output/notifications/subscription/update-help.golden +++ b/test/fixtures/output/notifications/subscription/update-help.golden @@ -4,8 +4,8 @@ Usage: confluent notifications subscription update [flags] Flags: - --current-state REQUIRED Denotes the state of the subscription. When the subscription is ENABLED, the user will receive notification on the configured Integrations. If the subscription is DISABLED, the user will not recieve any notification for the configured notification type. Note that, you cannot disable a subscription for REQUIRED notification type. - --integrations strings Integrations to which notifications are to be sent. + --current-state REQUIRED Denotes the state of the subscription. When the subscription is ENABLED, the user will receive notification on the configured integrations. If the subscription is DISABLED, the user will not receive any notification for the configured notification type. Note that, you cannot disable a subscription for REQUIRED notification type. + --integrations strings A comma-separated list of integration IDs to notify. --context string CLI context name. -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") diff --git a/test/fixtures/output/notifications/user-notification/list-help.golden b/test/fixtures/output/notifications/user-notification/list-help.golden index 0cb3d09cba..991989fbea 100644 --- a/test/fixtures/output/notifications/user-notification/list-help.golden +++ b/test/fixtures/output/notifications/user-notification/list-help.golden @@ -4,16 +4,16 @@ Usage: confluent notifications user-notification list [flags] Flags: - --read Filter the results where read is true or false. - --severity ?severity=CRITICAL&severity=WARN Filter notifications by severity. Pass the parameter multiple times to match any of the given values (?severity=CRITICAL&severity=WARN). A notification matches if its `severity` equals any of the listed values. - --include integrations Comma-separated list of optional fields to populate in the response items. Allowed values: integrations, `recommended_actions`. By default these fields are omitted from list responses to keep collection payloads slim; set this parameter to opt in. This is a partial-response selector, not a value filter. - --type ?resource.type=CLUSTER&resource.type=CONNECTOR Filter notifications by the Confluent Cloud resource type they relate to. Pass the parameter multiple times to match any of the given values (?resource.type=CLUSTER&resource.type=CONNECTOR). A notification matches if its `resource.type` equals any of the listed values. - --crn resource.crn Filter notifications by the CRN of the Confluent Cloud resource they relate to. Pass the parameter multiple times to match any of the given CRNs; a notification matches if its resource.crn equals any of the listed values. - --search display_name Free-text partial-match search across the embedded notification type's display_name and `description`. - --time-range PAST_24H Filter notifications by a preset time window relative to now. Allowed values: PAST_24H (last 24 hours), `PAST_7D` (last 7 days), `PAST_30D` (last 30 days). - --sort strings The list of fields and directions that are used to sort the collection. - --context string CLI context name. - -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") + --read Filter the results where read is true or false. + --severity strings A comma-separated list of severity levels to filter by. + --include integrations Comma-separated list of optional fields to populate in the response items. Allowed values: integrations, `recommended_actions`. By default these fields are omitted from list responses to keep collection payloads slim; set this parameter to opt in. This is a partial-response selector, not a value filter. + --type strings A comma-separated list of Confluent Cloud resource types to filter by. + --crn strings A comma-separated list of Confluent Cloud resource CRNs to filter by. + --search display_name Free-text partial-match search across the embedded notification type's display_name and `description`. + --time-range PAST_24H Filter notifications by a preset time window relative to now. Allowed values: PAST_24H (last 24 hours), `PAST_7D` (last 7 days), `PAST_30D` (last 30 days). + --sort strings A comma-separated list of fields and directions to sort by. + --context string CLI context name. + -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") Global Flags: -h, --help Show help for this command. From 1673aac7dc9bc65bfebe3c51992e2f91aeacc727 Mon Sep 17 00:00:00 2001 From: Alexander Fayad Date: Fri, 14 Aug 2026 13:36:33 -0400 Subject: [PATCH 3/6] Consume notifications from the published public SDK module ccloud-sdk-go-v2/notifications v0.1.0 is published, so the six commands and their test-server handlers import it instead of the -internal path. The Alpine docker build runs go build in a container with no GitHub credentials and the repo carries no vendor/, so a private module cannot resolve there. Co-Authored-By: Claude Opus 5 (1M context) --- .cli-generation-checksum | 2 +- go.mod | 2 +- go.sum | 4 ++-- internal/notifications/command_integration.go | 2 +- internal/notifications/command_integration_create.go | 2 +- internal/notifications/command_integration_update.go | 2 +- internal/notifications/command_notification_type.go | 2 +- internal/notifications/command_resource_preference.go | 2 +- internal/notifications/command_resource_preference_create.go | 2 +- internal/notifications/command_resource_preference_update.go | 2 +- internal/notifications/command_resource_subscription.go | 2 +- .../notifications/command_resource_subscription_create.go | 2 +- .../notifications/command_resource_subscription_update.go | 2 +- internal/notifications/command_subscription.go | 2 +- internal/notifications/command_subscription_create.go | 2 +- internal/notifications/command_subscription_update.go | 2 +- internal/notifications/command_user_notification.go | 2 +- internal/notifications/command_user_notification_update.go | 2 +- pkg/ccloudv2/client.go | 2 +- pkg/ccloudv2/notifications.go | 2 +- test/test-server/notifications_integration_handler.go | 2 +- test/test-server/notifications_notification_type_handler.go | 2 +- test/test-server/notifications_resource_preference_handler.go | 2 +- .../notifications_resource_subscription_handler.go | 2 +- test/test-server/notifications_subscription_handler.go | 2 +- test/test-server/notifications_user_notification_handler.go | 2 +- 26 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.cli-generation-checksum b/.cli-generation-checksum index f65f6ded8e..d66f0cf312 100644 --- a/.cli-generation-checksum +++ b/.cli-generation-checksum @@ -1 +1 @@ -297234ba1310522de3b498a7f2c6b088688e40f12ff78c7c557d629ff7ed79c3 +9a55349dad61de6639fb09e6a59cd7fbe5dbdc92ad4b5b37103b9fcbec10a48d diff --git a/go.mod b/go.mod index 42dec1e6a2..40105f9fdc 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,6 @@ require ( github.com/charmbracelet/lipgloss v0.11.0 github.com/client9/gospell v0.0.0-20160306015952-90dfc71015df github.com/confluentinc/ccloud-sdk-go-v1-public v0.0.0-20250521223017-0e8f6f971b52 - github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications v0.1.0 github.com/confluentinc/ccloud-sdk-go-v2/ai v0.1.0 github.com/confluentinc/ccloud-sdk-go-v2/apikeys v0.4.0 github.com/confluentinc/ccloud-sdk-go-v2/billing v0.3.0 @@ -46,6 +45,7 @@ require ( github.com/confluentinc/ccloud-sdk-go-v2/networking-gateway v0.7.0 github.com/confluentinc/ccloud-sdk-go-v2/networking-ip v0.2.0 github.com/confluentinc/ccloud-sdk-go-v2/networking-privatelink v0.3.0 + github.com/confluentinc/ccloud-sdk-go-v2/notifications v0.1.0 github.com/confluentinc/ccloud-sdk-go-v2/org v0.14.0 github.com/confluentinc/ccloud-sdk-go-v2/provider-integration v0.2.0 github.com/confluentinc/ccloud-sdk-go-v2/rtce v0.1.0 diff --git a/go.sum b/go.sum index 17f2d0b45f..e2a4b889ef 100644 --- a/go.sum +++ b/go.sum @@ -165,8 +165,6 @@ github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/confluentinc/ccloud-sdk-go-v1-public v0.0.0-20250521223017-0e8f6f971b52 h1:19qEGhkbZa5fopKCe0VPIV+Sasby4Pv10z9ZaktwWso= github.com/confluentinc/ccloud-sdk-go-v1-public v0.0.0-20250521223017-0e8f6f971b52/go.mod h1:62EMf+5uFEt1BJ2q8WMrUoI9VUSxAbDnmZCGRt/MbA0= -github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications v0.1.0 h1:AGs1k07kekZDIeHHrqiBKYNJdaEGoLlEq4uJa4ChANI= -github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications v0.1.0/go.mod h1:2TF8hUgz/FHKneN1ikvLKHjpN7uzLioN375TF6chbq0= github.com/confluentinc/ccloud-sdk-go-v2/ai v0.1.0 h1:zSF4OQUJXWH2JeAo9rsq13ibk+JFdzITGR8S7cFMpzw= github.com/confluentinc/ccloud-sdk-go-v2/ai v0.1.0/go.mod h1:DoxqzzF3JzvJr3fWkvCiOHFlE0GoYpozWxFZ1Ud9ntA= github.com/confluentinc/ccloud-sdk-go-v2/apikeys v0.4.0 h1:8fWyLwMuy8ec0MVF5Avd54UvbIxhDFhZzanHBVwgxdw= @@ -227,6 +225,8 @@ github.com/confluentinc/ccloud-sdk-go-v2/networking-ip v0.2.0 h1:ZHNF2DeqVlNPuKG github.com/confluentinc/ccloud-sdk-go-v2/networking-ip v0.2.0/go.mod h1:KTShFBZA7WG8LcxlWjJpoZFdWkJ+uOw3dDuwAHs5eKU= github.com/confluentinc/ccloud-sdk-go-v2/networking-privatelink v0.3.0 h1:mC0E1nKUt57AxMM4Lpdfd+KA/YZwJVwro9ER+dCUFi8= github.com/confluentinc/ccloud-sdk-go-v2/networking-privatelink v0.3.0/go.mod h1:GIHF2cYOUKx+6ycYokr4i8E4cuNBC22xqvO/IhqZ31U= +github.com/confluentinc/ccloud-sdk-go-v2/notifications v0.1.0 h1:LidTP8SPc9g3Cw56eW73kCbB9JbKZ5iJ0UkgmG6Gn9I= +github.com/confluentinc/ccloud-sdk-go-v2/notifications v0.1.0/go.mod h1:VpOjD3MKw8uRUNhwBEkEbH1a+JTs50FiNANMh0LYOQ8= github.com/confluentinc/ccloud-sdk-go-v2/org v0.14.0 h1:n+4lb+CFCExljsp4Goyb4JTDL/UibGUhT0k++5JNhw8= github.com/confluentinc/ccloud-sdk-go-v2/org v0.14.0/go.mod h1:z+7wtFzDczbMGda7AG7w14BGE3pQSjaFYhNbvkZAlOs= github.com/confluentinc/ccloud-sdk-go-v2/provider-integration v0.2.0 h1:UN2a+aqYhk95ro+wVLkeB/8W7n+UV2KsE3jNFbbDCSw= diff --git a/internal/notifications/command_integration.go b/internal/notifications/command_integration.go index 2d8bb6c87d..09d65589cf 100644 --- a/internal/notifications/command_integration.go +++ b/internal/notifications/command_integration.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" pcmd "github.com/confluentinc/cli/v4/pkg/cmd" "github.com/confluentinc/cli/v4/pkg/config" diff --git a/internal/notifications/command_integration_create.go b/internal/notifications/command_integration_create.go index a8fefc5afe..b5e4a20048 100644 --- a/internal/notifications/command_integration_create.go +++ b/internal/notifications/command_integration_create.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/cobra" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" pcmd "github.com/confluentinc/cli/v4/pkg/cmd" "github.com/confluentinc/cli/v4/pkg/errors" diff --git a/internal/notifications/command_integration_update.go b/internal/notifications/command_integration_update.go index d824d8523a..709be3e3a7 100644 --- a/internal/notifications/command_integration_update.go +++ b/internal/notifications/command_integration_update.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/cobra" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" pcmd "github.com/confluentinc/cli/v4/pkg/cmd" "github.com/confluentinc/cli/v4/pkg/errors" diff --git a/internal/notifications/command_notification_type.go b/internal/notifications/command_notification_type.go index 9660ba8161..3eaa2a73f9 100644 --- a/internal/notifications/command_notification_type.go +++ b/internal/notifications/command_notification_type.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" pcmd "github.com/confluentinc/cli/v4/pkg/cmd" "github.com/confluentinc/cli/v4/pkg/config" diff --git a/internal/notifications/command_resource_preference.go b/internal/notifications/command_resource_preference.go index b473c29cd3..7369331de8 100644 --- a/internal/notifications/command_resource_preference.go +++ b/internal/notifications/command_resource_preference.go @@ -5,7 +5,7 @@ package notifications import ( "github.com/spf13/cobra" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" pcmd "github.com/confluentinc/cli/v4/pkg/cmd" "github.com/confluentinc/cli/v4/pkg/config" diff --git a/internal/notifications/command_resource_preference_create.go b/internal/notifications/command_resource_preference_create.go index 5e322323b1..fc75e744ac 100644 --- a/internal/notifications/command_resource_preference_create.go +++ b/internal/notifications/command_resource_preference_create.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" pcmd "github.com/confluentinc/cli/v4/pkg/cmd" "github.com/confluentinc/cli/v4/pkg/errors" diff --git a/internal/notifications/command_resource_preference_update.go b/internal/notifications/command_resource_preference_update.go index 685e00a9b8..639b1d43b0 100644 --- a/internal/notifications/command_resource_preference_update.go +++ b/internal/notifications/command_resource_preference_update.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" pcmd "github.com/confluentinc/cli/v4/pkg/cmd" "github.com/confluentinc/cli/v4/pkg/errors" diff --git a/internal/notifications/command_resource_subscription.go b/internal/notifications/command_resource_subscription.go index 0b1366d647..97002aae2c 100644 --- a/internal/notifications/command_resource_subscription.go +++ b/internal/notifications/command_resource_subscription.go @@ -5,7 +5,7 @@ package notifications import ( "github.com/spf13/cobra" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" pcmd "github.com/confluentinc/cli/v4/pkg/cmd" "github.com/confluentinc/cli/v4/pkg/config" diff --git a/internal/notifications/command_resource_subscription_create.go b/internal/notifications/command_resource_subscription_create.go index a1c2ebe455..637ae6a8f7 100644 --- a/internal/notifications/command_resource_subscription_create.go +++ b/internal/notifications/command_resource_subscription_create.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" pcmd "github.com/confluentinc/cli/v4/pkg/cmd" "github.com/confluentinc/cli/v4/pkg/errors" diff --git a/internal/notifications/command_resource_subscription_update.go b/internal/notifications/command_resource_subscription_update.go index aee8c51441..c46cdb7f50 100644 --- a/internal/notifications/command_resource_subscription_update.go +++ b/internal/notifications/command_resource_subscription_update.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" pcmd "github.com/confluentinc/cli/v4/pkg/cmd" "github.com/confluentinc/cli/v4/pkg/errors" diff --git a/internal/notifications/command_subscription.go b/internal/notifications/command_subscription.go index b801bc6d1e..0cbefab680 100644 --- a/internal/notifications/command_subscription.go +++ b/internal/notifications/command_subscription.go @@ -5,7 +5,7 @@ package notifications import ( "github.com/spf13/cobra" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" pcmd "github.com/confluentinc/cli/v4/pkg/cmd" "github.com/confluentinc/cli/v4/pkg/config" diff --git a/internal/notifications/command_subscription_create.go b/internal/notifications/command_subscription_create.go index 655b94988f..be35b86ec9 100644 --- a/internal/notifications/command_subscription_create.go +++ b/internal/notifications/command_subscription_create.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" pcmd "github.com/confluentinc/cli/v4/pkg/cmd" "github.com/confluentinc/cli/v4/pkg/errors" diff --git a/internal/notifications/command_subscription_update.go b/internal/notifications/command_subscription_update.go index c141fca43b..c87cdcde96 100644 --- a/internal/notifications/command_subscription_update.go +++ b/internal/notifications/command_subscription_update.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" pcmd "github.com/confluentinc/cli/v4/pkg/cmd" "github.com/confluentinc/cli/v4/pkg/errors" diff --git a/internal/notifications/command_user_notification.go b/internal/notifications/command_user_notification.go index 4e8861eae1..cc635aae32 100644 --- a/internal/notifications/command_user_notification.go +++ b/internal/notifications/command_user_notification.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" pcmd "github.com/confluentinc/cli/v4/pkg/cmd" "github.com/confluentinc/cli/v4/pkg/config" diff --git a/internal/notifications/command_user_notification_update.go b/internal/notifications/command_user_notification_update.go index a6f8d5776f..a572c2239e 100644 --- a/internal/notifications/command_user_notification_update.go +++ b/internal/notifications/command_user_notification_update.go @@ -5,7 +5,7 @@ package notifications import ( "github.com/spf13/cobra" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" pcmd "github.com/confluentinc/cli/v4/pkg/cmd" "github.com/confluentinc/cli/v4/pkg/errors" diff --git a/pkg/ccloudv2/client.go b/pkg/ccloudv2/client.go index a71b17c938..d49831ceca 100644 --- a/pkg/ccloudv2/client.go +++ b/pkg/ccloudv2/client.go @@ -1,7 +1,6 @@ package ccloudv2 import ( - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" aiv1 "github.com/confluentinc/ccloud-sdk-go-v2/ai/v1" apikeysv2 "github.com/confluentinc/ccloud-sdk-go-v2/apikeys/v2" billingv1 "github.com/confluentinc/ccloud-sdk-go-v2/billing/v1" @@ -29,6 +28,7 @@ import ( networkingipv1 "github.com/confluentinc/ccloud-sdk-go-v2/networking-ip/v1" networkingprivatelinkv1 "github.com/confluentinc/ccloud-sdk-go-v2/networking-privatelink/v1" networkingv1 "github.com/confluentinc/ccloud-sdk-go-v2/networking/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" orgv2 "github.com/confluentinc/ccloud-sdk-go-v2/org/v2" pi "github.com/confluentinc/ccloud-sdk-go-v2/provider-integration/v1" piv2 "github.com/confluentinc/ccloud-sdk-go-v2/provider-integration/v2" diff --git a/pkg/ccloudv2/notifications.go b/pkg/ccloudv2/notifications.go index 19931865b1..df9e7aecb9 100644 --- a/pkg/ccloudv2/notifications.go +++ b/pkg/ccloudv2/notifications.go @@ -6,7 +6,7 @@ import ( "context" "net/http" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" "github.com/confluentinc/cli/v4/pkg/errors" ) diff --git a/test/test-server/notifications_integration_handler.go b/test/test-server/notifications_integration_handler.go index 68f9322f83..00b5ac0ab7 100644 --- a/test/test-server/notifications_integration_handler.go +++ b/test/test-server/notifications_integration_handler.go @@ -12,7 +12,7 @@ import ( "github.com/gorilla/mux" "github.com/stretchr/testify/require" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" ) // Handler for "/notifications/v1/integrations" diff --git a/test/test-server/notifications_notification_type_handler.go b/test/test-server/notifications_notification_type_handler.go index b5c3478867..92a01633ee 100644 --- a/test/test-server/notifications_notification_type_handler.go +++ b/test/test-server/notifications_notification_type_handler.go @@ -12,7 +12,7 @@ import ( "github.com/gorilla/mux" "github.com/stretchr/testify/require" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" ) // Handler for "/notifications/v1/notification-types" diff --git a/test/test-server/notifications_resource_preference_handler.go b/test/test-server/notifications_resource_preference_handler.go index 9337161e28..dfb8f780f8 100644 --- a/test/test-server/notifications_resource_preference_handler.go +++ b/test/test-server/notifications_resource_preference_handler.go @@ -12,7 +12,7 @@ import ( "github.com/gorilla/mux" "github.com/stretchr/testify/require" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" ) // Handler for "/notifications/v1/resource-preferences" diff --git a/test/test-server/notifications_resource_subscription_handler.go b/test/test-server/notifications_resource_subscription_handler.go index 56ddfb3938..e54a0eb3b0 100644 --- a/test/test-server/notifications_resource_subscription_handler.go +++ b/test/test-server/notifications_resource_subscription_handler.go @@ -12,7 +12,7 @@ import ( "github.com/gorilla/mux" "github.com/stretchr/testify/require" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" ) // Handler for "/notifications/v1/resource-subscriptions" diff --git a/test/test-server/notifications_subscription_handler.go b/test/test-server/notifications_subscription_handler.go index 423c0c68f3..d15a5f1e4d 100644 --- a/test/test-server/notifications_subscription_handler.go +++ b/test/test-server/notifications_subscription_handler.go @@ -12,7 +12,7 @@ import ( "github.com/gorilla/mux" "github.com/stretchr/testify/require" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" ) // Handler for "/notifications/v1/subscriptions" diff --git a/test/test-server/notifications_user_notification_handler.go b/test/test-server/notifications_user_notification_handler.go index 372d72bf5d..70df8fded0 100644 --- a/test/test-server/notifications_user_notification_handler.go +++ b/test/test-server/notifications_user_notification_handler.go @@ -12,7 +12,7 @@ import ( "github.com/gorilla/mux" "github.com/stretchr/testify/require" - notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2-internal/notifications/v1" + notificationsv1 "github.com/confluentinc/ccloud-sdk-go-v2/notifications/v1" ) // Handler for "/notifications/v1/user-notifications" From e128560322dff885a5a2bd1ba2425e3e8dc8d653 Mon Sep 17 00:00:00 2001 From: Alexander Fayad Date: Tue, 18 Aug 2026 17:15:33 -0400 Subject: [PATCH 4/6] Handle a top-level JSON array in extractID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A list command's -o json output is a JSON array, not an object, so Unmarshal into a map failed and fell through to the table-fallback path, which grabbed the ASCII separator row as a fake id. Try an array first and pull the id from its first element; fall back to a plain object for describe-style output. Drop the table-parsing path entirely — every CaptureID call site pairs with -o json now. Co-Authored-By: Claude Sonnet 5 --- test/live/live_test.go | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/test/live/live_test.go b/test/live/live_test.go index e067c6993e..5e7f872d05 100644 --- a/test/live/live_test.go +++ b/test/live/live_test.go @@ -378,29 +378,30 @@ func substituteStateVars(t *testing.T, s string, state *LiveTestState) string { return buf.String() } -// extractID extracts the "id" field from JSON output. +// extractID extracts the "id" field from JSON output. A list command's JSON output is a +// top-level array, so the id comes from its first element; a describe command's is a top-level +// object. func extractID(t *testing.T, output string) string { t.Helper() trimmed := strings.TrimSpace(output) - var parsed map[string]interface{} - if err := json.Unmarshal([]byte(trimmed), &parsed); err != nil { - // Not JSON — try to extract from table-style output (first column of second line) - lines := strings.Split(trimmed, "\n") - for i, line := range lines { - if i == 0 { - continue // skip header - } - fields := strings.Fields(line) - if len(fields) > 0 { - return fields[0] - } + + var array []map[string]interface{} + if err := json.Unmarshal([]byte(trimmed), &array); err == nil { + if len(array) == 0 { + return "" + } + if id, ok := array[0]["id"]; ok { + return fmt.Sprintf("%v", id) } return "" } - if id, ok := parsed["id"]; ok { - return fmt.Sprintf("%v", id) + var object map[string]interface{} + if err := json.Unmarshal([]byte(trimmed), &object); err == nil { + if id, ok := object["id"]; ok { + return fmt.Sprintf("%v", id) + } } return "" } From f4b655cfeb9c4df7b42a15877372c2883171517b Mon Sep 17 00:00:00 2001 From: Alexander Fayad Date: Tue, 18 Aug 2026 17:15:42 -0400 Subject: [PATCH 5/6] Re-merge all six notifications suites to pick up outstanding generator fixes The last merge predated several generator-side fixes: the zeroCheck replacement for optional StringSlice query params (a []string flag never reads as a literal nil, so severity/resource-type/resource-crn/ sort filters were always sent even when unset), the switch from a literal {id} placeholder to the spec's own example values in create/ update test args, and the List-before-Describe reordering plus -o json request on every live-test List step used for ID capture. Regenerated command/wrapper/test-server/fixture/golden files for Integration, Subscription, ResourcePreference, ResourceSubscription, NotificationType, and UserNotification. Co-Authored-By: Claude Sonnet 5 --- .cli-generation-checksum | 2 +- pkg/ccloudv2/notifications.go | 8 +- .../integration/create_ms_teams_target.json | 2 +- .../integration/create_slack_target.json | 2 +- .../integration/create_webhook_target.json | 2 +- .../read_created_ms_teams_target.json | 2 +- .../read_created_slack_target.json | 2 +- .../read_created_webhook_target.json | 2 +- .../create_user_notification.json | 2 +- .../read_created_user_notification.json | 2 +- .../create/create-description.golden | 12 +- .../create/create-ms-teams-target.golden | 12 +- .../create/create-slack-target.golden | 12 +- .../create/create-webhook-target.golden | 12 +- .../describe/describe-in-app-target.golden | 12 +- .../integration/describe/describe-json.golden | 2 +- .../describe/describe-ms-teams-target.golden | 12 +- .../describe-role-email-target.golden | 12 +- .../describe/describe-slack-target.golden | 12 +- .../describe-user-email-target.golden | 12 +- .../describe/describe-webhook-target.golden | 12 +- .../integration/describe/describe-yaml.golden | 2 +- .../integration/list/list-json.golden | 2 +- .../integration/list/list-yaml.golden | 2 +- .../integration/list/list.golden | 6 +- .../update/update-description.golden | 12 +- .../update/update-display-name.golden | 12 +- .../update/update-ms-teams-target.golden | 12 +- .../update/update-slack-target.golden | 12 +- .../update/update-webhook-target.golden | 12 +- .../notifications_integration_live_test.go | 268 +----------------- ...tifications_notification_type_live_test.go | 16 +- .../notifications_subscription_live_test.go | 2 +- ...tifications_user_notification_live_test.go | 9 +- test/notifications_integration_test.go | 14 +- 35 files changed, 134 insertions(+), 395 deletions(-) diff --git a/.cli-generation-checksum b/.cli-generation-checksum index d66f0cf312..a2ef0095e4 100644 --- a/.cli-generation-checksum +++ b/.cli-generation-checksum @@ -1 +1 @@ -9a55349dad61de6639fb09e6a59cd7fbe5dbdc92ad4b5b37103b9fcbec10a48d +f820c6d08b3bc491a490aec8e1d92af345e8c41c5888a69ca5fa46a16d7f624e diff --git a/pkg/ccloudv2/notifications.go b/pkg/ccloudv2/notifications.go index df9e7aecb9..64e47c3cde 100644 --- a/pkg/ccloudv2/notifications.go +++ b/pkg/ccloudv2/notifications.go @@ -290,16 +290,16 @@ func (c *Client) executeListNotificationsUserNotifications(read *bool, severity if read != nil { req = req.Read(*read) } - if severity != nil { + if len(severity) > 0 { req = req.Severity(notificationsv1.MultipleSearchFilter{Items: severity}) } if include != "" { req = req.Include(include) } - if resourceType != nil { + if len(resourceType) > 0 { req = req.ResourceType(notificationsv1.MultipleSearchFilter{Items: resourceType}) } - if resourceCrn != nil { + if len(resourceCrn) > 0 { req = req.ResourceCrn(notificationsv1.MultipleSearchFilter{Items: resourceCrn}) } if search != "" { @@ -308,7 +308,7 @@ func (c *Client) executeListNotificationsUserNotifications(read *bool, severity if timeRange != "" { req = req.TimeRange(timeRange) } - if sort != nil { + if len(sort) > 0 { req = req.Sort(sort) } if pageToken != "" { diff --git a/test/fixtures/input/notifications/integration/create_ms_teams_target.json b/test/fixtures/input/notifications/integration/create_ms_teams_target.json index 7aa87edaf9..93e9e14938 100644 --- a/test/fixtures/input/notifications/integration/create_ms_teams_target.json +++ b/test/fixtures/input/notifications/integration/create_ms_teams_target.json @@ -13,6 +13,6 @@ }, "target": { "kind": "MsTeams", - "webhook_url": "https://admin.webhook.office.com/webhookb2/{id}/IncomingWebhook/{id}" + "webhook_url": "https://admin.webhook.office.com/webhookb2/00000000-0000-0000-0000-000000000000/IncomingWebhook/00000000000000000000000000000000/00000000-0000-0000-0000-000000000000" } } diff --git a/test/fixtures/input/notifications/integration/create_slack_target.json b/test/fixtures/input/notifications/integration/create_slack_target.json index efe075737f..d8e007f9ce 100644 --- a/test/fixtures/input/notifications/integration/create_slack_target.json +++ b/test/fixtures/input/notifications/integration/create_slack_target.json @@ -13,6 +13,6 @@ }, "target": { "kind": "Slack", - "webhook_url": "https://hooks.slack.com/services/{id}/{id}/{id}" + "webhook_url": "https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx" } } diff --git a/test/fixtures/input/notifications/integration/create_webhook_target.json b/test/fixtures/input/notifications/integration/create_webhook_target.json index d69b9ec4f1..55f8beb4d3 100644 --- a/test/fixtures/input/notifications/integration/create_webhook_target.json +++ b/test/fixtures/input/notifications/integration/create_webhook_target.json @@ -13,6 +13,6 @@ }, "target": { "kind": "Webhook", - "url": "https://my.webhook.url/{id}" + "url": "https://my.webhook.url/00000000-0000-0000-0000-000000000000" } } diff --git a/test/fixtures/input/notifications/integration/read_created_ms_teams_target.json b/test/fixtures/input/notifications/integration/read_created_ms_teams_target.json index 7aa87edaf9..93e9e14938 100644 --- a/test/fixtures/input/notifications/integration/read_created_ms_teams_target.json +++ b/test/fixtures/input/notifications/integration/read_created_ms_teams_target.json @@ -13,6 +13,6 @@ }, "target": { "kind": "MsTeams", - "webhook_url": "https://admin.webhook.office.com/webhookb2/{id}/IncomingWebhook/{id}" + "webhook_url": "https://admin.webhook.office.com/webhookb2/00000000-0000-0000-0000-000000000000/IncomingWebhook/00000000000000000000000000000000/00000000-0000-0000-0000-000000000000" } } diff --git a/test/fixtures/input/notifications/integration/read_created_slack_target.json b/test/fixtures/input/notifications/integration/read_created_slack_target.json index efe075737f..d8e007f9ce 100644 --- a/test/fixtures/input/notifications/integration/read_created_slack_target.json +++ b/test/fixtures/input/notifications/integration/read_created_slack_target.json @@ -13,6 +13,6 @@ }, "target": { "kind": "Slack", - "webhook_url": "https://hooks.slack.com/services/{id}/{id}/{id}" + "webhook_url": "https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx" } } diff --git a/test/fixtures/input/notifications/integration/read_created_webhook_target.json b/test/fixtures/input/notifications/integration/read_created_webhook_target.json index d69b9ec4f1..55f8beb4d3 100644 --- a/test/fixtures/input/notifications/integration/read_created_webhook_target.json +++ b/test/fixtures/input/notifications/integration/read_created_webhook_target.json @@ -13,6 +13,6 @@ }, "target": { "kind": "Webhook", - "url": "https://my.webhook.url/{id}" + "url": "https://my.webhook.url/00000000-0000-0000-0000-000000000000" } } diff --git a/test/fixtures/input/notifications/user-notification/create_user_notification.json b/test/fixtures/input/notifications/user-notification/create_user_notification.json index 98133fd506..0196382c2a 100644 --- a/test/fixtures/input/notifications/user-notification/create_user_notification.json +++ b/test/fixtures/input/notifications/user-notification/create_user_notification.json @@ -24,7 +24,7 @@ }, "target": { "kind": "Slack", - "webhook_url": "https://hooks.slack.com/services/{id}/{id}/{id}" + "webhook_url": "https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx" } } ], diff --git a/test/fixtures/input/notifications/user-notification/read_created_user_notification.json b/test/fixtures/input/notifications/user-notification/read_created_user_notification.json index 98133fd506..0196382c2a 100644 --- a/test/fixtures/input/notifications/user-notification/read_created_user_notification.json +++ b/test/fixtures/input/notifications/user-notification/read_created_user_notification.json @@ -24,7 +24,7 @@ }, "target": { "kind": "Slack", - "webhook_url": "https://hooks.slack.com/services/{id}/{id}/{id}" + "webhook_url": "https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx" } } ], diff --git a/test/fixtures/output/notifications/integration/create/create-description.golden b/test/fixtures/output/notifications/integration/create/create-description.golden index 2a2a79b932..f364e93a55 100644 --- a/test/fixtures/output/notifications/integration/create/create-description.golden +++ b/test/fixtures/output/notifications/integration/create/create-description.golden @@ -1,6 +1,6 @@ -+--------------------------+-------------------------------------------------+ -| ID | dlz-f3a90de | -| Display Name | test-name | -| Description | A Slack channel integration | -| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | -+--------------------------+-------------------------------------------------+ ++--------------------------+-------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | test-name | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx | ++--------------------------+-------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/create/create-ms-teams-target.golden b/test/fixtures/output/notifications/integration/create/create-ms-teams-target.golden index 3b19850d56..6a2381a851 100644 --- a/test/fixtures/output/notifications/integration/create/create-ms-teams-target.golden +++ b/test/fixtures/output/notifications/integration/create/create-ms-teams-target.golden @@ -1,6 +1,6 @@ -+-----------------------------+----------------------------------------------------------------------+ -| ID | dlz-f3a90de | -| Display Name | test-name | -| Description | A Slack channel integration | -| Ms Teams Target Webhook Url | https://admin.webhook.office.com/webhookb2/{id}/IncomingWebhook/{id} | -+-----------------------------+----------------------------------------------------------------------+ ++-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | test-name | +| Description | A Slack channel integration | +| Ms Teams Target Webhook Url | https://admin.webhook.office.com/webhookb2/00000000-0000-0000-0000-000000000000/IncomingWebhook/00000000000000000000000000000000/00000000-0000-0000-0000-000000000000 | ++-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/create/create-slack-target.golden b/test/fixtures/output/notifications/integration/create/create-slack-target.golden index 2a2a79b932..f364e93a55 100644 --- a/test/fixtures/output/notifications/integration/create/create-slack-target.golden +++ b/test/fixtures/output/notifications/integration/create/create-slack-target.golden @@ -1,6 +1,6 @@ -+--------------------------+-------------------------------------------------+ -| ID | dlz-f3a90de | -| Display Name | test-name | -| Description | A Slack channel integration | -| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | -+--------------------------+-------------------------------------------------+ ++--------------------------+-------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | test-name | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx | ++--------------------------+-------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/create/create-webhook-target.golden b/test/fixtures/output/notifications/integration/create/create-webhook-target.golden index 2a2a79b932..f364e93a55 100644 --- a/test/fixtures/output/notifications/integration/create/create-webhook-target.golden +++ b/test/fixtures/output/notifications/integration/create/create-webhook-target.golden @@ -1,6 +1,6 @@ -+--------------------------+-------------------------------------------------+ -| ID | dlz-f3a90de | -| Display Name | test-name | -| Description | A Slack channel integration | -| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | -+--------------------------+-------------------------------------------------+ ++--------------------------+-------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | test-name | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx | ++--------------------------+-------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/describe/describe-in-app-target.golden b/test/fixtures/output/notifications/integration/describe/describe-in-app-target.golden index 7e0a0c40a7..96d72c5113 100644 --- a/test/fixtures/output/notifications/integration/describe/describe-in-app-target.golden +++ b/test/fixtures/output/notifications/integration/describe/describe-in-app-target.golden @@ -1,6 +1,6 @@ -+--------------------------+-------------------------------------------------+ -| ID | dlz-f3a90de | -| Display Name | Slack integration | -| Description | A Slack channel integration | -| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | -+--------------------------+-------------------------------------------------+ ++--------------------------+-------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx | ++--------------------------+-------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/describe/describe-json.golden b/test/fixtures/output/notifications/integration/describe/describe-json.golden index eb0544685c..53efd1a980 100644 --- a/test/fixtures/output/notifications/integration/describe/describe-json.golden +++ b/test/fixtures/output/notifications/integration/describe/describe-json.golden @@ -2,5 +2,5 @@ "id": "dlz-f3a90de", "display_name": "Slack integration", "description": "A Slack channel integration", - "slack_target_webhook_url": "https://hooks.slack.com/services/{id}/{id}/{id}" + "slack_target_webhook_url": "https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx" } diff --git a/test/fixtures/output/notifications/integration/describe/describe-ms-teams-target.golden b/test/fixtures/output/notifications/integration/describe/describe-ms-teams-target.golden index 7e0a0c40a7..96d72c5113 100644 --- a/test/fixtures/output/notifications/integration/describe/describe-ms-teams-target.golden +++ b/test/fixtures/output/notifications/integration/describe/describe-ms-teams-target.golden @@ -1,6 +1,6 @@ -+--------------------------+-------------------------------------------------+ -| ID | dlz-f3a90de | -| Display Name | Slack integration | -| Description | A Slack channel integration | -| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | -+--------------------------+-------------------------------------------------+ ++--------------------------+-------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx | ++--------------------------+-------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/describe/describe-role-email-target.golden b/test/fixtures/output/notifications/integration/describe/describe-role-email-target.golden index 7e0a0c40a7..96d72c5113 100644 --- a/test/fixtures/output/notifications/integration/describe/describe-role-email-target.golden +++ b/test/fixtures/output/notifications/integration/describe/describe-role-email-target.golden @@ -1,6 +1,6 @@ -+--------------------------+-------------------------------------------------+ -| ID | dlz-f3a90de | -| Display Name | Slack integration | -| Description | A Slack channel integration | -| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | -+--------------------------+-------------------------------------------------+ ++--------------------------+-------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx | ++--------------------------+-------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/describe/describe-slack-target.golden b/test/fixtures/output/notifications/integration/describe/describe-slack-target.golden index 7e0a0c40a7..96d72c5113 100644 --- a/test/fixtures/output/notifications/integration/describe/describe-slack-target.golden +++ b/test/fixtures/output/notifications/integration/describe/describe-slack-target.golden @@ -1,6 +1,6 @@ -+--------------------------+-------------------------------------------------+ -| ID | dlz-f3a90de | -| Display Name | Slack integration | -| Description | A Slack channel integration | -| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | -+--------------------------+-------------------------------------------------+ ++--------------------------+-------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx | ++--------------------------+-------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/describe/describe-user-email-target.golden b/test/fixtures/output/notifications/integration/describe/describe-user-email-target.golden index 7e0a0c40a7..96d72c5113 100644 --- a/test/fixtures/output/notifications/integration/describe/describe-user-email-target.golden +++ b/test/fixtures/output/notifications/integration/describe/describe-user-email-target.golden @@ -1,6 +1,6 @@ -+--------------------------+-------------------------------------------------+ -| ID | dlz-f3a90de | -| Display Name | Slack integration | -| Description | A Slack channel integration | -| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | -+--------------------------+-------------------------------------------------+ ++--------------------------+-------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx | ++--------------------------+-------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/describe/describe-webhook-target.golden b/test/fixtures/output/notifications/integration/describe/describe-webhook-target.golden index 7e0a0c40a7..96d72c5113 100644 --- a/test/fixtures/output/notifications/integration/describe/describe-webhook-target.golden +++ b/test/fixtures/output/notifications/integration/describe/describe-webhook-target.golden @@ -1,6 +1,6 @@ -+--------------------------+-------------------------------------------------+ -| ID | dlz-f3a90de | -| Display Name | Slack integration | -| Description | A Slack channel integration | -| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | -+--------------------------+-------------------------------------------------+ ++--------------------------+-------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx | ++--------------------------+-------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/describe/describe-yaml.golden b/test/fixtures/output/notifications/integration/describe/describe-yaml.golden index 6c3a8e2629..02f7f321dc 100644 --- a/test/fixtures/output/notifications/integration/describe/describe-yaml.golden +++ b/test/fixtures/output/notifications/integration/describe/describe-yaml.golden @@ -1,4 +1,4 @@ id: dlz-f3a90de display_name: Slack integration description: A Slack channel integration -slack_target_webhook_url: https://hooks.slack.com/services/{id}/{id}/{id} +slack_target_webhook_url: https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx diff --git a/test/fixtures/output/notifications/integration/list/list-json.golden b/test/fixtures/output/notifications/integration/list/list-json.golden index edb0520fbf..87598dcdaa 100644 --- a/test/fixtures/output/notifications/integration/list/list-json.golden +++ b/test/fixtures/output/notifications/integration/list/list-json.golden @@ -3,6 +3,6 @@ "id": "dlz-f3a90de", "display_name": "Slack integration", "description": "A Slack channel integration", - "slack_target_webhook_url": "https://hooks.slack.com/services/{id}/{id}/{id}" + "slack_target_webhook_url": "https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx" } ] diff --git a/test/fixtures/output/notifications/integration/list/list-yaml.golden b/test/fixtures/output/notifications/integration/list/list-yaml.golden index f3a8d92161..e11c483548 100644 --- a/test/fixtures/output/notifications/integration/list/list-yaml.golden +++ b/test/fixtures/output/notifications/integration/list/list-yaml.golden @@ -1,4 +1,4 @@ - id: dlz-f3a90de display_name: Slack integration description: A Slack channel integration - slack_target_webhook_url: https://hooks.slack.com/services/{id}/{id}/{id} + slack_target_webhook_url: https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx diff --git a/test/fixtures/output/notifications/integration/list/list.golden b/test/fixtures/output/notifications/integration/list/list.golden index f13514cd0c..cf44d09b52 100644 --- a/test/fixtures/output/notifications/integration/list/list.golden +++ b/test/fixtures/output/notifications/integration/list/list.golden @@ -1,3 +1,3 @@ - ID | Display Name | Description | Slack Target Webhook Url | Role Email Target Role Name | Webhook Target Url | Ms Teams Target Webhook Url ---------------+-------------------+-----------------------------+-------------------------------------------------+-----------------------------+--------------------+------------------------------ - dlz-f3a90de | Slack integration | A Slack channel integration | https://hooks.slack.com/services/{id}/{id}/{id} | | | + ID | Display Name | Description | Slack Target Webhook Url | Role Email Target Role Name | Webhook Target Url | Ms Teams Target Webhook Url +--------------+-------------------+-----------------------------+-------------------------------------------------------------------------------+-----------------------------+--------------------+------------------------------ + dlz-f3a90de | Slack integration | A Slack channel integration | https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx | | | diff --git a/test/fixtures/output/notifications/integration/update/update-description.golden b/test/fixtures/output/notifications/integration/update/update-description.golden index 44d0518563..e0f9e5bb7c 100644 --- a/test/fixtures/output/notifications/integration/update/update-description.golden +++ b/test/fixtures/output/notifications/integration/update/update-description.golden @@ -1,7 +1,7 @@ Updated notifications integration "integration-1". -+--------------------------+-------------------------------------------------+ -| ID | dlz-f3a90de | -| Display Name | Slack integration | -| Description | A Slack channel integration | -| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | -+--------------------------+-------------------------------------------------+ ++--------------------------+-------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx | ++--------------------------+-------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/update/update-display-name.golden b/test/fixtures/output/notifications/integration/update/update-display-name.golden index 44d0518563..e0f9e5bb7c 100644 --- a/test/fixtures/output/notifications/integration/update/update-display-name.golden +++ b/test/fixtures/output/notifications/integration/update/update-display-name.golden @@ -1,7 +1,7 @@ Updated notifications integration "integration-1". -+--------------------------+-------------------------------------------------+ -| ID | dlz-f3a90de | -| Display Name | Slack integration | -| Description | A Slack channel integration | -| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | -+--------------------------+-------------------------------------------------+ ++--------------------------+-------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx | ++--------------------------+-------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/update/update-ms-teams-target.golden b/test/fixtures/output/notifications/integration/update/update-ms-teams-target.golden index 5114fc7659..97894b1624 100644 --- a/test/fixtures/output/notifications/integration/update/update-ms-teams-target.golden +++ b/test/fixtures/output/notifications/integration/update/update-ms-teams-target.golden @@ -1,7 +1,7 @@ Updated notifications integration "integration-1". -+-----------------------------+----------------------------------------------------------------------+ -| ID | dlz-f3a90de | -| Display Name | Slack integration | -| Description | A Slack channel integration | -| Ms Teams Target Webhook Url | https://admin.webhook.office.com/webhookb2/{id}/IncomingWebhook/{id} | -+-----------------------------+----------------------------------------------------------------------+ ++-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Ms Teams Target Webhook Url | https://admin.webhook.office.com/webhookb2/00000000-0000-0000-0000-000000000000/IncomingWebhook/00000000000000000000000000000000/00000000-0000-0000-0000-000000000000 | ++-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/update/update-slack-target.golden b/test/fixtures/output/notifications/integration/update/update-slack-target.golden index 44d0518563..e0f9e5bb7c 100644 --- a/test/fixtures/output/notifications/integration/update/update-slack-target.golden +++ b/test/fixtures/output/notifications/integration/update/update-slack-target.golden @@ -1,7 +1,7 @@ Updated notifications integration "integration-1". -+--------------------------+-------------------------------------------------+ -| ID | dlz-f3a90de | -| Display Name | Slack integration | -| Description | A Slack channel integration | -| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | -+--------------------------+-------------------------------------------------+ ++--------------------------+-------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx | ++--------------------------+-------------------------------------------------------------------------------+ diff --git a/test/fixtures/output/notifications/integration/update/update-webhook-target.golden b/test/fixtures/output/notifications/integration/update/update-webhook-target.golden index 44d0518563..e0f9e5bb7c 100644 --- a/test/fixtures/output/notifications/integration/update/update-webhook-target.golden +++ b/test/fixtures/output/notifications/integration/update/update-webhook-target.golden @@ -1,7 +1,7 @@ Updated notifications integration "integration-1". -+--------------------------+-------------------------------------------------+ -| ID | dlz-f3a90de | -| Display Name | Slack integration | -| Description | A Slack channel integration | -| Slack Target Webhook Url | https://hooks.slack.com/services/{id}/{id}/{id} | -+--------------------------+-------------------------------------------------+ ++--------------------------+-------------------------------------------------------------------------------+ +| ID | dlz-f3a90de | +| Display Name | Slack integration | +| Description | A Slack channel integration | +| Slack Target Webhook Url | https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx | ++--------------------------+-------------------------------------------------------------------------------+ diff --git a/test/live/notifications_integration_live_test.go b/test/live/notifications_integration_live_test.go index 0227120922..7af8af8c02 100644 --- a/test/live/notifications_integration_live_test.go +++ b/test/live/notifications_integration_live_test.go @@ -5,7 +5,6 @@ package live import ( - "os" "testing" ) @@ -17,7 +16,7 @@ func (s *CLILiveTestSuite) TestNotificationsIntegrationSlackTargetCRUDLive() { // Variables integrationName := uniqueName("integr") kindVariant := "slack" - webhookUrl := "https://hooks.slack.com/services/{id}/{id}/{id}" + webhookUrl := "https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx" updatedDescription := "updated-live-test-description" // Cleanup (LIFO — execution is reverse-registration order) @@ -45,176 +44,7 @@ func (s *CLILiveTestSuite) TestNotificationsIntegrationSlackTargetCRUDLive() { }, { Name: "List notifications integrations", - Args: "notifications integration list", - UseStateVars: true, - ExitCode: 0, - Contains: []string{integrationName}, - }, - { - Name: "Update notifications integration name", - Args: "notifications integration update {{.integration_id}} --display-name " + integrationName + "-updated", - UseStateVars: true, - ExitCode: 0, - }, - { - Name: "Update notifications integration description", - Args: "notifications integration update {{.integration_id}} --description " + updatedDescription, - UseStateVars: true, - ExitCode: 0, - }, - { - Name: "Verify notifications integration update", - Args: "notifications integration describe {{.integration_id}} -o json", - UseStateVars: true, - ExitCode: 0, - JSONFields: map[string]string{ - "description": updatedDescription, - }, - }, - { - Name: "Delete notifications integration", - Args: "notifications integration delete {{.integration_id}} --force", - UseStateVars: true, - ExitCode: 0, - }, - { - Name: "Verify deletion", - Args: "notifications integration describe {{.integration_id}}", - UseStateVars: true, - ExitCode: 1, - }, - } - - for _, step := range steps { - t.Run(step.Name, func(t *testing.T) { - s.runLiveCommand(t, step, state) - }) - } -} - -func (s *CLILiveTestSuite) TestNotificationsIntegrationRoleEmailTargetCRUDLive() { - t := s.T() - t.Parallel() - state := s.setupTestContext(t) - - // Variables - integrationName := uniqueName("integr") - kindVariant := "roleemail" - roleName := "OrganizationAdmin" - updatedDescription := "updated-live-test-description" - - // Cleanup (LIFO — execution is reverse-registration order) - s.registerCleanup(t, "notifications integration delete {{.integration_id}} --force", state) - - steps := []CLILiveTest{ - { - Name: "Create notifications integration (role_email_target)", - Args: "notifications integration create " + integrationName + " --kind " + kindVariant + " --role-name " + roleName + " -o json", - ExitCode: 0, - JSONFields: map[string]string{ - "name": integrationName, - }, - JSONFieldsExist: []string{"id"}, - CaptureID: "integration_id", - }, - { - Name: "Describe notifications integration", - Args: "notifications integration describe {{.integration_id}} -o json", - UseStateVars: true, - ExitCode: 0, - JSONFields: map[string]string{ - "name": integrationName, - }, - }, - { - Name: "List notifications integrations", - Args: "notifications integration list", - UseStateVars: true, - ExitCode: 0, - Contains: []string{integrationName}, - }, - { - Name: "Update notifications integration name", - Args: "notifications integration update {{.integration_id}} --display-name " + integrationName + "-updated", - UseStateVars: true, - ExitCode: 0, - }, - { - Name: "Update notifications integration description", - Args: "notifications integration update {{.integration_id}} --description " + updatedDescription, - UseStateVars: true, - ExitCode: 0, - }, - { - Name: "Verify notifications integration update", - Args: "notifications integration describe {{.integration_id}} -o json", - UseStateVars: true, - ExitCode: 0, - JSONFields: map[string]string{ - "description": updatedDescription, - }, - }, - { - Name: "Delete notifications integration", - Args: "notifications integration delete {{.integration_id}} --force", - UseStateVars: true, - ExitCode: 0, - }, - { - Name: "Verify deletion", - Args: "notifications integration describe {{.integration_id}}", - UseStateVars: true, - ExitCode: 1, - }, - } - - for _, step := range steps { - t.Run(step.Name, func(t *testing.T) { - s.runLiveCommand(t, step, state) - }) - } -} - -func (s *CLILiveTestSuite) TestNotificationsIntegrationUserEmailTargetCRUDLive() { - t := s.T() - t.Parallel() - state := s.setupTestContext(t) - - // Variables - integrationName := uniqueName("integr") - kindVariant := "useremail" - updatedDescription := "updated-live-test-description" - user := os.Getenv("CONFLUENT_LIVE_TEST_USER_ID") - if user == "" { - t.Skipf("%s must be set to run this live test (user ID)", "CONFLUENT_LIVE_TEST_USER_ID") - } - - // Cleanup (LIFO — execution is reverse-registration order) - s.registerCleanup(t, "notifications integration delete {{.integration_id}} --force", state) - - steps := []CLILiveTest{ - { - Name: "Create notifications integration (user_email_target)", - Args: "notifications integration create " + integrationName + " --kind " + kindVariant + " --user " + user + " -o json", - ExitCode: 0, - JSONFields: map[string]string{ - "name": integrationName, - }, - JSONFieldsExist: []string{"id"}, - CaptureID: "integration_id", - }, - { - Name: "Describe notifications integration", - Args: "notifications integration describe {{.integration_id}} -o json", - UseStateVars: true, - ExitCode: 0, - JSONFields: map[string]string{ - "name": integrationName, - }, - }, - { - Name: "List notifications integrations", - Args: "notifications integration list", + Args: "notifications integration list -o json", UseStateVars: true, ExitCode: 0, Contains: []string{integrationName}, @@ -269,7 +99,7 @@ func (s *CLILiveTestSuite) TestNotificationsIntegrationWebhookTargetCRUDLive() { // Variables integrationName := uniqueName("integr") kindVariant := "webhook" - url := "https://my.webhook.url/{id}" + url := "https://my.webhook.url/00000000-0000-0000-0000-000000000000" updatedDescription := "updated-live-test-description" // Cleanup (LIFO — execution is reverse-registration order) @@ -297,7 +127,7 @@ func (s *CLILiveTestSuite) TestNotificationsIntegrationWebhookTargetCRUDLive() { }, { Name: "List notifications integrations", - Args: "notifications integration list", + Args: "notifications integration list -o json", UseStateVars: true, ExitCode: 0, Contains: []string{integrationName}, @@ -352,7 +182,7 @@ func (s *CLILiveTestSuite) TestNotificationsIntegrationMsTeamsTargetCRUDLive() { // Variables integrationName := uniqueName("integr") kindVariant := "msteams" - webhookUrl := "https://admin.webhook.office.com/webhookb2/{id}/IncomingWebhook/{id}" + webhookUrl := "https://admin.webhook.office.com/webhookb2/00000000-0000-0000-0000-000000000000/IncomingWebhook/00000000000000000000000000000000/00000000-0000-0000-0000-000000000000" updatedDescription := "updated-live-test-description" // Cleanup (LIFO — execution is reverse-registration order) @@ -380,93 +210,7 @@ func (s *CLILiveTestSuite) TestNotificationsIntegrationMsTeamsTargetCRUDLive() { }, { Name: "List notifications integrations", - Args: "notifications integration list", - UseStateVars: true, - ExitCode: 0, - Contains: []string{integrationName}, - }, - { - Name: "Update notifications integration name", - Args: "notifications integration update {{.integration_id}} --display-name " + integrationName + "-updated", - UseStateVars: true, - ExitCode: 0, - }, - { - Name: "Update notifications integration description", - Args: "notifications integration update {{.integration_id}} --description " + updatedDescription, - UseStateVars: true, - ExitCode: 0, - }, - { - Name: "Verify notifications integration update", - Args: "notifications integration describe {{.integration_id}} -o json", - UseStateVars: true, - ExitCode: 0, - JSONFields: map[string]string{ - "description": updatedDescription, - }, - }, - { - Name: "Delete notifications integration", - Args: "notifications integration delete {{.integration_id}} --force", - UseStateVars: true, - ExitCode: 0, - }, - { - Name: "Verify deletion", - Args: "notifications integration describe {{.integration_id}}", - UseStateVars: true, - ExitCode: 1, - }, - } - - for _, step := range steps { - t.Run(step.Name, func(t *testing.T) { - s.runLiveCommand(t, step, state) - }) - } -} - -func (s *CLILiveTestSuite) TestNotificationsIntegrationInAppTargetCRUDLive() { - t := s.T() - t.Parallel() - state := s.setupTestContext(t) - - // Variables - integrationName := uniqueName("integr") - kindVariant := "inapp" - updatedDescription := "updated-live-test-description" - user := os.Getenv("CONFLUENT_LIVE_TEST_USER_ID") - if user == "" { - t.Skipf("%s must be set to run this live test (user ID)", "CONFLUENT_LIVE_TEST_USER_ID") - } - - // Cleanup (LIFO — execution is reverse-registration order) - s.registerCleanup(t, "notifications integration delete {{.integration_id}} --force", state) - - steps := []CLILiveTest{ - { - Name: "Create notifications integration (in_app_target)", - Args: "notifications integration create " + integrationName + " --kind " + kindVariant + " --user " + user + " -o json", - ExitCode: 0, - JSONFields: map[string]string{ - "name": integrationName, - }, - JSONFieldsExist: []string{"id"}, - CaptureID: "integration_id", - }, - { - Name: "Describe notifications integration", - Args: "notifications integration describe {{.integration_id}} -o json", - UseStateVars: true, - ExitCode: 0, - JSONFields: map[string]string{ - "name": integrationName, - }, - }, - { - Name: "List notifications integrations", - Args: "notifications integration list", + Args: "notifications integration list -o json", UseStateVars: true, ExitCode: 0, Contains: []string{integrationName}, diff --git a/test/live/notifications_notification_type_live_test.go b/test/live/notifications_notification_type_live_test.go index e7c5903137..8a9a09d2a1 100644 --- a/test/live/notifications_notification_type_live_test.go +++ b/test/live/notifications_notification_type_live_test.go @@ -13,27 +13,21 @@ func (s *CLILiveTestSuite) TestNotificationsNotificationTypeCRUDLive() { t.Parallel() state := s.setupTestContext(t) - // Variables - notificationTypeName := uniqueName("notifi") - // Cleanup (LIFO — execution is reverse-registration order) steps := []CLILiveTest{ { - Name: "Describe notifications notification type", - Args: "notifications notification-type describe {{.notification_type_id}} -o json", + Name: "List notifications notification types", + Args: "notifications notification-type list -o json", UseStateVars: true, ExitCode: 0, - JSONFields: map[string]string{ - "name": notificationTypeName, - }, + CaptureID: "notification_type_id", }, { - Name: "List notifications notification types", - Args: "notifications notification-type list", + Name: "Describe notifications notification type", + Args: "notifications notification-type describe {{.notification_type_id}} -o json", UseStateVars: true, ExitCode: 0, - Contains: []string{notificationTypeName}, }, } diff --git a/test/live/notifications_subscription_live_test.go b/test/live/notifications_subscription_live_test.go index 2eba066ec6..ea95eff0a3 100644 --- a/test/live/notifications_subscription_live_test.go +++ b/test/live/notifications_subscription_live_test.go @@ -43,7 +43,7 @@ func (s *CLILiveTestSuite) TestNotificationsSubscriptionCRUDLive() { }, { Name: "List notifications subscriptions", - Args: "notifications subscription list", + Args: "notifications subscription list -o json", UseStateVars: true, ExitCode: 0, }, diff --git a/test/live/notifications_user_notification_live_test.go b/test/live/notifications_user_notification_live_test.go index a685dd53ad..fb69ca5d97 100644 --- a/test/live/notifications_user_notification_live_test.go +++ b/test/live/notifications_user_notification_live_test.go @@ -20,14 +20,15 @@ func (s *CLILiveTestSuite) TestNotificationsUserNotificationCRUDLive() { steps := []CLILiveTest{ { - Name: "Describe notifications user notification", - Args: "notifications user-notification describe {{.user_notification_id}} -o json", + Name: "List notifications user notifications", + Args: "notifications user-notification list -o json", UseStateVars: true, ExitCode: 0, + CaptureID: "user_notification_id", }, { - Name: "List notifications user notifications", - Args: "notifications user-notification list", + Name: "Describe notifications user notification", + Args: "notifications user-notification describe {{.user_notification_id}} -o json", UseStateVars: true, ExitCode: 0, }, diff --git a/test/notifications_integration_test.go b/test/notifications_integration_test.go index 1c9f3a00da..c982950cf4 100644 --- a/test/notifications_integration_test.go +++ b/test/notifications_integration_test.go @@ -4,10 +4,10 @@ package test func (s *CLITestSuite) TestNotificationsIntegrationCreate() { tests := []CLITest{ - {args: "notifications integration create test-name --kind slack --webhook-url https://hooks.slack.com/services/{id}/{id}/{id} --description \"A Slack channel integration\"", fixture: "notifications/integration/create/create-description.golden"}, - {args: "notifications integration create test-name --kind slack --webhook-url https://hooks.slack.com/services/{id}/{id}/{id}", fixture: "notifications/integration/create/create-slack-target.golden"}, - {args: "notifications integration create test-name --kind webhook --url https://my.webhook.url/{id}", fixture: "notifications/integration/create/create-webhook-target.golden"}, - {args: "notifications integration create test-name --kind msteams --webhook-url https://admin.webhook.office.com/webhookb2/{id}/IncomingWebhook/{id}", fixture: "notifications/integration/create/create-ms-teams-target.golden"}, + {args: "notifications integration create test-name --kind slack --webhook-url https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx --description \"A Slack channel integration\"", fixture: "notifications/integration/create/create-description.golden"}, + {args: "notifications integration create test-name --kind slack --webhook-url https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx", fixture: "notifications/integration/create/create-slack-target.golden"}, + {args: "notifications integration create test-name --kind webhook --url https://my.webhook.url/00000000-0000-0000-0000-000000000000", fixture: "notifications/integration/create/create-webhook-target.golden"}, + {args: "notifications integration create test-name --kind msteams --webhook-url https://admin.webhook.office.com/webhookb2/00000000-0000-0000-0000-000000000000/IncomingWebhook/00000000000000000000000000000000/00000000-0000-0000-0000-000000000000", fixture: "notifications/integration/create/create-ms-teams-target.golden"}, } for _, test := range tests { @@ -66,9 +66,9 @@ func (s *CLITestSuite) TestNotificationsIntegrationUpdate() { tests := []CLITest{ {args: "notifications integration update integration-1 --display-name \"Slack integration\"", fixture: "notifications/integration/update/update-display-name.golden"}, {args: "notifications integration update integration-1 --description \"A Slack channel integration\"", fixture: "notifications/integration/update/update-description.golden"}, - {args: "notifications integration update integration-1 --kind slack --webhook-url https://hooks.slack.com/services/{id}/{id}/{id}", fixture: "notifications/integration/update/update-slack-target.golden"}, - {args: "notifications integration update integration-1 --kind webhook --url https://my.webhook.url/{id}", fixture: "notifications/integration/update/update-webhook-target.golden"}, - {args: "notifications integration update integration-1 --kind msteams --webhook-url https://admin.webhook.office.com/webhookb2/{id}/IncomingWebhook/{id}", fixture: "notifications/integration/update/update-ms-teams-target.golden"}, + {args: "notifications integration update integration-1 --kind slack --webhook-url https://hooks.slack.com/services/T000AAAA0/B000BBBB0/xxxxxxxxxxxxxxxxxxxxxxxx", fixture: "notifications/integration/update/update-slack-target.golden"}, + {args: "notifications integration update integration-1 --kind webhook --url https://my.webhook.url/00000000-0000-0000-0000-000000000000", fixture: "notifications/integration/update/update-webhook-target.golden"}, + {args: "notifications integration update integration-1 --kind msteams --webhook-url https://admin.webhook.office.com/webhookb2/00000000-0000-0000-0000-000000000000/IncomingWebhook/00000000000000000000000000000000/00000000-0000-0000-0000-000000000000", fixture: "notifications/integration/update/update-ms-teams-target.golden"}, {args: "notifications integration update invalid", fixture: "notifications/integration/update/update-invalid.golden", exitCode: 1}, } From 06cace06da065c2310350d269184d24e0ef3276a Mon Sep 17 00:00:00 2001 From: Alexander Fayad Date: Mon, 24 Aug 2026 13:24:06 -0400 Subject: [PATCH 6/6] Regenerate notifications subscription and resource-subscription commands to pick up objectref_write_placeholders An array-valued ObjectReference field (integrations) built each element as {Id: id} only, leaving the SDK's required related/resource_name fields as empty strings on the wire. The real API rejects that with a 400. cli.objectref_write_placeholders already covered the scalar notification_type case; this regeneration picks up the generator-side fix that ported the same placeholder injection into the array-building loops of create and update. Regenerated Subscription and ResourceSubscription via cli-tfgen --official-sdk to avoid a local SDK replace directive in go.mod. Co-Authored-By: Claude Sonnet 5 --- .cli-generation-checksum | 2 +- internal/notifications/command_resource_subscription.go | 2 +- .../notifications/command_resource_subscription_create.go | 6 +++--- .../notifications/command_resource_subscription_delete.go | 2 +- .../notifications/command_resource_subscription_describe.go | 2 +- .../notifications/command_resource_subscription_update.go | 4 ++-- internal/notifications/command_subscription.go | 2 +- internal/notifications/command_subscription_create.go | 6 +++--- internal/notifications/command_subscription_delete.go | 2 +- internal/notifications/command_subscription_describe.go | 2 +- internal/notifications/command_subscription_list.go | 2 +- internal/notifications/command_subscription_update.go | 4 ++-- test/live/notifications_resource_subscription_live_test.go | 2 +- test/live/notifications_subscription_live_test.go | 2 +- test/notifications_resource_subscription_test.go | 2 +- test/notifications_subscription_test.go | 2 +- .../notifications_resource_subscription_handler.go | 2 +- test/test-server/notifications_subscription_handler.go | 2 +- 18 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.cli-generation-checksum b/.cli-generation-checksum index a2ef0095e4..f9e1f0b07c 100644 --- a/.cli-generation-checksum +++ b/.cli-generation-checksum @@ -1 +1 @@ -f820c6d08b3bc491a490aec8e1d92af345e8c41c5888a69ca5fa46a16d7f624e +95a34e2970dcde24e8baa0ceaf78d25d36a143fe81a6d8fdfb5c8be80e26dcf7 diff --git a/internal/notifications/command_resource_subscription.go b/internal/notifications/command_resource_subscription.go index 97002aae2c..c9839613fd 100644 --- a/internal/notifications/command_resource_subscription.go +++ b/internal/notifications/command_resource_subscription.go @@ -1,4 +1,4 @@ -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package notifications diff --git a/internal/notifications/command_resource_subscription_create.go b/internal/notifications/command_resource_subscription_create.go index 637ae6a8f7..132d6351ac 100644 --- a/internal/notifications/command_resource_subscription_create.go +++ b/internal/notifications/command_resource_subscription_create.go @@ -1,4 +1,4 @@ -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package notifications @@ -73,7 +73,7 @@ func (c *resourceSubscriptionCommand) create(cmd *cobra.Command, args []string) if err != nil { return err } - createReq.NotificationType = ¬ificationsv1.GlobalObjectReference{Id: notificationTypeId} + createReq.NotificationType = ¬ificationsv1.GlobalObjectReference{Id: notificationTypeId, Related: "https://confluent.cloud/_", ResourceName: "https://confluent.cloud/_"} integrations, err := cmd.Flags().GetStringSlice("integrations") if err != nil { @@ -81,7 +81,7 @@ func (c *resourceSubscriptionCommand) create(cmd *cobra.Command, args []string) } integrationsRefs := make([]notificationsv1.GlobalObjectReference, len(integrations)) for i, id := range integrations { - integrationsRefs[i] = notificationsv1.GlobalObjectReference{Id: id} + integrationsRefs[i] = notificationsv1.GlobalObjectReference{Id: id, Related: "https://confluent.cloud/_", ResourceName: "https://confluent.cloud/_"} } createReq.Integrations = &integrationsRefs diff --git a/internal/notifications/command_resource_subscription_delete.go b/internal/notifications/command_resource_subscription_delete.go index e51222b213..472e4694ed 100644 --- a/internal/notifications/command_resource_subscription_delete.go +++ b/internal/notifications/command_resource_subscription_delete.go @@ -1,4 +1,4 @@ -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package notifications diff --git a/internal/notifications/command_resource_subscription_describe.go b/internal/notifications/command_resource_subscription_describe.go index bdf8527f26..b010f3a9b1 100644 --- a/internal/notifications/command_resource_subscription_describe.go +++ b/internal/notifications/command_resource_subscription_describe.go @@ -1,4 +1,4 @@ -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package notifications diff --git a/internal/notifications/command_resource_subscription_update.go b/internal/notifications/command_resource_subscription_update.go index c46cdb7f50..e605382e41 100644 --- a/internal/notifications/command_resource_subscription_update.go +++ b/internal/notifications/command_resource_subscription_update.go @@ -1,4 +1,4 @@ -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package notifications @@ -78,7 +78,7 @@ func (c *resourceSubscriptionCommand) update(cmd *cobra.Command, args []string) if len(integrations) > 0 { integrationsRefs := make([]notificationsv1.GlobalObjectReference, len(integrations)) for i, id := range integrations { - integrationsRefs[i] = notificationsv1.GlobalObjectReference{Id: id} + integrationsRefs[i] = notificationsv1.GlobalObjectReference{Id: id, Related: "https://confluent.cloud/_", ResourceName: "https://confluent.cloud/_"} } updateReq.Integrations = &integrationsRefs } diff --git a/internal/notifications/command_subscription.go b/internal/notifications/command_subscription.go index 0cbefab680..982c578409 100644 --- a/internal/notifications/command_subscription.go +++ b/internal/notifications/command_subscription.go @@ -1,4 +1,4 @@ -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package notifications diff --git a/internal/notifications/command_subscription_create.go b/internal/notifications/command_subscription_create.go index be35b86ec9..3d12892e83 100644 --- a/internal/notifications/command_subscription_create.go +++ b/internal/notifications/command_subscription_create.go @@ -1,4 +1,4 @@ -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package notifications @@ -53,7 +53,7 @@ func (c *subscriptionCommand) create(cmd *cobra.Command, args []string) error { if err != nil { return err } - createReq.NotificationType = ¬ificationsv1.GlobalObjectReference{Id: notificationTypeId} + createReq.NotificationType = ¬ificationsv1.GlobalObjectReference{Id: notificationTypeId, Related: "https://confluent.cloud/_", ResourceName: "https://confluent.cloud/_"} integrations, err := cmd.Flags().GetStringSlice("integrations") if err != nil { @@ -61,7 +61,7 @@ func (c *subscriptionCommand) create(cmd *cobra.Command, args []string) error { } integrationsRefs := make([]notificationsv1.GlobalObjectReference, len(integrations)) for i, id := range integrations { - integrationsRefs[i] = notificationsv1.GlobalObjectReference{Id: id} + integrationsRefs[i] = notificationsv1.GlobalObjectReference{Id: id, Related: "https://confluent.cloud/_", ResourceName: "https://confluent.cloud/_"} } createReq.Integrations = &integrationsRefs diff --git a/internal/notifications/command_subscription_delete.go b/internal/notifications/command_subscription_delete.go index 3361d3bb83..353fcbd0fe 100644 --- a/internal/notifications/command_subscription_delete.go +++ b/internal/notifications/command_subscription_delete.go @@ -1,4 +1,4 @@ -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package notifications diff --git a/internal/notifications/command_subscription_describe.go b/internal/notifications/command_subscription_describe.go index 1afddc53db..886fee33c3 100644 --- a/internal/notifications/command_subscription_describe.go +++ b/internal/notifications/command_subscription_describe.go @@ -1,4 +1,4 @@ -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package notifications diff --git a/internal/notifications/command_subscription_list.go b/internal/notifications/command_subscription_list.go index ac3087b71d..42fe5f390a 100644 --- a/internal/notifications/command_subscription_list.go +++ b/internal/notifications/command_subscription_list.go @@ -1,4 +1,4 @@ -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package notifications diff --git a/internal/notifications/command_subscription_update.go b/internal/notifications/command_subscription_update.go index c87cdcde96..034e4dedca 100644 --- a/internal/notifications/command_subscription_update.go +++ b/internal/notifications/command_subscription_update.go @@ -1,4 +1,4 @@ -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package notifications @@ -57,7 +57,7 @@ func (c *subscriptionCommand) update(cmd *cobra.Command, args []string) error { if len(integrations) > 0 { integrationsRefs := make([]notificationsv1.GlobalObjectReference, len(integrations)) for i, id := range integrations { - integrationsRefs[i] = notificationsv1.GlobalObjectReference{Id: id} + integrationsRefs[i] = notificationsv1.GlobalObjectReference{Id: id, Related: "https://confluent.cloud/_", ResourceName: "https://confluent.cloud/_"} } updateReq.Integrations = &integrationsRefs } diff --git a/test/live/notifications_resource_subscription_live_test.go b/test/live/notifications_resource_subscription_live_test.go index fdd16de15f..d64f5f9796 100644 --- a/test/live/notifications_resource_subscription_live_test.go +++ b/test/live/notifications_resource_subscription_live_test.go @@ -1,6 +1,6 @@ //go:build live_test && (all || notifications) -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package live diff --git a/test/live/notifications_subscription_live_test.go b/test/live/notifications_subscription_live_test.go index ea95eff0a3..78d9286597 100644 --- a/test/live/notifications_subscription_live_test.go +++ b/test/live/notifications_subscription_live_test.go @@ -1,6 +1,6 @@ //go:build live_test && (all || notifications) -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package live diff --git a/test/notifications_resource_subscription_test.go b/test/notifications_resource_subscription_test.go index 9b3cd870e0..d7b8f82a87 100644 --- a/test/notifications_resource_subscription_test.go +++ b/test/notifications_resource_subscription_test.go @@ -1,4 +1,4 @@ -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package test diff --git a/test/notifications_subscription_test.go b/test/notifications_subscription_test.go index c695d43015..8857b1bebb 100644 --- a/test/notifications_subscription_test.go +++ b/test/notifications_subscription_test.go @@ -1,4 +1,4 @@ -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package test diff --git a/test/test-server/notifications_resource_subscription_handler.go b/test/test-server/notifications_resource_subscription_handler.go index e54a0eb3b0..2d4e98a040 100644 --- a/test/test-server/notifications_resource_subscription_handler.go +++ b/test/test-server/notifications_resource_subscription_handler.go @@ -1,4 +1,4 @@ -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package testserver diff --git a/test/test-server/notifications_subscription_handler.go b/test/test-server/notifications_subscription_handler.go index d15a5f1e4d..d83c3011d0 100644 --- a/test/test-server/notifications_subscription_handler.go +++ b/test/test-server/notifications_subscription_handler.go @@ -1,4 +1,4 @@ -// Code generated by cli-terraform-generator; DO NOT EDIT. +// Code generated by cli-terraform-generator v0.8.4; DO NOT EDIT. package testserver