Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
s3-url.hh
Go to the documentation of this file.
1#pragma once
3
5#include "nix/util/error.hh"
6#include "nix/util/url.hh"
7#include "nix/util/util.hh"
8
9#include <optional>
10#include <string>
11#include <string_view>
12#include <variant>
13#include <vector>
14
15namespace nix {
16
24 Auto,
25 Path,
26 Virtual,
27};
28
29MakeError(InvalidS3AddressingStyle, Error);
30
31S3AddressingStyle parseS3AddressingStyle(std::string_view style);
32std::string_view showS3AddressingStyle(S3AddressingStyle style);
33
34NIX_DECLARE_CONFIG_SERIALISER(S3AddressingStyle)
35
36
40{
41 std::string bucket;
47 std::vector<std::string> key;
48 std::optional<std::string> profile;
49 std::optional<std::string> region;
50 std::optional<std::string> scheme;
51 std::optional<std::string> versionId;
52 std::optional<S3AddressingStyle> addressingStyle;
57 std::variant<std::monostate, ParsedURL, ParsedURL::Authority> endpoint;
58
59 std::optional<std::string> getEncodedEndpoint() const
60 {
61 return std::visit(
63 [](std::monostate) -> std::optional<std::string> { return std::nullopt; },
64 [](const auto & authorityOrUrl) -> std::optional<std::string> { return authorityOrUrl.to_string(); },
65 },
66 endpoint);
67 }
68
69 static ParsedS3URL parse(const ParsedURL & uri);
70
75 ParsedURL toHttpsUrl() const;
76
77 auto operator<=>(const ParsedS3URL & other) const = default;
78};
79
80} // namespace nix
This file defines two main structs/classes used in nix error handling.
S3AddressingStyle
Definition s3-url.hh:23
Definition store-reference.hh:53
Definition s3-url.hh:40
std::vector< std::string > key
Definition s3-url.hh:47
std::variant< std::monostate, ParsedURL, ParsedURL::Authority > endpoint
Definition s3-url.hh:57
Definition url.hh:22
Definition util.hh:444