Android-cuttlefish cvd tool
create.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <optional>
20#include <string>
21#include <vector>
22
29
30namespace cuttlefish {
31
33 public:
35
36 Result<void> Handle(const CommandRequest& request) override;
37 std::vector<std::string> CmdList() const override { return {"create"}; }
38 std::string SummaryHelp() const override;
40 bool RequiresHostConfiguration() const override { return true; }
41
42 private:
43 struct CreateFlags {
44 std::string host_path;
45 std::string product_path;
46 bool start;
47 std::string config_file;
48 bool reuse;
49 };
50
51 std::vector<Flag> ConfigFileModeFlags();
52 std::vector<Flag> FlagModeFlags(
53 const std::unordered_map<std::string, std::string>& env,
56 const selector::SelectorOptions& selectors,
57 const std::unordered_map<std::string, std::string>& envs);
59 const std::vector<std::string>& subcmd_args,
60 const std::unordered_map<std::string, std::string>& envs,
61 const CommandRequest& request);
62
66};
67
68} // namespace cuttlefish
Definition: command_request.h:33
Definition: command_handler.h:28
Result< LocalInstanceGroup > CreateGroup(const std::vector< std::string > &subcmd_args, const std::unordered_map< std::string, std::string > &envs, const CommandRequest &request)
Definition: create.cpp:393
std::vector< Flag > ConfigFileModeFlags()
Definition: create.cpp:489
Result< std::string > DetailedHelp(const CommandRequest &) override
Definition: create.cpp:423
bool RequiresHostConfiguration() const override
Definition: create.h:40
selector::NumInstancesParser num_instances_parser_
Definition: create.h:65
InstanceManager & instance_manager_
Definition: create.h:63
std::string SummaryHelp() const override
Definition: create.cpp:419
std::vector< std::string > CmdList() const override
Definition: create.h:37
Result< void > Handle(const CommandRequest &request) override
Definition: create.cpp:332
std::vector< Flag > FlagModeFlags(const std::unordered_map< std::string, std::string > &env, const selector::SelectorOptions &)
Definition: create.cpp:495
CvdCreateCommandHandler(InstanceManager &instance_manager)
Definition: create.cpp:296
CreateFlags own_flags_
Definition: create.h:64
Result< std::optional< LocalInstanceGroup > > FindReusableGroup(const selector::SelectorOptions &selectors, const std::unordered_map< std::string, std::string > &envs)
Definition: create.cpp:301
Definition: instance_manager.h:50
Definition: num_instances_parser.h:32
Definition: alloc_driver.h:20
tl::expected< T, StackTraceError > Result
Definition: result_type.h:30
std::string config_file
Definition: create.h:47
std::string product_path
Definition: create.h:45
std::string host_path
Definition: create.h:44
Definition: selector_common_parser.h:28