github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/environs/models/model.go (about)

     1  // Copyright 2023 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package models
     5  
     6  import (
     7  	"github.com/juju/juju/core/network/firewall"
     8  	"github.com/juju/juju/environs/context"
     9  )
    10  
    11  // ModelFirewaller provides model-level firewall functionality
    12  type ModelFirewaller interface {
    13  	// OpenModelPorts opens the given port ranges on the model firewall
    14  	OpenModelPorts(ctx context.ProviderCallContext, rules firewall.IngressRules) error
    15  
    16  	// CloseModelPorts Closes the given port ranges on the model firewall
    17  	CloseModelPorts(ctx context.ProviderCallContext, rules firewall.IngressRules) error
    18  
    19  	// ModelIngressRules returns the set of ingress rules on the model firewall.
    20  	// The rules are returned as sorted by network.SortIngressRules().
    21  	// It is expected that there be only one ingress rule result for a given
    22  	// port range - the rule's SourceCIDRs will contain all applicable source
    23  	// address rules for that port range.
    24  	// If the model security group doesn't exist, return a NotFound error
    25  	ModelIngressRules(ctx context.ProviderCallContext) (firewall.IngressRules, error)
    26  }