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