[#140] apistatus: Support ACCESS_DENIED error

Define `ObjectAccessDenied` type for `ACCESS_DENIED` code. Provide
method to write/read human-readable reason.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-02-28 11:39:22 +03:00 committed by LeL
parent 2b28f91a89
commit 3e94b7c892
4 changed files with 90 additions and 0 deletions

View file

@ -71,6 +71,16 @@ func TestToStatusV2(t *testing.T) {
}),
codeV2: 2051,
},
{
status: (statusConstructor)(func() apistatus.Status {
var st apistatus.ObjectAccessDenied
st.WriteReason("any reason")
return st
}),
codeV2: 2048,
},
} {
var st apistatus.Status
@ -161,6 +171,16 @@ func TestFromStatusV2(t *testing.T) {
}),
codeV2: 2051,
},
{
status: (statusConstructor)(func() apistatus.Status {
var st apistatus.ObjectAccessDenied
st.WriteReason("any reason")
return st
}),
codeV2: 2048,
},
} {
var st apistatus.Status