Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
go-gitlab
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
go-gitlab
Commits
321eba65
Commit
321eba65
authored
Mar 06, 2019
by
Sander van Harmelen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix style
parent
02ba1eae
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
18 deletions
+21
-18
README.md
README.md
+1
-1
gitlab.go
gitlab.go
+2
-2
registry.go
registry.go
+18
-15
No files found.
README.md
View file @
321eba65
...
@@ -29,8 +29,8 @@ to add new and/or missing endpoints. Currently the following services are suppor
...
@@ -29,8 +29,8 @@ to add new and/or missing endpoints. Currently the following services are suppor
-
[
x
]
Branches
-
[
x
]
Branches
-
[
x
]
Broadcast Messages
-
[
x
]
Broadcast Messages
-
[
x
]
Commits
-
[
x
]
Commits
-
[
x
]
Custom Attributes
-
[
x
]
Container Registry
-
[
x
]
Container Registry
-
[
x
]
Custom Attributes
-
[
x
]
Deploy Keys
-
[
x
]
Deploy Keys
-
[
x
]
Deployments
-
[
x
]
Deployments
-
[
x
]
Environments
-
[
x
]
Environments
...
...
gitlab.go
View file @
321eba65
...
@@ -294,6 +294,7 @@ type Client struct {
...
@@ -294,6 +294,7 @@ type Client struct {
BuildVariables
*
BuildVariablesService
BuildVariables
*
BuildVariablesService
CIYMLTemplate
*
CIYMLTemplatesService
CIYMLTemplate
*
CIYMLTemplatesService
Commits
*
CommitsService
Commits
*
CommitsService
ContainerRegistry
*
ContainerRegistryService
CustomAttribute
*
CustomAttributesService
CustomAttribute
*
CustomAttributesService
DeployKeys
*
DeployKeysService
DeployKeys
*
DeployKeysService
Deployments
*
DeploymentsService
Deployments
*
DeploymentsService
...
@@ -333,7 +334,6 @@ type Client struct {
...
@@ -333,7 +334,6 @@ type Client struct {
Projects
*
ProjectsService
Projects
*
ProjectsService
ProtectedBranches
*
ProtectedBranchesService
ProtectedBranches
*
ProtectedBranchesService
ProtectedTags
*
ProtectedTagsService
ProtectedTags
*
ProtectedTagsService
ContainerRegistry
*
ContainerRegistryService
Repositories
*
RepositoriesService
Repositories
*
RepositoriesService
RepositoryFiles
*
RepositoryFilesService
RepositoryFiles
*
RepositoryFilesService
Runners
*
RunnersService
Runners
*
RunnersService
...
@@ -438,6 +438,7 @@ func newClient(httpClient *http.Client) *Client {
...
@@ -438,6 +438,7 @@ func newClient(httpClient *http.Client) *Client {
c
.
BuildVariables
=
&
BuildVariablesService
{
client
:
c
}
c
.
BuildVariables
=
&
BuildVariablesService
{
client
:
c
}
c
.
CIYMLTemplate
=
&
CIYMLTemplatesService
{
client
:
c
}
c
.
CIYMLTemplate
=
&
CIYMLTemplatesService
{
client
:
c
}
c
.
Commits
=
&
CommitsService
{
client
:
c
}
c
.
Commits
=
&
CommitsService
{
client
:
c
}
c
.
ContainerRegistry
=
&
ContainerRegistryService
{
client
:
c
}
c
.
CustomAttribute
=
&
CustomAttributesService
{
client
:
c
}
c
.
CustomAttribute
=
&
CustomAttributesService
{
client
:
c
}
c
.
DeployKeys
=
&
DeployKeysService
{
client
:
c
}
c
.
DeployKeys
=
&
DeployKeysService
{
client
:
c
}
c
.
Deployments
=
&
DeploymentsService
{
client
:
c
}
c
.
Deployments
=
&
DeploymentsService
{
client
:
c
}
...
@@ -477,7 +478,6 @@ func newClient(httpClient *http.Client) *Client {
...
@@ -477,7 +478,6 @@ func newClient(httpClient *http.Client) *Client {
c
.
Projects
=
&
ProjectsService
{
client
:
c
}
c
.
Projects
=
&
ProjectsService
{
client
:
c
}
c
.
ProtectedBranches
=
&
ProtectedBranchesService
{
client
:
c
}
c
.
ProtectedBranches
=
&
ProtectedBranchesService
{
client
:
c
}
c
.
ProtectedTags
=
&
ProtectedTagsService
{
client
:
c
}
c
.
ProtectedTags
=
&
ProtectedTagsService
{
client
:
c
}
c
.
ContainerRegistry
=
&
ContainerRegistryService
{
client
:
c
}
c
.
Repositories
=
&
RepositoriesService
{
client
:
c
}
c
.
Repositories
=
&
RepositoriesService
{
client
:
c
}
c
.
RepositoryFiles
=
&
RepositoryFilesService
{
client
:
c
}
c
.
RepositoryFiles
=
&
RepositoryFilesService
{
client
:
c
}
c
.
Runners
=
&
RunnersService
{
client
:
c
}
c
.
Runners
=
&
RunnersService
{
client
:
c
}
...
...
registry.go
View file @
321eba65
...
@@ -39,7 +39,7 @@ type RegistryRepositoryTag struct {
...
@@ -39,7 +39,7 @@ type RegistryRepositoryTag struct {
Revision
string
`json:"revision"`
Revision
string
`json:"revision"`
ShortRevision
string
`json:"short_revision"`
ShortRevision
string
`json:"short_revision"`
Digest
string
`json:"digest"`
Digest
string
`json:"digest"`
CreatedAt
*
time
.
Time
`json:"created_at
,omitempty
"`
CreatedAt
*
time
.
Time
`json:"created_at"`
TotalSize
int
`json:"total_size"`
TotalSize
int
`json:"total_size"`
}
}
...
@@ -47,13 +47,14 @@ func (s RegistryRepositoryTag) String() string {
...
@@ -47,13 +47,14 @@ func (s RegistryRepositoryTag) String() string {
return
Stringify
(
s
)
return
Stringify
(
s
)
}
}
// ListRegistryRepositoriesOptions represents the available ListRegistryRepositories() options.
// ListRegistryRepositoriesOptions represents the available
// ListRegistryRepositories() options.
//
//
// GitLab API docs:
// GitLab API docs:
// https://docs.gitlab.com/ee/api/container_registry.html#list-registry-repositories
// https://docs.gitlab.com/ee/api/container_registry.html#list-registry-repositories
type
ListRegistryRepositoriesOptions
ListOptions
type
ListRegistryRepositoriesOptions
ListOptions
// ListRegistryRepositories gets a list of registry repositories in a project
y
// ListRegistryRepositories gets a list of registry repositories in a project
.
//
//
// GitLab API docs:
// GitLab API docs:
// https://docs.gitlab.com/ee/api/container_registry.html#list-registry-repositories
// https://docs.gitlab.com/ee/api/container_registry.html#list-registry-repositories
...
@@ -74,6 +75,7 @@ func (s *ContainerRegistryService) ListRegistryRepositories(pid interface{}, opt
...
@@ -74,6 +75,7 @@ func (s *ContainerRegistryService) ListRegistryRepositories(pid interface{}, opt
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
resp
,
err
return
nil
,
resp
,
err
}
}
return
repos
,
resp
,
err
return
repos
,
resp
,
err
}
}
...
@@ -86,13 +88,13 @@ func (s *ContainerRegistryService) DeleteRegistryRepository(pid interface{}, rep
...
@@ -86,13 +88,13 @@ func (s *ContainerRegistryService) DeleteRegistryRepository(pid interface{}, rep
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
u
:=
fmt
.
Sprintf
(
"projects/%s/registry/repositories/%d"
,
url
.
QueryEscape
(
project
),
repository
)
u
:=
fmt
.
Sprintf
(
"projects/%s/registry/repositories/%d"
,
url
.
QueryEscape
(
project
),
repository
)
req
,
err
:=
s
.
client
.
NewRequest
(
"DELETE"
,
u
,
nil
,
options
)
req
,
err
:=
s
.
client
.
NewRequest
(
"DELETE"
,
u
,
nil
,
options
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
s
.
client
.
Do
(
req
,
nil
)
return
s
.
client
.
Do
(
req
,
nil
)
}
}
...
@@ -112,7 +114,6 @@ func (s *ContainerRegistryService) ListRegistryRepositoryTags(pid interface{}, r
...
@@ -112,7 +114,6 @@ func (s *ContainerRegistryService) ListRegistryRepositoryTags(pid interface{}, r
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
u
:=
fmt
.
Sprintf
(
"projects/%s/registry/repositories/%d/tags"
,
u
:=
fmt
.
Sprintf
(
"projects/%s/registry/repositories/%d/tags"
,
url
.
QueryEscape
(
project
),
url
.
QueryEscape
(
project
),
repository
,
repository
,
...
@@ -123,12 +124,13 @@ func (s *ContainerRegistryService) ListRegistryRepositoryTags(pid interface{}, r
...
@@ -123,12 +124,13 @@ func (s *ContainerRegistryService) ListRegistryRepositoryTags(pid interface{}, r
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
var
repo
s
[]
*
RegistryRepositoryTag
var
tag
s
[]
*
RegistryRepositoryTag
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
repo
s
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
tag
s
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
resp
,
err
return
nil
,
resp
,
err
}
}
return
repos
,
resp
,
err
return
tags
,
resp
,
err
}
}
// GetRegistryRepositoryTagDetail get details of a registry repository tag
// GetRegistryRepositoryTagDetail get details of a registry repository tag
...
@@ -140,7 +142,6 @@ func (s *ContainerRegistryService) GetRegistryRepositoryTagDetail(pid interface{
...
@@ -140,7 +142,6 @@ func (s *ContainerRegistryService) GetRegistryRepositoryTagDetail(pid interface{
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
u
:=
fmt
.
Sprintf
(
"projects/%s/registry/repositories/%d/tags/%s"
,
u
:=
fmt
.
Sprintf
(
"projects/%s/registry/repositories/%d/tags/%s"
,
url
.
QueryEscape
(
project
),
url
.
QueryEscape
(
project
),
repository
,
repository
,
...
@@ -152,12 +153,13 @@ func (s *ContainerRegistryService) GetRegistryRepositoryTagDetail(pid interface{
...
@@ -152,12 +153,13 @@ func (s *ContainerRegistryService) GetRegistryRepositoryTagDetail(pid interface{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
t
d
:=
new
(
RegistryRepositoryTag
)
t
ag
:=
new
(
RegistryRepositoryTag
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
t
d
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
t
ag
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
resp
,
err
return
nil
,
resp
,
err
}
}
return
td
,
resp
,
err
return
tag
,
resp
,
err
}
}
// DeleteRegistryRepositoryTag deletes a registry repository tag.
// DeleteRegistryRepositoryTag deletes a registry repository tag.
...
@@ -169,7 +171,6 @@ func (s *ContainerRegistryService) DeleteRegistryRepositoryTag(pid interface{},
...
@@ -169,7 +171,6 @@ func (s *ContainerRegistryService) DeleteRegistryRepositoryTag(pid interface{},
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
u
:=
fmt
.
Sprintf
(
"projects/%s/registry/repositories/%d/tags/%s"
,
u
:=
fmt
.
Sprintf
(
"projects/%s/registry/repositories/%d/tags/%s"
,
url
.
QueryEscape
(
project
),
url
.
QueryEscape
(
project
),
repository
,
repository
,
...
@@ -180,6 +181,7 @@ func (s *ContainerRegistryService) DeleteRegistryRepositoryTag(pid interface{},
...
@@ -180,6 +181,7 @@ func (s *ContainerRegistryService) DeleteRegistryRepositoryTag(pid interface{},
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
s
.
client
.
Do
(
req
,
nil
)
return
s
.
client
.
Do
(
req
,
nil
)
}
}
...
@@ -194,7 +196,8 @@ type DeleteRegistryRepositoryTagsOptions struct {
...
@@ -194,7 +196,8 @@ type DeleteRegistryRepositoryTagsOptions struct {
OlderThan
*
string
`url:"older_than,omitempty" json:"older_than,omitempty"`
OlderThan
*
string
`url:"older_than,omitempty" json:"older_than,omitempty"`
}
}
// DeleteRegistryRepositoryTags deletes repository tags in bulk based on given criteria.
// DeleteRegistryRepositoryTags deletes repository tags in bulk based on
// given criteria.
//
//
// GitLab API docs:
// GitLab API docs:
// https://docs.gitlab.com/ee/api/container_registry.html#delete-repository-tags-in-bulk
// https://docs.gitlab.com/ee/api/container_registry.html#delete-repository-tags-in-bulk
...
@@ -203,7 +206,6 @@ func (s *ContainerRegistryService) DeleteRegistryRepositoryTags(pid interface{},
...
@@ -203,7 +206,6 @@ func (s *ContainerRegistryService) DeleteRegistryRepositoryTags(pid interface{},
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
u
:=
fmt
.
Sprintf
(
"projects/%s/registry/repositories/%d/tags"
,
u
:=
fmt
.
Sprintf
(
"projects/%s/registry/repositories/%d/tags"
,
url
.
QueryEscape
(
project
),
url
.
QueryEscape
(
project
),
repository
,
repository
,
...
@@ -213,5 +215,6 @@ func (s *ContainerRegistryService) DeleteRegistryRepositoryTags(pid interface{},
...
@@ -213,5 +215,6 @@ func (s *ContainerRegistryService) DeleteRegistryRepositoryTags(pid interface{},
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
s
.
client
.
Do
(
req
,
nil
)
return
s
.
client
.
Do
(
req
,
nil
)
}
}
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