1 // 2 // Copyright (C) 2022 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 #pragma once 17 18 #include <sstream> 19 #include <string> 20 21 namespace cuttlefish { 22 23 struct CVDOutput { 24 bool verbose; 25 const std::string& service_url; 26 const std::string& zone; 27 const std::string& host; 28 const std::string& name; 29 ToStringCVDOutput30 std::string ToString() { return verbose ? Verbose() : Name(); } 31 32 private: NameCVDOutput33 std::string Name() { return name + " " + "(" + host + ")"; } 34 VerboseCVDOutput35 std::string Verbose() { 36 std::stringstream stream; 37 stream << name + " " + "(" + host + ")" << std::endl; 38 stream << " " 39 << "webrtcstream_url: " << WebRTCStreamURL() << std::endl; 40 return stream.str(); 41 } 42 WebRTCStreamURLCVDOutput43 std::string WebRTCStreamURL() { 44 return service_url + "/v1/zones/" + zone + "/hosts/" + host + "/devices/" + 45 name + "/files/client.html"; 46 } 47 }; 48 49 } // namespace cuttlefish 50