package netobjgroups import ( "context" "encoding/json" "net/http" "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) // GetRequest struct to get info about a network object group type GetRequest struct { // ID of a network object group // Required: true NetObjGroupID string `url:"object_group_id" json:"object_group_id" validate:"required"` } // Get gets network object group details as a NetworkObjectGroups struct func (nog NetworkObjectGroups) Get(ctx context.Context, req GetRequest) (*RecordNetObjGroup, error) { res, err := nog.GetRaw(ctx, req) if err != nil { return nil, err } info := RecordNetObjGroup{} err = json.Unmarshal(res, &info) if err != nil { return nil, err } return &info, nil } // GetRaw gets network object group details as an array of bytes func (nog NetworkObjectGroups) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/sdn/network_object_group/get" res, err := nog.client.DecortApiCall(ctx, http.MethodGet, url, req) return res, err }