mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 20:39:18 +08:00
Bump github.com/ncw/swift to v1.0.44
This commit is contained in:
parent
6f25e48cbb
commit
38c0018906
2
go.mod
2
go.mod
|
@ -30,7 +30,7 @@ require (
|
||||||
github.com/kr/pretty v0.1.0 // indirect
|
github.com/kr/pretty v0.1.0 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.3 // indirect
|
github.com/mattn/go-runewidth v0.0.3 // indirect
|
||||||
github.com/ncw/go-acd v0.0.0-20171120105400-887eb06ab6a2
|
github.com/ncw/go-acd v0.0.0-20171120105400-887eb06ab6a2
|
||||||
github.com/ncw/swift v1.0.43
|
github.com/ncw/swift v1.0.44
|
||||||
github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed
|
github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed
|
||||||
github.com/okzk/sdnotify v0.0.0-20180710141335-d9becc38acbd
|
github.com/okzk/sdnotify v0.0.0-20180710141335-d9becc38acbd
|
||||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -74,6 +74,8 @@ github.com/ncw/swift v1.0.42 h1:ztvRb6hs52IHOcaYt73f9lXYLIeIuWgdooRDhdyllGI=
|
||||||
github.com/ncw/swift v1.0.42/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
|
github.com/ncw/swift v1.0.42/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
|
||||||
github.com/ncw/swift v1.0.43 h1:TZn2l/bPV0CqG+/G5BFh/ROWnyX7dL2D0URaOjNQRsw=
|
github.com/ncw/swift v1.0.43 h1:TZn2l/bPV0CqG+/G5BFh/ROWnyX7dL2D0URaOjNQRsw=
|
||||||
github.com/ncw/swift v1.0.43/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
|
github.com/ncw/swift v1.0.43/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
|
||||||
|
github.com/ncw/swift v1.0.44 h1:EKvOTvUxElbpDWqxsyVaVGvc2IfuOqQnRmjnR2AGhQ4=
|
||||||
|
github.com/ncw/swift v1.0.44/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
|
||||||
github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed h1:bAVGG6B+R5qpSylrrA+BAMrzYkdAoiTaKPVxRB+4cyM=
|
github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed h1:bAVGG6B+R5qpSylrrA+BAMrzYkdAoiTaKPVxRB+4cyM=
|
||||||
github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ=
|
github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ=
|
||||||
github.com/okzk/sdnotify v0.0.0-20180710141335-d9becc38acbd h1:+iAPaTbi1gZpcpDwe/BW1fx7Xoesv69hLNGPheoyhBs=
|
github.com/okzk/sdnotify v0.0.0-20180710141335-d9becc38acbd h1:+iAPaTbi1gZpcpDwe/BW1fx7Xoesv69hLNGPheoyhBs=
|
||||||
|
|
3
vendor/github.com/ncw/swift/README.md
generated
vendored
3
vendor/github.com/ncw/swift/README.md
generated
vendored
|
@ -139,7 +139,7 @@ Contributors
|
||||||
- Cezar Sa Espinola <cezarsa@gmail.com>
|
- Cezar Sa Espinola <cezarsa@gmail.com>
|
||||||
- Sam Gunaratne <samgzeit@gmail.com>
|
- Sam Gunaratne <samgzeit@gmail.com>
|
||||||
- Richard Scothern <richard.scothern@gmail.com>
|
- Richard Scothern <richard.scothern@gmail.com>
|
||||||
- Michel Couillard <couillard.michel@voxlog.ca>
|
- Michel Couillard <!--<couillard.michel@voxlog.ca>--> <michel.couillard@gmail.com>
|
||||||
- Christopher Waldon <ckwaldon@us.ibm.com>
|
- Christopher Waldon <ckwaldon@us.ibm.com>
|
||||||
- dennis <dai.haojun@gmail.com>
|
- dennis <dai.haojun@gmail.com>
|
||||||
- hag <hannes.georg@xing.com>
|
- hag <hannes.georg@xing.com>
|
||||||
|
@ -152,3 +152,4 @@ Contributors
|
||||||
- Charles Hsu <charles0126@gmail.com>
|
- Charles Hsu <charles0126@gmail.com>
|
||||||
- Omar Ali <omarali@users.noreply.github.com>
|
- Omar Ali <omarali@users.noreply.github.com>
|
||||||
- Andreas Andersen <andreas@softwaredesign.se>
|
- Andreas Andersen <andreas@softwaredesign.se>
|
||||||
|
- kayrus <kay.diam@gmail.com>
|
||||||
|
|
114
vendor/github.com/ncw/swift/auth_v3.go
generated
vendored
114
vendor/github.com/ncw/swift/auth_v3.go
generated
vendored
|
@ -3,14 +3,16 @@ package swift
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
v3AuthMethodToken = "token"
|
v3AuthMethodToken = "token"
|
||||||
v3AuthMethodPassword = "password"
|
v3AuthMethodPassword = "password"
|
||||||
v3CatalogTypeObjectStore = "object-store"
|
v3AuthMethodApplicationCredential = "application_credential"
|
||||||
|
v3CatalogTypeObjectStore = "object-store"
|
||||||
)
|
)
|
||||||
|
|
||||||
// V3 Authentication request
|
// V3 Authentication request
|
||||||
|
@ -19,9 +21,10 @@ const (
|
||||||
type v3AuthRequest struct {
|
type v3AuthRequest struct {
|
||||||
Auth struct {
|
Auth struct {
|
||||||
Identity struct {
|
Identity struct {
|
||||||
Methods []string `json:"methods"`
|
Methods []string `json:"methods"`
|
||||||
Password *v3AuthPassword `json:"password,omitempty"`
|
Password *v3AuthPassword `json:"password,omitempty"`
|
||||||
Token *v3AuthToken `json:"token,omitempty"`
|
Token *v3AuthToken `json:"token,omitempty"`
|
||||||
|
ApplicationCredential *v3AuthApplicationCredential `json:"application_credential,omitempty"`
|
||||||
} `json:"identity"`
|
} `json:"identity"`
|
||||||
Scope *v3Scope `json:"scope,omitempty"`
|
Scope *v3Scope `json:"scope,omitempty"`
|
||||||
} `json:"auth"`
|
} `json:"auth"`
|
||||||
|
@ -63,6 +66,13 @@ type v3AuthPassword struct {
|
||||||
User v3User `json:"user"`
|
User v3User `json:"user"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type v3AuthApplicationCredential struct {
|
||||||
|
Id string `json:"id,omitempty"`
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
|
Secret string `json:"secret,omitempty"`
|
||||||
|
User *v3User `json:"user,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// V3 Authentication response
|
// V3 Authentication response
|
||||||
type v3AuthResponse struct {
|
type v3AuthResponse struct {
|
||||||
Token struct {
|
Token struct {
|
||||||
|
@ -117,7 +127,57 @@ func (auth *v3Auth) Request(c *Connection) (*http.Request, error) {
|
||||||
|
|
||||||
v3 := v3AuthRequest{}
|
v3 := v3AuthRequest{}
|
||||||
|
|
||||||
if c.UserName == "" && c.UserId == "" {
|
if (c.ApplicationCredentialId != "" || c.ApplicationCredentialName != "") && c.ApplicationCredentialSecret != "" {
|
||||||
|
var user *v3User
|
||||||
|
|
||||||
|
if c.ApplicationCredentialId != "" {
|
||||||
|
c.ApplicationCredentialName = ""
|
||||||
|
user = &v3User{}
|
||||||
|
}
|
||||||
|
|
||||||
|
if user == nil && c.UserId != "" {
|
||||||
|
// UserID could be used without the domain information
|
||||||
|
user = &v3User{
|
||||||
|
Id: c.UserId,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if user == nil && c.UserName == "" {
|
||||||
|
// Make sure that Username or UserID are provided
|
||||||
|
return nil, fmt.Errorf("UserID or Name should be provided")
|
||||||
|
}
|
||||||
|
|
||||||
|
if user == nil && c.DomainId != "" {
|
||||||
|
user = &v3User{
|
||||||
|
Name: c.UserName,
|
||||||
|
Domain: &v3Domain{
|
||||||
|
Id: c.DomainId,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if user == nil && c.Domain != "" {
|
||||||
|
user = &v3User{
|
||||||
|
Name: c.UserName,
|
||||||
|
Domain: &v3Domain{
|
||||||
|
Name: c.Domain,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure that DomainID or DomainName are provided among Username
|
||||||
|
if user == nil {
|
||||||
|
return nil, fmt.Errorf("DomainID or Domain should be provided")
|
||||||
|
}
|
||||||
|
|
||||||
|
v3.Auth.Identity.Methods = []string{v3AuthMethodApplicationCredential}
|
||||||
|
v3.Auth.Identity.ApplicationCredential = &v3AuthApplicationCredential{
|
||||||
|
Id: c.ApplicationCredentialId,
|
||||||
|
Name: c.ApplicationCredentialName,
|
||||||
|
Secret: c.ApplicationCredentialSecret,
|
||||||
|
User: user,
|
||||||
|
}
|
||||||
|
} else if c.UserName == "" && c.UserId == "" {
|
||||||
v3.Auth.Identity.Methods = []string{v3AuthMethodToken}
|
v3.Auth.Identity.Methods = []string{v3AuthMethodToken}
|
||||||
v3.Auth.Identity.Token = &v3AuthToken{Id: c.ApiKey}
|
v3.Auth.Identity.Token = &v3AuthToken{Id: c.ApiKey}
|
||||||
} else {
|
} else {
|
||||||
|
@ -140,27 +200,29 @@ func (auth *v3Auth) Request(c *Connection) (*http.Request, error) {
|
||||||
v3.Auth.Identity.Password.User.Domain = domain
|
v3.Auth.Identity.Password.User.Domain = domain
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.TrustId != "" {
|
if v3.Auth.Identity.Methods[0] != v3AuthMethodApplicationCredential {
|
||||||
v3.Auth.Scope = &v3Scope{Trust: &v3Trust{Id: c.TrustId}}
|
if c.TrustId != "" {
|
||||||
} else if c.TenantId != "" || c.Tenant != "" {
|
v3.Auth.Scope = &v3Scope{Trust: &v3Trust{Id: c.TrustId}}
|
||||||
|
} else if c.TenantId != "" || c.Tenant != "" {
|
||||||
|
|
||||||
v3.Auth.Scope = &v3Scope{Project: &v3Project{}}
|
v3.Auth.Scope = &v3Scope{Project: &v3Project{}}
|
||||||
|
|
||||||
if c.TenantId != "" {
|
if c.TenantId != "" {
|
||||||
v3.Auth.Scope.Project.Id = c.TenantId
|
v3.Auth.Scope.Project.Id = c.TenantId
|
||||||
} else if c.Tenant != "" {
|
} else if c.Tenant != "" {
|
||||||
v3.Auth.Scope.Project.Name = c.Tenant
|
v3.Auth.Scope.Project.Name = c.Tenant
|
||||||
switch {
|
switch {
|
||||||
case c.TenantDomain != "":
|
case c.TenantDomain != "":
|
||||||
v3.Auth.Scope.Project.Domain = &v3Domain{Name: c.TenantDomain}
|
v3.Auth.Scope.Project.Domain = &v3Domain{Name: c.TenantDomain}
|
||||||
case c.TenantDomainId != "":
|
case c.TenantDomainId != "":
|
||||||
v3.Auth.Scope.Project.Domain = &v3Domain{Id: c.TenantDomainId}
|
v3.Auth.Scope.Project.Domain = &v3Domain{Id: c.TenantDomainId}
|
||||||
case c.Domain != "":
|
case c.Domain != "":
|
||||||
v3.Auth.Scope.Project.Domain = &v3Domain{Name: c.Domain}
|
v3.Auth.Scope.Project.Domain = &v3Domain{Name: c.Domain}
|
||||||
case c.DomainId != "":
|
case c.DomainId != "":
|
||||||
v3.Auth.Scope.Project.Domain = &v3Domain{Id: c.DomainId}
|
v3.Auth.Scope.Project.Domain = &v3Domain{Id: c.DomainId}
|
||||||
default:
|
default:
|
||||||
v3.Auth.Scope.Project.Domain = &v3Domain{Name: "Default"}
|
v3.Auth.Scope.Project.Domain = &v3Domain{Name: "Default"}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
49
vendor/github.com/ncw/swift/swift.go
generated
vendored
49
vendor/github.com/ncw/swift/swift.go
generated
vendored
|
@ -96,26 +96,29 @@ const (
|
||||||
type Connection struct {
|
type Connection struct {
|
||||||
// Parameters - fill these in before calling Authenticate
|
// Parameters - fill these in before calling Authenticate
|
||||||
// They are all optional except UserName, ApiKey and AuthUrl
|
// They are all optional except UserName, ApiKey and AuthUrl
|
||||||
Domain string // User's domain name
|
Domain string // User's domain name
|
||||||
DomainId string // User's domain Id
|
DomainId string // User's domain Id
|
||||||
UserName string // UserName for api
|
UserName string // UserName for api
|
||||||
UserId string // User Id
|
UserId string // User Id
|
||||||
ApiKey string // Key for api access
|
ApiKey string // Key for api access
|
||||||
AuthUrl string // Auth URL
|
ApplicationCredentialId string // Application Credential ID
|
||||||
Retries int // Retries on error (default is 3)
|
ApplicationCredentialName string // Application Credential Name
|
||||||
UserAgent string // Http User agent (default goswift/1.0)
|
ApplicationCredentialSecret string // Application Credential Secret
|
||||||
ConnectTimeout time.Duration // Connect channel timeout (default 10s)
|
AuthUrl string // Auth URL
|
||||||
Timeout time.Duration // Data channel timeout (default 60s)
|
Retries int // Retries on error (default is 3)
|
||||||
Region string // Region to use eg "LON", "ORD" - default is use first region (v2,v3 auth only)
|
UserAgent string // Http User agent (default goswift/1.0)
|
||||||
AuthVersion int // Set to 1, 2 or 3 or leave at 0 for autodetect
|
ConnectTimeout time.Duration // Connect channel timeout (default 10s)
|
||||||
Internal bool // Set this to true to use the the internal / service network
|
Timeout time.Duration // Data channel timeout (default 60s)
|
||||||
Tenant string // Name of the tenant (v2,v3 auth only)
|
Region string // Region to use eg "LON", "ORD" - default is use first region (v2,v3 auth only)
|
||||||
TenantId string // Id of the tenant (v2,v3 auth only)
|
AuthVersion int // Set to 1, 2 or 3 or leave at 0 for autodetect
|
||||||
EndpointType EndpointType // Endpoint type (v2,v3 auth only) (default is public URL unless Internal is set)
|
Internal bool // Set this to true to use the the internal / service network
|
||||||
TenantDomain string // Name of the tenant's domain (v3 auth only), only needed if it differs from the user domain
|
Tenant string // Name of the tenant (v2,v3 auth only)
|
||||||
TenantDomainId string // Id of the tenant's domain (v3 auth only), only needed if it differs the from user domain
|
TenantId string // Id of the tenant (v2,v3 auth only)
|
||||||
TrustId string // Id of the trust (v3 auth only)
|
EndpointType EndpointType // Endpoint type (v2,v3 auth only) (default is public URL unless Internal is set)
|
||||||
Transport http.RoundTripper `json:"-" xml:"-"` // Optional specialised http.Transport (eg. for Google Appengine)
|
TenantDomain string // Name of the tenant's domain (v3 auth only), only needed if it differs from the user domain
|
||||||
|
TenantDomainId string // Id of the tenant's domain (v3 auth only), only needed if it differs the from user domain
|
||||||
|
TrustId string // Id of the trust (v3 auth only)
|
||||||
|
Transport http.RoundTripper `json:"-" xml:"-"` // Optional specialised http.Transport (eg. for Google Appengine)
|
||||||
// These are filled in after Authenticate is called as are the defaults for above
|
// These are filled in after Authenticate is called as are the defaults for above
|
||||||
StorageUrl string
|
StorageUrl string
|
||||||
AuthToken string
|
AuthToken string
|
||||||
|
@ -194,6 +197,9 @@ func setFromEnv(param interface{}, name string) (err error) {
|
||||||
// OS_USERNAME - UserName for api
|
// OS_USERNAME - UserName for api
|
||||||
// OS_USER_ID - User Id
|
// OS_USER_ID - User Id
|
||||||
// OS_PASSWORD - Key for api access
|
// OS_PASSWORD - Key for api access
|
||||||
|
// OS_APPLICATION_CREDENTIAL_ID - Application Credential ID
|
||||||
|
// OS_APPLICATION_CREDENTIAL_NAME - Application Credential Name
|
||||||
|
// OS_APPLICATION_CREDENTIAL_SECRET - Application Credential Secret
|
||||||
// OS_USER_DOMAIN_NAME - User's domain name
|
// OS_USER_DOMAIN_NAME - User's domain name
|
||||||
// OS_USER_DOMAIN_ID - User's domain Id
|
// OS_USER_DOMAIN_ID - User's domain Id
|
||||||
// OS_PROJECT_NAME - Name of the project
|
// OS_PROJECT_NAME - Name of the project
|
||||||
|
@ -227,6 +233,9 @@ func (c *Connection) ApplyEnvironment() (err error) {
|
||||||
{&c.UserName, "OS_USERNAME"},
|
{&c.UserName, "OS_USERNAME"},
|
||||||
{&c.UserId, "OS_USER_ID"},
|
{&c.UserId, "OS_USER_ID"},
|
||||||
{&c.ApiKey, "OS_PASSWORD"},
|
{&c.ApiKey, "OS_PASSWORD"},
|
||||||
|
{&c.ApplicationCredentialId, "OS_APPLICATION_CREDENTIAL_ID"},
|
||||||
|
{&c.ApplicationCredentialName, "OS_APPLICATION_CREDENTIAL_NAME"},
|
||||||
|
{&c.ApplicationCredentialSecret, "OS_APPLICATION_CREDENTIAL_SECRET"},
|
||||||
{&c.AuthUrl, "OS_AUTH_URL"},
|
{&c.AuthUrl, "OS_AUTH_URL"},
|
||||||
{&c.Retries, "GOSWIFT_RETRIES"},
|
{&c.Retries, "GOSWIFT_RETRIES"},
|
||||||
{&c.UserAgent, "GOSWIFT_USER_AGENT"},
|
{&c.UserAgent, "GOSWIFT_USER_AGENT"},
|
||||||
|
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
|
@ -103,7 +103,7 @@ github.com/kr/fs
|
||||||
github.com/mattn/go-runewidth
|
github.com/mattn/go-runewidth
|
||||||
# github.com/ncw/go-acd v0.0.0-20171120105400-887eb06ab6a2
|
# github.com/ncw/go-acd v0.0.0-20171120105400-887eb06ab6a2
|
||||||
github.com/ncw/go-acd
|
github.com/ncw/go-acd
|
||||||
# github.com/ncw/swift v1.0.43
|
# github.com/ncw/swift v1.0.44
|
||||||
github.com/ncw/swift
|
github.com/ncw/swift
|
||||||
# github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed
|
# github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed
|
||||||
github.com/nsf/termbox-go
|
github.com/nsf/termbox-go
|
||||||
|
|
Loading…
Reference in New Issue
Block a user