Skip to main content

rules

Creates, updates, deletes, gets or lists a rules resource.

Overview

Namerules
TypeResource
Idokta.groups.rules

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringID of the group rule
namestringName of the group rule
actionsobjectDefines which users and groups to assign
conditionsobjectDefines group rule conditions
createdstring (date-time)Creation date for group rule
lastUpdatedstring (date-time)Date group rule was last updated
statusstringStatus of group rule
typestringType to indicate a group rule operation. Only group_rule is allowed.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_group_rulesselectsubdomainlimit, after, search, expandLists all group rules for your org
get_group_ruleselectsubdomainexpandRetrieves a specific group rule by ID from your org
create_group_ruleinsertsubdomainCreates a group rule to dynamically add users to the specified group if they match the condition
> Note: Group rules are created with the status set to 'INACTIVE'.
replace_group_rulereplacesubdomainReplaces a group rule
> Notes: You can only update rules with a group whose status is set to 'INACTIVE'.
>
> You currently can't update the action section.
delete_group_ruledeletesubdomainremoveUsersDeletes a specific group rule by groupRuleId
activate_group_ruleexecsubdomainActivates a specific group rule by ID from your org
deactivate_group_ruleexecsubdomainDeactivates a specific group rule by ID from your org

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.

NameDatatypeDescription
subdomainstringThe domain of your organization. This can be a provided subdomain of an official okta domain (okta.com, oktapreview.com, etc) or one of your configured custom domains. (default: my-org)
afterstringSpecifies the pagination cursor for the next page of rules
expandstringIf specified as groupIdToGroupNameMap, then show group names
limitinteger (int32)Specifies the number of rule results in a page
removeUsersbooleanIf set to true, removes users from groups assigned by this rule

SELECT examples

Lists all group rules for your org

SELECT
id,
name,
actions,
conditions,
created,
lastUpdated,
status,
type
FROM okta.groups.rules
WHERE subdomain = '{{ subdomain }}' -- required
AND limit = '{{ limit }}'
AND after = '{{ after }}'
AND search = '{{ search }}'
AND expand = '{{ expand }}';

INSERT examples

Creates a group rule to dynamically add users to the specified group if they match the condition
> Note: Group rules are created with the status set to 'INACTIVE'.

INSERT INTO okta.groups.rules (
data__actions,
data__conditions,
data__name,
data__type,
subdomain
)
SELECT
'{{ actions }}',
'{{ conditions }}',
'{{ name }}',
'{{ type }}',
'{{ subdomain }}'
RETURNING
id,
name,
actions,
conditions,
created,
lastUpdated,
status,
type
;

REPLACE examples

Replaces a group rule
> Notes: You can only update rules with a group whose status is set to 'INACTIVE'.
>
> You currently can't update the action section.

REPLACE okta.groups.rules
SET
data__actions = '{{ actions }}',
data__conditions = '{{ conditions }}',
data__name = '{{ name }}',
data__status = '{{ status }}',
data__type = '{{ type }}'
WHERE
subdomain = '{{ subdomain }}' --required
RETURNING
id,
name,
actions,
conditions,
created,
lastUpdated,
status,
type;

DELETE examples

Deletes a specific group rule by groupRuleId

DELETE FROM okta.groups.rules
WHERE subdomain = '{{ subdomain }}' --required
AND removeUsers = '{{ removeUsers }}';

Lifecycle Methods

Activates a specific group rule by ID from your org

EXEC okta.groups.rules.activate_group_rule 
@subdomain='{{ subdomain }}' --required;