84 references to Text
NativeIntegrations.DockerCompose (84)
DockerComposeBuilderExtensions.cs (5)
42
if (Objects(parameters).Any(entry =>
Text
(entry, "environmentVariable") == variable &&
Text
(entry, "name") != parameter.Resource.Name))
46
if (!Objects(parameters).Any(entry =>
Text
(entry, "name") == parameter.Resource.Name))
53
plan.Inputs["parameters"] = new JsonArray(Objects(parameters).OrderBy(entry =>
Text
(entry, "name"), StringComparer.Ordinal)
230
if (!resources.Any(resource =>
Text
(resource, "type") == "docker-compose/environment") &&
DockerComposeEnvironment.cs (14)
90
var placeholders = Objects(plan.Inputs["parameters"]).Select(parameter => Placeholder(
Text
(parameter, "environmentVariable"))).ToHashSet(StringComparer.Ordinal);
108
if (file.Name != originalName && Objects(context.Model["resources"]).Count(resource =>
Text
(resource, "type") == "docker-compose/environment") > 1)
117
var native = Objects(context.Model["resources"]).SingleOrDefault(resource =>
Text
(resource, "name") == entry.Resource);
122
Text
(native, "kind") == "executable" && service["build"] is null)
137
ComposeJson.ValidateImage(
Text
(service, "image"));
157
if (
Text
(mount, "type") == "volume" && plan.Compose["volumes"]?[
Text
(mount, "source")] is null)
159
throw new InvalidOperationException($"Service '{name}' references missing Compose volume '{
Text
(mount, "source")}'.");
183
(!Directory.Exists(
Text
(build, "context").Replace("$$", "$", StringComparison.Ordinal)) ||
184
!File.Exists(
Text
(build, "dockerfile").Replace("$$", "$", StringComparison.Ordinal))))
204
"External cleanup (argument list): " + new JsonArray("docker", "compose", "-p",
Text
(plan.Compose, "name"), "-f",
242
"-p",
Text
(plan.Compose, "name"), "-f", composePath];
279
Objects(context.Model["resources"]).Count(resource =>
Text
(resource, "type") == "docker-compose/environment") > 1 ?
352
return new() { ["schemaVersion"] = 1, ["projectName"] =
Text
(plan.Compose, "name"), ["services"] = services };
DockerComposeGenerator.cs (65)
39
var environments = all.Where(resource =>
Text
(resource, "type") == "docker-compose/environment").ToArray();
40
var environment = environments.SingleOrDefault(resource =>
Text
(resource, "name") == name);
49
foreach (var resource in all.OrderBy(resource =>
Text
(resource, "name"), StringComparer.Ordinal))
51
var resourceName = ComposeJson.Text(
Text
(resource, "name"));
56
if (environments.Contains(resource) ||
Text
(resource, "type") == "hosting/parameter")
71
if (assignment is not null && !environments.Any(value =>
Text
(value, "name") == assignment))
83
if (
Text
(resource, "kind") is not ("container" or "executable"))
117
if ((!HasText(image) ||
Text
(resource, "kind") == "executable" &&
138
service["build"] = ComposeJson.BuildPaths(new(
Text
(build, "context"),
Text
(build, "dockerfile")), context.ApplicationDirectory);
140
if (
Text
(resource, "kind") == "container" && resource["entrypoint"] is not null)
142
service["entrypoint"] = new JsonArray(ComposeJson.Literal(ComposeJson.Text(
Text
(resource, "entrypoint"))));
155
var endpoints = Objects(resource["endpoints"]).OrderBy(value =>
Text
(value, "name"), StringComparer.Ordinal).ToArray();
156
if (endpoints.Select(endpoint =>
Text
(endpoint, "name")).Distinct(StringComparer.Ordinal).Count() != endpoints.Length)
163
if (
Text
(endpoint, "protocol") is not ("tcp" or "udp") ||
164
!Regex.IsMatch(
Text
(endpoint, "scheme"), "^[a-z][a-z0-9+.-]*$", RegexOptions.CultureInvariant))
174
throw new InvalidOperationException($"Endpoint '{resourceName}/{
Text
(endpoint, "name")}' port environment conflicts with authored environment.");
186
$"{Integer(endpoint, "targetPort")}/{
Text
(endpoint, "protocol")}").Distinct().Order(StringComparer.Ordinal));
192
var exposure = new JsonObject { ["endpoint"] =
Text
(endpoint, "name") };
200
foreach (var exposure in exposures.OrderBy(value =>
Text
(value, "endpoint"), StringComparer.Ordinal))
202
var endpoint = endpoints.SingleOrDefault(endpoint =>
Text
(endpoint, "name") ==
Text
(exposure, "endpoint"))
203
?? throw new InvalidOperationException($"Exposed endpoint '{resourceName}/{
Text
(exposure, "endpoint")}' does not exist.");
204
exposed.Add(new(
Text
(endpoint, "name"), Integer(endpoint, "targetPort"),
Text
(endpoint, "protocol"),
Text
(endpoint, "scheme"),
222
var mounts = Objects(resource["mounts"]).OrderBy(mount =>
Text
(mount, "target") + "\0" +
Text
(mount, "source"), StringComparer.Ordinal).ToArray();
227
var source = ComposeJson.Text(
Text
(mount, "source"));
228
var target =
Text
(mount, "target");
230
var kind =
Text
(mount, "kind");
313
switch (
Text
(value, "kind"))
316
return new() { ["kind"] = "literal", ["value"] = ComposeJson.Text(
Text
(value, "value"), true) };
318
var parameter =
Text
(value, "name");
329
return new() { ["kind"] = "endpoint", ["resource"] =
Text
(value, "resource"), ["endpoint"] =
Text
(value, "endpoint"), ["property"] =
Text
(value, "property") };
341
switch (
Text
(value, "kind"))
344
return ComposeJson.Literal(
Text
(value, "value"));
348
return Placeholder(parameters[
Text
(value, "name")]);
377
var name =
Text
(parameter, "name");
378
var variable =
Text
(parameter, "environmentVariable");
392
var resources = Objects(model["resources"]).ToDictionary(resource =>
Text
(resource, "name"), StringComparer.Ordinal);
406
var name =
Text
(parameter, "name");
407
var variable =
Text
(parameter, "environmentVariable");
460
var resourceName =
Text
(environment, "name") + "-dashboard";
476
["Dashboard__Frontend__BrowserToken"] = Secret(ParameterVariable(
Text
(environment, "name") + "-dashboard-token"), "Dashboard browser token"),
478
["Dashboard__Otlp__PrimaryApiKey"] = Secret(ParameterVariable(
Text
(environment, "name") + "-dashboard-otlp-key"), "Dashboard OTLP API key"),
502
if (captured.ContainsKey(variable) || Objects(plan.Inputs["parameters"]).Any(parameter =>
Text
(parameter, "environmentVariable") == variable))
531
ComposeJson.ValidateImage(
Text
(options, "image"));
537
ComposeJson.Text(
Text
(build, "context"));
538
ComposeJson.Text(
Text
(build, "dockerfile"));
552
if (!endpoints.Add(ComposeJson.Text(
Text
(exposure, "endpoint"))))
560
if (exposure.ContainsKey("hostIp") && !IPAddress.TryParse(
Text
(exposure, "hostIp"), out _))
608
private static bool ContainsParameter(JsonObject value) =>
Text
(value, "kind") switch
616
IReadOnlyDictionary<string, string> names, IReadOnlyDictionary<string, string> parameters) =>
Text
(value, "kind") switch
618
"literal" =>
Text
(value, "value"),
619
"parameter" => parameters[ParameterVariable(
Text
(value, "name"))],
632
var name =
Text
(value, "resource");
637
var endpoint = Objects(resource["endpoints"]).SingleOrDefault(endpoint =>
Text
(endpoint, "name") ==
Text
(value, "endpoint"))
638
?? throw new InvalidOperationException($"Endpoint '{
Text
(value, "endpoint")}' is missing on '{name}'.");
641
return
Text
(value, "property") switch
646
"Scheme" =>
Text
(endpoint, "scheme"),
647
"Url" => $"{
Text
(endpoint, "scheme")}://{host}:{port}",