Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
511ac5d1
Commit
511ac5d1
authored
Mar 22, 2016
by
jackgr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix style errors
parent
b2570ef1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
50 additions
and
50 deletions
+50
-50
filebased_credential_provider.go
pkg/repo/filebased_credential_provider.go
+5
-5
filebased_credential_provider_test.go
pkg/repo/filebased_credential_provider_test.go
+3
-3
gcs_repo.go
pkg/repo/gcs_repo.go
+2
-2
inmem_credential_provider.go
pkg/repo/inmem_credential_provider.go
+5
-5
inmem_credential_provider_test.go
pkg/repo/inmem_credential_provider_test.go
+3
-3
repo.go
pkg/repo/repo.go
+6
-6
repoprovider.go
pkg/repo/repoprovider.go
+3
-3
repoprovider_test.go
pkg/repo/repoprovider_test.go
+1
-1
secrets_credential_provider.go
pkg/repo/secrets_credential_provider.go
+5
-5
types.go
pkg/repo/types.go
+17
-17
No files found.
pkg/repo/filebased_credential_provider.go
View file @
511ac5d1
...
@@ -30,10 +30,10 @@ type FilebasedCredentialProvider struct {
...
@@ -30,10 +30,10 @@ type FilebasedCredentialProvider struct {
backingCredentialProvider
ICredentialProvider
backingCredentialProvider
ICredentialProvider
}
}
// NamedRepoCredential associates a name with a
Repo
Credential.
// NamedRepoCredential associates a name with a Credential.
type
NamedRepoCredential
struct
{
type
NamedRepoCredential
struct
{
Name
string
`json:"name,omitempty"`
Name
string
`json:"name,omitempty"`
Repo
Credential
Credential
}
}
// NewFilebasedCredentialProvider creates a file based credential provider.
// NewFilebasedCredentialProvider creates a file based credential provider.
...
@@ -47,7 +47,7 @@ func NewFilebasedCredentialProvider(filename string) (ICredentialProvider, error
...
@@ -47,7 +47,7 @@ func NewFilebasedCredentialProvider(filename string) (ICredentialProvider, error
for
_
,
nc
:=
range
c
{
for
_
,
nc
:=
range
c
{
log
.
Printf
(
"Loading credential named %s"
,
nc
.
Name
)
log
.
Printf
(
"Loading credential named %s"
,
nc
.
Name
)
icp
.
SetCredential
(
nc
.
Name
,
&
nc
.
Repo
Credential
)
icp
.
SetCredential
(
nc
.
Name
,
&
nc
.
Credential
)
}
}
return
&
FilebasedCredentialProvider
{
icp
},
nil
return
&
FilebasedCredentialProvider
{
icp
},
nil
...
@@ -72,11 +72,11 @@ func parseCredentials(bytes []byte) ([]NamedRepoCredential, error) {
...
@@ -72,11 +72,11 @@ func parseCredentials(bytes []byte) ([]NamedRepoCredential, error) {
}
}
// GetCredential returns a credential by name.
// GetCredential returns a credential by name.
func
(
fcp
*
FilebasedCredentialProvider
)
GetCredential
(
name
string
)
(
*
Repo
Credential
,
error
)
{
func
(
fcp
*
FilebasedCredentialProvider
)
GetCredential
(
name
string
)
(
*
Credential
,
error
)
{
return
fcp
.
backingCredentialProvider
.
GetCredential
(
name
)
return
fcp
.
backingCredentialProvider
.
GetCredential
(
name
)
}
}
// SetCredential sets a credential by name.
// SetCredential sets a credential by name.
func
(
fcp
*
FilebasedCredentialProvider
)
SetCredential
(
name
string
,
credential
*
Repo
Credential
)
error
{
func
(
fcp
*
FilebasedCredentialProvider
)
SetCredential
(
name
string
,
credential
*
Credential
)
error
{
return
fmt
.
Errorf
(
"SetCredential operation not supported with FilebasedCredentialProvider"
)
return
fmt
.
Errorf
(
"SetCredential operation not supported with FilebasedCredentialProvider"
)
}
}
pkg/repo/filebased_credential_provider_test.go
View file @
511ac5d1
...
@@ -24,7 +24,7 @@ var filename = "./testdata/test_credentials_file.yaml"
...
@@ -24,7 +24,7 @@ var filename = "./testdata/test_credentials_file.yaml"
type
filebasedTestCase
struct
{
type
filebasedTestCase
struct
{
name
string
name
string
exp
*
Repo
Credential
exp
*
Credential
expErr
error
expErr
error
}
}
...
@@ -36,14 +36,14 @@ func TestNotExistFilebased(t *testing.T) {
...
@@ -36,14 +36,14 @@ func TestNotExistFilebased(t *testing.T) {
func
TestGetApiTokenFilebased
(
t
*
testing
.
T
)
{
func
TestGetApiTokenFilebased
(
t
*
testing
.
T
)
{
cp
:=
getProvider
(
t
)
cp
:=
getProvider
(
t
)
tc
:=
&
testCase
{
"test1"
,
&
Repo
Credential
{
APIToken
:
"token"
},
nil
}
tc
:=
&
testCase
{
"test1"
,
&
Credential
{
APIToken
:
"token"
},
nil
}
testGetCredential
(
t
,
cp
,
tc
)
testGetCredential
(
t
,
cp
,
tc
)
}
}
func
TestSetAndGetBasicAuthFilebased
(
t
*
testing
.
T
)
{
func
TestSetAndGetBasicAuthFilebased
(
t
*
testing
.
T
)
{
cp
:=
getProvider
(
t
)
cp
:=
getProvider
(
t
)
ba
:=
BasicAuthCredential
{
Username
:
"user"
,
Password
:
"password"
}
ba
:=
BasicAuthCredential
{
Username
:
"user"
,
Password
:
"password"
}
tc
:=
&
testCase
{
"test2"
,
&
Repo
Credential
{
BasicAuth
:
ba
},
nil
}
tc
:=
&
testCase
{
"test2"
,
&
Credential
{
BasicAuth
:
ba
},
nil
}
testGetCredential
(
t
,
cp
,
tc
)
testGetCredential
(
t
,
cp
,
tc
)
}
}
...
...
pkg/repo/gcs_repo.go
View file @
511ac5d1
...
@@ -37,7 +37,7 @@ var GCSChartURLMatcher = regexp.MustCompile("gs://(.*)/(.*)-(.*).tgz")
...
@@ -37,7 +37,7 @@ var GCSChartURLMatcher = regexp.MustCompile("gs://(.*)/(.*)-(.*).tgz")
const
(
const
(
// GCSRepoType identifies the GCS repository type.
// GCSRepoType identifies the GCS repository type.
GCSRepoType
=
RepoType
(
"gcs"
)
GCSRepoType
=
E
RepoType
(
"gcs"
)
// GCSRepoFormat identifies the GCS repository format.
// GCSRepoFormat identifies the GCS repository format.
// In a GCS repository all charts appear at the top level.
// In a GCS repository all charts appear at the top level.
...
@@ -106,7 +106,7 @@ func newGCSRepo(r *Repo, httpClient *http.Client) (*GCSRepo, error) {
...
@@ -106,7 +106,7 @@ func newGCSRepo(r *Repo, httpClient *http.Client) (*GCSRepo, error) {
return
gcsr
,
nil
return
gcsr
,
nil
}
}
func
validateRepoType
(
repoType
RepoType
)
error
{
func
validateRepoType
(
repoType
E
RepoType
)
error
{
switch
repoType
{
switch
repoType
{
case
GCSRepoType
:
case
GCSRepoType
:
return
nil
return
nil
...
...
pkg/repo/inmem_credential_provider.go
View file @
511ac5d1
...
@@ -24,16 +24,16 @@ import (
...
@@ -24,16 +24,16 @@ import (
// InmemCredentialProvider is a memory based credential provider.
// InmemCredentialProvider is a memory based credential provider.
type
InmemCredentialProvider
struct
{
type
InmemCredentialProvider
struct
{
sync
.
RWMutex
sync
.
RWMutex
credentials
map
[
string
]
*
Repo
Credential
credentials
map
[
string
]
*
Credential
}
}
// NewInmemCredentialProvider creates a new memory based credential provider.
// NewInmemCredentialProvider creates a new memory based credential provider.
func
NewInmemCredentialProvider
()
ICredentialProvider
{
func
NewInmemCredentialProvider
()
ICredentialProvider
{
return
&
InmemCredentialProvider
{
credentials
:
make
(
map
[
string
]
*
Repo
Credential
)}
return
&
InmemCredentialProvider
{
credentials
:
make
(
map
[
string
]
*
Credential
)}
}
}
// GetCredential returns a credential by name.
// GetCredential returns a credential by name.
func
(
fcp
*
InmemCredentialProvider
)
GetCredential
(
name
string
)
(
*
Repo
Credential
,
error
)
{
func
(
fcp
*
InmemCredentialProvider
)
GetCredential
(
name
string
)
(
*
Credential
,
error
)
{
fcp
.
RLock
()
fcp
.
RLock
()
defer
fcp
.
RUnlock
()
defer
fcp
.
RUnlock
()
...
@@ -45,10 +45,10 @@ func (fcp *InmemCredentialProvider) GetCredential(name string) (*RepoCredential,
...
@@ -45,10 +45,10 @@ func (fcp *InmemCredentialProvider) GetCredential(name string) (*RepoCredential,
}
}
// SetCredential sets a credential by name.
// SetCredential sets a credential by name.
func
(
fcp
*
InmemCredentialProvider
)
SetCredential
(
name
string
,
credential
*
Repo
Credential
)
error
{
func
(
fcp
*
InmemCredentialProvider
)
SetCredential
(
name
string
,
credential
*
Credential
)
error
{
fcp
.
Lock
()
fcp
.
Lock
()
defer
fcp
.
Unlock
()
defer
fcp
.
Unlock
()
fcp
.
credentials
[
name
]
=
&
Repo
Credential
{
APIToken
:
credential
.
APIToken
,
BasicAuth
:
credential
.
BasicAuth
,
ServiceAccount
:
credential
.
ServiceAccount
}
fcp
.
credentials
[
name
]
=
&
Credential
{
APIToken
:
credential
.
APIToken
,
BasicAuth
:
credential
.
BasicAuth
,
ServiceAccount
:
credential
.
ServiceAccount
}
return
nil
return
nil
}
}
pkg/repo/inmem_credential_provider_test.go
View file @
511ac5d1
...
@@ -24,7 +24,7 @@ import (
...
@@ -24,7 +24,7 @@ import (
type
testCase
struct
{
type
testCase
struct
{
name
string
name
string
exp
*
Repo
Credential
exp
*
Credential
expErr
error
expErr
error
}
}
...
@@ -60,13 +60,13 @@ func TestNotExist(t *testing.T) {
...
@@ -60,13 +60,13 @@ func TestNotExist(t *testing.T) {
func
TestSetAndGetApiToken
(
t
*
testing
.
T
)
{
func
TestSetAndGetApiToken
(
t
*
testing
.
T
)
{
cp
:=
NewInmemCredentialProvider
()
cp
:=
NewInmemCredentialProvider
()
tc
:=
&
testCase
{
"testcredential"
,
&
Repo
Credential
{
APIToken
:
"some token here"
},
nil
}
tc
:=
&
testCase
{
"testcredential"
,
&
Credential
{
APIToken
:
"some token here"
},
nil
}
verifySetAndGetCredential
(
t
,
cp
,
tc
)
verifySetAndGetCredential
(
t
,
cp
,
tc
)
}
}
func
TestSetAndGetBasicAuth
(
t
*
testing
.
T
)
{
func
TestSetAndGetBasicAuth
(
t
*
testing
.
T
)
{
cp
:=
NewInmemCredentialProvider
()
cp
:=
NewInmemCredentialProvider
()
ba
:=
BasicAuthCredential
{
Username
:
"user"
,
Password
:
"pass"
}
ba
:=
BasicAuthCredential
{
Username
:
"user"
,
Password
:
"pass"
}
tc
:=
&
testCase
{
"testcredential"
,
&
Repo
Credential
{
BasicAuth
:
ba
},
nil
}
tc
:=
&
testCase
{
"testcredential"
,
&
Credential
{
BasicAuth
:
ba
},
nil
}
verifySetAndGetCredential
(
t
,
cp
,
tc
)
verifySetAndGetCredential
(
t
,
cp
,
tc
)
}
}
pkg/repo/repo.go
View file @
511ac5d1
...
@@ -23,10 +23,10 @@ import (
...
@@ -23,10 +23,10 @@ import (
// NewRepo takes params and returns a IRepo
// NewRepo takes params and returns a IRepo
func
NewRepo
(
name
,
URL
,
credentialName
,
repoFormat
,
repoType
string
)
(
IRepo
,
error
)
{
func
NewRepo
(
name
,
URL
,
credentialName
,
repoFormat
,
repoType
string
)
(
IRepo
,
error
)
{
return
newRepo
(
name
,
URL
,
credentialName
,
RepoFormat
(
repoFormat
),
RepoType
(
repoType
))
return
newRepo
(
name
,
URL
,
credentialName
,
ERepoFormat
(
repoFormat
),
E
RepoType
(
repoType
))
}
}
func
newRepo
(
name
,
URL
,
credentialName
string
,
repoFormat
RepoFormat
,
repoType
RepoType
)
(
*
Repo
,
error
)
{
func
newRepo
(
name
,
URL
,
credentialName
string
,
repoFormat
ERepoFormat
,
repoType
E
RepoType
)
(
*
Repo
,
error
)
{
if
name
==
""
{
if
name
==
""
{
return
nil
,
fmt
.
Errorf
(
"name must not be empty"
)
return
nil
,
fmt
.
Errorf
(
"name must not be empty"
)
}
}
...
@@ -56,7 +56,7 @@ func newRepo(name, URL, credentialName string, repoFormat RepoFormat, repoType R
...
@@ -56,7 +56,7 @@ func newRepo(name, URL, credentialName string, repoFormat RepoFormat, repoType R
}
}
// Currently, only flat repositories are supported.
// Currently, only flat repositories are supported.
func
validateRepoFormat
(
repoFormat
RepoFormat
)
error
{
func
validateRepoFormat
(
repoFormat
E
RepoFormat
)
error
{
switch
repoFormat
{
switch
repoFormat
{
case
FlatRepoFormat
:
case
FlatRepoFormat
:
return
nil
return
nil
...
@@ -71,7 +71,7 @@ func (r *Repo) GetName() string {
...
@@ -71,7 +71,7 @@ func (r *Repo) GetName() string {
}
}
// GetType returns the technology implementing this repository.
// GetType returns the technology implementing this repository.
func
(
r
*
Repo
)
GetType
()
RepoType
{
func
(
r
*
Repo
)
GetType
()
E
RepoType
{
return
r
.
Type
return
r
.
Type
}
}
...
@@ -81,7 +81,7 @@ func (r *Repo) GetURL() string {
...
@@ -81,7 +81,7 @@ func (r *Repo) GetURL() string {
}
}
// GetFormat returns the format of this repository.
// GetFormat returns the format of this repository.
func
(
r
*
Repo
)
GetFormat
()
RepoFormat
{
func
(
r
*
Repo
)
GetFormat
()
E
RepoFormat
{
return
r
.
Format
return
r
.
Format
}
}
...
@@ -90,7 +90,7 @@ func (r *Repo) GetCredentialName() string {
...
@@ -90,7 +90,7 @@ func (r *Repo) GetCredentialName() string {
return
r
.
CredentialName
return
r
.
CredentialName
}
}
func
validateRepo
(
tr
IRepo
,
wantName
,
wantURL
,
wantCredentialName
string
,
wantFormat
RepoFormat
,
wantType
RepoType
)
error
{
func
validateRepo
(
tr
IRepo
,
wantName
,
wantURL
,
wantCredentialName
string
,
wantFormat
ERepoFormat
,
wantType
E
RepoType
)
error
{
haveName
:=
tr
.
GetName
()
haveName
:=
tr
.
GetName
()
if
haveName
!=
wantName
{
if
haveName
!=
wantName
{
return
fmt
.
Errorf
(
"unexpected repository name; want: %s, have %s"
,
wantName
,
haveName
)
return
fmt
.
Errorf
(
"unexpected repository name; want: %s, have %s"
,
wantName
,
haveName
)
...
...
pkg/repo/repoprovider.go
View file @
511ac5d1
...
@@ -29,8 +29,8 @@ import (
...
@@ -29,8 +29,8 @@ import (
"sync"
"sync"
)
)
// RepoProvider is a factory for IChartRepo instances.
//
I
RepoProvider is a factory for IChartRepo instances.
type
RepoProvider
interface
{
type
I
RepoProvider
interface
{
GetRepoByURL
(
URL
string
)
(
IChartRepo
,
error
)
GetRepoByURL
(
URL
string
)
(
IChartRepo
,
error
)
GetRepoByName
(
repoName
string
)
(
IChartRepo
,
error
)
GetRepoByName
(
repoName
string
)
(
IChartRepo
,
error
)
GetChartByReference
(
reference
string
)
(
*
chart
.
Chart
,
error
)
GetChartByReference
(
reference
string
)
(
*
chart
.
Chart
,
error
)
...
@@ -45,7 +45,7 @@ type repoProvider struct {
...
@@ -45,7 +45,7 @@ type repoProvider struct {
}
}
// NewRepoProvider creates a new repository provider.
// NewRepoProvider creates a new repository provider.
func
NewRepoProvider
(
rs
IRepoService
,
gcsrp
GCSRepoProvider
,
cp
ICredentialProvider
)
RepoProvider
{
func
NewRepoProvider
(
rs
IRepoService
,
gcsrp
GCSRepoProvider
,
cp
ICredentialProvider
)
I
RepoProvider
{
return
newRepoProvider
(
rs
,
gcsrp
,
cp
)
return
newRepoProvider
(
rs
,
gcsrp
,
cp
)
}
}
...
...
pkg/repo/repoprovider_test.go
View file @
511ac5d1
...
@@ -112,7 +112,7 @@ func TestGetChartByReferenceWithValidReferences(t *testing.T) {
...
@@ -112,7 +112,7 @@ func TestGetChartByReferenceWithValidReferences(t *testing.T) {
}
}
}
}
func
getTestRepoProvider
(
t
*
testing
.
T
)
RepoProvider
{
func
getTestRepoProvider
(
t
*
testing
.
T
)
I
RepoProvider
{
rp
:=
newRepoProvider
(
nil
,
nil
,
nil
)
rp
:=
newRepoProvider
(
nil
,
nil
,
nil
)
rs
:=
rp
.
GetRepoService
()
rs
:=
rp
.
GetRepoService
()
tr
,
err
:=
newRepo
(
TestRepoName
,
TestRepoURL
,
TestRepoCredentialName
,
TestRepoFormat
,
TestRepoType
)
tr
,
err
:=
newRepo
(
TestRepoName
,
TestRepoURL
,
TestRepoCredentialName
,
TestRepoFormat
,
TestRepoType
)
...
...
pkg/repo/secrets_credential_provider.go
View file @
511ac5d1
...
@@ -70,7 +70,7 @@ func NewSecretsCredentialProvider() ICredentialProvider {
...
@@ -70,7 +70,7 @@ func NewSecretsCredentialProvider() ICredentialProvider {
return
&
SecretsCredentialProvider
{
util
.
NewKubernetesKubectl
(
kubernetesConfig
)}
return
&
SecretsCredentialProvider
{
util
.
NewKubernetesKubectl
(
kubernetesConfig
)}
}
}
func
parseCredential
(
credential
string
)
(
*
Repo
Credential
,
error
)
{
func
parseCredential
(
credential
string
)
(
*
Credential
,
error
)
{
var
c
common
.
KubernetesSecret
var
c
common
.
KubernetesSecret
if
err
:=
json
.
Unmarshal
([]
byte
(
credential
),
&
c
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
([]
byte
(
credential
),
&
c
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot unmarshal credential (%s): %s"
,
credential
,
err
)
return
nil
,
fmt
.
Errorf
(
"cannot unmarshal credential (%s): %s"
,
credential
,
err
)
...
@@ -81,8 +81,8 @@ func parseCredential(credential string) (*RepoCredential, error) {
...
@@ -81,8 +81,8 @@ func parseCredential(credential string) (*RepoCredential, error) {
return
nil
,
fmt
.
Errorf
(
"cannot unmarshal credential (%s): %s"
,
c
,
err
)
return
nil
,
fmt
.
Errorf
(
"cannot unmarshal credential (%s): %s"
,
c
,
err
)
}
}
// And then finally unmarshal it from yaml to
Repo
Credential
// And then finally unmarshal it from yaml to Credential
r
:=
&
Repo
Credential
{}
r
:=
&
Credential
{}
if
err
:=
yaml
.
Unmarshal
(
d
,
&
r
);
err
!=
nil
{
if
err
:=
yaml
.
Unmarshal
(
d
,
&
r
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot unmarshal credential %s (%#v)"
,
c
,
err
)
return
nil
,
fmt
.
Errorf
(
"cannot unmarshal credential %s (%#v)"
,
c
,
err
)
}
}
...
@@ -91,7 +91,7 @@ func parseCredential(credential string) (*RepoCredential, error) {
...
@@ -91,7 +91,7 @@ func parseCredential(credential string) (*RepoCredential, error) {
}
}
// GetCredential returns a credential by name.
// GetCredential returns a credential by name.
func
(
scp
*
SecretsCredentialProvider
)
GetCredential
(
name
string
)
(
*
Repo
Credential
,
error
)
{
func
(
scp
*
SecretsCredentialProvider
)
GetCredential
(
name
string
)
(
*
Credential
,
error
)
{
o
,
err
:=
scp
.
k
.
Get
(
name
,
secretType
)
o
,
err
:=
scp
.
k
.
Get
(
name
,
secretType
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -101,7 +101,7 @@ func (scp *SecretsCredentialProvider) GetCredential(name string) (*RepoCredentia
...
@@ -101,7 +101,7 @@ func (scp *SecretsCredentialProvider) GetCredential(name string) (*RepoCredentia
}
}
// SetCredential sets a credential by name.
// SetCredential sets a credential by name.
func
(
scp
*
SecretsCredentialProvider
)
SetCredential
(
name
string
,
credential
*
Repo
Credential
)
error
{
func
(
scp
*
SecretsCredentialProvider
)
SetCredential
(
name
string
,
credential
*
Credential
)
error
{
// Marshal the credential & base64 encode it.
// Marshal the credential & base64 encode it.
b
,
err
:=
yaml
.
Marshal
(
credential
)
b
,
err
:=
yaml
.
Marshal
(
credential
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/repo/types.go
View file @
511ac5d1
...
@@ -37,8 +37,8 @@ type APITokenCredential string
...
@@ -37,8 +37,8 @@ type APITokenCredential string
// JWTTokenCredential defines a JWT token.
// JWTTokenCredential defines a JWT token.
type
JWTTokenCredential
string
type
JWTTokenCredential
string
//
Repo
Credential holds a credential used to access a repository.
// Credential holds a credential used to access a repository.
type
Repo
Credential
struct
{
type
Credential
struct
{
APIToken
APITokenCredential
`json:"apitoken,omitempty"`
APIToken
APITokenCredential
`json:"apitoken,omitempty"`
BasicAuth
BasicAuthCredential
`json:"basicauth,omitempty"`
BasicAuth
BasicAuthCredential
`json:"basicauth,omitempty"`
ServiceAccount
JWTTokenCredential
`json:"serviceaccount,omitempty"`
ServiceAccount
JWTTokenCredential
`json:"serviceaccount,omitempty"`
...
@@ -48,33 +48,33 @@ type RepoCredential struct {
...
@@ -48,33 +48,33 @@ type RepoCredential struct {
type
ICredentialProvider
interface
{
type
ICredentialProvider
interface
{
// SetCredential sets the credential for a repository.
// SetCredential sets the credential for a repository.
// May not be supported by some repository services.
// May not be supported by some repository services.
SetCredential
(
name
string
,
credential
*
Repo
Credential
)
error
SetCredential
(
name
string
,
credential
*
Credential
)
error
// GetCredential returns the specified credential or nil if there's no credential.
// GetCredential returns the specified credential or nil if there's no credential.
// Error is non-nil if fetching the credential failed.
// Error is non-nil if fetching the credential failed.
GetCredential
(
name
string
)
(
*
Repo
Credential
,
error
)
GetCredential
(
name
string
)
(
*
Credential
,
error
)
}
}
// RepoType defines the technology that implements a repository.
//
E
RepoType defines the technology that implements a repository.
type
RepoType
string
type
E
RepoType
string
// RepoFormat is a semi-colon delimited string that describes the format of a repository.
//
E
RepoFormat is a semi-colon delimited string that describes the format of a repository.
type
RepoFormat
string
type
E
RepoFormat
string
const
(
const
(
// PathRepoFormat identfies a repository where charts are organized hierarchically.
// PathRepoFormat identfies a repository where charts are organized hierarchically.
PathRepoFormat
=
RepoFormat
(
"path"
)
PathRepoFormat
=
E
RepoFormat
(
"path"
)
// FlatRepoFormat identifies a repository where all charts appear at the top level.
// FlatRepoFormat identifies a repository where all charts appear at the top level.
FlatRepoFormat
=
RepoFormat
(
"flat"
)
FlatRepoFormat
=
E
RepoFormat
(
"flat"
)
)
)
// Repo describes a repository
// Repo describes a repository
type
Repo
struct
{
type
Repo
struct
{
Name
string
`json:"name"`
// Friendly name for this repository
Name
string
`json:"name"`
// Friendly name for this repository
URL
string
`json:"url"`
// URL to the root of this repository
URL
string
`json:"url"`
// URL to the root of this repository
CredentialName
string
`json:"credentialname"`
// Credential name used to access this repository
CredentialName
string
`json:"credentialname"`
// Credential name used to access this repository
Format
RepoFormat
`json:"format"`
// Format of this repository
Format
E
RepoFormat
`json:"format"`
// Format of this repository
Type
RepoType
`json:"type"`
// Technology implementing this repository
Type
E
RepoType
`json:"type"`
// Technology implementing this repository
}
}
// IRepo abstracts a repository.
// IRepo abstracts a repository.
...
@@ -86,9 +86,9 @@ type IRepo interface {
...
@@ -86,9 +86,9 @@ type IRepo interface {
// GetCredentialName returns the credential name used to access this repository.
// GetCredentialName returns the credential name used to access this repository.
GetCredentialName
()
string
GetCredentialName
()
string
// GetFormat returns the format of this repository.
// GetFormat returns the format of this repository.
GetFormat
()
RepoFormat
GetFormat
()
E
RepoFormat
// GetType returns the technology implementing this repository.
// GetType returns the technology implementing this repository.
GetType
()
RepoType
GetType
()
E
RepoType
}
}
// IChartRepo abstracts a place that holds charts.
// IChartRepo abstracts a place that holds charts.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment