aboutsummaryrefslogtreecommitdiff
path: root/bbot/machine-manifest
blob: 0d71bd74cb222d26aec169590b1ee5f792042312 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// file      : bbot/machine-manifest -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

#ifndef BBOT_MACHINE_MANIFEST
#define BBOT_MACHINE_MANIFEST

#include <map>

#include <butl/manifest-forward>

#include <bbot/types>
#include <bbot/utility>

#include <bbot/manifest> // machine_header

namespace bbot
{
  // Machine type.
  //
  enum class machine_type {kvm, nspawn};

  string
  to_string (machine_type);

  machine_type
  to_machine_type (const string&); // Throws invalid_argument.

  // Machine.
  //
  class machine_manifest: public machine_header_manifest
  {
  public:
    machine_type type;
    optional<string> mac; // Required in bootstrapped machine manifest.

    machine_manifest (std::string i,
                      std::string n,
                      std::string s,
                      machine_type t)
        : machine_header_manifest (std::move (i),
                                   std::move (n),
                                   std::move (s)),
          type (t) {}

  public:
    machine_manifest () = default; // VC export.
    machine_manifest (butl::manifest_parser&, bool ignore_unknown = false);
    machine_manifest (butl::manifest_parser&,
                      butl::manifest_name_value start,
                      bool ignore_unknown = false);

    void
    serialize (butl::manifest_serializer&) const;
  };
}

#endif // BBOT_MACHINE_MANIFEST