mirror of
https://github.com/outbackdingo/ghorg.git
synced 2026-01-27 18:18:58 +00:00
Bump github.com/ktrysmt/go-bitbucket from 0.9.49 to 0.9.50 (#246)
Bumps [github.com/ktrysmt/go-bitbucket](https://github.com/ktrysmt/go-bitbucket) from 0.9.49 to 0.9.50. - [Release notes](https://github.com/ktrysmt/go-bitbucket/releases) - [Commits](https://github.com/ktrysmt/go-bitbucket/compare/v0.9.49...v0.9.50) --- updated-dependencies: - dependency-name: github.com/ktrysmt/go-bitbucket dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
2
go.mod
2
go.mod
@@ -8,7 +8,7 @@ require (
|
||||
github.com/fatih/color v1.13.0
|
||||
github.com/google/go-github/v41 v41.0.0
|
||||
github.com/korovkin/limiter v0.0.0-20220422174850-01f593e64cf7
|
||||
github.com/ktrysmt/go-bitbucket v0.9.49
|
||||
github.com/ktrysmt/go-bitbucket v0.9.50
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/spf13/cobra v1.5.0
|
||||
github.com/spf13/viper v1.12.0
|
||||
|
||||
4
go.sum
4
go.sum
@@ -163,8 +163,8 @@ github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/ktrysmt/go-bitbucket v0.9.49 h1:VVfdYIw1SLmgD4xremGkyVY8oI84m9hSbZTK3FyBjxA=
|
||||
github.com/ktrysmt/go-bitbucket v0.9.49/go.mod h1:aB/IUpoFE65X84soIfgUPT53bzp/jfYoffLN2mg3bFc=
|
||||
github.com/ktrysmt/go-bitbucket v0.9.50 h1:xZcYssIrrj9KODEZFlZCu/KEsveBGRoc+i+wlSVZhFk=
|
||||
github.com/ktrysmt/go-bitbucket v0.9.50/go.mod h1:aB/IUpoFE65X84soIfgUPT53bzp/jfYoffLN2mg3bFc=
|
||||
github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=
|
||||
github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
|
||||
14
vendor/github.com/ktrysmt/go-bitbucket/bitbucket.go
generated
vendored
14
vendor/github.com/ktrysmt/go-bitbucket/bitbucket.go
generated
vendored
@@ -476,6 +476,20 @@ type RepositoryEnvironmentsOptions struct {
|
||||
RepoSlug string `json:"repo_slug"`
|
||||
}
|
||||
|
||||
type RepositoryGroupPermissionsOptions struct {
|
||||
Owner string `json:"owner"`
|
||||
RepoSlug string `json:"repo_slug"`
|
||||
Group string `json:"group"`
|
||||
Permission string `json:"permission"`
|
||||
}
|
||||
|
||||
type RepositoryUserPermissionsOptions struct {
|
||||
Owner string `json:"owner"`
|
||||
RepoSlug string `json:"repo_slug"`
|
||||
User string `json:"user"`
|
||||
Permission string `json:"permission"`
|
||||
}
|
||||
|
||||
type RepositoryEnvironmentTypeOption int
|
||||
|
||||
const (
|
||||
|
||||
255
vendor/github.com/ktrysmt/go-bitbucket/repository.go
generated
vendored
255
vendor/github.com/ktrysmt/go-bitbucket/repository.go
generated
vendored
@@ -205,6 +205,51 @@ type DefaultReviewers struct {
|
||||
DefaultReviewers []DefaultReviewer
|
||||
}
|
||||
|
||||
type Group struct {
|
||||
AccountPrivilege string `mapstructure:"account_privilege"`
|
||||
DefaultPermission string `mapstructure:"default_permission"`
|
||||
EmailForwardingDisabled bool `mapstructure:"email_forwarding_disabled"`
|
||||
FullSlug string `mapstructure:"full_slug"`
|
||||
Links map[string]map[string]string
|
||||
Name string `mapstructure:"name"`
|
||||
Slug string `mapstructure:"slug"`
|
||||
Type string `mapstructure:"type"`
|
||||
Workspace map[string]interface{} `mapstructure:"workspace"`
|
||||
Owner map[string]interface{}
|
||||
}
|
||||
|
||||
type GroupPermission struct {
|
||||
Type string
|
||||
Group Group
|
||||
Permission string
|
||||
Links map[string]map[string]string
|
||||
}
|
||||
|
||||
type GroupPermissions struct {
|
||||
Page int
|
||||
Pagelen int
|
||||
MaxDepth int
|
||||
Size int
|
||||
Next string
|
||||
GroupPermissions []GroupPermission
|
||||
}
|
||||
|
||||
type UserPermission struct {
|
||||
Type string
|
||||
User User
|
||||
Permission string
|
||||
Links map[string]map[string]string
|
||||
}
|
||||
|
||||
type UserPermissions struct {
|
||||
Page int
|
||||
Pagelen int
|
||||
MaxDepth int
|
||||
Size int
|
||||
Next string
|
||||
UserPermissions []UserPermission
|
||||
}
|
||||
|
||||
func (r *Repository) Create(ro *RepositoryOptions) (*Repository, error) {
|
||||
data, err := r.buildRepositoryBody(ro)
|
||||
if err != nil {
|
||||
@@ -834,6 +879,88 @@ func (r *Repository) UpdateDeploymentVariable(opt *RepositoryDeploymentVariableO
|
||||
return decodeDeploymentVariable(response)
|
||||
}
|
||||
|
||||
func (r *Repository) ListGroupPermissions(ro *RepositoryOptions) (*GroupPermissions, error) {
|
||||
urlStr := r.c.requestUrl("/repositories/%s/%s/permissions-config/groups?pagelen=1", ro.Owner, ro.RepoSlug)
|
||||
|
||||
res, err := r.c.executePaginated("GET", urlStr, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return decodeGroupsPermissions(res)
|
||||
}
|
||||
|
||||
func (r *Repository) SetGroupPermissions(rgo *RepositoryGroupPermissionsOptions) (*GroupPermission, error) {
|
||||
body, err := r.buildRepositoryGroupPermissionBody(rgo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
urlStr := r.c.requestUrl("/repositories/%s/%s/permissions-config/groups/%s", rgo.Owner, rgo.RepoSlug, rgo.Group)
|
||||
|
||||
res, err := r.c.execute("PUT", urlStr, body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return decodeGroupPermissions(res)
|
||||
}
|
||||
|
||||
func (r *Repository) DeleteGroupPermissions(rgo *RepositoryGroupPermissionsOptions) (interface{}, error) {
|
||||
urlStr := r.c.requestUrl("/repositories/%s/%s/permissions-config/groups/%s", rgo.Owner, rgo.RepoSlug, rgo.Group)
|
||||
return r.c.execute("DELETE", urlStr, "")
|
||||
}
|
||||
|
||||
func (r *Repository) GetGroupPermissions(rgo *RepositoryGroupPermissionsOptions) (*GroupPermission, error) {
|
||||
urlStr := r.c.requestUrl("/repositories/%s/%s/permissions-config/groups/%s", rgo.Owner, rgo.RepoSlug, rgo.Group)
|
||||
|
||||
res, err := r.c.executePaginated("GET", urlStr, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return decodeGroupPermissions(res)
|
||||
}
|
||||
|
||||
func (r *Repository) ListUserPermissions(ro *RepositoryOptions) (*UserPermissions, error) {
|
||||
urlStr := r.c.requestUrl("/repositories/%s/%s/permissions-config/users?pagelen=1", ro.Owner, ro.RepoSlug)
|
||||
|
||||
res, err := r.c.executePaginated("GET", urlStr, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return decodeUsersPermissions(res)
|
||||
}
|
||||
|
||||
func (r *Repository) SetUserPermissions(rgo *RepositoryUserPermissionsOptions) (*UserPermission, error) {
|
||||
body, err := r.buildRepositoryUserPermissionBody(rgo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
urlStr := r.c.requestUrl("/repositories/%s/%s/permissions-config/users/%s", rgo.Owner, rgo.RepoSlug, rgo.User)
|
||||
|
||||
res, err := r.c.execute("PUT", urlStr, body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return decodeUserPermissions(res)
|
||||
}
|
||||
|
||||
func (r *Repository) DeleteUserPermissions(rgo *RepositoryUserPermissionsOptions) (interface{}, error) {
|
||||
urlStr := r.c.requestUrl("/repositories/%s/%s/permissions-config/users/%s", rgo.Owner, rgo.RepoSlug, rgo.User)
|
||||
return r.c.execute("DELETE", urlStr, "")
|
||||
}
|
||||
|
||||
func (r *Repository) GetUserPermissions(rgo *RepositoryUserPermissionsOptions) (*UserPermission, error) {
|
||||
urlStr := r.c.requestUrl("/repositories/%s/%s/permissions-config/users/%s", rgo.Owner, rgo.RepoSlug, rgo.User)
|
||||
|
||||
res, err := r.c.executePaginated("GET", urlStr, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return decodeUserPermissions(res)
|
||||
}
|
||||
|
||||
func (r *Repository) buildRepositoryBody(ro *RepositoryOptions) (string, error) {
|
||||
body := map[string]interface{}{}
|
||||
|
||||
@@ -1019,6 +1146,22 @@ func (r *Repository) buildDeploymentVariableBody(opt *RepositoryDeploymentVariab
|
||||
return r.buildJsonBody(body)
|
||||
}
|
||||
|
||||
func (r *Repository) buildRepositoryGroupPermissionBody(rpo *RepositoryGroupPermissionsOptions) (string, error) {
|
||||
body := map[string]interface{}{}
|
||||
|
||||
body["permission"] = rpo.Permission
|
||||
|
||||
return r.buildJsonBody(body)
|
||||
}
|
||||
|
||||
func (r *Repository) buildRepositoryUserPermissionBody(rpo *RepositoryUserPermissionsOptions) (string, error) {
|
||||
body := map[string]interface{}{}
|
||||
|
||||
body["permission"] = rpo.Permission
|
||||
|
||||
return r.buildJsonBody(body)
|
||||
}
|
||||
|
||||
func (r *Repository) buildJsonBody(body map[string]interface{}) (string, error) {
|
||||
data, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
@@ -1591,3 +1734,115 @@ func decodeDefaultReviewers(response interface{}) (*DefaultReviewers, error) {
|
||||
}
|
||||
return &defaultReviewerVariables, nil
|
||||
}
|
||||
|
||||
func decodeGroupPermissions(response interface{}) (*GroupPermission, error) {
|
||||
var groupPermission GroupPermission
|
||||
err := mapstructure.Decode(response, &groupPermission)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &groupPermission, nil
|
||||
}
|
||||
|
||||
func decodeGroupsPermissions(response interface{}) (*GroupPermissions, error) {
|
||||
responseMap := response.(map[string]interface{})
|
||||
values := responseMap["values"].([]interface{})
|
||||
|
||||
var variables []GroupPermission
|
||||
for _, variable := range values {
|
||||
var groupPermission GroupPermission
|
||||
err := mapstructure.Decode(variable, &groupPermission)
|
||||
if err == nil {
|
||||
variables = append(variables, groupPermission)
|
||||
}
|
||||
}
|
||||
|
||||
page, ok := responseMap["page"].(float64)
|
||||
if !ok {
|
||||
page = 0
|
||||
}
|
||||
|
||||
pagelen, ok := responseMap["pagelen"].(float64)
|
||||
if !ok {
|
||||
pagelen = 0
|
||||
}
|
||||
max_depth, ok := responseMap["max_depth"].(float64)
|
||||
if !ok {
|
||||
max_depth = 0
|
||||
}
|
||||
size, ok := responseMap["size"].(float64)
|
||||
if !ok {
|
||||
size = 0
|
||||
}
|
||||
|
||||
next, ok := responseMap["next"].(string)
|
||||
if !ok {
|
||||
next = ""
|
||||
}
|
||||
|
||||
groupPermissions := GroupPermissions{
|
||||
Page: int(page),
|
||||
Pagelen: int(pagelen),
|
||||
MaxDepth: int(max_depth),
|
||||
Size: int(size),
|
||||
Next: next,
|
||||
GroupPermissions: variables,
|
||||
}
|
||||
return &groupPermissions, nil
|
||||
}
|
||||
|
||||
func decodeUserPermissions(response interface{}) (*UserPermission, error) {
|
||||
var userPermission UserPermission
|
||||
err := mapstructure.Decode(response, &userPermission)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &userPermission, nil
|
||||
}
|
||||
|
||||
func decodeUsersPermissions(response interface{}) (*UserPermissions, error) {
|
||||
responseMap := response.(map[string]interface{})
|
||||
values := responseMap["values"].([]interface{})
|
||||
|
||||
var variables []UserPermission
|
||||
for _, variable := range values {
|
||||
var userPermission UserPermission
|
||||
err := mapstructure.Decode(variable, &userPermission)
|
||||
if err == nil {
|
||||
variables = append(variables, userPermission)
|
||||
}
|
||||
}
|
||||
|
||||
page, ok := responseMap["page"].(float64)
|
||||
if !ok {
|
||||
page = 0
|
||||
}
|
||||
|
||||
pagelen, ok := responseMap["pagelen"].(float64)
|
||||
if !ok {
|
||||
pagelen = 0
|
||||
}
|
||||
max_depth, ok := responseMap["max_depth"].(float64)
|
||||
if !ok {
|
||||
max_depth = 0
|
||||
}
|
||||
size, ok := responseMap["size"].(float64)
|
||||
if !ok {
|
||||
size = 0
|
||||
}
|
||||
|
||||
next, ok := responseMap["next"].(string)
|
||||
if !ok {
|
||||
next = ""
|
||||
}
|
||||
|
||||
userPermissions := UserPermissions{
|
||||
Page: int(page),
|
||||
Pagelen: int(pagelen),
|
||||
MaxDepth: int(max_depth),
|
||||
Size: int(size),
|
||||
Next: next,
|
||||
UserPermissions: variables,
|
||||
}
|
||||
return &userPermissions, nil
|
||||
}
|
||||
|
||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -46,7 +46,7 @@ github.com/inconshreveable/mousetrap
|
||||
# github.com/korovkin/limiter v0.0.0-20220422174850-01f593e64cf7
|
||||
## explicit; go 1.17
|
||||
github.com/korovkin/limiter
|
||||
# github.com/ktrysmt/go-bitbucket v0.9.49
|
||||
# github.com/ktrysmt/go-bitbucket v0.9.50
|
||||
## explicit; go 1.14
|
||||
github.com/ktrysmt/go-bitbucket
|
||||
# github.com/magiconair/properties v1.8.6
|
||||
|
||||
Reference in New Issue
Block a user