v11.0.0
This commit is contained in:
@@ -5,15 +5,23 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
|
||||
)
|
||||
|
||||
// APIFindRequest struct for finding apiaccess groups.
|
||||
type APIFindRequest struct {
|
||||
// API function to find
|
||||
// Example: cloudbroker/k8s/create
|
||||
// Required: true
|
||||
APIName string `url:"apiName" json:"apiName" validate:"required"`
|
||||
//API group to find (cloudbroker, cloudapi, etc)
|
||||
//Available values : cloudapi, cloudbroker, system
|
||||
//Required: true
|
||||
APIGroup string `url:"api_group" json:"api_group" validate:"required,apiGroup"`
|
||||
|
||||
//API object to find (compute, vins, etc )
|
||||
//Required: true
|
||||
APIObject string `url:"api_object" json:"api_object" validate:"required"`
|
||||
|
||||
//API endpoint to find (delete, create, etc)
|
||||
//Required: true
|
||||
APIMethod string `url:"api_method" json:"api_method" validate:"required"`
|
||||
}
|
||||
|
||||
// APIFind outputs a list of apiaccess groups that mention the specified API function.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package apiaccess
|
||||
|
||||
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/interfaces"
|
||||
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/interfaces"
|
||||
|
||||
// Structure for creating request to APIAccess
|
||||
type APIAccess struct {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
|
||||
)
|
||||
|
||||
type APIString string
|
||||
@@ -15,7 +15,7 @@ type APIString string
|
||||
type APIsExcludeRequest struct {
|
||||
// APIAccess group ID
|
||||
// Required: true
|
||||
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
|
||||
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
|
||||
|
||||
// APIs to remove from APIAccess group
|
||||
// Required: true
|
||||
|
||||
@@ -5,14 +5,14 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
|
||||
)
|
||||
|
||||
// APIsIncludeRequest struct for adding api to access group.
|
||||
type APIsIncludeRequest struct {
|
||||
// APIAccess group ID.
|
||||
// Required: true
|
||||
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
|
||||
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
|
||||
|
||||
// APIs to add to APIAccess group.
|
||||
// Required: true
|
||||
|
||||
@@ -5,14 +5,14 @@ import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
|
||||
)
|
||||
|
||||
// CopyRequest Request for copying apiaccess group.
|
||||
type CopyRequest struct {
|
||||
// ID of the API access group to make copy from
|
||||
// Required: true
|
||||
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
|
||||
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
|
||||
|
||||
// Name of the target API access group, which will be created on successful copy
|
||||
// Required: true
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
|
||||
)
|
||||
|
||||
// CreateRequest struct for creating apiaccess group.
|
||||
|
||||
@@ -5,14 +5,14 @@ import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
|
||||
)
|
||||
|
||||
// DeleteRequest struct for deleting apiaccess group.
|
||||
type DeleteRequest struct {
|
||||
// APIAccess group ID.
|
||||
// Required: true
|
||||
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
|
||||
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
|
||||
|
||||
// Set True to delete apiaccess group with attached users.
|
||||
// Required: false
|
||||
|
||||
@@ -5,14 +5,14 @@ import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
|
||||
)
|
||||
|
||||
// DescUpdateRequest struct for updating apiaccess group description.
|
||||
type DescUpdateRequest struct {
|
||||
// APIAccess group ID.
|
||||
// Required: true
|
||||
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
|
||||
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
|
||||
|
||||
// New description to set for the apiaccess group.
|
||||
// Required: true
|
||||
|
||||
@@ -5,14 +5,14 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
|
||||
)
|
||||
|
||||
// GetRequest struct to get apiaccess group.
|
||||
type GetRequest struct {
|
||||
// APIAccess group ID.
|
||||
// Required: true
|
||||
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
|
||||
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets apiaccess group as an ItemAPIAccess struct
|
||||
|
||||
@@ -6,11 +6,11 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// GetPreGroups gets list of pre default groups from spec
|
||||
func (a APIAccess) GetPreGroups(ctx context.Context) (map[string]APIsEndpoints, error) {
|
||||
url := "/cloudbroker/apiaccess/getPreGroups"
|
||||
// GetDefault gets default apiaccess group
|
||||
func (a APIAccess) GetDefault(ctx context.Context) (*ItemAPIAccessDefault, error) {
|
||||
url := "/cloudbroker/apiaccess/getDefault"
|
||||
|
||||
info := make(map[string]APIsEndpoints)
|
||||
info := ItemAPIAccessDefault{}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, nil)
|
||||
if err != nil {
|
||||
@@ -22,5 +22,5 @@ func (a APIAccess) GetPreGroups(ctx context.Context) (map[string]APIsEndpoints,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return info, nil
|
||||
return &info, nil
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
|
||||
)
|
||||
|
||||
// ListRequest struct to get list of all non deleted apiaccess instances.
|
||||
@@ -22,21 +22,21 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
Status string `url:"status,omitempty" json:"status,omitempty"`
|
||||
|
||||
// Find by created actor
|
||||
// Find by description
|
||||
// Required: false
|
||||
CreatedBy string `url:"createdBy,omitempty" json:"createdBy,omitempty"`
|
||||
Desc string `url:"desc,omitempty" json:"desc,omitempty"`
|
||||
|
||||
// Find by created after time (unix timestamp)
|
||||
// Required: false
|
||||
CreatedAfter uint64 `url:"createdAfter,omitempty" json:"createdAfter,omitempty"`
|
||||
CreatedAfter uint64 `url:"created_after,omitempty" json:"created_after,omitempty"`
|
||||
|
||||
// Find by created before time (unix timestamp)
|
||||
// Required: false
|
||||
CreatedBefore uint64 `url:"createdBefore,omitempty" json:"createdBefore,omitempty"`
|
||||
CreatedBefore uint64 `url:"created_before,omitempty" json:"created_before,omitempty"`
|
||||
|
||||
// Sort by one of supported fields, format +|-(field)
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
SortBy string `url:"sort_by,omitempty" json:"sort_by,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package apiaccess
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
|
||||
)
|
||||
|
||||
// ListDeletedRequest struct for getting list of all deleted apiaccess instances.
|
||||
type ListDeletedRequest struct {
|
||||
// Sort by one of supported fields, format +|-(field)
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
// Page number.
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size.
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// ListDeleted gets list of all deleted apiaccess instances.
|
||||
func (a APIAccess) ListDeleted(ctx context.Context, req ListDeletedRequest) (*ListAPIAccess, error) {
|
||||
|
||||
if err := validators.ValidateRequest(req); err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/apiaccess/listDeleted"
|
||||
|
||||
info := ListAPIAccess{}
|
||||
|
||||
res, err := a.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
|
||||
}
|
||||
@@ -4,20 +4,51 @@ type ItemAPIAccess struct {
|
||||
// APIs
|
||||
APIs APIsEndpoints `json:"apis"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"createdBy"`
|
||||
|
||||
// Created time
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
CreatedTime uint64 `json:"created_at"`
|
||||
|
||||
// Is default
|
||||
Default bool `json:"default"`
|
||||
|
||||
// Deleted by
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
|
||||
// Deleted time
|
||||
DeletedTime uint64 `json:"deletedTime"`
|
||||
DeletedTime uint64 `json:"deleted_at"`
|
||||
|
||||
// Description
|
||||
Description string `json:"desc"`
|
||||
|
||||
// GID
|
||||
GID uint64 `json:"gid"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Is protected
|
||||
Protected bool `json:"protected"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Updated time
|
||||
UpdatedTime uint64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
type ItemAPIAccessDefault struct {
|
||||
// APIs
|
||||
APIs APIsEndpoints `json:"apis"`
|
||||
|
||||
// Created at
|
||||
CreatedAt uint64 `json:"created_at"`
|
||||
|
||||
// Is default
|
||||
Default bool `json:"default"`
|
||||
|
||||
// Deleted at
|
||||
DeletedAt uint64 `json:"deleted_at"`
|
||||
|
||||
// Description
|
||||
Description string `json:"decs"`
|
||||
@@ -31,23 +62,17 @@ type ItemAPIAccess struct {
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Milestones
|
||||
Milestones uint64 `json:"milestones"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Is protected
|
||||
// Protected
|
||||
Protected bool `json:"protected"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
//Updated by
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
|
||||
// Updated time
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
//Updated at
|
||||
UpdatedAt uint64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
type ListAPIAccess struct {
|
||||
@@ -77,6 +102,7 @@ type CloudAPIEndpoints struct {
|
||||
Compute []string `json:"compute,omitempty"`
|
||||
ComputeCI []string `json:"computeci,omitempty"`
|
||||
Disks []string `json:"disks,omitempty"`
|
||||
DPDK []string `json:"dpdk,omitempty"`
|
||||
ExtNet []string `json:"extnet,omitempty"`
|
||||
FLIPGroup []string `json:"flipgroup,omitempty"`
|
||||
GPU []string `json:"gpu,omitempty"`
|
||||
@@ -115,6 +141,7 @@ type CloudBrokerEndpoints struct {
|
||||
Desnode []string `json:"desnode,omitempty"`
|
||||
Diagnostics []string `json:"diagnostics,omitempty"`
|
||||
Disks []string `json:"disks,omitempty"`
|
||||
DPDK []string `json:"dpdk,omitempty"`
|
||||
Eco []string `json:"eco,omitempty"`
|
||||
ExtNet []string `json:"extnet,omitempty"`
|
||||
FlIPgroup []string `json:"flipgroup,omitempty"`
|
||||
|
||||
@@ -5,14 +5,14 @@ import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
|
||||
)
|
||||
|
||||
// SetDefaultRequest struct for setting default apiaccess group.
|
||||
type SetDefaultRequest struct {
|
||||
// APIAccess group ID
|
||||
// Required: true
|
||||
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
|
||||
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
|
||||
}
|
||||
|
||||
// SetDefault sets current apiaccess group default.
|
||||
|
||||
@@ -6,16 +6,16 @@ import (
|
||||
|
||||
"context"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
|
||||
)
|
||||
|
||||
// SubtractRequest struct for subtracting.
|
||||
type SubtractRequest struct {
|
||||
// ID of the API access group to subtract from. This group will contain the difference.
|
||||
MinuendID uint64 `url:"minuendId" json:"minuendId" validate:"required"`
|
||||
MinuendID uint64 `url:"minuend_group_id" json:"minuend_group_id" validate:"required"`
|
||||
|
||||
// ID of the API access group which is subtracted. This group is unchanged.
|
||||
SubtrahendID uint64 `url:"subtrahendId" json:"subtrahendId" validate:"required"`
|
||||
SubtrahendID uint64 `url:"subtrahend_group_id" json:"subtrahend_group_id" validate:"required"`
|
||||
}
|
||||
|
||||
// Subtract removes such APIs from MinuendID that match APIs from SubtrahendID.
|
||||
|
||||
@@ -5,18 +5,18 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
|
||||
)
|
||||
|
||||
// UnionRequest struct for union.
|
||||
type UnionRequest struct {
|
||||
// Recipient apiaccess group ID
|
||||
// Required: true
|
||||
RecipientID uint64 `url:"recipientId" json:"recipientId" validate:"required"`
|
||||
RecipientID uint64 `url:"recipient_group_id" json:"recipient_group_id" validate:"required"`
|
||||
|
||||
// Donor apiaccess group ID
|
||||
// Required: true
|
||||
DonorID uint64 `url:"donorId" json:"donorId" validate:"required"`
|
||||
DonorID uint64 `url:"donor_group_id" json:"donor_group_id" validate:"required"`
|
||||
}
|
||||
|
||||
// Union combines the API list of group #1 ("recipient") and group #2 ("donor"),
|
||||
|
||||
@@ -6,14 +6,14 @@ import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
|
||||
)
|
||||
|
||||
// UpdateRequest struct for updating apis of apiaccess group.
|
||||
type UpdateRequest struct {
|
||||
// APIAccess group ID
|
||||
// Required: true
|
||||
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
|
||||
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
|
||||
|
||||
// APIs to remove from APIAccess group
|
||||
// Required: false
|
||||
|
||||
@@ -5,14 +5,14 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
|
||||
)
|
||||
|
||||
// UserListRequest struct for getting a list of users currently included in the specified group.
|
||||
type UserListRequest struct {
|
||||
// APIAccess group ID
|
||||
// Required: true
|
||||
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
|
||||
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
|
||||
Reference in New Issue
Block a user