awss3

package
v0.0.0-...-7bfb7dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 9 Imported by: 0

README

awss3

The awss3 package provides urfave/cli/v3 value sources backed by AWS S3. It fetches the contents of an S3 object to populate your CLI flags.

Usage

import (
    "github.com/aws-contrib/aws-cli/awss3"
    "github.com/urfave/cli/v3"
)

// Fetch a single S3 object
&cli.StringFlag{
    Name: "config-file",
    Sources: cli.NewValueSourceChain(
        awss3.Object("my-bucket", "path/to/config.json"),
    ),
}
Fallbacks (Multiple S3 Objects)

If you have multiple S3 objects you want to check as fallbacks, use the awss3.Objects helper using standard s3:// URIs:

&cli.StringFlag{
    Name: "config-file",
    Sources: awss3.Objects("s3://my-bucket/path/to/config.json", "s3://default-bucket/default.json"),
}
Custom AWS Configuration

You can pass standard AWS SDK functional options to the constructors to configure the underlying AWS client (e.g., setting a specific region or custom endpoint).

import "github.com/aws/aws-sdk-go-v2/config"

awss3.Object("my-bucket", "path/to/config.json", config.WithRegion("us-west-2"))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Objects

func Objects(uris ...string) cli.ValueSourceChain

Objects is a helper function to encapsulate a number of ValueSource together as a ValueSourceChain. It expects S3 URIs in the format s3://bucket/key.

Types

type ValueSource

type ValueSource struct {
	Bucket  string
	Key     string
	Options []func(*config.LoadOptions) error
}

ValueSource retrieves values from an AWS S3 object. It implements the cli.ValueSource interface.

func Object

func Object(bucket, key string, opts ...func(*config.LoadOptions) error) *ValueSource

Object creates a new ValueSource for the given bucket and key. Optional AWS SDK configuration options can be provided.

func (*ValueSource) GoString

func (f *ValueSource) GoString() string

GoString returns a Go-syntax representation of the ValueSource.

func (*ValueSource) Lookup

func (f *ValueSource) Lookup() (string, bool)

Lookup retrieves the object content from S3. It returns the object content as a string and a boolean indicating whether the retrieval was successful.

func (*ValueSource) String

func (f *ValueSource) String() string

String returns a string representation of the ValueSource.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL