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