v12.8.0
This commit is contained in:
@@ -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
46
pkg/sdn/acsgroups/get.go
Normal 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
|
||||
}
|
||||
@@ -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 {
|
||||
Reference in New Issue
Block a user