69 references to ComposeJson
NativeIntegrations.DockerCompose (69)
ComposeModels.cs (23)
36
result["healthcheck"] =
ComposeJson
.Healthcheck(Healthcheck);
79
_render = render ??
ComposeJson
.Literal;
89
ComposeJson
.ValidateImage(value);
91
Set("image", value is null ? null :
ComposeJson
.Literal(value));
98
set => Set("build", value is null ? null :
ComposeJson
.BuildPaths(value, _applicationDirectory));
103
get => Model["healthcheck"] is JsonObject health ?
ComposeJson
.ReadHealthcheck(health) : null;
104
set => Set("healthcheck", value is null ? null :
ComposeJson
.Healthcheck(value, escape: true));
110
set => Set("container_name", value is null ? null : _render(
ComposeJson
.Text(value)));
139
public void SetLabel(string name, string value) => Model["labels"]!.AsObject()[name] =
ComposeJson
.Literal(value);
143
ComposeJson
.Key(source);
144
ComposeJson
.AbsoluteTarget(target);
147
["type"] = "volume", ["source"] = source, ["target"] =
ComposeJson
.Literal(target), ["read_only"] = isReadOnly
185
ComposeJson
.Key(name);
186
ComposeJson
.ValidateImage(image);
192
var service = new JsonObject { ["image"] =
ComposeJson
.Literal(image), ["labels"] = new JsonObject() };
196
KeyValuePair.Create(pair.Key, (JsonNode?)JsonValue.Create(
ComposeJson
.Literal(pair.Value)))));
203
public void AddNetwork(string name, JsonObject options) => Add("networks", name,
ComposeJson
.Escape(options));
209
volume["driver"] =
ComposeJson
.Literal(driver);
214
KeyValuePair.Create(pair.Key, (JsonNode?)JsonValue.Create(
ComposeJson
.Literal(pair.Value)))));
218
public void AddConfig(string name, string content) => Add("configs", name, new() { ["content"] =
ComposeJson
.Literal(content) });
224
secret["name"] =
ComposeJson
.Literal(externalName);
230
ComposeJson
.Key(name);
257
model["defaultValue"] =
ComposeJson
.Text(value, allowEmpty: true);
DockerComposeBuilderExtensions.cs (2)
68
ComposeJson
.Port(value);
91
var result = builder.AddComputeEnvironment(new DockerComposeEnvironmentResource(
ComposeJson
.Text(name)));
DockerComposeEnvironment.cs (9)
40
Name =
ComposeJson
.Text(name);
93
.Select(part => placeholders.Contains(part) ? part :
ComposeJson
.Literal(part)));
137
ComposeJson
.ValidateImage(Text(service, "image"));
140
ComposeJson
.Healthcheck(
ComposeJson
.ReadHealthcheck(healthcheck));
191
await File.WriteAllTextAsync(Path.Combine(context.OutputPath, "compose.yaml"),
ComposeJson
.Json(plan.Compose), context.CancellationToken).ConfigureAwait(false);
192
await File.WriteAllTextAsync(Path.Combine(context.OutputPath, "deployment-inputs.json"),
ComposeJson
.Json(plan.Inputs), context.CancellationToken).ConfigureAwait(false);
248
await File.WriteAllTextAsync(Path.Combine(context.OutputPath, "deployment-state.json"),
ComposeJson
.Json(state), context.CancellationToken).ConfigureAwait(false);
290
JsonValue.Create(secret)!.ToJsonString(
ComposeJson
.s_indented)[1..^1], JsonValue.Create(secret)!.ToJsonString()[1..^1]
DockerComposeGenerator.cs (35)
19
ComposeJson
.Text(environmentName);
20
ComposeJson
.Text(name);
21
var identity = Hash(
ComposeJson
.Json(new JsonArray(directory, environmentName, name)));
27
"ASPIRE_PARAMETER_" + Regex.Replace(
ComposeJson
.Text(name).ToUpperInvariant(), "[^A-Z0-9_]", "_", RegexOptions.CultureInvariant);
51
var resourceName =
ComposeJson
.Text(Text(resource, "name"));
124
ComposeJson
.ValidateImage(image);
134
["image"] =
ComposeJson
.Literal(image ?? ""), ["labels"] = new JsonObject { ["aspire.resource"] =
ComposeJson
.Literal(resourceName) }
138
service["build"] =
ComposeJson
.BuildPaths(new(Text(build, "context"), Text(build, "dockerfile")), context.ApplicationDirectory);
142
service["entrypoint"] = new JsonArray(
ComposeJson
.Literal(
ComposeJson
.Text(Text(resource, "entrypoint"))));
147
service["command"] =
ComposeJson
.Strings(arguments.Select(value => Render(Normalize(value))));
162
ComposeJson
.Port(Integer(endpoint, "targetPort"));
185
service["expose"] =
ComposeJson
.Strings(endpoints.Select(endpoint =>
227
var source =
ComposeJson
.Text(Text(mount, "source"));
229
ComposeJson
.AbsoluteTarget(target);
247
ComposeJson
.Key(source);
264
["type"] = kind, ["source"] = source, ["target"] =
ComposeJson
.Literal(target), ["read_only"] = Boolean(mount, "readOnly")
279
service["healthcheck"] =
ComposeJson
.Healthcheck(
ComposeJson
.ReadHealthcheck(healthcheck), escape: true);
316
return new() { ["kind"] = "literal", ["value"] =
ComposeJson
.Text(Text(value, "value"), true) };
344
return
ComposeJson
.Literal(Text(value, "value"));
346
return
ComposeJson
.Literal(EndpointValue(value, resources, names));
354
return
ComposeJson
.Literal(Evaluate(value, resources, names, new Dictionary<string, string>()));
356
var key = value.ToJsonString(
ComposeJson
.s_indented);
453
["name"] =
ComposeJson
.Literal(
ComposeJson
.Text(network.GetValue<string>())), ["external"] = true
470
ComposeJson
.Port(port);
531
ComposeJson
.ValidateImage(Text(options, "image"));
537
ComposeJson
.Text(Text(build, "context"));
538
ComposeJson
.Text(Text(build, "dockerfile"));
544
ComposeJson
.Healthcheck(
ComposeJson
.ReadHealthcheck(health));
552
if (!endpoints.Add(
ComposeJson
.Text(Text(exposure, "endpoint"))))
558
ComposeJson
.Port(Integer(exposure, "published"));