github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/pkg/block/params/block.go (about)

     1  package params
     2  
     3  import (
     4  	"time"
     5  )
     6  
     7  // AdapterConfig configures a block adapter.
     8  type AdapterConfig interface {
     9  	BlockstoreType() string
    10  	BlockstoreLocalParams() (Local, error)
    11  	BlockstoreS3Params() (S3, error)
    12  	BlockstoreGSParams() (GS, error)
    13  	BlockstoreAzureParams() (Azure, error)
    14  }
    15  
    16  type Mem struct{}
    17  
    18  type Local struct {
    19  	Path                    string
    20  	ImportEnabled           bool
    21  	ImportHidden            bool
    22  	AllowedExternalPrefixes []string
    23  }
    24  
    25  // S3WebIdentity contains parameters for customizing S3 web identity.  This
    26  // is also used when configuring S3 with IRSA in EKS (Kubernetes).
    27  type S3WebIdentity struct {
    28  	// SessionDuration is the duration WebIdentityRoleProvider will
    29  	// request for a token for its assumed role.  It can be 1 hour or
    30  	// more, but its maximum is configurable on AWS.
    31  	SessionDuration time.Duration
    32  
    33  	// SessionExpiryWindow is the time before credentials expiry that
    34  	// the WebIdentityRoleProvider may request a fresh token.
    35  	SessionExpiryWindow time.Duration
    36  }
    37  
    38  type S3Credentials struct {
    39  	AccessKeyID     string
    40  	SecretAccessKey string
    41  	SessionToken    string
    42  }
    43  
    44  type S3 struct {
    45  	Region                        string
    46  	Profile                       string
    47  	CredentialsFile               string
    48  	Credentials                   S3Credentials
    49  	MaxRetries                    int
    50  	Endpoint                      string
    51  	ForcePathStyle                bool
    52  	DiscoverBucketRegion          bool
    53  	SkipVerifyCertificateTestOnly bool
    54  	ServerSideEncryption          string
    55  	ServerSideEncryptionKmsKeyID  string
    56  	PreSignedExpiry               time.Duration
    57  	DisablePreSigned              bool
    58  	DisablePreSignedUI            bool
    59  	DisablePreSignedMultipart     bool
    60  	ClientLogRetries              bool
    61  	ClientLogRequest              bool
    62  	WebIdentity                   *S3WebIdentity
    63  }
    64  
    65  type GS struct {
    66  	CredentialsFile    string
    67  	CredentialsJSON    string
    68  	PreSignedExpiry    time.Duration
    69  	DisablePreSigned   bool
    70  	DisablePreSignedUI bool
    71  }
    72  
    73  type Azure struct {
    74  	StorageAccount     string
    75  	StorageAccessKey   string
    76  	TryTimeout         time.Duration
    77  	PreSignedExpiry    time.Duration
    78  	DisablePreSigned   bool
    79  	DisablePreSignedUI bool
    80  	// TestEndpointURL - For testing purposes, provide a custom URL to override the default URL template
    81  	TestEndpointURL string
    82  	// Domain - Azure cloud domain
    83  	Domain string
    84  }