Skip to content

Commit

Permalink
Merge pull request #30 from oreillymedia/CL-532-kinesis-signaling-cha…
Browse files Browse the repository at this point in the history
…nnels

CL-534 | add KinesisSignalingChannels module
  • Loading branch information
corybekk authored Aug 8, 2024
2 parents c334b85 + c1622c9 commit b1363ac
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions resources/kinesis-signaling-channels.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package resources

import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/kinesisvideo"
)

type KinesisSignalingChannels struct {
svc *kinesisvideo.KinesisVideo
ChannelARN *string
}

func init() {
register("KinesisSignalingChannels", ListKinesisSignalingChannels)
}

func ListKinesisSignalingChannels(sess *session.Session) ([]Resource, error) {
svc := kinesisvideo.New(sess)
resources := []Resource{}

params := &kinesisvideo.ListSignalingChannelsInput{
MaxResults: aws.Int64(100),
}

for {
output, err := svc.ListSignalingChannels(params)
if err != nil {
return nil, err
}

for _, streamInfo := range output.ChannelInfoList {
resources = append(resources, &KinesisSignalingChannels{
svc: svc,
ChannelARN: streamInfo.ChannelARN,
})
}

if output.NextToken == nil {
break
}

params.NextToken = output.NextToken
}

return resources, nil
}

func (f *KinesisSignalingChannels) Remove() error {

_, err := f.svc.DeleteSignalingChannel(&kinesisvideo.DeleteSignalingChannelInput{
ChannelARN: f.ChannelARN,
})

return err
}

func (f *KinesisSignalingChannels) String() string {
return *f.ChannelARN
}

0 comments on commit b1363ac

Please sign in to comment.