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

    Class NetworkPolicy

    Object-oriented interface for working with Network Policies.

    The NetworkPolicy class provides a high-level, object-oriented API for managing network policies. Network policies define egress network access rules for devboxes and can be applied to blueprints, devboxes, and snapshot resumes.

    import { RunloopSDK } from '@runloop/api-client-ts';

    const runloop = new RunloopSDK();
    const policy = await runloop.networkPolicy.create({
    name: 'my-policy',
    allow_all: false,
    allowed_hostnames: ['github.com', '*.npmjs.org'],
    });

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

    Accessors

    Methods

    Accessors

    Methods

    • Get the complete network policy data from the API.

      Parameters

      • Optionaloptions: RequestOptions<unknown>

        Request options

      Returns Promise<Runloop.NetworkPolicyView>

      The network policy data

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