Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
feat(firehose): history revamp (#49)
Browse files Browse the repository at this point in the history
* feat(firehose): revamp history

* chore: update swagger

* feat(firehose): use model from entropy for scale and start action

* feat(firehose): enrich history with the actor

* feat: use temporary library for building history

* feat(firehose): allow editing group

* feat(firehose): change reset and scale API to put

* feat(firehose): use reset payload from entropy

* feat(firehose): move createdBy to root model

* feat(firehose): handle multiple topics

* fix(firehose): partial update not handling stencil url

* feat(firehose): use URN instead of helm release name for siren identifier
  • Loading branch information
StewartJingga authored Aug 7, 2023
1 parent 54f56c2 commit bf01953
Show file tree
Hide file tree
Showing 16 changed files with 618 additions and 479 deletions.
12 changes: 6 additions & 6 deletions compass/compass.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Schema struct {

func GetTopicSchema(ctx context.Context, cl compassv1beta1grpc.CompassServiceClient,
userID, projectSlug, stream, topic string, protoNames []string,
) (*Schema, error) {
) (Schema, error) {
md := metadata.New(map[string]string{"X-Shield-User-Id": userID})

res, err := cl.GetAllAssets(
Expand All @@ -45,29 +45,29 @@ func GetTopicSchema(ctx context.Context, cl compassv1beta1grpc.CompassServiceCli
grpc.Header(&metadata.MD{}),
)
if err != nil {
return nil, err
return Schema{}, err
}

schemaSet := makeSet(protoNames)
for _, asset := range res.GetData() {
val, err := protojson.Marshal(asset.GetData())
if err != nil {
return nil, err
return Schema{}, err
}

var ad assetData
if err := json.Unmarshal(val, &ad); err != nil {
return nil, err
return Schema{}, err
}

for _, schema := range ad.Attributes.Schemas {
if _, found := schemaSet[schema.Name]; found {
return &schema, nil
return schema, nil
}
}
}

return nil, errors.ErrNotFound.WithMsgf("no schema found")
return Schema{}, errors.ErrNotFound.WithMsgf("no schema found")
}

func makeSet(arr []string) map[string]struct{} {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

105 changes: 6 additions & 99 deletions generated/client/operations/get_firehose_history_responses.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 36 additions & 8 deletions generated/models/firehose.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bf01953

Please sign in to comment.