This commit is contained in:
Andrey Smirnov
2015-02-20 23:43:40 +03:00
parent 3004473bbb
commit b67f3dd6f7

View File

@@ -1,22 +1,22 @@
package swift package swift
import ( import (
"encoding/json"
"fmt" "fmt"
"github.com/ncw/swift" "github.com/ncw/swift"
"github.com/smira/aptly/aptly" "github.com/smira/aptly/aptly"
"github.com/smira/aptly/files" "github.com/smira/aptly/files"
"time" "net/http"
"os" "os"
"path/filepath" "path/filepath"
"net/http" "time"
"encoding/json"
) )
// PublishedStorage abstract file system with published files (actually hosted on Swift) // PublishedStorage abstract file system with published files (actually hosted on Swift)
type PublishedStorage struct { type PublishedStorage struct {
conn swift.Connection conn swift.Connection
container string container string
prefix string prefix string
support_bulk_delete bool support_bulk_delete bool
} }
@@ -54,13 +54,13 @@ func NewPublishedStorage(username string, password string, authUrl string, tenan
ct := swift.Connection{ ct := swift.Connection{
UserName: username, UserName: username,
ApiKey: password, ApiKey: password,
AuthUrl: authUrl, AuthUrl: authUrl,
UserAgent: "aptly/" + aptly.Version, UserAgent: "aptly/" + aptly.Version,
Tenant: tenant, Tenant: tenant,
TenantId: tenantId, TenantId: tenantId,
ConnectTimeout: 60 * time.Second, ConnectTimeout: 60 * time.Second,
Timeout: 60 * time.Second, Timeout: 60 * time.Second,
} }
err := ct.Authenticate() err := ct.Authenticate()
if err != nil { if err != nil {
@@ -79,9 +79,9 @@ func NewPublishedStorage(username string, password string, authUrl string, tenan
} }
result := &PublishedStorage{ result := &PublishedStorage{
conn: ct, conn: ct,
container: container, container: container,
prefix: prefix, prefix: prefix,
support_bulk_delete: bulk_delete, support_bulk_delete: bulk_delete,
} }