You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit eb89078
Browse filesBrowse the repository at this point in the historyBrowse files
- Source type enum and auth rules are available via **`pkg/cmd/sources.FetchSourceTypes()`** (fetches from the API OpenAPI URL, caches under temp with TTL). Use it for**source management** (e.g. `source create`, `source upsert`) and **connection management** (e.g. `connection create` inline source) to validate `--type` and type-specific required auth flags.
188
-
- If `FetchSourceTypes()` fails (network, parse), **warn and continue**—do not block the command;let the API validate. If the given type is not in the cached enum, let the API validate.
188
+
- It parses the `SourceTypeConfig<TYPE>` schemas: which types require `config.auth` (from `x-required` on the `SourceTypeConfig` oneOf entry) and which fields each type's `config.auth` requires. `validateSourceAuthFromSpec` (`pkg/cmd/source_common.go`) checks the auth flags against those fields. `x-required` also marks types whose *handshake* is required; `optionalAuthSourceTypes` lists the one that still reads as auth-required (ONFLEET).
189
+
- If `FetchSourceTypes()` fails (network, parse, or a spec with no source types), **warn and continue**—do not block the command; let the API validate. A failed or empty parse is never cached. If the given type is not in the cached enum, let the API validate.
189
190
- Prefer this over hardcoding type lists or required-auth rules so the CLI stays aligned with the API.
Copy file name to clipboardExpand all lines: REFERENCE.md
+38-12Lines changed: 38 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -342,6 +342,8 @@ Create a connection between a source and destination.
342
342
343
343
You can either reference existing resources by ID or create them inline.
344
344
345
+
The auth flags build config.auth from the source type's own verification methods in the API spec. `--webhook-secret` sends webhook_secret_key; on WEBHOOK and HTTP it adds the HMAC settings those types need (sha256, hex, header x-webhook-signature), and on every other type it sends the secret alone so the provider's own header and algorithm apply. `--hmac-secret` sends that HMAC shape (with `--hmac-algo`) wherever the type's method takes an algorithm, and otherwise behaves like `--webhook-secret`. `--api-key` sends api_key; WEBHOOK and HTTP also get header x-api-key, while a type that needs its own header name is refused, because no flag sets it: pass config.auth with header_key through `--source-config`. Types that offer a choice of method (WEBHOOK, HTTP, GITLAB, GRAFANA and others) also need auth_type; the flags set it to the method they used. A flag no method of the type can express is refused, with the methods the type accepts. When auth comes from `--source-config` without auth_type, it is set only if the auth fields fit exactly one method (for example, webhook_secret_key alone is STANDARD_WEBHOOKS on WEBHOOK). Set auth_type in `--source-config` to choose the method yourself.
| `--rule-filter-query` | `string` | Filter on request query parameters using Hookdeck filter syntax (JSON) |
401
403
| `--rule-retry-count` | `int` | Number of retry attempts (default "0") |
402
404
| `--rule-retry-interval` | `int` | Interval between retries in milliseconds (default "0") |
403
-
| `--rule-retry-response-status-codes` | `string` | Comma-separated HTTP status codes to retry on |
405
+
| `--rule-retry-response-status-codes` | `string` | Comma-separated HTTP status codes or expressions to retry on: codes (404), ranges (500-599), comparisons (>400, <=499) and exclusions (!401), e.g. "429,500-599" |
| `--rule-transform-code` | `string` | Transformation code. Creates the transformation named by `--rule-transform-name`, or replaces its code if it exists |
406
408
| `--rule-transform-env` | `string` | JSON string representing environment variables for transformation. Replaces the env of an existing transformation |
|`--source-webhook-secret`|`string`| Webhook secret thesourceverifies signatures with; sent as webhook_secret_key, plus HMAC settings on WEBHOOK and HTTP only|
|`--destination-id`|`string`|Update destination by ID|
511
+
|`--destination-id`|`string`|Destination ID the connection already uses (a different value is rejected: a connection's destination cannot be changed) |
510
512
| `--name` | `string` | New connection name |
511
513
| `--output` | `string` | Output format (json) |
512
514
| `--rule-deduplicate-exclude-fields` | `string` | Comma-separated list of fields to exclude for deduplication |
| `--rule-filter-query` | `string` | Filter on request query parameters using Hookdeck filter syntax (JSON) |
520
522
| `--rule-retry-count` | `int` | Number of retry attempts (default "0") |
521
523
| `--rule-retry-interval` | `int` | Interval between retries in milliseconds (default "0") |
522
-
|`--rule-retry-response-status-codes`|`string`| Comma-separated HTTP status codes to retry on |
524
+
| `--rule-retry-response-status-codes` | `string` | Comma-separated HTTP status codes or expressions to retry on: codes (404), ranges (500-599), comparisons (>400, <=499) and exclusions (!401), e.g. "429,500-599" |
| `--rule-transform-code` | `string` | Transformation code. Creates the transformation named by `--rule-transform-name`, or replaces its code if it exists |
525
527
| `--rule-transform-env` | `string` | JSON string representing environment variables for transformation. Replaces the env of an existing transformation |
526
528
| `--rule-transform-name` | `string` | Name or ID of an existing transformation to apply. With `--rule-transform-code`, an existing transformation's code is replaced, or a new transformation is created with this name |
527
529
|`--rules`|`string`| JSON string representing the entire rules array |
528
530
|`--rules-file`|`string`| Path to a JSON file containing the rules array |
529
-
| `--source-id` | `string` | Update source by ID |
531
+
|`--source-id`|`string`|Source ID the connection already uses (a different value is rejected: a connection's source cannot be changed) |
# A connection's source and destination cannot be changed. --source-id and
543
+
# --destination-id are accepted only when they match the stored values;
544
+
# to use a different one, create a new connection.
542
545
543
546
# Update rules
544
547
hookdeck gateway connection update web_abc123 \
@@ -593,8 +596,18 @@ Create a new connection or update an existing one by name (idempotent).
593
596
- Only updates properties that are explicitly provided
594
597
- Preserves existing properties that aren't specified
595
598
599
+
An existing connection's destination cannot be changed. If the destination
600
+
you name (by ID or by name) differs from the one the connection already uses,
601
+
the command fails before changing anything. Settings of the current
602
+
destination can still be updated. The source can be changed.
603
+
604
+
Rules are replaced as a whole when `--rules` or `--rules-file` is given, and
605
+
left alone otherwise. Pass `--rules` '[]' to remove all rules.
606
+
596
607
Use `--dry-run` to preview changes without applying them.
597
608
609
+
The auth flags build config.auth from the source type's own verification methods in the API spec. `--webhook-secret` sends webhook_secret_key; on WEBHOOK and HTTP it adds the HMAC settings those types need (sha256, hex, header x-webhook-signature), and on every other type it sends the secret alone so the provider's own header and algorithm apply. `--hmac-secret` sends that HMAC shape (with `--hmac-algo`) wherever the type's method takes an algorithm, and otherwise behaves like `--webhook-secret`. `--api-key` sends api_key; WEBHOOK and HTTP also get header x-api-key, while a type that needs its own header name is refused, because no flag sets it: pass config.auth with header_key through `--source-config`. Types that offer a choice of method (WEBHOOK, HTTP, GITLAB, GRAFANA and others) also need auth_type; the flags set it to the method they used. A flag no method of the type can express is refused, with the methods the type accepts. When auth comes from `--source-config` without auth_type, it is set only if the auth fields fit exactly one method (for example, webhook_secret_key alone is STANDARD_WEBHOOKS on WEBHOOK). Set auth_type in `--source-config` to choose the method yourself.
| `--rule-filter-query` | `string` | Filter on request query parameters using Hookdeck filter syntax (JSON) |
660
673
| `--rule-retry-count` | `int` | Number of retry attempts (default "0") |
661
674
| `--rule-retry-interval` | `int` | Interval between retries in milliseconds (default "0") |
662
-
| `--rule-retry-response-status-codes` | `string` | Comma-separated HTTP status codes to retry on |
675
+
| `--rule-retry-response-status-codes` | `string` | Comma-separated HTTP status codes or expressions to retry on: codes (404), ranges (500-599), comparisons (>400, <=499) and exclusions (!401), e.g. "429,500-599" |
| `--rule-transform-code` | `string` | Transformation code. Creates the transformation named by `--rule-transform-name`, or replaces its code if it exists |
665
678
| `--rule-transform-env` | `string` | JSON string representing environment variables for transformation. Replaces the env of an existing transformation |
|`--source-webhook-secret`|`string`| Webhook secret thesourceverifies signatures with; sent as webhook_secret_key, plus HMAC settings on WEBHOOK and HTTP only|
684
697
685
698
**Examples:**
686
699
@@ -838,6 +851,8 @@ Create a new source.
838
851
839
852
Requires `--name` and `--type`. Use `--config` or `--config-file`for authentication (e.g. webhook_secret, api_key).
840
853
854
+
The auth flags build config.auth from the source type's own verification methods in the API spec. `--webhook-secret` sends webhook_secret_key; on WEBHOOK and HTTP it adds the HMAC settings those types need (sha256, hex, header x-webhook-signature), and on every other type it sends the secret alone so the provider's own header and algorithm apply. `--hmac-secret` sends that HMAC shape (with `--hmac-algo`) wherever the type's method takes an algorithm, and otherwise behaves like `--webhook-secret`. `--api-key` sends api_key; WEBHOOK and HTTP also get header x-api-key, while a type that needs its own header name is refused, because no flag sets it: pass config.auth with header_key through `--config`. Types that offer a choice of method (WEBHOOK, HTTP, GITLAB, GRAFANA and others) also need auth_type; the flags set it to the method they used. A flag no method of the type can express is refused, with the methods the type accepts. When auth comes from `--config` without auth_type, it is set only if the auth fields fit exactly one method (for example, webhook_secret_key alone is STANDARD_WEBHOOKS on WEBHOOK). Set auth_type in `--config` to choose the method yourself.
|`--webhook-secret`|`string`| Webhook secret thesourceverifies signatures with; sent as webhook_secret_key, plus HMAC settings on WEBHOOK and HTTP only|
866
881
867
882
**Examples:**
868
883
@@ -899,6 +914,10 @@ hookdeck gateway source get my-source --include-auth
899
914
900
915
Update an existing source by its ID.
901
916
917
+
Config flags without `--type` are applied to the source's current type, which is looked up first.
918
+
919
+
The auth flags build config.auth from the source type's own verification methods in the API spec. `--webhook-secret` sends webhook_secret_key; on WEBHOOK and HTTP it adds the HMAC settings those types need (sha256, hex, header x-webhook-signature), and on every other type it sends the secret alone so the provider's own header and algorithm apply. `--hmac-secret` sends that HMAC shape (with `--hmac-algo`) wherever the type's method takes an algorithm, and otherwise behaves like `--webhook-secret`. `--api-key` sends api_key; WEBHOOK and HTTP also get header x-api-key, while a type that needs its own header name is refused, because no flag sets it: pass config.auth with header_key through `--config`. Types that offer a choice of method (WEBHOOK, HTTP, GITLAB, GRAFANA and others) also need auth_type; the flags set it to the method they used. A flag no method of the type can express is refused, with the methods the type accepts. When auth comes from `--config` without auth_type, it is set only if the auth fields fit exactly one method (for example, webhook_secret_key alone is STANDARD_WEBHOOKS on WEBHOOK). Set auth_type in `--config` to choose the method yourself.
| `--webhook-secret` | `string` | Webhook secret the source verifies signatures with; sent as webhook_secret_key, plus HMAC settings on WEBHOOK and HTTP only |
Create a new source or update an existing one by name (idempotent).
960
979
980
+
When `--type` is omitted and the source already exists, its current type is kept,
981
+
along with its verification unless you pass new auth flags or config. When the
982
+
source does not exist, it is created as a WEBHOOK source. Pass `--type` to change
983
+
an existing source's type.
984
+
985
+
The auth flags build config.auth from the source type's own verification methods in the API spec. `--webhook-secret` sends webhook_secret_key; on WEBHOOK and HTTP it adds the HMAC settings those types need (sha256, hex, header x-webhook-signature), and on every other type it sends the secret alone so the provider's own header and algorithm apply. `--hmac-secret` sends that HMAC shape (with `--hmac-algo`) wherever the type's method takes an algorithm, and otherwise behaves like `--webhook-secret`. `--api-key` sends api_key; WEBHOOK and HTTP also get header x-api-key, while a type that needs its own header name is refused, because no flag sets it: pass config.auth with header_key through `--config`. Types that offer a choice of method (WEBHOOK, HTTP, GITLAB, GRAFANA and others) also need auth_type; the flags set it to the method they used. A flag no method of the type can express is refused, with the methods the type accepts. When auth comes from `--config` without auth_type, it is set only if the auth fields fit exactly one method (for example, webhook_secret_key alone is STANDARD_WEBHOOKS on WEBHOOK). Set auth_type in `--config` to choose the method yourself.
|`--webhook-secret`|`string`| Webhook secret thesourceverifies signatures with; sent as webhook_secret_key, plus HMAC settings on WEBHOOK and HTTP only|
0 commit comments