summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/src/app/shared/api/motd.service.ts
blob: dd17b2e04efd39e98245a20cbdae707035fa39db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';

import { Observable } from 'rxjs';

export interface Motd {
  message: string;
  md5: string;
  severity: 'info' | 'warning' | 'danger';
  // The expiration date in ISO 8601. Does not expire if empty.
  expires: string;
}

@Injectable({
  providedIn: 'root'
})
export class MotdService {
  private url = 'ui-api/motd';

  constructor(private http: HttpClient) {}

  get(): Observable<Motd | null> {
    return this.http.get<Motd | null>(this.url);
  }
}