Skip to content

Commit

Permalink
Merge pull request #92 from strmprivacy/feature/strm-1122
Browse files Browse the repository at this point in the history
expose kafka topic in streams (api 2.35.0)
  • Loading branch information
bvdeenen authored May 19, 2022
2 parents 09a8e12 + 2d28339 commit 3c33291
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 20 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ require (
github.com/spf13/cobra v1.3.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.10.0
github.com/strmprivacy/api-definitions-go/v2 v2.30.0
github.com/strmprivacy/api-definitions-go/v2 v2.35.0
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
google.golang.org/grpc v1.44.0
google.golang.org/grpc v1.46.0
google.golang.org/protobuf v1.27.1
gopkg.in/natefinch/lumberjack.v2 v2.0.0
sigs.k8s.io/yaml v1.3.0
Expand Down
153 changes: 153 additions & 0 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/entity/data_connector/azure_blob_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const (
tenantIdFlag = "tenant-id"
clientIdFlag = "client-id"
clientSecretFlag = "client-secret"
longDocBlobStorage = `Creates a data connector for an Azure Blob Storage container. Authentication is based on
longDocBlobStorage = `Creates a data connector for an Azure Blob Storage container. Authentication is based on
Client Secret Credentials, i.e. of an Application Principal.
### Usage`
Expand Down
5 changes: 3 additions & 2 deletions pkg/entity/data_connector/gcs_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const (
### Usage`
)

func createGcsBucketCmd() *cobra.Command {
gcsBucket := &cobra.Command{
Use: "gcs [data-connector-name] [bucket-name]",
Expand All @@ -28,8 +29,8 @@ func createGcsBucketCmd() *cobra.Command {
Ref: ref(dataConnectorName),
Location: &entities.DataConnector_GoogleCloudStorageBucket{
GoogleCloudStorageBucket: &entities.GoogleCloudStorageBucketLocation{
BucketName: *bucketName,
Credentials: credentials,
BucketName: *bucketName,
Credentials: credentials,
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/entity/data_connector/s3_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

const (
assumeRoleArnFlag = "assume-role-arn"
longDocS3 = `Creates a data connector for an AWS S3 bucket. An ARN can be specified in case a role should be assumed.
longDocS3 = `Creates a data connector for an AWS S3 bucket. An ARN can be specified in case a role should be assumed.
### Usage`
)
Expand Down
5 changes: 3 additions & 2 deletions pkg/entity/installation/installation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package installation

import (
"context"
"fmt"
"github.com/spf13/cobra"
"github.com/strmprivacy/api-definitions-go/v2/api/installations/v1"
"google.golang.org/grpc"
Expand Down Expand Up @@ -36,9 +35,11 @@ func namesCompletion(cmd *cobra.Command, args []string, complete string) ([]stri
if auth.Auth.BillingIdAbsent() {
return common.MissingBillingIdCompletionError(cmd.CommandPath())
}
if len(args) != 0 {
return nil, cobra.ShellCompDirectiveNoFileComp
}
req := &installations.ListInstallationsRequest{}
response, err := client.ListInstallations(apiContext, req)
fmt.Println(response)
if err != nil {
return common.GrpcRequestCompletionError(err)
}
Expand Down
34 changes: 22 additions & 12 deletions pkg/entity/stream/printers.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ func (p deletePrinter) Print(data interface{}) {

func printTable(streamTreeArray []*v1.StreamTree) {
rows := make([]table.Row, 0, len(streamTreeArray))
// topics are only set for CCD installations. We don't yet have the installation
// id inside the StreamTree, so we have this workaround to only show a topic
// column if any of the shown streams has a topic
hasTopics := false

for _, stream := range streamTreeArray {
var consentLevelType string
Expand All @@ -98,25 +102,31 @@ func printTable(streamTreeArray []*v1.StreamTree) {
consentLevelType = ""
}

rows = append(rows, table.Row{
row := table.Row{
stream.Stream.Ref.Name,
len(stream.Stream.LinkedStream) != 0,
consentLevelType,
stream.Stream.ConsentLevels,
stream.Stream.Enabled,
})
}
if len(stream.Stream.KafkaTopic) != 0 {
row = append(row, stream.Stream.KafkaTopic)
hasTopics = true
}
rows = append(rows, row)
}

util.RenderTable(
table.Row{
"Stream",
"Derived",
"Consent Level Type",
"Consent Levels",
"Enabled",
},
rows,
)
headers := table.Row{
"Stream",
"Derived",
"Consent Level Type",
"Consent Levels",
"Enabled",
}
if hasTopics {
headers = append(headers, "Kafka Topic")
}
util.RenderTable(headers, rows)
}

func printPlain(streamTreeArray []*v1.StreamTree) {
Expand Down

0 comments on commit 3c33291

Please sign in to comment.