forked from testcontainers/testcontainers-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnix.cs
More file actions
132 lines (118 loc) · 4.13 KB
/
Unix.cs
File metadata and controls
132 lines (118 loc) · 4.13 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
namespace DotNet.Testcontainers.Configurations
{
using System;
using DotNet.Testcontainers.Builders;
using JetBrains.Annotations;
/// <summary>
/// Unix operating system.
/// </summary>
[PublicAPI]
public sealed class Unix : IOperatingSystem
{
/// <summary>
/// Represents the Unix file mode 600, which grants read and write permissions to the user and no permissions to the group and others.
/// </summary>
public const UnixFileModes FileMode600 =
UnixFileModes.UserRead |
UnixFileModes.UserWrite;
/// <summary>
/// Represents the Unix file mode 644, which grants read and write permissions to the user and read permissions to the group and others.
/// </summary>
public const UnixFileModes FileMode644 =
UnixFileModes.UserRead |
UnixFileModes.UserWrite |
UnixFileModes.GroupRead |
UnixFileModes.OtherRead;
/// <summary>
/// Represents the Unix file mode 666, which grants read and write permissions to the user, group, and others.
/// </summary>
public const UnixFileModes FileMode666 =
UnixFileModes.UserRead |
UnixFileModes.UserWrite |
UnixFileModes.GroupRead |
UnixFileModes.GroupWrite |
UnixFileModes.OtherRead |
UnixFileModes.OtherWrite;
/// <summary>
/// Represents the Unix file mode 700, which grants read, write, and execute permissions to the user, and no permissions to the group and others.
/// </summary>
public const UnixFileModes FileMode700 =
UnixFileModes.UserRead |
UnixFileModes.UserWrite |
UnixFileModes.UserExecute;
/// <summary>
/// Represents the Unix file mode 755, which grants read, write, and execute permissions to the user, and read and execute permissions to the group and others.
/// </summary>
public const UnixFileModes FileMode755 =
UnixFileModes.UserRead |
UnixFileModes.UserWrite |
UnixFileModes.UserExecute |
UnixFileModes.GroupRead |
UnixFileModes.GroupExecute |
UnixFileModes.OtherRead |
UnixFileModes.OtherExecute;
/// <summary>
/// Represents the Unix file mode 777, which grants read, write, and execute permissions to the user, group, and others.
/// </summary>
public const UnixFileModes FileMode777 =
UnixFileModes.UserRead |
UnixFileModes.UserWrite |
UnixFileModes.UserExecute |
UnixFileModes.GroupRead |
UnixFileModes.GroupWrite |
UnixFileModes.GroupExecute |
UnixFileModes.OtherRead |
UnixFileModes.OtherWrite |
UnixFileModes.OtherExecute;
static Unix()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Unix" /> class.
/// </summary>
[PublicAPI]
public Unix()
: this(UnixEndpointAuthenticationProvider.DockerEngine)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Unix" /> class.
/// </summary>
/// <param name="endpoint">The Docker API endpoint.</param>
[PublicAPI]
public Unix(string endpoint)
: this(new Uri(endpoint))
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Unix" /> class.
/// </summary>
/// <param name="endpoint">The Docker API endpoint.</param>
[PublicAPI]
public Unix(Uri endpoint)
: this(new DockerEndpointAuthenticationConfiguration(endpoint))
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Unix" /> class.
/// </summary>
/// <param name="dockerEndpointAuthConfig">The Docker endpoint authentication configuration.</param>
[PublicAPI]
public Unix(IDockerEndpointAuthenticationConfiguration dockerEndpointAuthConfig)
{
DockerEndpointAuthConfig = dockerEndpointAuthConfig;
}
/// <summary>
/// Gets the <see cref="IOperatingSystem" /> instance.
/// </summary>
public static IOperatingSystem Instance { get; }
= new Unix(dockerEndpointAuthConfig: null);
/// <inheritdoc />
public IDockerEndpointAuthenticationConfiguration DockerEndpointAuthConfig { get; }
/// <inheritdoc />
public string NormalizePath(string path)
{
return path?.Replace('\\', '/');
}
}
}