github.com/fastly/cli@v1.7.2-0.20240304164155-9d0f1d77c3bf/pkg/commands/logging/common/flags.go (about)

     1  package common
     2  
     3  import (
     4  	"github.com/fastly/kingpin"
     5  
     6  	"github.com/fastly/cli/pkg/argparser"
     7  )
     8  
     9  // AccountName defines the account-name flag.
    10  func AccountName(command *kingpin.CmdClause, c *argparser.OptionalString) {
    11  	command.Flag("account-name", "The google account name used to obtain temporary credentials (default none)").Action(c.Set).StringVar(&c.Value)
    12  }
    13  
    14  // Format defines the format flag.
    15  func Format(command *kingpin.CmdClause, c *argparser.OptionalString) {
    16  	command.Flag("format", "Apache style log formatting. Your log must produce valid JSON").Action(c.Set).StringVar(&c.Value)
    17  }
    18  
    19  // GzipLevel defines the gzip flag.
    20  func GzipLevel(command *kingpin.CmdClause, c *argparser.OptionalInt) {
    21  	command.Flag("gzip-level", "What level of GZIP encoding to have when dumping logs (default 0, no compression)").Action(c.Set).IntVar(&c.Value)
    22  }
    23  
    24  // Path defines the path flag.
    25  func Path(command *kingpin.CmdClause, c *argparser.OptionalString) {
    26  	command.Flag("path", "The path to upload logs to").Action(c.Set).StringVar(&c.Value)
    27  }
    28  
    29  // MessageType defines the path flag.
    30  func MessageType(command *kingpin.CmdClause, c *argparser.OptionalString) {
    31  	command.Flag("message-type", "How the message should be formatted. One of: classic (default), loggly, logplex or blank").Action(c.Set).StringVar(&c.Value)
    32  }
    33  
    34  // Period defines the period flag.
    35  func Period(command *kingpin.CmdClause, c *argparser.OptionalInt) {
    36  	command.Flag("period", "How frequently log files are finalized so they can be available for reading (in seconds, default 3600)").Action(c.Set).IntVar(&c.Value)
    37  }
    38  
    39  // FormatVersion defines the format-version flag.
    40  func FormatVersion(command *kingpin.CmdClause, c *argparser.OptionalInt) {
    41  	command.Flag("format-version", "The version of the custom logging format used for the configured endpoint. Can be either 2 (the default, version 2 log format) or 1 (the version 1 log format). The logging call gets placed by default in vcl_log if format_version is set to 2 and in vcl_deliver if format_version is set to 1").Action(c.Set).IntVar(&c.Value)
    42  }
    43  
    44  // CompressionCodec defines the compression-codec flag.
    45  func CompressionCodec(command *kingpin.CmdClause, c *argparser.OptionalString) {
    46  	command.Flag("compression-codec", `The codec used for compression of your logs. Valid values are zstd, snappy, and gzip. If the specified codec is "gzip", gzip_level will default to 3. To specify a different level, leave compression_codec blank and explicitly set the level using gzip_level. Specifying both compression_codec and gzip_level in the same API request will result in an error.`).Action(c.Set).StringVar(&c.Value)
    47  }
    48  
    49  // Placement defines the placement flag.
    50  func Placement(command *kingpin.CmdClause, c *argparser.OptionalString) {
    51  	command.Flag("placement", "Where in the generated VCL the logging call should be placed, overriding any format_version default. Can be none or waf_debug. This field is not required and has no default value").Action(c.Set).StringVar(&c.Value)
    52  }
    53  
    54  // ResponseCondition defines the response-condition flag.
    55  func ResponseCondition(command *kingpin.CmdClause, c *argparser.OptionalString) {
    56  	command.Flag("response-condition", "The name of an existing condition in the configured endpoint, or leave blank to always execute").Action(c.Set).StringVar(&c.Value)
    57  }
    58  
    59  // TimestampFormat defines the timestamp-format flag.
    60  func TimestampFormat(command *kingpin.CmdClause, c *argparser.OptionalString) {
    61  	command.Flag("timestamp-format", `strftime specified timestamp formatting (default "%Y-%m-%dT%H:%M:%S.000")`).Action(c.Set).StringVar(&c.Value)
    62  }
    63  
    64  // PublicKey defines the public-key flag.
    65  func PublicKey(command *kingpin.CmdClause, c *argparser.OptionalString) {
    66  	command.Flag("public-key", "A PGP public key that Fastly will use to encrypt your log files before writing them to disk").Action(c.Set).StringVar(&c.Value)
    67  }
    68  
    69  // TLSCACert defines the tls-ca-cert flag.
    70  func TLSCACert(command *kingpin.CmdClause, c *argparser.OptionalString) {
    71  	command.Flag("tls-ca-cert", "A secure certificate to authenticate the server with. Must be in PEM format").Action(c.Set).StringVar(&c.Value)
    72  }
    73  
    74  // TLSHostname defines the tls-hostname flag.
    75  func TLSHostname(command *kingpin.CmdClause, c *argparser.OptionalString) {
    76  	command.Flag("tls-hostname", "Used during the TLS handshake to validate the certificate").Action(c.Set).StringVar(&c.Value)
    77  }
    78  
    79  // TLSClientCert defines the tls-client-cert flag.
    80  func TLSClientCert(command *kingpin.CmdClause, c *argparser.OptionalString) {
    81  	command.Flag("tls-client-cert", "The client certificate used to make authenticated requests. Must be in PEM format").Action(c.Set).StringVar(&c.Value)
    82  }
    83  
    84  // TLSClientKey defines the tls-client-key flag.
    85  func TLSClientKey(command *kingpin.CmdClause, c *argparser.OptionalString) {
    86  	command.Flag("tls-client-key", "The client private key used to make authenticated requests. Must be in PEM format").Action(c.Set).StringVar(&c.Value)
    87  }