Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

deprecate: deprecate all existing APIs #96

Merged
merged 14 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions file_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.
package credentials

import (
orascreds "oras.land/oras-go/v2/registry/remote/credentials"
credentials "oras.land/oras-go/v2/registry/remote/credentials"
Wwwsylvia marked this conversation as resolved.
Show resolved Hide resolved
)

// FileStore implements a credentials store using the docker configuration file
Expand All @@ -27,7 +27,7 @@ import (
// Deprecated: This type is now simply [credentials.FileStore] of oras-go.
//
// [credentials.FileStore]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#FileStore
type FileStore = orascreds.FileStore
type FileStore = credentials.FileStore

var (
// ErrPlaintextPutDisabled is returned by Put() when DisablePut is set
Expand All @@ -36,14 +36,14 @@ var (
// Deprecated: This type is now simply [credentials.ErrPlaintextPutDisabled] of oras-go.
//
// [credentials.ErrPlaintextPutDisabled]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#ErrPlaintextPutDisabled
ErrPlaintextPutDisabled = orascreds.ErrPlaintextPutDisabled
ErrPlaintextPutDisabled = credentials.ErrPlaintextPutDisabled
// ErrBadCredentialFormat is returned by Put() when the credential format
// is bad.
//
// Deprecated: This type is now simply [credentials.ErrBadCredentialFormat] of oras-go.
//
// [credentials.ErrBadCredentialFormat]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#ErrBadCredentialFormat
ErrBadCredentialFormat = orascreds.ErrBadCredentialFormat
ErrBadCredentialFormat = credentials.ErrBadCredentialFormat
)

// NewFileStore creates a new file credentials store.
Expand All @@ -54,5 +54,5 @@ var (
//
// [credentials.NewFileStore]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#NewFileStore
func NewFileStore(configPath string) (*FileStore, error) {
return orascreds.NewFileStore(configPath)
return credentials.NewFileStore(configPath)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/oras-project/oras-credentials-go

go 1.19

require oras.land/oras-go/v2 v2.3.1-0.20230920034305-9f83e6714707
require oras.land/oras-go/v2 v2.3.1-0.20230925030825-cb8c8bc3075c

require (
github.com/opencontainers/go-digest v1.0.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ github.com/opencontainers/image-spec v1.1.0-rc4 h1:oOxKUJWnFC4YGHCCMNql1x4YaDfYB
github.com/opencontainers/image-spec v1.1.0-rc4/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
oras.land/oras-go/v2 v2.3.1-0.20230920034305-9f83e6714707 h1:zfZBJei7FucaPSlHtxHTJfyfQTeEqV6fDoKMxlGJP0k=
oras.land/oras-go/v2 v2.3.1-0.20230920034305-9f83e6714707/go.mod h1:LTHGmKO431CaOWkqgadzYq0sEixlO+EN/zShuWvT1Yg=
oras.land/oras-go/v2 v2.3.1-0.20230925030825-cb8c8bc3075c h1:znOn5Gb/vfBI/rvruoeqUHyJEfi9woL6r/IvqnFpqRQ=
oras.land/oras-go/v2 v2.3.1-0.20230925030825-cb8c8bc3075c/go.mod h1:LTHGmKO431CaOWkqgadzYq0sEixlO+EN/zShuWvT1Yg=
4 changes: 2 additions & 2 deletions memory_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.
package credentials

import (
orascreds "oras.land/oras-go/v2/registry/remote/credentials"
credentials "oras.land/oras-go/v2/registry/remote/credentials"
)
Wwwsylvia marked this conversation as resolved.
Show resolved Hide resolved

// NewMemoryStore creates a new in-memory credentials store.
Expand All @@ -25,5 +25,5 @@ import (
//
// [credentials.NewMemoryStore]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#NewMemoryStore
func NewMemoryStore() Store {
return orascreds.NewMemoryStore()
return credentials.NewMemoryStore()
}
6 changes: 3 additions & 3 deletions native_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.
package credentials

import (
orascreds "oras.land/oras-go/v2/registry/remote/credentials"
credentials "oras.land/oras-go/v2/registry/remote/credentials"
)
Wwwsylvia marked this conversation as resolved.
Show resolved Hide resolved

// NewNativeStore creates a new native store that uses a remote helper program to
Expand All @@ -33,7 +33,7 @@ import (
//
// [credentials.NewNativeStore]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#NewNativeStore
func NewNativeStore(helperSuffix string) Store {
return orascreds.NewNativeStore(helperSuffix)
return credentials.NewNativeStore(helperSuffix)
}

// NewDefaultNativeStore returns a native store based on the platform-default
Expand All @@ -50,5 +50,5 @@ func NewNativeStore(helperSuffix string) Store {
//
// [credentials.NewDefaultNativeStore]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#NewDefaultNativeStore
func NewDefaultNativeStore() (Store, bool) {
return orascreds.NewDefaultNativeStore()
return credentials.NewDefaultNativeStore()
}
14 changes: 7 additions & 7 deletions registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"oras.land/oras-go/v2/registry/remote"
"oras.land/oras-go/v2/registry/remote/auth"
orascreds "oras.land/oras-go/v2/registry/remote/credentials"
credentials "oras.land/oras-go/v2/registry/remote/credentials"
Wwwsylvia marked this conversation as resolved.
Show resolved Hide resolved
)

// ErrClientTypeUnsupported is thrown by Login() when the registry's client type
Expand All @@ -29,7 +29,7 @@ import (
// Deprecated: This type is now simply [credentials.ErrClientTypeUnsupported] of oras-go.
//
// [credentials.ErrClientTypeUnsupported]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#ErrClientTypeUnsupported
var ErrClientTypeUnsupported = orascreds.ErrClientTypeUnsupported
var ErrClientTypeUnsupported = credentials.ErrClientTypeUnsupported

// Login provides the login functionality with the given credentials. The target
// registry's client should be nil or of type *auth.Client. Login uses
Expand All @@ -40,7 +40,7 @@ var ErrClientTypeUnsupported = orascreds.ErrClientTypeUnsupported
//
// [credentials.Login]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#Login
func Login(ctx context.Context, store Store, reg *remote.Registry, cred auth.Credential) error {
return orascreds.Login(ctx, store, reg, cred)
return credentials.Login(ctx, store, reg, cred)
}

// Logout provides the logout functionality given the registry name.
Expand All @@ -49,7 +49,7 @@ func Login(ctx context.Context, store Store, reg *remote.Registry, cred auth.Cre
//
// [credentials.Logout]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#Logout
func Logout(ctx context.Context, store Store, registryName string) error {
return orascreds.Logout(ctx, store, registryName)
return credentials.Logout(ctx, store, registryName)
}

// Credential returns a Credential() function that can be used by auth.Client.
Expand All @@ -58,7 +58,7 @@ func Logout(ctx context.Context, store Store, registryName string) error {
//
// [credentials.Credential]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#Credential
func Credential(store Store) func(context.Context, string) (auth.Credential, error) {
return orascreds.Credential(store)
return credentials.Credential(store)
}

// ServerAddressFromRegistry maps a registry to a server address, which is used as
Expand All @@ -70,7 +70,7 @@ func Credential(store Store) func(context.Context, string) (auth.Credential, err
//
// [credentials.ServerAddressFromRegistry]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#ServerAddressFromRegistry
func ServerAddressFromRegistry(registry string) string {
return orascreds.ServerAddressFromRegistry(registry)
return credentials.ServerAddressFromRegistry(registry)
}

// ServerAddressFromHostname maps a hostname to a server address, which is used as
Expand All @@ -82,5 +82,5 @@ func ServerAddressFromRegistry(registry string) string {
//
// [credentials.ServerAddressFromHostname]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#ServerAddressFromHostname
func ServerAddressFromHostname(hostname string) string {
return orascreds.ServerAddressFromHostname(hostname)
return credentials.ServerAddressFromHostname(hostname)
}
14 changes: 7 additions & 7 deletions store.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,30 @@ limitations under the License.
package credentials

import (
orascreds "oras.land/oras-go/v2/registry/remote/credentials"
credentials "oras.land/oras-go/v2/registry/remote/credentials"
)
Wwwsylvia marked this conversation as resolved.
Show resolved Hide resolved

// Store is the interface that any credentials store must implement.
//
// Deprecated: This type is now simply [credentials.Store] of oras-go.
//
// [credentials.Store]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#Store
type Store = orascreds.Store
type Store = credentials.Store

// DynamicStore dynamically determines which store to use based on the settings
// in the config file.
//
// Deprecated: This type is now simply [credentials.DynamicStore] of oras-go.
//
// [credentials.DynamicStore]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#DynamicStore
type DynamicStore = orascreds.DynamicStore
type DynamicStore = credentials.DynamicStore

// StoreOptions provides options for NewStore.
//
// Deprecated: This type is now simply [credentials.StoreOptions] of oras-go.
//
// [credentials.StoreOptions]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#StoreOptions
type StoreOptions = orascreds.StoreOptions
type StoreOptions = credentials.StoreOptions

// NewStore returns a Store based on the given configuration file.
//
Expand All @@ -62,7 +62,7 @@ type StoreOptions = orascreds.StoreOptions
//
// [credentials.NewStore]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#NewStore
func NewStore(configPath string, opts StoreOptions) (*DynamicStore, error) {
return orascreds.NewStore(configPath, opts)
return credentials.NewStore(configPath, opts)
}

// NewStoreFromDocker returns a Store based on the default docker config file.
Expand All @@ -80,7 +80,7 @@ func NewStore(configPath string, opts StoreOptions) (*DynamicStore, error) {
//
// [credentials.NewStoreFromDocker]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#NewStoreFromDocker
func NewStoreFromDocker(opts StoreOptions) (*DynamicStore, error) {
return orascreds.NewStoreFromDocker(opts)
return credentials.NewStoreFromDocker(opts)
}

// NewStoreWithFallbacks returns a new store based on the given stores.
Expand All @@ -94,5 +94,5 @@ func NewStoreFromDocker(opts StoreOptions) (*DynamicStore, error) {
//
// [credentials.NewStoreWithFallbacks]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#NewStoreWithFallbacks
func NewStoreWithFallbacks(primary Store, fallbacks ...Store) Store {
return orascreds.NewStoreWithFallbacks(primary, fallbacks...)
return credentials.NewStoreWithFallbacks(primary, fallbacks...)
}
16 changes: 8 additions & 8 deletions trace/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@ package trace
import (
"context"

orastrace "oras.land/oras-go/v2/registry/remote/credentials/trace"
trace "oras.land/oras-go/v2/registry/remote/credentials/trace"
Wwwsylvia marked this conversation as resolved.
Show resolved Hide resolved
)

// ExecutableTrace is a set of hooks used to trace the execution of binary
// executables. Any particular hook may be nil.
//
// Deprecated: This type is now simply [trace.ExecutableTrace] of oras-go.
//
// [trace.ExecutableTrace]: http://localhost:6060/pkg/github.com/oras-project/oras-credentials-go/trace/#ExecutableTrace
type ExecutableTrace = orastrace.ExecutableTrace
// [trace.ExecutableTrace]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials/trace#ExecutableTrace
type ExecutableTrace = trace.ExecutableTrace

// ContextExecutableTrace returns the ExecutableTrace associated with the
// context. If none, it returns nil.
//
// Deprecated: This function now simply calls [trace.ContextExecutableTrace] of oras-go.
//
// [trace.ContextExecutableTrace]: http://localhost:6060/pkg/github.com/oras-project/oras-credentials-go/trace/#ContextExecutableTrace
// [trace.ContextExecutableTrace]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials/trace#ContextExecutableTrace
func ContextExecutableTrace(ctx context.Context) *ExecutableTrace {
return orastrace.ContextExecutableTrace(ctx)
return trace.ContextExecutableTrace(ctx)
}

// WithExecutableTrace takes a Context and an ExecutableTrace, and returns a
Expand All @@ -50,7 +50,7 @@ func ContextExecutableTrace(ctx context.Context) *ExecutableTrace {
//
// Deprecated: This function now simply calls [trace.WithExecutableTrace] of oras-go.
//
// [trace.WithExecutableTrace]: http://localhost:6060/pkg/github.com/oras-project/oras-credentials-go/trace/#WithExecutableTrace
func WithExecutableTrace(ctx context.Context, trace *ExecutableTrace) context.Context {
return orastrace.WithExecutableTrace(ctx, trace)
// [trace.WithExecutableTrace]: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials/trace#WithExecutableTrace
func WithExecutableTrace(ctx context.Context, et *ExecutableTrace) context.Context {
return trace.WithExecutableTrace(ctx, et)
}
Loading