@gravity-rail/cli 0.43.0 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib.js CHANGED
@@ -14741,7 +14741,41 @@ var ORG_WEBHOOK_COLUMNS = [
14741
14741
  maxWidth: 80
14742
14742
  }
14743
14743
  ];
14744
+ function requireWebhookEndpointUuid(args) {
14745
+ const value = args["endpoint-uuid"] ?? args.id;
14746
+ if (typeof value !== "string" || !value.trim()) {
14747
+ throw new CLIError("Missing required argument: --endpoint-uuid");
14748
+ }
14749
+ return value.trim();
14750
+ }
14751
+ function webhookStatusCommand(action) {
14752
+ const status = action === "pause" ? "paused" : "active";
14753
+ return {
14754
+ path: ["org", "webhooks", action],
14755
+ description: `${action === "pause" ? "Pause" : "Resume"} one organization webhook endpoint. Requires organization admin access. Pausing retains the endpoint and delivery history; resuming can deliver held events.`,
14756
+ mutates: true,
14757
+ requiresWorkspace: false,
14758
+ args: [
14759
+ ORG_UUID_ARG2,
14760
+ { name: "endpoint-uuid", aliases: ["id"], description: "Endpoint UUID", required: true }
14761
+ ],
14762
+ examples: [
14763
+ `yarn gr org webhooks ${action} --org-uuid $ORG_UUID --endpoint-uuid $ENDPOINT_UUID --allow-write`
14764
+ ],
14765
+ handler: async (hctx) => {
14766
+ const endpointUuid = requireWebhookEndpointUuid(hctx.args);
14767
+ const result2 = await requireAuth(hctx.ctx).apiClient.updateOrgWebhookEndpoint(
14768
+ requireOrgRef(hctx.args),
14769
+ endpointUuid,
14770
+ { status }
14771
+ );
14772
+ outputSingle(result2, hctx.ctx, ORG_WEBHOOK_COLUMNS);
14773
+ }
14774
+ };
14775
+ }
14744
14776
  var webhookCommands = [
14777
+ webhookStatusCommand("pause"),
14778
+ webhookStatusCommand("resume"),
14745
14779
  {
14746
14780
  path: ["org", "webhooks", "list"],
14747
14781
  description: "List an organization's webhook endpoints (read-only). Each row carries the destination host fingerprint and a masked signing secret, never the URL or a usable secret.",
@@ -14765,10 +14799,7 @@ var webhookCommands = [
14765
14799
  ],
14766
14800
  examples: ["yarn gr org webhooks get --org $ORG_UUID --endpoint-uuid $ENDPOINT_UUID"],
14767
14801
  handler: async (hctx) => {
14768
- const endpointUuid = hctx.args["endpoint-uuid"];
14769
- if (typeof endpointUuid !== "string" || !endpointUuid) {
14770
- throw new CLIError("Missing required argument: --endpoint-uuid");
14771
- }
14802
+ const endpointUuid = requireWebhookEndpointUuid(hctx.args);
14772
14803
  const result2 = await requireAuth(hctx.ctx).apiClient.getOrgWebhookEndpoint(
14773
14804
  requireOrgRef(hctx.args),
14774
14805
  endpointUuid