@runloop/api-client - v1.4.0
    Preparing search index...

    Class NetworkPolicyOps

    Network Policy SDK interface for managing network policies.

    The NetworkPolicyOps class provides a high-level abstraction for managing network policies, which define egress network access rules for devboxes. Policies can be applied to blueprints, devboxes, and snapshot resumes to control network access.

    This interface is accessed via RunloopSDK.networkPolicy. You should construct a RunloopSDK instance and use it from there:

    const runloop = new RunloopSDK();
    const policy = await runloop.networkPolicy.create({
    name: 'restricted-policy',
    allow_all: false,
    allowed_hostnames: ['github.com', 'api.openai.com'],
    });

    const info = await policy.getInfo();
    console.log(`Policy: ${info.name}`);
    Index

    Methods

    • Get a network policy object by its ID.

      Parameters

      • id: string

        The ID of the network policy.

      Returns RunloopSDK.NetworkPolicy

      A NetworkPolicy instance.

      const runloop = new RunloopSDK();
      const policy = runloop.networkPolicy.fromId('npol_1234567890');
      const info = await policy.getInfo();
      console.log(`Policy name: ${info.name}`);