Skip to content

Commit

Permalink
still provide deprecated package
Browse files Browse the repository at this point in the history
  • Loading branch information
mandelsoft committed Nov 13, 2023
1 parent ad9d8d5 commit 6948994
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 9 deletions.
17 changes: 8 additions & 9 deletions pkg/contexts/credentials/builtin/helm/identity/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"helm.sh/helm/v3/pkg/registry"

"github.com/open-component-model/ocm/pkg/common"
"github.com/open-component-model/ocm/pkg/contexts/credentials"
ociidentity "github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/oci/identity"
"github.com/open-component-model/ocm/pkg/contexts/credentials/cpi"
"github.com/open-component-model/ocm/pkg/contexts/credentials/identity/hostpath"
Expand Down Expand Up @@ -60,11 +59,11 @@ func IdentityMatcher(pattern, cur, id cpi.ConsumerIdentity) bool {
// used credential attributes

const (
ATTR_USERNAME = credentials.ATTR_USERNAME
ATTR_PASSWORD = credentials.ATTR_PASSWORD
ATTR_CERTIFICATE_AUTHORITY = credentials.ATTR_CERTIFICATE_AUTHORITY
ATTR_CERTIFICATE = credentials.ATTR_CERTIFICATE
ATTR_PRIVATE_KEY = credentials.ATTR_PRIVATE_KEY
ATTR_USERNAME = cpi.ATTR_USERNAME
ATTR_PASSWORD = cpi.ATTR_PASSWORD
ATTR_CERTIFICATE_AUTHORITY = cpi.ATTR_CERTIFICATE_AUTHORITY
ATTR_CERTIFICATE = cpi.ATTR_CERTIFICATE
ATTR_PRIVATE_KEY = cpi.ATTR_PRIVATE_KEY
)

func OCIRepoURL(repourl string, chartname string) string {
Expand All @@ -76,7 +75,7 @@ func OCIRepoURL(repourl string, chartname string) string {
}

func SimpleCredentials(user, passwd string) cpi.Credentials {
return credentials.DirectCredentials{
return cpi.DirectCredentials{
ATTR_USERNAME: user,
ATTR_PASSWORD: passwd,
}
Expand All @@ -95,12 +94,12 @@ func GetConsumerId(repourl string, chartname string) cpi.ConsumerIdentity {
}
}

func GetCredentials(ctx credentials.ContextProvider, repourl string, chartname string) common.Properties {
func GetCredentials(ctx cpi.ContextProvider, repourl string, chartname string) common.Properties {
id := GetConsumerId(repourl, chartname)
if id == nil {
return nil
}
creds, err := credentials.CredentialsForConsumer(ctx.CredentialsContext(), id)
creds, err := cpi.CredentialsForConsumer(ctx.CredentialsContext(), id)
if creds == nil || err != nil {
return nil
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/contexts/credentials/cpi/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ const (
ATTR_REGISTRY_TOKEN = internal.ATTR_REGISTRY_TOKEN
ATTR_KEY = internal.ATTR_KEY
ATTR_CERTIFICATE_AUTHORITY = internal.ATTR_CERTIFICATE_AUTHORITY
ATTR_CERTIFICATE = internal.ATTR_CERTIFICATE
ATTR_PRIVATE_KEY = internal.ATTR_PRIVATE_KEY
)
75 changes: 75 additions & 0 deletions pkg/helm/identity/identity.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and Open Component Model contributors.
//
// SPDX-License-Identifier: Apache-2.0

package identity

import (
"github.com/open-component-model/ocm/pkg/common"
"github.com/open-component-model/ocm/pkg/contexts/credentials"
helmidentity "github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity"
)

// CONSUMER_TYPE is the Helm chart repository type.
// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
const CONSUMER_TYPE = helmidentity.CONSUMER_TYPE

// ID_TYPE is the type field of a consumer identity.
// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
const ID_TYPE = helmidentity.ID_PORT

// ID_SCHEME is the scheme of the repository.
// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
const ID_SCHEME = helmidentity.ID_SCHEME

// ID_HOSTNAME is the hostname of a repository.
// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
const ID_HOSTNAME = helmidentity.ID_HOSTNAME

// ID_PORT is the port number of a repository.
// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
const ID_PORT = helmidentity.ID_PORT

// ID_PATHPREFIX is the path of a repository.
// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
const ID_PATHPREFIX = helmidentity.ID_PATHPREFIX

// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
func IdentityMatcher(pattern, cur, id credentials.ConsumerIdentity) bool {
return helmidentity.IdentityMatcher(pattern, cur, id)
}

// used credential attributes

const (
// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
ATTR_USERNAME = credentials.ATTR_USERNAME
// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
ATTR_PASSWORD = credentials.ATTR_PASSWORD
// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
ATTR_CERTIFICATE_AUTHORITY = credentials.ATTR_CERTIFICATE_AUTHORITY
// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
ATTR_CERTIFICATE = credentials.ATTR_CERTIFICATE
// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
ATTR_PRIVATE_KEY = credentials.ATTR_PRIVATE_KEY
)

// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
func OCIRepoURL(repourl string, chartname string) string {
return helmidentity.OCIRepoURL(repourl, chartname)
}

// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
func SimpleCredentials(user, passwd string) credentials.Credentials {
return helmidentity.SimpleCredentials(user, passwd)
}

// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
func GetConsumerId(repourl string, chartname string) credentials.ConsumerIdentity {
return helmidentity.GetConsumerId(repourl, chartname)
}

// Deprecated: use package github.com/open-component-model/ocm/pkg/contexts/credentials/builtin/helm/identity.
func GetCredentials(ctx credentials.ContextProvider, repourl string, chartname string) common.Properties {
return helmidentity.GetCredentials(ctx, repourl, chartname)
}

0 comments on commit 6948994

Please sign in to comment.