snowflake.core.network_policy.NetworkPolicyResource¶

class snowflake.core.network_policy.NetworkPolicyResource(name: Annotated[str, Strict(strict=True)], collection: NetworkPolicyCollection)¶

Bases: ObjectReferenceMixin[NetworkPolicyCollection]

Represents a reference to a Snowflake Network Policy resource.

With this network policy reference, you can create, update, and fetch information about network policies, as well as perform certain actions on them.

Attributes

root¶

Methods

drop(if_exists: bool | None = None) → None¶

Drop this network policy.

Parameters:

if_exists (bool, optional) – Check the existence of this network policy before dropping it. Default is None, which is equivalent to False.

Examples

Deleting a network policy using its reference:

>>> network_policy_reference.drop()
Copy

Deleting a network policy using its reference if it exists:

>>> network_policy_reference.drop(if_exists=True)
Copy
drop_async(if_exists: bool | None = None) → PollingOperation[None]¶

An asynchronous version of drop().

Refer to PollingOperation for more information on asynchronous execution and the return type.

fetch() → NetworkPolicy¶

Fetch the details of a network policy.

Examples

Fetching a network policy reference to print its time of creation:

>>> print(network_policy_reference.fetch().created_on)
Copy
fetch_async() → PollingOperation[NetworkPolicy]¶

An asynchronous version of fetch().

Refer to PollingOperation for more information on asynchronous execution and the return type.