This commit is contained in:
asteam
2025-11-14 17:59:31 +03:00
parent 18a4311b97
commit e3a65c0f33
151 changed files with 10721 additions and 28 deletions

View File

@@ -11,7 +11,7 @@ import (
// DeleteRequest struct to delete access group
type DeleteRequest struct {
// Comment of the access group
// ID of the access group
// Required: true
GroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
}

46
pkg/sdn/acsgroups/get.go Normal file
View File

@@ -0,0 +1,46 @@
package acsgroups
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// GetGroupRequest struct to get an access group
type GetGroupRequest struct {
// ID of the access group
// Required: true
GroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
}
// Info about access group
func (i AccessGroups) Get(ctx context.Context, req GetGroupRequest) (*AccessGroup, error) {
res, err := i.GetRaw(ctx, req)
if err != nil {
return nil, err
}
group := AccessGroup{}
err = json.Unmarshal(res, &group)
if err != nil {
return nil, err
}
return &group, nil
}
// GetRaw gets a details of group as an array of bytes
func (a AccessGroups) GetRaw(ctx context.Context, req GetGroupRequest) ([]byte, error) {
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/sdn/access_group/get"
res, err := a.client.DecortApiCall(ctx, http.MethodGet, url, req)
return res, err
}

View File

@@ -9,8 +9,8 @@ import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// PatchRequest struct to update access group
type PatchRequest struct {
// UpdateRequest struct to update access group
type UpdateRequest struct {
// Access group ID
// Required: true
AccessGroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
@@ -25,13 +25,13 @@ type PatchRequest struct {
}
// Update updates a access groups
func (i AccessGroups) Patch(ctx context.Context, req PatchRequest) (*AccessGroup, error) {
func (i AccessGroups) Update(ctx context.Context, req UpdateRequest) (*AccessGroup, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/sdn/access_group/patch"
url := "/sdn/access_group/update"
res, err := i.client.DecortApiCallCtype(ctx, http.MethodPatch, url, constants.MIMEJSON, req)
if err != nil {