Restauração de revisão de rota¶
Solicitar POST /gateway/api/v1/gateways/{gatewayId}/routes/{routeId}/revisions/{revisionId}/rollback. O BFF encaminha o mesmo sufixo ao Core.
%%{init: {"theme":"base","themeVariables":{"fontFamily":"Arial, sans-serif","fontSize":"16px","lineColor":"#64748b","primaryTextColor":"#172b4d"},"flowchart":{"htmlLabels":true,"useMaxWidth":true,"nodeSpacing":28,"rankSpacing":38,"padding":14,"curve":"linear","subGraphTitleMargin":{"top":12,"bottom":16}},"sequence":{"useMaxWidth":true,"actorMargin":28,"width":145,"height":45,"diagramMarginX":32,"diagramMarginY":12,"messageMargin":24,"wrap":true,"mirrorActors":false},"themeCSS":".edgeLabel, .edgeLabel p {background-color:var(--diagram-surface)!important;color:var(--diagram-text)!important}\n.cluster rect {fill:var(--diagram-group)!important;stroke:var(--diagram-line)!important}\n.cluster-label span, .cluster-label text {color:var(--diagram-text)!important;fill:var(--diagram-text)!important}\n.flowchart-link, .actor-line {stroke:var(--diagram-line)!important}\nmarker path {fill:var(--diagram-line)!important;stroke:var(--diagram-line)!important}\n.actor {fill:var(--diagram-domain)!important;stroke:var(--diagram-domain-border)!important}\ntext.actor, .messageText, .loopText, .labelText {fill:var(--diagram-text)!important}\n.messageLine0, .messageLine1, .loopLine {stroke:var(--diagram-line)!important}\n.labelBox {fill:var(--diagram-surface)!important;stroke:var(--diagram-line)!important}\n.note {fill:var(--diagram-async)!important;stroke:var(--diagram-async-border)!important}\n.noteText {fill:var(--diagram-text)!important}\n.nodeLabel, .nodeLabel p, .nodeLabel span {color:var(--diagram-text)!important}\n.node .nodeLabel, .node .nodeLabel p {font-size:17px;font-weight:600;line-height:1.4;text-align:center}\n.nodeLabel small {display:inline-block;margin-top:4px;font-size:15px;font-weight:400;line-height:1.4;color:var(--diagram-description)!important}\ntext.actor, text.actor tspan {font-size:17px;font-weight:600}\n.node.entry rect, .node.entry polygon, .node.entry path, .node.entry circle {fill:var(--diagram-entry)!important;stroke:var(--diagram-entry-border)!important}\n.node.domain rect, .node.domain polygon, .node.domain path, .node.domain circle {fill:var(--diagram-domain)!important;stroke:var(--diagram-domain-border)!important}\n.node.security rect, .node.security polygon, .node.security path, .node.security circle {fill:var(--diagram-security)!important;stroke:var(--diagram-security-border)!important}\n.node.store rect, .node.store polygon, .node.store path, .node.store circle {fill:var(--diagram-store)!important;stroke:var(--diagram-store-border)!important}\n.node.async rect, .node.async polygon, .node.async path, .node.async circle {fill:var(--diagram-async)!important;stroke:var(--diagram-async-border)!important}\n.node.external rect, .node.external polygon, .node.external path, .node.external circle {fill:var(--diagram-external)!important;stroke:var(--diagram-external-border)!important}\n text.actor tspan, .loopText tspan, .labelText tspan, .messageText tspan, .noteText tspan {fill:var(--diagram-text)!important}\n\n"}}%%
%%{init: {"sequence":{"width":180,"actorMargin":35,"messageMargin":24,"wrap":true}}}%%
sequenceDiagram
actor A as Cliente
participant B as BFF
participant C as Core
participant M as MongoDB
A->>B: Restaurar revisão de rota
B->>C: POST rollback + tenant
C->>M: Ler rota e revisão
C->>C: Despachar transição para DRAFT
alt Origem DEPRECATED ou ACTIVE
C->>M: Descontinuar DRAFT existente
C->>M: Inserir cópia DRAFT com minor incrementada
else Origem PUBLISHABLE
C->>M: Alterar para DRAFT e remover vínculo
end
C-->>B: 200 — rota e revisão
B-->>A: 200 — resposta encaminhada
Resumo: O nome do endpoint sugere restauração de histórico, mas o serviço despacha para DRAFT conforme o estado da revisão: há executores para DEPRECATED, ACTIVE e PUBLISHABLE. O BFF não aplica enriquecimento nesse retorno.
Resultado: Novo DRAFT nas transições de ACTIVE/DEPRECATED; no ramo PUBLISHABLE, a mesma revisão volta a DRAFT. O resultado fica sem gatewayRevisionId e exige preparação e publicação posteriores.
Alternativas relevantes: DRAFT → DRAFT não é uma transição suportada. Rota/revisão inexistente ou transição inválida resulta em erro. A ACTIVE permanece ativa quando o caminho cria uma cópia.