iotutil

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddThingToGroup

func AddThingToGroup(ctx context.Context, thingName, groupName string) error

AddThingToGroup adds a thing to a thing group

func AttachCertificateToThing

func AttachCertificateToThing(ctx context.Context, thingName, certArn string) error

AttachCertificateToThing attaches a certificate to a thing

func AttachDefaultPolicy

func AttachDefaultPolicy(ctx context.Context, certArn string, capabilities []string) error

AttachDefaultPolicy attaches the default thing policy to a certificate. Per-capability additions owned by core are attached on top of the base policy:

  • "s3" → rmng-node-file-policy (S3 file access via IoT Credential Provider)
  • "kvs" → rmng-node-video-policy (KVS access via IoT Credential Provider)

Capability policies owned by a separately-deployed optional stack are attached out-of-band by the node-register lifecycle hook (nodelifecycle.OnNodeRegister), not here.

func CreateSignalingChannel

func CreateSignalingChannel(ctx context.Context, channelName string) error

CreateSignalingChannel creates a KVS signaling channel with the given name. Returns nil if the channel already exists (idempotent).

func CreateThing

func CreateThing(ctx context.Context, thingName string) error

CreateThing creates a new thing in AWS IoT Core

func CreateThingGroup

func CreateThingGroup(ctx context.Context, groupName string, parentGroupName string) error

CreateThingGroup creates a thing group, optionally under a parent group.

func CreateThingWithAttributes

func CreateThingWithAttributes(ctx context.Context, thingName string, attributes map[string]string) error

CreateThingWithAttributes creates an IoT Thing with the provided attribute payload. Pass a nil/empty map for no attributes (identical to CreateThing). Used to create child Things with custom attributes.

func DeleteCertificate

func DeleteCertificate(ctx context.Context, certID string) error

DeleteCertificate deletes a certificate from AWS IoT Core

func DeleteThing

func DeleteThing(ctx context.Context, thingName string) error

DeleteThing deletes a thing from AWS IoT Core. Idempotent — returns nil if the thing does not exist. The node-registration rollback path (and other cleanup flows) rely on this being safe to call twice.

func DescribeCertificateARN

func DescribeCertificateARN(ctx context.Context, certID string) (string, error)

DescribeCertificateARN returns the canonical ARN for an existing AWS IoT certificate. Used by the registration retry path to recover an ARN for a cert that was registered by an earlier (partial) attempt.

func DescribeThingGroup

func DescribeThingGroup(ctx context.Context, groupName string) (*iot.DescribeThingGroupOutput, error)

DescribeThingGroup returns metadata for a thing group, or nil if it does not exist.

func DetachThingPrincipal

func DetachThingPrincipal(ctx context.Context, thingName, principal string) error

DetachThingPrincipal detaches a certificate from a thing

func ExtractCertIDFromARN

func ExtractCertIDFromARN(arn string) (string, error)

func GetCertIDFromPEM

func GetCertIDFromPEM(certPEM string) (string, error)

GetCertIDFromPEM derives the AWS IoT certificate ID for a PEM-encoded certificate without making an API call. AWS IoT defines the cert ID as the lowercase hex SHA-256 of the certificate's DER bytes; computing it locally lets us recover the cert's identity (and ARN, via DescribeCertificate) when RegisterCertificate returns ResourceAlreadyExistsException on retry.

func GetThingCertificates

func GetThingCertificates(ctx context.Context, thingName string) ([]*types.CertificateDescription, error)

func HasCapability

func HasCapability(capabilities []string, target string) bool

HasCapability checks if a specific capability is present in the capabilities slice.

func ListThingGroups

func ListThingGroups(ctx context.Context) ([]string, error)

func RegisterCertificate

func RegisterCertificate(ctx context.Context, certPEM string) (string, error)

RegisterCertificate registers a certificate with AWS IoT Core

func UpdateCertificate

func UpdateCertificate(ctx context.Context, certID string, status types.CertificateStatus) error

func UpdateThingAttribute

func UpdateThingAttribute(ctx context.Context, thingName, attributeKey, attributeValue string) error

UpdateThingAttribute sets a single attribute on an IoT thing. Pass an empty string as attributeValue to effectively clear the attribute. This is a best-effort operation; callers should log but not propagate errors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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