This commit is contained in:
asteam
2025-09-27 01:06:15 +03:00
parent 1ccc37a104
commit cf584c8123
1175 changed files with 11022 additions and 1832 deletions

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// APIListRequest struct for getting API list.

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// APIAccessJoinRequest struct for joining user into apiaccess group.

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// APIAccessLeaveRequest struct for leaving user from apiaccess group.

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// APIAccessListRequest struct for showing list of dicts with information about

View File

@@ -0,0 +1,38 @@
package user
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// BlockRequest struct to block a user.
type BlockRequest struct {
// ID of the user to block.
// Required: true
UserID string `url:"user_id" json:"user_id" validate:"required"`
}
// Block blocks a user
func (u User) Block(ctx context.Context, req BlockRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/user/block"
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// CreateRequest struct for creating a user.
@@ -20,15 +20,17 @@ type CreateRequest struct {
// Password of user
// Required: false
// Default: strongpassword
Password string `url:"password,omitempty" json:"password,omitempty"`
// List of groups this user belongs to.
// Required: false
Groups []string `url:"groups,omitempty" json:"groups,omitempty"`
// List of apiaccess groups this user belongs to.
// Required: false
APIAccess []uint64 `url:"apiaccess,omitempty" json:"apiaccess,omitempty"`
// Provider of user
// one of: bvs, decs3o
// Required: false
Provider string `url:"provider,omitempty" json:"provider,omitempty" validate:"omitempty,userProvider"`
}
// Create creates a user.

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DeleteRequest struct for deleting a user.

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DeleteByGUIDRequest struct for deleting a user using user's GUID.

View File

@@ -5,14 +5,14 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DeleteUsersRequest struct for bulk delete a list of users.
type DeleteUsersRequest struct {
// List of user ids
// Required: true
UserIDs string `url:"userIds" json:"userIds" validate:"required"`
UserIDs []string `url:"userIds" json:"userIds" validate:"required"`
}
// DeleteUsers bulk delete a list of users.

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// GetRequest struct to get user details.

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// GetMatchingUsernamesRequest struct for getting a list of the matching usernames for a given string.

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// ListRequest struct to get all non deleted user instances.
@@ -18,6 +18,10 @@ type ListRequest struct {
// Required: false
Active interface{} `url:"active,omitempty" json:"active,omitempty" validate:"omitempty,isBool"`
// Find by email.
// Required: false
Email string `url:"email,omitempty" json:"email,omitempty"`
// Find by serviceaccount. True or False.
// Required: false
ServiceAccount interface{} `url:"serviceaccount,omitempty" json:"serviceaccount,omitempty" validate:"omitempty,isBool"`

View File

@@ -21,6 +21,9 @@ type ItemUser struct {
// AuthKeys
AuthKeys []interface{}
// Blocked
Blocked bool `json:"blocked"`
// Data
Data string `json:"data"`

View File

@@ -0,0 +1,38 @@
package user
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// UnblockRequest struct to block a user.
type UnblockRequest struct {
// ID of the user to block.
// Required: true
UserID string `url:"user_id" json:"user_id" validate:"required"`
}
// Unblock unblocks a user
func (u User) Unblock(ctx context.Context, req UnblockRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/user/unblock"
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}

View File

@@ -1,6 +1,6 @@
package user
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/interfaces"
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/interfaces"
// Structure for creating request to User
type User struct {