package apistatus import ( "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/apemanager" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" ) // APEManagerAccessDenied describes status of the failure because of the access control violation. // Instances provide Status and StatusV2 interfaces. type APEManagerAccessDenied struct { v2 status.Status } const defaultAPEManagerAccessDeniedMsg = "apemanager access denied" func (x *APEManagerAccessDenied) Error() string { msg := x.v2.Message() if msg == "" { msg = defaultAPEManagerAccessDeniedMsg } return errMessageStatusV2( globalizeCodeV2(apemanager.StatusAPEManagerAccessDenied, apemanager.GlobalizeFail), msg, ) } func (x *APEManagerAccessDenied) fromStatusV2(st *status.Status) { x.v2 = *st } // ToStatusV2 converts APEManagerAccessDenied to v2's Status. // If the value was returned by FromStatusV2, returns the source message. // Otherwise, returns message with // - code: APE_MANAGER_ACCESS_DENIED; // - string message: "apemanager access denied"; // - details: empty. func (x APEManagerAccessDenied) ToStatusV2() *status.Status { x.v2.SetCode(globalizeCodeV2(apemanager.StatusAPEManagerAccessDenied, apemanager.GlobalizeFail)) x.v2.SetMessage(defaultAPEManagerAccessDeniedMsg) return &x.v2 } // WriteReason writes human-readable access rejection reason. func (x *APEManagerAccessDenied) WriteReason(reason string) { apemanager.WriteAccessDeniedDesc(&x.v2, reason) } // Reason returns human-readable access rejection reason returned by the server. // Returns empty value is reason is not presented. func (x APEManagerAccessDenied) Reason() string { return apemanager.ReadAccessDeniedDesc(x.v2) }