Module: Microsandbox::Destination

Defined in:
lib/microsandbox/network.rb

Overview

Factory for network-policy **rule destinations**. A destination is what an egress rule reaches (or, for an ingress rule, the connecting peer). Use the explicit constructors for unambiguous typing, or pass a plain String to Rule.allow/Rule.deny for shorthand classification (see Rule).

Mirrors the ‘Destination` factory in the official Python/Node/Go SDKs.

Examples:

Microsandbox::Destination.cidr("10.0.0.0/8")
Microsandbox::Destination.domain("api.openai.com")
Microsandbox::Destination.group(:public)

Class Method Summary collapse

Class Method Details

.anyObject

Match any destination.



19
# File 'lib/microsandbox/network.rb', line 19

def any = { "destination_kind" => "any" }

.cidr(value) ⇒ Object

An IP network in CIDR notation (e.g. “10.0.0.0/8”).



25
# File 'lib/microsandbox/network.rb', line 25

def cidr(value) = { "destination_kind" => "cidr", "destination" => value.to_s }

.domain(value) ⇒ Object

An exact domain name (matched against the resolved-hostname cache / SNI).



28
# File 'lib/microsandbox/network.rb', line 28

def domain(value) = { "destination_kind" => "domain", "destination" => value.to_s }

.domain_suffix(value) ⇒ Object

A domain suffix — matches the apex and any subdomain (e.g. “.internal”).



31
# File 'lib/microsandbox/network.rb', line 31

def domain_suffix(value) = { "destination_kind" => "domain_suffix", "destination" => value.to_s }

.group(value) ⇒ Object

A predefined group: :public, :loopback, :private, :link_local, :metadata, :multicast, or :host.



35
# File 'lib/microsandbox/network.rb', line 35

def group(value) = { "destination_kind" => "group", "destination" => value.to_s.tr("_", "-") }

.ip(value) ⇒ Object

A single IP address (stored as a /32 or /128).



22
# File 'lib/microsandbox/network.rb', line 22

def ip(value) = { "destination_kind" => "ip", "destination" => value.to_s }