v1.4.6
This commit is contained in:
43
pkg/cloudbroker/user/api_list.go
Normal file
43
pkg/cloudbroker/user/api_list.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for getting API list.
|
||||
type APIListRequest struct {
|
||||
// ID of the user.
|
||||
// Required: true
|
||||
UserID string `url:"userId" json:"userId" validate:"required"`
|
||||
}
|
||||
|
||||
// APIList gets a list of all API functions that a given user has
|
||||
// access to according to their apiaccess group membership.
|
||||
func (u User) APIList(ctx context.Context, req APIListRequest) (*APIsEndpoints, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/apiList"
|
||||
|
||||
info := APIsEndpoints{}
|
||||
|
||||
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
44
pkg/cloudbroker/user/apiaccess_join.go
Normal file
44
pkg/cloudbroker/user/apiaccess_join.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for joining user into apiaccess group.
|
||||
type APIAccessJoinRequest struct {
|
||||
// ID of the user whose membership will be updated.
|
||||
// Required: true
|
||||
UserID string `url:"userId" json:"userId" validate:"required"`
|
||||
|
||||
// ID of the API access group to join
|
||||
// Required: true
|
||||
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
|
||||
}
|
||||
|
||||
// APIAccessJoin joins user into apiaccess group.
|
||||
func (u User) APIAccessJoin(ctx context.Context, req APIAccessJoinRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/apiaccessJoin"
|
||||
|
||||
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
|
||||
}
|
||||
44
pkg/cloudbroker/user/apiaccess_leave.go
Normal file
44
pkg/cloudbroker/user/apiaccess_leave.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for leaving user from apiaccess group.
|
||||
type APIAccessLeaveRequest struct {
|
||||
// ID of the user whose membership will be updated.
|
||||
// Required: true
|
||||
UserID string `url:"userId" json:"userId" validate:"required"`
|
||||
|
||||
// ID of the API access group to leave.
|
||||
// Required: true
|
||||
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
|
||||
}
|
||||
|
||||
// APIAccessLeave leaves user from apiaccess group.
|
||||
func (u User) APIAccessLeave(ctx context.Context, req APIAccessLeaveRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/apiaccessLeave"
|
||||
|
||||
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
|
||||
}
|
||||
44
pkg/cloudbroker/user/apiaccess_list.go
Normal file
44
pkg/cloudbroker/user/apiaccess_list.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for showing list of dicts with information about
|
||||
// apiaccess groups contains to the user.
|
||||
type APIAccessListRequest struct {
|
||||
// ID of the user to list API access groups for.
|
||||
// Required: true
|
||||
UserID string `url:"userId" json:"userId" validate:"required"`
|
||||
}
|
||||
|
||||
// APIAccessList shows list of dicts with information about apiaccess groups contains to the user.
|
||||
func (u User) APIAccessList(ctx context.Context, req APIAccessListRequest) (ListAPIAccess, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/apiaccessList"
|
||||
|
||||
list := ListAPIAccess{}
|
||||
|
||||
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return list, nil
|
||||
}
|
||||
56
pkg/cloudbroker/user/create.go
Normal file
56
pkg/cloudbroker/user/create.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for creating a user.
|
||||
type CreateRequest struct {
|
||||
// ID of user.
|
||||
// Required: true
|
||||
Username string `url:"username" json:"username" validate:"required"`
|
||||
|
||||
// Email addresses of the user.
|
||||
// Required: true
|
||||
EmailAddress []string `url:"emailaddress" json:"emailaddress" validate:"required"`
|
||||
|
||||
// Password of user
|
||||
// Required: false
|
||||
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"`
|
||||
}
|
||||
|
||||
// Create creates a user.
|
||||
func (u User) Create(ctx context.Context, req CreateRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/create"
|
||||
|
||||
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
|
||||
}
|
||||
40
pkg/cloudbroker/user/delete.go
Normal file
40
pkg/cloudbroker/user/delete.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for deleting a user.
|
||||
type DeleteRequest struct {
|
||||
// ID of user.
|
||||
// Required: true
|
||||
Username string `url:"username" json:"username" validate:"required"`
|
||||
}
|
||||
|
||||
// Delete deletes a user.
|
||||
func (u User) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/delete"
|
||||
|
||||
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
|
||||
}
|
||||
42
pkg/cloudbroker/user/delete_by_guid.go
Normal file
42
pkg/cloudbroker/user/delete_by_guid.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for deleting a user using user's GUID.
|
||||
type DeleteByGUIDRequest struct {
|
||||
// GUID of user.
|
||||
// Required: true
|
||||
GUID string `url:"userguid" json:"userguid" validate:"required"`
|
||||
}
|
||||
|
||||
// DeleteByGUID deletes a user using user's GUID.
|
||||
// Note: This actor can also be called using username instead of guid to workaround CBGrid
|
||||
// allowing userguid or username.
|
||||
func (u User) DeleteByGUID(ctx context.Context, req DeleteByGUIDRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/deleteByGuid"
|
||||
|
||||
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
|
||||
}
|
||||
39
pkg/cloudbroker/user/delete_users.go
Normal file
39
pkg/cloudbroker/user/delete_users.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for bulk delete a list of users.
|
||||
type DeleteUsersRequest struct {
|
||||
// List of user ids
|
||||
UserIDs string
|
||||
}
|
||||
|
||||
// DeleteUsers bulk delete a list of users.
|
||||
func (u User) DeleteUsers(ctx context.Context, req DeleteUsersRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/deleteUsers"
|
||||
|
||||
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
|
||||
}
|
||||
42
pkg/cloudbroker/user/get.go
Normal file
42
pkg/cloudbroker/user/get.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for getting user details.
|
||||
type GetRequest struct {
|
||||
// ID of the user.
|
||||
// Required: true
|
||||
UserID string `url:"userId" json:"userId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets user details.
|
||||
func (u User) Get(ctx context.Context, req GetRequest) (*ItemUser, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/get"
|
||||
|
||||
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
item := ItemUser{}
|
||||
|
||||
err = json.Unmarshal(res, &item)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &item, nil
|
||||
}
|
||||
50
pkg/cloudbroker/user/get_audit.go
Normal file
50
pkg/cloudbroker/user/get_audit.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for getting user's audits.
|
||||
type GetAuditRequest struct {
|
||||
// Name of user (get audits for current user if set to empty).
|
||||
// Required: false
|
||||
Username string `url:"username,omitempty" json:"username,omitempty"`
|
||||
|
||||
// Page number.
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size, maximum - 100.
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// GetAudits gets user's audits.
|
||||
func (u User) GetAudit(ctx context.Context, req GetAuditRequest) (ListAudits, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/getAudit"
|
||||
|
||||
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListAudits{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return list, nil
|
||||
}
|
||||
47
pkg/cloudbroker/user/get_matching_usernames.go
Normal file
47
pkg/cloudbroker/user/get_matching_usernames.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for getting a list of the matching usernames for a given string.
|
||||
type GetMatchingUsernamesRequest struct {
|
||||
// Regex of the usernames to searched for.
|
||||
// Required: true
|
||||
UsernameRegex string `url:"usernameregex" json:"usernameregex" validate:"required"`
|
||||
|
||||
// The number of usernames to return.
|
||||
// Required: true
|
||||
Limit uint64 `url:"limit" json:"limit" validate:"required"`
|
||||
}
|
||||
|
||||
// GetMatchingUsernames gets a list of the matching usernames for a given string.
|
||||
func (u User) GetMatchingUsernames(ctx context.Context, req GetMatchingUsernamesRequest) (ListMatchingUsernames, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/getMatchingUsernames"
|
||||
|
||||
list := ListMatchingUsernames{}
|
||||
|
||||
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return list, nil
|
||||
}
|
||||
58
pkg/cloudbroker/user/list.go
Normal file
58
pkg/cloudbroker/user/list.go
Normal file
@@ -0,0 +1,58 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for getting all non deleted user instances.
|
||||
type ListRequest struct {
|
||||
// Find by ID.
|
||||
// Required: false
|
||||
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`
|
||||
|
||||
// Find by active. True or False.
|
||||
// Required: false
|
||||
Active bool `url:"active,omitempty" json:"active,omitempty"`
|
||||
|
||||
// Find by serviceaccount. True or False.
|
||||
// Required: false
|
||||
ServiceAccount bool `url:"serviceaccount,omitempty" json:"serviceaccount,omitempty"`
|
||||
|
||||
// Page number.
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size, maximum - 100.
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets all non deleted user instances.
|
||||
func (u User) List(ctx context.Context, req ListRequest) (*ListUsers, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/list"
|
||||
|
||||
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListUsers{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
276
pkg/cloudbroker/user/models.go
Normal file
276
pkg/cloudbroker/user/models.go
Normal file
@@ -0,0 +1,276 @@
|
||||
package user
|
||||
|
||||
import "strconv"
|
||||
|
||||
type ItemUser struct {
|
||||
// CKey
|
||||
CKey string `json:"_ckey"`
|
||||
|
||||
// Meta
|
||||
Meta []interface{} `json:"_meta"`
|
||||
|
||||
// Is active
|
||||
Active bool `json:"active"`
|
||||
|
||||
// APIAccess
|
||||
APIAccess []uint64 `json:"apiaccess"`
|
||||
|
||||
// AuthKey
|
||||
AuthKey string `json:"authkey"`
|
||||
|
||||
// AuthKeys
|
||||
AuthKeys []interface{}
|
||||
|
||||
// Data
|
||||
Data string `json:"data"`
|
||||
|
||||
// Description
|
||||
Description string `json:"description"`
|
||||
|
||||
// Domain
|
||||
Domain string `json:"domain"`
|
||||
|
||||
// Emails
|
||||
Emails []string `json:"emails"`
|
||||
|
||||
// GID
|
||||
GID uint64 `json:"gid"`
|
||||
|
||||
// Groups
|
||||
Groups []string `json:"groups"`
|
||||
|
||||
// GUID
|
||||
GUID string `json:"guid"`
|
||||
|
||||
// ID
|
||||
ID string `json:"id"`
|
||||
|
||||
// LastCheck
|
||||
LastCheck uint64 `json:"lastcheck"`
|
||||
|
||||
// Mobile
|
||||
Mobile []interface{} `json:"mobile"`
|
||||
|
||||
// Password
|
||||
Password string `json:"password"`
|
||||
|
||||
// Protected
|
||||
Protected bool `json:"protected"`
|
||||
|
||||
// Roles
|
||||
Roles []interface{} `json:"roles"`
|
||||
|
||||
// ServiceAccount
|
||||
ServiceAccount bool `json:"serviceaccount"`
|
||||
|
||||
// XMPP
|
||||
XMPP []interface{} `json:"xmpp"`
|
||||
}
|
||||
|
||||
type ListUsers struct {
|
||||
Data []ItemUser `json:"data"`
|
||||
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
type ItemAPIAccess struct {
|
||||
// Description
|
||||
Description string `json:"desc"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type ListAPIAccess []ItemAPIAccess
|
||||
|
||||
type ItemMatchingUsername struct {
|
||||
// Gravatar URL
|
||||
GravatarURL string `json:"gravatarurl"`
|
||||
|
||||
// Username
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
type ListMatchingUsernames []ItemMatchingUsername
|
||||
|
||||
type ItemAudit struct {
|
||||
// Call
|
||||
Call string `json:"Call"`
|
||||
|
||||
// Response time
|
||||
ResponseTime ResponseTime `json:"Response Time"`
|
||||
|
||||
// StatusCode
|
||||
StatusCode StatusCode `json:"Status Code"`
|
||||
|
||||
// Time
|
||||
Time float64 `json:"Time"`
|
||||
}
|
||||
|
||||
type ListAudits []ItemAudit
|
||||
|
||||
type ResponseTime float64
|
||||
|
||||
func (r *ResponseTime) UnmarshalJSON(b []byte) error {
|
||||
if string(b) == "null" {
|
||||
*r = ResponseTime(-1)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
res, err := strconv.ParseFloat(string(b), 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*r = ResponseTime(res)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type StatusCode int64
|
||||
|
||||
func (s *StatusCode) UnmarshalJSON(b []byte) error {
|
||||
if string(b) == "null" {
|
||||
*s = StatusCode(-1)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
res, err := strconv.ParseInt(string(b), 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*s = StatusCode(res)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type APIsEndpoints struct {
|
||||
// CloudAPI endpoints
|
||||
CloudAPI CloudAPIEndpoints `json:"cloudapi,omitempty"`
|
||||
|
||||
// CloudBroker endpoints
|
||||
CloudBroker CloudBrokerEndpoints `json:"cloudbroker,omitempty"`
|
||||
|
||||
// LibCloud endpoints
|
||||
LibCloud LibCloudEndpoints `json:"libcloud,omitempty"`
|
||||
|
||||
// System endpoints
|
||||
System SystemEndpoints `json:"system,omitempty"`
|
||||
}
|
||||
|
||||
type CloudAPIEndpoints struct {
|
||||
Account []string `json:"account,omitempty"`
|
||||
BService []string `json:"bservice,omitempty"`
|
||||
CloudSpace []string `json:"cloudspace,omitempty"`
|
||||
Compute []string `json:"compute,omitempty"`
|
||||
ComputeCI []string `json:"computeci,omitempty"`
|
||||
Disks []string `json:"disks,omitempty"`
|
||||
ExtNet []string `json:"extnet,omitempty"`
|
||||
FLIPGroup []string `json:"flipgroup,omitempty"`
|
||||
GPU []string `json:"gpu,omitempty"`
|
||||
Image []string `json:"image,omitempty"`
|
||||
K8CI []string `json:"k8ci,omitempty"`
|
||||
K8S []string `json:"k8s,omitempty"`
|
||||
KVMPPC []string `json:"kvmppc,omitempty"`
|
||||
KVMX86 []string `json:"kvmx86,omitempty"`
|
||||
LB []string `json:"lb,omitempty"`
|
||||
Loactions []string `json:"locations,omitempty"`
|
||||
Machine []string `json:"machine,omitempty"`
|
||||
Openshift []string `json:"openshift,omitempty"`
|
||||
OpenshiftCI []string `json:"openshiftci,omitempty"`
|
||||
PCIDevice []string `json:"pcidevice,omitempty"`
|
||||
PortForwarding []string `json:"portforwarding,omitempty"`
|
||||
Prometheus []string `json:"prometheus,omitempty"`
|
||||
RG []string `json:"rg,omitempty"`
|
||||
Sizes []string `json:"sizes,omitempty"`
|
||||
Tasks []string `json:"tasks,omitempty"`
|
||||
User []string `json:"user,omitempty"`
|
||||
VGPU []string `json:"vgpu,omitempty"`
|
||||
VINS []string `json:"vins,omitempty"`
|
||||
All bool `json:"ALL,omitempty"`
|
||||
}
|
||||
|
||||
type CloudBrokerEndpoints struct {
|
||||
Account []string `json:"account,omitempty"`
|
||||
APIAccess []string `json:"apiaccess,omitempty"`
|
||||
Audit []string `json:"audit,omitempty"`
|
||||
AuditBeat []string `json:"auditbeat,omitempty"`
|
||||
AuditCollector []string `json:"auditcollector,omitempty"`
|
||||
BackupCreator []string `json:"backupcreator,omitempty"`
|
||||
BService []string `json:"bservice,omitempty"`
|
||||
CloudSpace []string `json:"cloudspace,omitempty"`
|
||||
Compute []string `json:"compute,omitempty"`
|
||||
ComputeCI []string `json:"computeci,omitempty"`
|
||||
Desnode []string `json:"desnode,omitempty"`
|
||||
Diagnostics []string `json:"diagnostics,omitempty"`
|
||||
Disks []string `json:"disks,omitempty"`
|
||||
Eco []string `json:"eco,omitempty"`
|
||||
ExtNet []string `json:"extnet,omitempty"`
|
||||
FlIPgroup []string `json:"flipgroup,omitempty"`
|
||||
Grid []string `json:"grid,omitempty"`
|
||||
Group []string `json:"group,omitempty"`
|
||||
Health []string `json:"health,omitempty"`
|
||||
IaaS []string `json:"iaas,omitempty"`
|
||||
Image []string `json:"image,omitempty"`
|
||||
Job []string `json:"job,omitempty"`
|
||||
K8CI []string `json:"k8ci,omitempty"`
|
||||
K8S []string `json:"k8s,omitempty"`
|
||||
KVMPPC []string `json:"kvmppc,omitempty"`
|
||||
KVMX86 []string `json:"kvmx86,omitempty"`
|
||||
LB []string `json:"lb,omitempty"`
|
||||
Machine []string `json:"machine,omitempty"`
|
||||
Metering []string `json:"metering,omitempty"`
|
||||
Milestones []string `json:"milestones,omitempty"`
|
||||
Node []string `json:"node,omitempty"`
|
||||
Openshift []string `json:"openshift,omitempty"`
|
||||
OpenshiftCI []string `json:"openshiftci,omitempty"`
|
||||
Ovsnode []string `json:"ovsnode,omitempty"`
|
||||
PCIDevice []string `json:"pcidevice,omitempty"`
|
||||
PGPU []string `json:"pgpu,omitempty"`
|
||||
Prometheus []string `json:"prometheus,omitempty"`
|
||||
QOS []string `json:"qos,omitempty"`
|
||||
Resmon []string `json:"resmon,omitempty"`
|
||||
RG []string `json:"rg,omitempty"`
|
||||
Sep []string `json:"sep,omitempty"`
|
||||
Stack []string `json:"stack,omitempty"`
|
||||
Tasks []string `json:"tasks,omitempty"`
|
||||
TLock []string `json:"tlock,omitempty"`
|
||||
User []string `json:"user,omitempty"`
|
||||
VGPU []string `json:"vgpu,omitempty"`
|
||||
VINS []string `json:"vins,omitempty"`
|
||||
VNFDev []string `json:"vnfdev,omitempty"`
|
||||
ZeroAccess []string `json:"zeroaccess,omitempty"`
|
||||
All bool `json:"ALL,omitempty"`
|
||||
}
|
||||
|
||||
type LibCloudEndpoints struct {
|
||||
Libvirt []string `json:"libvirt,omitempty"`
|
||||
All bool `json:"ALL,omitempty"`
|
||||
}
|
||||
|
||||
type SystemEndpoints struct {
|
||||
AgentController []string `json:"agentcontroller,omitempty"`
|
||||
Alerts []string `json:"alerts,omitempty"`
|
||||
Audits []string `json:"audits,omitempty"`
|
||||
ContentManager []string `json:"contentmanager,omitempty"`
|
||||
DocGenerator []string `json:"docgenerator,omitempty"`
|
||||
EmailSender []string `json:"emailsender,omitempty"`
|
||||
ErrorConditionHandler []string `json:"errorconditionhandler,omitempty"`
|
||||
GridManager []string `json:"gridmanager,omitempty"`
|
||||
Health []string `json:"health,omitempty"`
|
||||
Info []string `json:"info,omitempty"`
|
||||
InfoMGR []string `json:"infomgr,omitempty"`
|
||||
Job []string `json:"job,omitempty"`
|
||||
Log []string `json:"log,omitempty"`
|
||||
Logo []string `json:"logo,omitempty"`
|
||||
Oauth []string `json:"oauth,omitempty"`
|
||||
Task []string `json:"task,omitempty"`
|
||||
UserManager []string `json:"usermanager,omitempty"`
|
||||
All bool `json:"ALL,omitempty"`
|
||||
}
|
||||
15
pkg/cloudbroker/user/user.go
Normal file
15
pkg/cloudbroker/user/user.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package user
|
||||
|
||||
import "repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||
|
||||
// Structure for creating request to User
|
||||
type User struct {
|
||||
client interfaces.Caller
|
||||
}
|
||||
|
||||
// Builder for User endpoints
|
||||
func New(client interfaces.Caller) *User {
|
||||
return &User{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user