Skip to content

Commit

Permalink
S3 collector implementation (#1308)
Browse files Browse the repository at this point in the history
* Initial commit

Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>

* goimport files

Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>

* improve signal and error handling, correctly handle flags

Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>

* add non-polling behaviour, make it default

Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>

* Use pointer receivers

Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>

* Make struct private

Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>

* Use processor encodings

Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>

* Make struct private, remove unnecessary printing

Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>

* Use existing poll option, return error

Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>

* Use positional arguments for s3 host and port

Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>

* Remove unneeded loop

Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>

* Defer call to close message provider

Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>

* Remove unused var

Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>

* Return with error if message was not receiving

Signed-off-by: Ulf Lilleengen <[email protected]>

* Allow collector configuration to rely on SDK environment variables

* Command line flags can be used to override environment variables.
* Use URLs for s3 and messaging provider endpoints to allow transparent use of TLS

Signed-off-by: Ulf Lilleengen <[email protected]>

* Log bucket and identifier of document being downloaded

Signed-off-by: Ulf Lilleengen <[email protected]>

* fix: ensure the whole key is returned

Signed-off-by: Ulf Lilleengen <[email protected]>

* fix: ensure collector can shut down while processing

Signed-off-by: Ulf Lilleengen <[email protected]>

* fix: improve csub and gql option handling

Signed-off-by: Ulf Lilleengen <[email protected]>

* fix: match encoding type case insensitive

Signed-off-by: Dejan Bosanac <[email protected]>

* fix: unit tests

Signed-off-by: Ulf Lilleengen <[email protected]>

* fix: handle signals externally to the library

Use context in test to signal shutdown

Signed-off-by: Ulf Lilleengen <[email protected]>

* fix: remove newline from errors

Signed-off-by: Ulf Lilleengen <[email protected]>

* fix: remove use of fmt

Signed-off-by: Ulf Lilleengen <[email protected]>

* fix: support downloading all itmes in a bucket

Signed-off-by: Ulf Lilleengen <[email protected]>

* fix: modify unit test after API was changed

Signed-off-by: Ulf Lilleengen <[email protected]>

---------

Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>
Signed-off-by: Ulf Lilleengen <[email protected]>
Signed-off-by: Dejan Bosanac <[email protected]>
Co-authored-by: Ulf Lilleengen <[email protected]>
Co-authored-by: Dejan Bosanac <[email protected]>
  • Loading branch information
3 people authored Oct 27, 2023
1 parent 165897d commit 83b892c
Show file tree
Hide file tree
Showing 11 changed files with 1,260 additions and 0 deletions.
187 changes: 187 additions & 0 deletions cmd/guacone/cmd/s3.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
//
// Copyright 2023 The GUAC Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package cmd

import (
"context"
"fmt"
"os"
"os/signal"
"syscall"

"github.com/guacsec/guac/pkg/cli"
csub_client "github.com/guacsec/guac/pkg/collectsub/client"
"github.com/guacsec/guac/pkg/handler/collector"
"github.com/guacsec/guac/pkg/handler/collector/s3"
"github.com/guacsec/guac/pkg/handler/processor"
"github.com/guacsec/guac/pkg/ingestor"
"github.com/guacsec/guac/pkg/logging"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)

// s3Options flags for configuring the command
type s3Options struct {
s3url string // base url of the s3 to collect from
s3bucket string // name of bucket to collect from
s3item string // s3 item (only for non-polling behaviour)
region string // AWS region, for s3/sqs configuration (defaults to us-east-1)
queues string // comma-separated list of queues/topics (only for polling behaviour)
mp string // message provider name (sqs or kafka, will default to kafka)
mpEndpoint string // endpoint for the message provider (only for polling behaviour)
poll bool // polling or non-polling behaviour? (defaults to non-polling)
graphqlEndpoint string // endpoint for the graphql server
csubClientOptions csub_client.CsubClientOptions // options for the collectsub client
}

var s3Cmd = &cobra.Command{
Use: "s3 [flags]",
Short: "listens to kafka/sqs s3 events to download documents and add them to the GUAC graph, or directly downloads from s3",
Args: cobra.MinimumNArgs(0),
Run: func(cmd *cobra.Command, args []string) {
ctx := logging.WithLogger(context.Background())
logger := logging.FromContext(ctx)

s3Opts, err := validateS3Opts(
viper.GetString("gql-addr"),
viper.GetString("csub-addr"),
viper.GetBool("csub-tls"),
viper.GetBool("csub-tls-skip-verify"),
viper.GetString("s3-url"),
viper.GetString("s3-bucket"),
viper.GetString("s3-region"),
viper.GetString("s3-item"),
viper.GetString("s3-mp"),
viper.GetString("s3-mp-endpoint"),
viper.GetString("s3-queues"),
viper.GetBool("poll"),
)
if err != nil {
logger.Errorf("failed to validate flags: %v", err)
_ = cmd.Help()
os.Exit(1)
}

signals := make(chan os.Signal, 1)
signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM)

s3Collector := s3.NewS3Collector(s3.S3CollectorConfig{
S3Url: s3Opts.s3url,
S3Bucket: s3Opts.s3bucket,
S3Region: s3Opts.region,
S3Item: s3Opts.s3item,
MessageProvider: s3Opts.mp,
MessageProviderEndpoint: s3Opts.mpEndpoint,
Queues: s3Opts.queues,
Poll: s3Opts.poll,
})

if err := collector.RegisterDocumentCollector(s3Collector, s3.S3CollectorType); err != nil {
logger.Errorf("unable to register s3 collector: %v\n", err)
os.Exit(1)
}

csubClient, err := csub_client.NewClient(s3Opts.csubClientOptions)
if err != nil {
logger.Infof("collectsub client initialization failed, this ingestion will not pull in any additional data through the collectsub service: %v", err)
csubClient = nil
} else {
defer csubClient.Close()
}

errFound := false

emit := func(d *processor.Document) error {
err := ingestor.Ingest(ctx, d, s3Opts.graphqlEndpoint, csubClient)

if err != nil {
errFound = true
return fmt.Errorf("unable to ingest document: %w", err)
}
return nil
}

errHandler := func(err error) bool {
if err == nil {
logger.Info("collector ended gracefully")
return true
}
logger.Errorf("collector ended with error: %v", err)
return false
}

cancelCtx, cancel := context.WithCancel(ctx)
defer cancel()

// Send cancellation in case of receiving SIGINT/SIGTERM
go func(cancel context.CancelFunc) {
cancel()
}(cancel)

if err := collector.Collect(cancelCtx, emit, errHandler); err != nil {
logger.Fatal(err)
}

if errFound {
logger.Fatalf("completed ingestion with error")
} else {
logger.Infof("completed ingestion")
}
},
}

func validateS3Opts(graphqlEndpoint string, csubAddr string, csubTls bool, csubTlsSkipVerify bool, s3url string, s3bucket string, region string, s3item string, mp string, mpEndpoint string, queues string, poll bool) (s3Options, error) {
var opts s3Options

if poll {
if mp == "kafka" {
if len(mpEndpoint) == 0 {
return opts, fmt.Errorf("expected endpoint for message provider")
}
}
if len(queues) == 0 {
return opts, fmt.Errorf("expected at least one queue")
}
}

if len(s3bucket) == 0 {
return opts, fmt.Errorf("expected s3 bucket")
}

csubClientOptions, err := csub_client.ValidateCsubClientFlags(csubAddr, csubTls, csubTlsSkipVerify)
if err != nil {
return opts, fmt.Errorf("unable to validate csub client flags: %w", err)
}

opts = s3Options{s3url, s3bucket, region, s3item, queues, mp, mpEndpoint, poll, graphqlEndpoint, csubClientOptions}

return opts, nil
}

func init() {
set, err := cli.BuildFlags([]string{"s3-url", "s3-bucket", "s3-region", "s3-item", "s3-mp", "s3-mp-endpoint", "s3-queues", "poll"})
if err != nil {
fmt.Fprintf(os.Stderr, "failed to setup flag: %s", err)
os.Exit(1)
}
s3Cmd.Flags().AddFlagSet(set)
if err := viper.BindPFlags(s3Cmd.Flags()); err != nil {
fmt.Fprintf(os.Stderr, "failed to bind flags: %s", err)
os.Exit(1)
}

collectCmd.AddCommand(s3Cmd)
}
21 changes: 21 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ require (
github.com/anchore/go-struct-converter v0.0.0-20230627203149-c72ef8859ca9 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/arangodb/go-velocypack v0.0.0-20200318135517-5af53c29c67e // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.11 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.31 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.7 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.37 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.31 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.38 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.12 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.32 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.31 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.13.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.21.1 // indirect
github.com/aws/smithy-go v1.14.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bombsimon/logrusr/v2 v2.0.1 // indirect
github.com/bradleyfalzon/ghinstallation/v2 v2.7.0 // indirect
Expand Down Expand Up @@ -130,6 +145,7 @@ require (
github.com/opencontainers/image-spec v1.1.0-rc3 // indirect
github.com/owenrumney/go-sarif/v2 v2.2.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pierrec/lz4/v4 v4.1.15 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
Expand Down Expand Up @@ -189,6 +205,10 @@ require (
github.com/Masterminds/semver v1.5.0
github.com/arangodb/go-driver v1.6.0
github.com/aws/aws-sdk-go v1.46.2
github.com/aws/aws-sdk-go-v2 v1.20.0
github.com/aws/aws-sdk-go-v2/config v1.18.32
github.com/aws/aws-sdk-go-v2/service/s3 v1.38.1
github.com/aws/aws-sdk-go-v2/service/sqs v1.24.1
github.com/fsnotify/fsnotify v1.6.0
github.com/go-git/go-git/v5 v5.9.0
github.com/gobwas/glob v0.2.3
Expand All @@ -213,6 +233,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.17.0
github.com/regclient/regclient v0.5.3
github.com/segmentio/kafka-go v0.4.42
github.com/segmentio/ksuid v1.0.4
github.com/sigstore/sigstore v1.7.4
github.com/spdx/tools-golang v0.5.3
Expand Down
16 changes: 16 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.0 h1:Wgjft9X4W5pMeu
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.0/go.mod h1:FWNzS4+zcWAP05IF7TDYTY1ysZAzIvogxWaDT9p8fsA=
github.com/aws/aws-sdk-go-v2/service/s3 v1.38.1 h1:mTgFVlfQT8gikc5+/HwD8UL9jnUro5MGv8n/VEYF12I=
github.com/aws/aws-sdk-go-v2/service/s3 v1.38.1/go.mod h1:6SOWLiobcZZshbmECRTADIRYliPL0etqFSigauQEeT0=
github.com/aws/aws-sdk-go-v2/service/sqs v1.24.1 h1:KbGaxApdPOT2ZWqJiQY5ApnpNhUGbGTjYiKAidlFwp8=
github.com/aws/aws-sdk-go-v2/service/sqs v1.24.1/go.mod h1:+phkm4aFvcM4jbsDRGoZ+mD8MMvksHF459Xpy5Z90f0=
github.com/aws/aws-sdk-go-v2/service/sso v1.13.1 h1:DSNpSbfEgFXRV+IfEcKE5kTbqxm+MeF5WgyeRlsLnHY=
github.com/aws/aws-sdk-go-v2/service/sso v1.13.1/go.mod h1:TC9BubuFMVScIU+TLKamO6VZiYTkYoEHqlSQwAe2omw=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.1 h1:hd0SKLMdOL/Sl6Z0np1PX9LeH2gqNtBe0MhTedA8MGI=
Expand Down Expand Up @@ -329,6 +331,7 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
Expand Down Expand Up @@ -450,6 +453,7 @@ github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM=
github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg=
Expand Down Expand Up @@ -557,6 +561,8 @@ github.com/package-url/packageurl-go v0.1.1 h1:KTRE0bK3sKbFKAk3yy63DpeskU7Cvs/x/
github.com/package-url/packageurl-go v0.1.1/go.mod h1:uQd4a7Rh3ZsVg5j0lNyAfyxIeGde9yrlhjF78GzeW0c=
github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ=
github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4=
github.com/pierrec/lz4/v4 v4.1.15 h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0=
github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down Expand Up @@ -595,6 +601,8 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/secure-systems-lab/go-securesystemslib v0.7.0 h1:OwvJ5jQf9LnIAS83waAjPbcMsODrTQUpJ02eNLUoxBg=
github.com/secure-systems-lab/go-securesystemslib v0.7.0/go.mod h1:/2gYnlnHVQ6xeGtfIqFy7Do03K4cdCY0A/GlJLDKLHI=
github.com/segmentio/kafka-go v0.4.42 h1:qffhBZCz4WcWyNuHEclHjIMLs2slp6mZO8px+5W5tfU=
github.com/segmentio/kafka-go v0.4.42/go.mod h1:d0g15xPMqoUookug0OU75DhGZxXwCFxSLeJ4uphwJzg=
github.com/segmentio/ksuid v1.0.4 h1:sBo2BdShXjmcugAMwjugoGUdUV0pcxY5mW4xKRn3v4c=
github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
Expand Down Expand Up @@ -680,6 +688,12 @@ github.com/xanzy/go-gitlab v0.93.0 h1:/Fy4akqKIQasZgQ2xj2xJBrEZ+iCW+iC+9qLEt19tg
github.com/xanzy/go-gitlab v0.93.0/go.mod h1:5ryv+MnpZStBH8I/77HuQBsMbBGANtVpLWC15qOjWAw=
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8=
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
Expand Down Expand Up @@ -812,6 +826,7 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
Expand Down Expand Up @@ -930,6 +945,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
Expand Down
9 changes: 9 additions & 0 deletions pkg/cli/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ func init() {
// Google Cloud platform flags
set.String("gcp-credentials-path", "", "Path to the Google Cloud service account credentials json file.\nAlternatively you can set GOOGLE_APPLICATION_CREDENTIALS=<path> in your environment.")

// S3 flags
set.String("s3-url", "", "url of the s3 endpoint")
set.String("s3-bucket", "", "bucket in the s3 provider")
set.String("s3-item", "", "item in the s3 provider")
set.String("s3-mp", "kafka", "message provider (sqs or kafka)")
set.String("s3-mp-endpoint", "", "endpoint for the message provider")
set.String("s3-queues", "", "comma-separated list of queue/topic names")
set.String("s3-region", "us-east-1", "aws region")

set.VisitAll(func(f *pflag.Flag) {
flagStore[f.Name] = f
})
Expand Down
Loading

0 comments on commit 83b892c

Please sign in to comment.