(ctx context.Context, request []byte)
| 66 | } |
| 67 | |
| 68 | func (h *Host) callHostAuthGet(ctx context.Context, request []byte) ([]byte, error) { |
| 69 | _ = ctx |
| 70 | var req rpcHostAuthGetRequest |
| 71 | if errUnmarshal := json.Unmarshal(request, &req); errUnmarshal != nil { |
| 72 | return nil, fmt.Errorf("decode host auth get request: %w", errUnmarshal) |
| 73 | } |
| 74 | authIndex := strings.TrimSpace(req.AuthIndex) |
| 75 | if authIndex == "" { |
| 76 | return nil, fmt.Errorf("auth_index is required") |
| 77 | } |
| 78 | auth, rawJSON, errGet := h.authPhysicalJSONByIndex(authIndex) |
| 79 | if errGet != nil { |
| 80 | return nil, errGet |
| 81 | } |
| 82 | name := strings.TrimSpace(auth.FileName) |
| 83 | if name == "" { |
| 84 | name = strings.TrimSpace(auth.ID) |
| 85 | } |
| 86 | path := strings.TrimSpace(authAttribute(auth, "path")) |
| 87 | return marshalRPCResult(rpcHostAuthGetResponse{ |
| 88 | AuthIndex: authIndex, |
| 89 | Name: name, |
| 90 | Path: path, |
| 91 | JSON: json.RawMessage(rawJSON), |
| 92 | }) |
| 93 | } |
| 94 | |
| 95 | func (h *Host) callHostAuthGetRuntime(ctx context.Context, request []byte) ([]byte, error) { |
| 96 | _ = ctx |
no test coverage detected