Skip to main content

network_policies

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

Overview

Namenetwork_policies
TypeResource
Idsnowflake.network_policy.network_policies

Fields

NameDatatypeDescription
namestringName of the network policy
allowed_ip_listarrayList of allowed IPs in a network policy
allowed_network_rule_listarrayList of names of allowed network rules in a network policy
blocked_ip_listarrayList of blocked IPs in a network policy
blocked_network_rule_listarrayList of names of blocked network rules in a network policy
commentstringuser comment associated to an object in the dictionary
created_onstringDate and time when the network policy was created.
ownerstringRole that owns the network policy
owner_role_typestringThe type of role that owns the network policy

Methods

NameAccessible byRequired ParamsDescription
fetch_network_policySELECTname, endpointFetch a network policy
list_network_policiesSELECTendpointList network policies
create_network_policyINSERTdata__name, endpointCreate a network policy
delete_network_policyDELETEname, endpointDelete a network policy

SELECT examples

List network policies

SELECT
name,
allowed_ip_list,
allowed_network_rule_list,
blocked_ip_list,
blocked_network_rule_list,
comment,
created_on,
owner,
owner_role_type
FROM snowflake.network_policy.network_policies
WHERE endpoint = '{{ endpoint }}';

INSERT example

Use the following StackQL query and manifest file to create a new network_policies resource.

/*+ create */
INSERT INTO snowflake.network_policy.network_policies (
data__name,
data__allowed_network_rule_list,
data__blocked_network_rule_list,
data__allowed_ip_list,
data__blocked_ip_list,
data__comment,
endpoint
)
SELECT
'{{ name }}',
'{{ allowed_network_rule_list }}',
'{{ blocked_network_rule_list }}',
'{{ allowed_ip_list }}',
'{{ blocked_ip_list }}',
'{{ comment }}',
'{{ endpoint }}'
;

DELETE example

Deletes the specified network_policies resource.

/*+ delete */
DELETE FROM snowflake.network_policy.network_policies
WHERE name = '{{ name }}'
AND endpoint = '{{ endpoint }}';