flipt icon indicating copy to clipboard operation
flipt copied to clipboard

[FLI-648] Flipt Export API

Open markphelps opened this issue 2 years ago • 3 comments

Make /export endpoint that will allow users to export all their data to *.features.yml files

Will essentially duplicate the logic that we have for the flipt export command.

The endpoint should allow for either exporting ALL namespaces or a specific namespace id

Example (open for design)

# export all data
/api/v1/export/

# export specific namespace
/api/v1/export/namespace/foo

Will need to likely break this issue down into smaller issues

From SyncLinear.com | FLI-602

From SyncLinear.com | FLI-648

markphelps avatar Oct 30 '23 16:10 markphelps

I think JSON (when over HTTP) would be the most appropriate format for both endpoints. We could just create a parent object and either have a list or object (keyed by namespace) to envelope them in.

Tooling (like the CLI) could convert to yaml if requested.

{
    "namespaces": [ {"namespace": "default", "flags": []}, ... ]
}
{
    "namespaces": { "default": {"namespace": "default", "flags": []}, ... }
}

I did the work in my OCI spike to start support JSON marshalling of the ext.Document format. You could take those changes for this.

GeorgeMac avatar Oct 30 '23 16:10 GeorgeMac

Here are all the tags and the marshal / unmarshal funcs for segment types: https://github.com/flipt-io/flipt/blob/gm/oci/internal/ext/common.go

GeorgeMac avatar Oct 30 '23 16:10 GeorgeMac

Infact, if you implement it as a one way grpc stream, gateway will just map that onto a newline delimited JSON stream for HTTP:

https://github.com/grpc-ecosystem/grpc-gateway#supported

GeorgeMac avatar Oct 30 '23 16:10 GeorgeMac