Files
decort-golang-sdk/pkg/sdn/acsgroups/delete.go

34 lines
842 B
Go
Raw Normal View History

2025-08-29 12:51:25 +03:00
package acsgroups
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// DeleteRequest struct to delete access group
type DeleteRequest struct {
2025-11-14 17:38:59 +03:00
// ID of the access group
2025-08-29 12:51:25 +03:00
// Required: true
GroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
}
2026-04-17 17:04:11 +03:00
// Delete an access groups
func (i AccessGroups) Delete(ctx context.Context, req DeleteRequest) (string, error) {
2025-08-29 12:51:25 +03:00
err := validators.ValidateRequest(req)
if err != nil {
2026-04-17 17:04:11 +03:00
return "", validators.ValidationErrors(validators.GetErrors(err))
2025-08-29 12:51:25 +03:00
}
url := "/sdn/access_group/delete"
res, err := i.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req)
if err != nil {
2026-04-17 17:04:11 +03:00
return "", err
2025-08-29 12:51:25 +03:00
}
2026-04-17 17:04:11 +03:00
return string(res), nil
2025-08-29 12:51:25 +03:00
}