func (o *Operation) DeleteAuthorization(rw http.ResponseWriter, _ *http.Request) {
	rw.WriteHeader(http.StatusOK)
}
DeleteAuthorization swagger:route DELETE /vaults/{vaultID}/authorizations/{authID} vault deleteAuthorizationReq

Deletes an authorization.

Responses:
default: genericError
200: deleteAuthorizationResp
package operation
import (
	"encoding/json"
	"errors"
	"fmt"
	"net/http"
	"strings"
	"github.com/gorilla/mux"
	"github.com/hyperledger/aries-framework-go/spi/storage"
	"github.com/trustbloc/edge-core/pkg/log"
	"github.com/trustbloc/edv/pkg/edvutils"
	"github.com/trustbloc/edv/pkg/restapi/messages"
	"github.com/trustbloc/edge-service/pkg/internal/common/support"
	"github.com/trustbloc/edge-service/pkg/restapi/model"
	"github.com/trustbloc/edge-service/pkg/restapi/vault"
)
const (
	operationID             = "/vaults"
	CreateVaultPath         = operationID
	DeleteVaultPath         = operationID + "/{vaultID}"
	SaveDocPath             = operationID + "/{vaultID}/docs"
	GetDocMetadataPath      = operationID + "/{vaultID}/docs/{docID}/metadata"
	CreateAuthorizationPath = operationID + "/{vaultID}/authorizations"
	GetAuthorizationPath    = operationID + "/{vaultID}/authorizations/{authID}"
	DeleteAuthorizationPath = operationID + "/{vaultID}/authorizations/{authID}"
)
var logger = log.New("vault-operation")
type Operation struct {
	vault      vault.Vault
	GenerateID func() (string, error)
}
func New(v vault.Vault) *Operation {
	return &Operation{
		vault:      v,
		GenerateID: edvutils.GenerateEDVCompatibleID,
	}
}
func (o *Operation) GetRESTHandlers() []support.Handler {
	return []support.Handler{
		support.NewHTTPHandler(CreateVaultPath, http.MethodPost, o.CreateVault),
		support.NewHTTPHandler(DeleteVaultPath, http.MethodDelete, o.DeleteVault),
		support.NewHTTPHandler(SaveDocPath, http.MethodPost, o.SaveDoc),
		support.NewHTTPHandler(GetDocMetadataPath, http.MethodGet, o.GetDocMetadata),
		support.NewHTTPHandler(CreateAuthorizationPath, http.MethodPost, o.CreateAuthorization),
		support.NewHTTPHandler(GetAuthorizationPath, http.MethodGet, o.GetAuthorization),
		support.NewHTTPHandler(DeleteAuthorizationPath, http.MethodDelete, o.DeleteAuthorization),
	}
}
func (o *Operation) CreateVault(rw http.ResponseWriter, _ *http.Request) {
	result, err := o.vault.CreateVault()
	if err != nil {
		o.writeErrorResponse(rw, err, http.StatusInternalServerError)
		return
	}
	var resp createVaultResp
	resp.Body = result
	o.WriteResponse(rw, resp.Body, http.StatusCreated)
}
func (o *Operation) DeleteVault(rw http.ResponseWriter, _ *http.Request) {
	rw.WriteHeader(http.StatusOK)
}
func (o *Operation) SaveDoc(rw http.ResponseWriter, req *http.Request) {
	var doc saveDocReq
	if err := json.NewDecoder(req.Body).Decode(&doc.Request); err != nil {
		o.writeErrorResponse(rw, err, http.StatusBadRequest)
		return
	}
	var (
		vaultID    = mux.Vars(req)["vaultID"]
		docID      = doc.Request.ID
		docContent = doc.Request.Content
	)
	if docID == "" {
		var err error
		docID, err = o.GenerateID()
		if err != nil {
			o.writeErrorResponse(rw, err, http.StatusInternalServerError)
			return
		}
	}
	result, err := o.vault.SaveDoc(vaultID, docID, docContent)
	if err != nil {
		o.writeErrorResponse(rw, err, http.StatusInternalServerError)
		return
	}
	var resp saveDocResp
	resp.Body = result
	o.WriteResponse(rw, resp.Body, http.StatusCreated)
}
func (o *Operation) GetDocMetadata(rw http.ResponseWriter, req *http.Request) {
	var (
		vaultID = mux.Vars(req)["vaultID"]
		docID   = mux.Vars(req)["docID"]
	)
	result, err := o.vault.GetDocMetadata(vaultID, docID)
	if err != nil {
		status := http.StatusInternalServerError
		if strings.HasSuffix(err.Error(), messages.ErrDocumentNotFound.Error()+".") {
			status = http.StatusNotFound
		}
		o.writeErrorResponse(rw, err, status)
		return
	}
	var resp getDocMetadataResp
	resp.Body = result
	o.WriteResponse(rw, resp.Body, http.StatusOK)
}
func (o *Operation) CreateAuthorization(rw http.ResponseWriter, req *http.Request) {
	var doc createAuthorizationsReq
	if err := json.NewDecoder(req.Body).Decode(&doc.Request); err != nil {
		o.writeErrorResponse(rw, err, http.StatusBadRequest)
		return
	}
	var (
		vaultID         = mux.Vars(req)["vaultID"]
		scope           = doc.Request.Scope
		requestingParty = doc.Request.RequestingParty
	)
	result, err := o.vault.CreateAuthorization(vaultID, requestingParty, &scope)
	if err != nil {
		o.writeErrorResponse(rw, err, http.StatusInternalServerError)
		return
	}
	var resp createAuthorizationResp
	resp.Body = result
	o.WriteResponse(rw, resp.Body, http.StatusCreated)
}
func (o *Operation) GetAuthorization(rw http.ResponseWriter, req *http.Request) {
	var (
		vaultID = mux.Vars(req)["vaultID"]
		authID  = mux.Vars(req)["authID"]
	)
	result, err := o.vault.GetAuthorization(vaultID, authID)
	if err != nil {
		status := http.StatusInternalServerError
		if errors.Is(err, storage.ErrDataNotFound) {
			status = http.StatusNotFound
		}
		o.writeErrorResponse(rw, err, status)
		return
	}
	var resp createAuthorizationResp
	resp.Body = result
	o.WriteResponse(rw, resp.Body, http.StatusOK)
}