org_custom_patterns
Creates, updates, deletes, gets or lists an org_custom_patterns resource.
Overview
| Name | org_custom_patterns |
| Type | Resource |
| Id | github.secret_scanning.org_custom_patterns |
Fields
The following fields are returned by SELECT queries:
- list_org_custom_patterns
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | The ID of the custom pattern. |
name | string | The name of the custom pattern. |
created_at | string (date-time) | The date and time the custom pattern was created in ISO 8601 format. |
custom_pattern_version | string | The version of the entity. This is used to confirm you're updating the current version of the entity and mitigate unintentionally overriding someone else's update. |
end_delimiter | string | The end delimiter regex for the custom pattern. |
must_match | array | List of regexes that the secret must match. |
must_not_match | array | List of regexes that the secret must not match. |
pattern | string | The regular expression of the custom pattern. |
push_protection_enabled | boolean | Whether push protection is enabled for this custom pattern. |
slug | string | A URL-friendly identifier for the custom pattern, derived from its name. |
start_delimiter | string | The start delimiter regex for the custom pattern. |
state | string | The state of the custom pattern. (published, unpublished) |
updated_at | string (date-time) | The date and time the custom pattern was last updated in ISO 8601 format. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_org_custom_patterns | select | org | state, push_protection, sort, direction, page, per_page | Lists secret scanning custom patterns for an organization. Personal access tokens (classic) need the read:org scope to use this endpoint. |
bulk_create_org_custom_patterns | insert | org, patterns | Bulk creates secret scanning custom patterns for an organization. Personal access tokens (classic) need the write:org scope to use this endpoint. | |
update_org_custom_pattern | update | org, pattern_id, custom_pattern_version, pattern, start_delimiter, end_delimiter, must_match, must_not_match | Updates a secret scanning custom pattern for an organization. Personal access tokens (classic) need the write:org scope to use this endpoint. | |
bulk_delete_org_custom_patterns | delete | org | Bulk deletes secret scanning custom patterns for an organization. Personal access tokens (classic) need the write:org scope to use this endpoint. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
org | string | The organization name. The name is not case sensitive. |
pattern_id | integer | The ID of the custom pattern. |
direction | string | The direction to sort the results by. |
page | integer | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
per_page | integer | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
push_protection | string | Filter custom patterns by whether push protection is enabled. When absent, returns patterns regardless of push protection status. |
sort | string | The property to sort the results by. |
state | string | Filter custom patterns by state. When absent, returns patterns in all states. |
SELECT examples
- list_org_custom_patterns
Lists secret scanning custom patterns for an organization.
Personal access tokens (classic) need the read:org scope to use this endpoint.
SELECT
id,
name,
created_at,
custom_pattern_version,
end_delimiter,
must_match,
must_not_match,
pattern,
push_protection_enabled,
slug,
start_delimiter,
state,
updated_at
FROM github.secret_scanning.org_custom_patterns
WHERE org = '{{ org }}' -- required
AND state = '{{ state }}'
AND push_protection = '{{ push_protection }}'
AND sort = '{{ sort }}'
AND direction = '{{ direction }}'
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
;
INSERT examples
- bulk_create_org_custom_patterns
- Manifest
Bulk creates secret scanning custom patterns for an organization.
Personal access tokens (classic) need the write:org scope to use this endpoint.
INSERT INTO github.secret_scanning.org_custom_patterns (
patterns,
org
)
SELECT
'{{ patterns }}' /* required */,
'{{ org }}'
RETURNING
created_patterns
;
# Description fields are for documentation purposes
- name: org_custom_patterns
props:
- name: org
value: "{{ org }}"
description: Required parameter for the org_custom_patterns resource.
- name: patterns
description: |
The list of custom patterns to create.
value:
- name: "{{ name }}"
pattern: "{{ pattern }}"
start_delimiter: "{{ start_delimiter }}"
end_delimiter: "{{ end_delimiter }}"
must_match: "{{ must_match }}"
must_not_match: "{{ must_not_match }}"
UPDATE examples
- update_org_custom_pattern
Updates a secret scanning custom pattern for an organization.
Personal access tokens (classic) need the write:org scope to use this endpoint.
UPDATE github.secret_scanning.org_custom_patterns
SET
pattern = '{{ pattern }}',
start_delimiter = '{{ start_delimiter }}',
end_delimiter = '{{ end_delimiter }}',
must_match = '{{ must_match }}',
must_not_match = '{{ must_not_match }}',
custom_pattern_version = '{{ custom_pattern_version }}'
WHERE
org = '{{ org }}' --required
AND pattern_id = '{{ pattern_id }}' --required
AND custom_pattern_version = '{{ custom_pattern_version }}' --required
AND pattern = '{{ pattern }}' --required
AND start_delimiter = '{{ start_delimiter }}' --required
AND end_delimiter = '{{ end_delimiter }}' --required
AND must_match = '{{ must_match }}' --required
AND must_not_match = '{{ must_not_match }}' --required
RETURNING
id,
name,
created_at,
custom_pattern_version,
end_delimiter,
must_match,
must_not_match,
pattern,
push_protection_enabled,
slug,
start_delimiter,
state,
updated_at;
DELETE examples
- bulk_delete_org_custom_patterns
Bulk deletes secret scanning custom patterns for an organization.
Personal access tokens (classic) need the write:org scope to use this endpoint.
DELETE FROM github.secret_scanning.org_custom_patterns
WHERE org = '{{ org }}' --required
;