utils

package
v0.0.0-...-c8c6e10 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const SYSTEM_ACTOR = "system"

Variables

This section is empty.

Functions

func APIGwRespJSON

func APIGwRespJSON(statusCode int, body interface{}) events.APIGatewayProxyResponse

CreateAPIGatewayResponse creates a standardized API Gateway response

func APIGwRespText

func APIGwRespText(statusCode int, body string) events.APIGatewayProxyResponse

func ConvertAnyToAny

func ConvertAnyToAny(source any, ptrToTarget any) error

ConvertAnyToAny converts between different types using JSON marshaling/unmarshaling This function supports the following conversions: - Map to struct - Struct to struct - Struct to map - Map to map

Note: This function does not overwrite fields in the target that are not present in the source. Like MERGES both. All numbers are unmarshaled to float64 when using map as the target. If you convert from map to struct, the extra fields will be LOST

func GetGroupPermissions

func GetGroupPermissions(accessType GroupAccessType) []string

func GetOptional

func GetOptional[T any](v []T) T

GetOptional returns the first element of a slice or the zero value if the slice is empty

func InitLogger

func InitLogger(logConfig map[string]interface{})

func IsEmpty

func IsEmpty[T any](v T) bool

func Ptr

func Ptr[T any](v T) *T

func PtrValue

func PtrValue[T any](v *T) T

PtrValue returns the value pointed to by v or the zero value if v is nil

func RMErrorMarshaler

func RMErrorMarshaler(err error) interface{}

RMErrorMarshaler implements custom stack marshaling for rmerror.RMError

func ResetTestEnvVars

func ResetTestEnvVars(envVars map[string]string)

func SetTestEnvVars

func SetTestEnvVars(envVars map[string]string)

func ToString

func ToString(i interface{}) string

Types

type APIStatus

type APIStatus struct {
	Message string `json:"message"`
}

func NewAPIStatus

func NewAPIStatus(message string) *APIStatus

type AdminConfigActions

type AdminConfigActions string

AdminConfigActions gate access to the rmng_admin_config table — the shared store for runtime-set admin configuration that needs to survive CloudFormation redeploys (see docs/en/specs/iot_event_mode.md §4.4 and rmneo/handlers/admin/admin_config_base.py). Resource is the row's config_key (e.g. "iot_event_mode"); writers must hold AdminConfigSet, readers AdminConfigGet. Granted exclusively to SystemActor and superAdmin callers — this table is never user-facing.

const (
	// All
	AdminConfigAll AdminConfigActions = "adminconfig:*"
	// Read a config row
	AdminConfigGet AdminConfigActions = "adminconfig:get"
	// Write a config row
	AdminConfigSet AdminConfigActions = "adminconfig:set"
)

func (AdminConfigActions) String

func (a AdminConfigActions) String() string

type FilterWriter

type FilterWriter struct {
	// contains filtered or unexported fields
}

FilterWriter implements custom filtering logic

func (*FilterWriter) AddAllowFilter

func (w *FilterWriter) AddAllowFilter(key, value string)

func (*FilterWriter) Write

func (w *FilterWriter) Write(p []byte) (n int, err error)

func (*FilterWriter) WriteLevel

func (w *FilterWriter) WriteLevel(level zerolog.Level, p []byte) (n int, err error)

type GroupAccessType

type GroupAccessType string
const (
	GroupPrimaryAccess   GroupAccessType = "primary"
	GroupSecondaryAccess GroupAccessType = "secondary"
	GroupSubEntityAccess GroupAccessType = "subentity"
)

type GroupActions

type GroupActions string

GroupActions are the actions that can be performed on a group These actions are only applicable to the parent group, not the sub-groups As of now no RBAC is applied to the sub-groups, so no actions are defined for them. They always operate under the permissions of the parent group

const (
	// All
	GroupAll GroupActions = "group:*"
	// Create a Group
	GroupCreate GroupActions = "group:create"
	// Create a SubGroup within a Group
	GroupCreateSubGroup GroupActions = "group:createsubgroup"
	// List or Get a Group
	GroupGet GroupActions = "group:get"
	// List or Get a SubEntity within a Group
	GroupListSubEntities GroupActions = "group:listsubentities"
	// Add/Remove a Node to/from a Group
	GroupEditNodes GroupActions = "group:editnodes"
	// Update a Group (e.g., rename, services)
	GroupUpdate GroupActions = "group:update"
	// Update a SubGroup (e.g., rename)
	GroupUpdateSubGroup GroupActions = "group:updatesubgroup"
	// Enable/Update capabilities on a Group (e.g., convert to a Matter fabric)
	GroupUpdateCapabilities GroupActions = "group:updatecapabilities"
	// Delete a Group
	GroupDelete GroupActions = "group:delete"
	// Delete a SubGroup
	GroupDeleteSubGroup GroupActions = "group:deletesubgroup"
	// Share a Group with a User
	GroupShare GroupActions = "group:share"
	// List Users who have access to a Group
	GroupListUsers GroupActions = "group:listusers"
	// List Users who have primary access to a Group
	GroupListPrimaryUsers GroupActions = "group:listprimaryusers"
	// Automation-specific permissions
	GroupGetAutomation    GroupActions = "group:getautomation"
	GroupEditAutomation   GroupActions = "group:editautomation"
	GroupDeleteAutomation GroupActions = "group:deleteautomation"
)

func (GroupActions) String

func (g GroupActions) String() string

type NodeActions

type NodeActions string
const (
	// All
	NodeAll NodeActions = "node:*"
	// Get a Node
	NodeGet NodeActions = "node:get"
	// Node update (except config and sadow)
	NodeUpdate NodeActions = "node:update"
	// Delete a Node Config
	NodeDeleteConfig NodeActions = "node:deleteconfig"
	// Put a Node Config
	NodePutConfig NodeActions = "node:putconfig"
	// Add a Node to a Group
	NodeEditGroups NodeActions = "node:editgroups"
	// Write to the reported shadow of a Node
	NodeWriteShadow NodeActions = "node:writeshadow"
	// Read from the shadow of a Node
	NodeReadShadow NodeActions = "node:readshadow"
	// Publish to Device's topics
	NodePublishToDevice NodeActions = "node:publishtodevice"
)

func (NodeActions) String

func (n NodeActions) String() string

type NodeAdminActions

type NodeAdminActions string
const (
	// All
	NodeAdminAll NodeAdminActions = "nodeadmin:*"
	// Add a Node
	NodeAdminAdd NodeAdminActions = "nodeadmin:add"
	// Node regsiter status
	NodeAdminRegisterStatus NodeAdminActions = "nodeadmin:registerstatus"
	// Create a node-ID reservation for a claim key.
	// Resource is the reservation's mac_addr.
	NodeAdminReserveID NodeAdminActions = "nodeadmin:reserveid"
	// Read a single node-ID reservation, keyed by its device.
	// Resource is the reservation's mac_addr.
	NodeAdminGetReservation NodeAdminActions = "nodeadmin:getreservation"
	// Count a claimant's node-ID reservations for quota enforcement. This is a
	// claimant-scoped operation spanning all of the claimant's devices, so the
	// resource is the claimant_id — not a mac_addr, unlike the two above.
	NodeAdminCountReservations NodeAdminActions = "nodeadmin:countreservations"
)

func (NodeAdminActions) String

func (na NodeAdminActions) String() string

type RlogType

type RlogType struct {
	zerolog.Logger
}
var Rlog RlogType

type SystemActor

type SystemActor struct {
	SystemID    string
	Permissions rbac.EntityPermissions
}

func NewSystemActor

func NewSystemActor() *SystemActor

func (*SystemActor) GetID

func (sa *SystemActor) GetID() string

func (*SystemActor) GetPermissions

func (sa *SystemActor) GetPermissions() *rbac.EntityPermissions

Directories

Path Synopsis
Package certissuer produces device certificates from a validated public key under a named profile.
Package certissuer produces device certificates from a validated public key under a named profile.
Package httpclient owns the process-wide outbound HTTP client so every outbound call shares one timeout and one seam tests can replace.
Package httpclient owns the process-wide outbound HTTP client so every outbound call shares one timeout and one seam tests can replace.
Package jsonutils converts between a dotted key path ("0x1.c.s.0x6.a.0x0") and its nested map form ({"0x1":{"c":{"s":{"0x6":{"a":{"0x0":<value>}}}}}}).
Package jsonutils converts between a dotted key path ("0x1.c.s.0x6.a.0x0") and its nested map form ({"0x1":{"c":{"s":{"0x6":{"a":{"0x0":<value>}}}}}}).
Package jwtutils holds reusable RS256 JWT + JWK helpers: sign a claim set with a kid-stamped header, verify a token against a JWK set, parse an RSA signing key, and build the public JWK/JWKS.
Package jwtutils holds reusable RS256 JWT + JWK helpers: sign a claim set with a kid-stamped header, verify a token against a JWK set, parse an RSA signing key, and build the public JWK/JWKS.
Package metrics provides CloudWatch Embedded Metrics Format (EMF) support for Lambda functions to emit custom metrics without API call overhead.
Package metrics provides CloudWatch Embedded Metrics Format (EMF) support for Lambda functions to emit custom metrics without API call overhead.
Package otputils holds generic, table-agnostic OTP helpers: id/code generation and salted-hash create/verify.
Package otputils holds generic, table-agnostic OTP helpers: id/code generation and salted-hash create/verify.
Package pkceutil derives and verifies RFC 7636 PKCE code challenges.
Package pkceutil derives and verifies RFC 7636 PKCE code challenges.
Package rlog provides a global logger for rmng.
Package rlog provides a global logger for rmng.
Package secretutil generates cryptographically-random secrets/identifiers.
Package secretutil generates cryptographically-random secrets/identifiers.

Jump to

Keyboard shortcuts

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