Skip to main content

rules

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

Overview​

Namerules
TypeResource
Idokta.authorizationservers.rules

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringIdentifier of the rule
namestringName of the rule
_linksobjectSpecifies link relations (see Web Linking) available using the JSON Hypertext Application Language specification. This object is used for dynamic discovery of related resources and lifecycle operations.
actionsstring(opaque JSON object)
conditionsobject
createdstring (date-time)Timestamp when the rule was created
lastUpdatedstring (date-time)Timestamp when the rule was last modified
priorityintegerPriority of the rule
statusstringStatus of the rule (ACTIVE, INACTIVE)
systembooleanSet to true for system rules. You can't delete system rules.
typestringRule type (RESOURCE_ACCESS)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_authorization_server_policy_ruleselectauthServerId, policyId, ruleId, subdomainRetrieves a policy rule by ruleId
list_authorization_server_policy_rulesselectauthServerId, policyId, subdomainLists all policy rules for the specified Custom Authorization Server and Policy
create_authorization_server_policy_ruleinsertauthServerId, policyId, subdomain, name, conditions, typeCreates a policy rule for the specified Custom Authorization Server and Policy
replace_authorization_server_policy_rulereplaceauthServerId, policyId, ruleId, subdomain, name, conditions, typeReplaces the configuration of the Policy Rule defined in the specified Custom Authorization Server and Policy
delete_authorization_server_policy_ruledeleteauthServerId, policyId, ruleId, subdomainDeletes a Policy Rule defined in the specified Custom Authorization Server and Policy
activate_authorization_server_policy_ruleexecauthServerId, policyId, ruleId, subdomainActivates an authorization server policy rule
deactivate_authorization_server_policy_ruleexecauthServerId, policyId, ruleId, subdomainDeactivates an authorization server policy rule

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
authServerIdstringid of the Authorization Server
policyIdstringid of the policy
ruleIdstringid of the policy rule
subdomainstring(default: my-org)

SELECT examples​

Retrieves a policy rule by ruleId

SELECT
id,
name,
_links,
actions,
conditions,
created,
lastUpdated,
priority,
status,
system,
type
FROM okta.authorizationservers.rules
WHERE authServerId = '{{ authServerId }}' -- required
AND policyId = '{{ policyId }}' -- required
AND ruleId = '{{ ruleId }}' -- required
AND subdomain = '{{ subdomain }}' -- required
;

INSERT examples​

Creates a policy rule for the specified Custom Authorization Server and Policy

INSERT INTO okta.authorizationservers.rules (
actions,
conditions,
name,
priority,
status,
system,
type,
authServerId,
policyId,
subdomain
)
SELECT
'{{ actions }}',
'{{ conditions }}' /* required */,
'{{ name }}' /* required */,
{{ priority }},
'{{ status }}',
{{ system }},
'{{ type }}' /* required */,
'{{ authServerId }}',
'{{ policyId }}',
'{{ subdomain }}'
RETURNING
id,
name,
_links,
actions,
conditions,
created,
lastUpdated,
priority,
status,
system,
type
;

REPLACE examples​

Replaces the configuration of the Policy Rule defined in the specified Custom Authorization Server and Policy

REPLACE okta.authorizationservers.rules
SET
actions = '{{ actions }}',
conditions = '{{ conditions }}',
name = '{{ name }}',
priority = {{ priority }},
status = '{{ status }}',
system = {{ system }},
type = '{{ type }}'
WHERE
authServerId = '{{ authServerId }}' --required
AND policyId = '{{ policyId }}' --required
AND ruleId = '{{ ruleId }}' --required
AND subdomain = '{{ subdomain }}' --required
AND name = '{{ name }}' --required
AND conditions = '{{ conditions }}' --required
AND type = '{{ type }}' --required
RETURNING
id,
name,
_links,
actions,
conditions,
created,
lastUpdated,
priority,
status,
system,
type;

DELETE examples​

Deletes a Policy Rule defined in the specified Custom Authorization Server and Policy

DELETE FROM okta.authorizationservers.rules
WHERE authServerId = '{{ authServerId }}' --required
AND policyId = '{{ policyId }}' --required
AND ruleId = '{{ ruleId }}' --required
AND subdomain = '{{ subdomain }}' --required
;

Lifecycle Methods​

Activates an authorization server policy rule

EXEC okta.authorizationservers.rules.activate_authorization_server_policy_rule
@authServerId='{{ authServerId }}' --required,
@policyId='{{ policyId }}' --required,
@ruleId='{{ ruleId }}' --required,
@subdomain='{{ subdomain }}' --required
;