MCPcopy Create free account
hub / github.com/aptly-dev/aptly / NewPublishedStorage

Function NewPublishedStorage

s3/public.go:128–150  ·  view source on GitHub ↗

NewPublishedStorage creates new instance of PublishedStorage with specified S3 access keys, region and bucket name

(
	accessKey, secretKey, sessionToken, region, endpoint, bucket, defaultACL, prefix, storageClass, encryptionMethod string,
	plusWorkaround, disableMultiDel, _, forceVirtualHostedStyle, debug bool)

Source from the content-addressed store, hash-verified

126// NewPublishedStorage creates new instance of PublishedStorage with specified S3 access
127// keys, region and bucket name
128func NewPublishedStorage(
129 accessKey, secretKey, sessionToken, region, endpoint, bucket, defaultACL, prefix, storageClass, encryptionMethod string,
130 plusWorkaround, disableMultiDel, _, forceVirtualHostedStyle, debug bool) (*PublishedStorage, error) {
131
132 opts := []func(*config.LoadOptions) error{config.WithRegion(region)}
133 if accessKey != "" {
134 opts = append(opts, config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(accessKey, secretKey, sessionToken)))
135 }
136
137 if debug {
138 opts = append(opts, config.WithLogger(&logger{}))
139 }
140
141 config, err := config.LoadDefaultConfig(context.TODO(), opts...)
142 if err != nil {
143 return nil, err
144 }
145
146 result, err := NewPublishedStorageRaw(bucket, defaultACL, prefix, storageClass,
147 encryptionMethod, plusWorkaround, disableMultiDel, forceVirtualHostedStyle, &config, endpoint)
148
149 return result, err
150}
151
152// String returns the storage as string
153func (storage *PublishedStorage) String() string {

Callers 2

GetPublishedStorageMethod · 0.92
SetUpTestMethod · 0.70

Calls 1

NewPublishedStorageRawFunction · 0.70

Tested by 1

SetUpTestMethod · 0.56