Skip to content

Commit

Permalink
Add structs required for proxy repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
Nosmoht committed Jan 28, 2020
1 parent 8b10451 commit 591a42d
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
50 changes: 49 additions & 1 deletion repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@ type Repository struct {
*RepositoryAptSigning `json:"aptSigning,omitempty"`

// Docker Repository data
*RepositoryDocker `json:"docker"`
*RepositoryDocker `json:"docker"`
*RepositoryDockerProxy `json:"dockerProxy"`

// HTTPClient
*RepositoryHTTPClient `json:"httpClient"`

// Cache data for proxy Repository
*RepositoryNegativeCache `json:"negativeCache"`

// Proxy Repository data
*RepositoryProxy `json:"proxy"`
}

// RepositoryCleanup ...
Expand All @@ -39,6 +49,44 @@ type RepositoryStorage struct {
WritePolicy string `json:"writePolicy"`
}

// RepositoryProxy contains Proxy Repository data
type RepositoryProxy struct {
ContentMaxAge int `json:"contentMaxAge"`
MetadataMaxAge int `json:"metadataMaxAge"`
RemoteURL string `json:"remoteUrl"`
}

// RepositoryNegativeCache ...
type RepositoryNegativeCache struct {
Enabled bool `json:"enabled"`
TTL int `json:"timeToLive"`
}

// RepositoryHTTPClient ...
type RepositoryHTTPClient struct {
Authentication RepositoryHTTPClientAuthentication `json:"authentication"`
AutoBlock bool `json:"autoBlock"`
Blocked bool `json:"blocked"`
Connection RepositoryHTTPClientConnection `json:"connection"`
}

// RepositoryHTTPClientConnection ...
type RepositoryHTTPClientConnection struct {
EnableCircularRedirects bool `json:"enableCircularRedirects"`
EnableCookies bool `json:"enableCookies"`
Retries int `json:"retries"`
Timeout int `json:"timeout"`
UserAgentSuffic string `json:"userAgentSuffix"`
}

// RepositoryHTTPClientAuthentication ...
type RepositoryHTTPClientAuthentication struct {
NTLMDomain string `json:"ntlmDomain"`
NTLMHost string `json:"ntlmHost"`
Type string `json:"type"`
Username string `json:"username"`
}

func (c client) RepositoryCreate(repo Repository, format string, repoType string) error {
data, err := jsonMarshalInterfaceToIOReader(repo)
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions repository_docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ type RepositoryDocker struct {
V1Enabled bool `json:"v1Enabled"`
}

// RepositoryDockerProxy contains data of a Docker Proxy Repository
type RepositoryDockerProxy struct {
IndexType string `json:"indexType"`
IndexURL string `json:"indexUrl"`
}

func (c client) RepositoryDockerCreate(repo Repository, repoType string) error {
return c.RepositoryCreate(repo, "docker", repoType)
}
Expand Down

0 comments on commit 591a42d

Please sign in to comment.