securitygroup

package
v1.16.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

README

Security Group

Purpose

pkg/handler/securitygroup handles security groups in both the older v1 identity-scoped model and the preferred v2 network-linked model.

In v2, a security group is no longer addressed through an identity path. It is attached directly to a network and inherits most of its real context from that network.

So the distinctive concerns here are linkage, cascade, and a small amount of rule-shape validation rather than deep multi-object orchestration.

Distinctive Behaviour

  • v1 security groups are owned by an Identity
  • v2 security groups are owned by a Network
  • v2 create derives organization/project/region/identity context from the selected network
  • v2 rules are converted into a flatter wire shape with protocol/port/prefix validation rules

Invariants And Guard Rails

  • v2 is the intended model; v1 is compatibility surface only.
  • direct v2 object access is gated to resources labeled with ResourceAPIVersionLabel=2.
  • A SecurityGroup v2 must belong to a visible and authorized network in the same project context.
  • Deletion is primarily handled through the ownership graph rooted at the network rather than bespoke orchestration here.

Caveats

  • Most of the interesting behaviour here is inherited from the handler roll-up: inferred scope, direct shared-namespace lookup, and ownership graph semantics.
  • This package is intentionally not doing very much beyond linkage and rule translation; that is a sign of decent scoping rather than missing behaviour.

TODO

  • Delete the deprecated v1 handler surface once migration is complete.

Cross-Package Context

  • ../network is the real parent context for v2 security groups
  • ../README.md documents the shared v2 list/filter and direct-lookup model this package follows

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	common.ClientArgs
}

Client provides a restful API for identities.

func New

func New(clientArgs common.ClientArgs) *Client

New creates a new client.

func (*Client) Create

func (c *Client) Create(ctx context.Context, organizationID, projectID, identityID string, request *openapi.SecurityGroupWrite) (*openapi.SecurityGroupRead, error)

Create instantiates a new resource.

func (*Client) CreateV2 added in v1.11.0

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, organizationID, projectID, securityGroupID string) error

Delete a resource.

func (*Client) DeleteV2 added in v1.11.0

func (c *Client) DeleteV2(ctx context.Context, securityGroupID string) error

func (*Client) Get

func (c *Client) Get(ctx context.Context, organizationID, projectID, securityGroupID string) (*openapi.SecurityGroupRead, error)

Get a resource.

func (*Client) GetRaw

func (c *Client) GetRaw(ctx context.Context, organizationID, projectID, securityGroupID string) (*unikornv1.SecurityGroup, error)

GetRaw gives access to the raw Kubernetes resource.

func (*Client) GetV2 added in v1.11.0

func (c *Client) GetV2(ctx context.Context, securityGroupID string) (*openapi.SecurityGroupV2Read, error)

func (*Client) GetV2Raw added in v1.11.0

func (c *Client) GetV2Raw(ctx context.Context, securityGroupID string) (*regionv1.SecurityGroup, error)

func (*Client) List

List returns an ordered list of all resources in scope.

func (*Client) ListV2 added in v1.11.0

func (*Client) Update

func (c *Client) Update(ctx context.Context, organizationID, projectID, identityID, securityGroupID string, request *openapi.SecurityGroupWrite) (*openapi.SecurityGroupRead, error)

Update a resource.

func (*Client) UpdateV2 added in v1.11.0

func (c *Client) UpdateV2(ctx context.Context, securityGroupID string, request *openapi.SecurityGroupV2Update) (*openapi.SecurityGroupV2Read, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL