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)
| 126 | // NewPublishedStorage creates new instance of PublishedStorage with specified S3 access |
| 127 | // keys, region and bucket name |
| 128 | func 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 |
| 153 | func (storage *PublishedStorage) String() string { |