RequestParams.h (1734B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 4 #pragma once 5 6 #include <optional> 7 #include <string> 8 #include <unordered_map> 9 #include <vector> 10 11 namespace SFS 12 { 13 using TargetingAttributes = std::unordered_map<std::string, std::string>; 14 15 constexpr unsigned c_maxRetries = 3; 16 17 struct ProductRequest 18 { 19 /// @brief The name or GUID that uniquely represents the product in the service (required) 20 std::string product; 21 22 /// @brief Key-value pair to filter the data retrieved from the service. Known from publishing (optional) 23 TargetingAttributes attributes; 24 }; 25 26 /// @brief Configurations to perform a request to the SFS service 27 struct RequestParams 28 { 29 /// @brief List of products to be retrieved from the server (required) 30 /// @note At the moment only a single product request is supported. Using a vector for future implementation of 31 /// batch requests 32 std::vector<ProductRequest> productRequests; 33 34 /// @brief Base CorrelationVector to be used in the request for service telemetry stitching (optional) 35 /// @note If not provided, a new CorrelationVector will be generated 36 std::optional<std::string> baseCV; 37 38 /// @brief Proxy setting which can be used to establish connections with the server (optional) 39 /// @note The string can be a hostname or dotted numerical IP address. It can be suffixed with the port number 40 /// like :[port], and can be prefixed with [scheme]://. If not provided, no proxy will be used. 41 std::optional<std::string> proxy; 42 43 /// @brief Retry for a web request after a failed attempt. If true, client will retry up to c_maxRetries times 44 bool retryOnError{true}; 45 }; 46 } // namespace SFS