Skip to content

Commit 818ee96

Browse files
committed
api/types: move AuthConfig to registry types
Making the api types more focused per API type, and the general api/types package somewhat smaller. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 857cb26 commit 818ee96

4 files changed

Lines changed: 30 additions & 22 deletions

File tree

api/types/auth.go

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,7 @@
11
package types // import "github.com/docker/docker/api/types"
2+
import "github.com/docker/docker/api/types/registry"
23

3-
// AuthConfig contains authorization information for connecting to a Registry
4-
type AuthConfig struct {
5-
Username string `json:"username,omitempty"`
6-
Password string `json:"password,omitempty"`
7-
Auth string `json:"auth,omitempty"`
8-
9-
// Email is an optional value associated with the username.
10-
// This field is deprecated and will be removed in a later
11-
// version of docker.
12-
Email string `json:"email,omitempty"`
13-
14-
ServerAddress string `json:"serveraddress,omitempty"`
15-
16-
// IdentityToken is used to authenticate the user and get
17-
// an access token for the registry.
18-
IdentityToken string `json:"identitytoken,omitempty"`
19-
20-
// RegistryToken is a bearer token to be sent to a registry
21-
RegistryToken string `json:"registrytoken,omitempty"`
22-
}
4+
// AuthConfig contains authorization information for connecting to a Registry.
5+
//
6+
// Deprecated: use github.com/docker/docker/api/types/registry.AuthConfig
7+
type AuthConfig = registry.AuthConfig

api/types/backend/build.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"io"
55

66
"github.com/docker/docker/api/types"
7+
"github.com/docker/docker/api/types/registry"
78
"github.com/docker/docker/pkg/streamformatter"
89
specs "github.com/opencontainers/image-spec/specs-go/v1"
910
)
@@ -39,7 +40,7 @@ type BuildConfig struct {
3940
// GetImageAndLayerOptions are the options supported by GetImageAndReleasableLayer
4041
type GetImageAndLayerOptions struct {
4142
PullOption PullOption
42-
AuthConfig map[string]types.AuthConfig
43+
AuthConfig map[string]registry.AuthConfig
4344
Output io.Writer
4445
Platform *specs.Platform
4546
}

api/types/client.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77

88
"github.com/docker/docker/api/types/container"
99
"github.com/docker/docker/api/types/filters"
10+
"github.com/docker/docker/api/types/registry"
1011
units "github.com/docker/go-units"
1112
)
1213

@@ -180,7 +181,7 @@ type ImageBuildOptions struct {
180181
// at all (nil). See the parsing of buildArgs in
181182
// api/server/router/build/build_routes.go for even more info.
182183
BuildArgs map[string]*string
183-
AuthConfigs map[string]AuthConfig
184+
AuthConfigs map[string]registry.AuthConfig
184185
Context io.Reader
185186
Labels map[string]string
186187
// squash the resulting image's layers to the parent

api/types/registry/authconfig.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,24 @@ package registry // import "github.com/docker/docker/api/types/registry"
33
// AuthHeader is the name of the header used to send encoded registry
44
// authorization credentials for registry operations (push/pull).
55
const AuthHeader = "X-Registry-Auth"
6+
7+
// AuthConfig contains authorization information for connecting to a Registry.
8+
type AuthConfig struct {
9+
Username string `json:"username,omitempty"`
10+
Password string `json:"password,omitempty"`
11+
Auth string `json:"auth,omitempty"`
12+
13+
// Email is an optional value associated with the username.
14+
// This field is deprecated and will be removed in a later
15+
// version of docker.
16+
Email string `json:"email,omitempty"`
17+
18+
ServerAddress string `json:"serveraddress,omitempty"`
19+
20+
// IdentityToken is used to authenticate the user and get
21+
// an access token for the registry.
22+
IdentityToken string `json:"identitytoken,omitempty"`
23+
24+
// RegistryToken is a bearer token to be sent to a registry
25+
RegistryToken string `json:"registrytoken,omitempty"`
26+
}

0 commit comments

Comments
 (0)