Job Args
data class JobArgs(val configuration: Output<JobConfigurationArgs>? = null, val environmentId: Output<String>? = null, val identity: Output<ManagedServiceIdentityArgs>? = null, val jobName: Output<String>? = null, val location: Output<String>? = null, val resourceGroupName: Output<String>? = null, val tags: Output<Map<String, String>>? = null, val template: Output<JobTemplateArgs>? = null, val workloadProfileName: Output<String>? = null) : ConvertibleToJava<JobArgs>
Container App Job Azure REST API version: 2023-04-01-preview. Other available API versions: 2023-05-01, 2023-05-02-preview.
Example Usage
Create or Update Container Apps Job
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var job = new AzureNative.App.Job("job", new()
{
Configuration = new AzureNative.App.Inputs.JobConfigurationArgs
{
ManualTriggerConfig = new AzureNative.App.Inputs.JobConfigurationManualTriggerConfigArgs
{
Parallelism = 4,
ReplicaCompletionCount = 1,
},
ReplicaRetryLimit = 10,
ReplicaTimeout = 10,
TriggerType = "Manual",
},
EnvironmentId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
JobName = "testcontainerAppsJob0",
Location = "East US",
ResourceGroupName = "rg",
Template = new AzureNative.App.Inputs.JobTemplateArgs
{
Containers = new[]
{
new AzureNative.App.Inputs.ContainerArgs
{
Image = "repo/testcontainerAppsJob0:v1",
Name = "testcontainerAppsJob0",
Probes = new[]
{
new AzureNative.App.Inputs.ContainerAppProbeArgs
{
HttpGet = new AzureNative.App.Inputs.ContainerAppProbeHttpGetArgs
{
HttpHeaders = new[]
{
new AzureNative.App.Inputs.ContainerAppProbeHttpHeadersArgs
{
Name = "Custom-Header",
Value = "Awesome",
},
},
Path = "/health",
Port = 8080,
},
InitialDelaySeconds = 5,
PeriodSeconds = 3,
Type = "Liveness",
},
},
},
},
InitContainers = new[]
{
new AzureNative.App.Inputs.InitContainerArgs
{
Args = new[]
{
"-c",
"while true; do echo hello; sleep 10;done",
},
Command = new[]
{
"/bin/sh",
},
Image = "repo/testcontainerAppsJob0:v4",
Name = "testinitcontainerAppsJob0",
Resources = new AzureNative.App.Inputs.ContainerResourcesArgs
{
Cpu = 0.2,
Memory = "100Mi",
},
},
},
},
});
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-azure-native-sdk/app/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := app.NewJob(ctx, "job", &app.JobArgs{
Configuration: app.JobConfigurationResponse{
ManualTriggerConfig: &app.JobConfigurationManualTriggerConfigArgs{
Parallelism: pulumi.Int(4),
ReplicaCompletionCount: pulumi.Int(1),
},
ReplicaRetryLimit: pulumi.Int(10),
ReplicaTimeout: pulumi.Int(10),
TriggerType: pulumi.String("Manual"),
},
EnvironmentId: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
JobName: pulumi.String("testcontainerAppsJob0"),
Location: pulumi.String("East US"),
ResourceGroupName: pulumi.String("rg"),
Template: app.JobTemplateResponse{
Containers: app.ContainerArray{
interface{}{
Image: pulumi.String("repo/testcontainerAppsJob0:v1"),
Name: pulumi.String("testcontainerAppsJob0"),
Probes: app.ContainerAppProbeArray{
interface{}{
HttpGet: interface{}{
HttpHeaders: app.ContainerAppProbeHttpHeadersArray{
&app.ContainerAppProbeHttpHeadersArgs{
Name: pulumi.String("Custom-Header"),
Value: pulumi.String("Awesome"),
},
},
Path: pulumi.String("/health"),
Port: pulumi.Int(8080),
},
InitialDelaySeconds: pulumi.Int(5),
PeriodSeconds: pulumi.Int(3),
Type: pulumi.String("Liveness"),
},
},
},
},
InitContainers: app.InitContainerArray{
interface{}{
Args: pulumi.StringArray{
pulumi.String("-c"),
pulumi.String("while true; do echo hello; sleep 10;done"),
},
Command: pulumi.StringArray{
pulumi.String("/bin/sh"),
},
Image: pulumi.String("repo/testcontainerAppsJob0:v4"),
Name: pulumi.String("testinitcontainerAppsJob0"),
Resources: &app.ContainerResourcesArgs{
Cpu: pulumi.Float64(0.2),
Memory: pulumi.String("100Mi"),
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.app.Job;
import com.pulumi.azurenative.app.JobArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var job = new Job("job", JobArgs.builder()
.configuration(Map.ofEntries(
Map.entry("manualTriggerConfig", Map.ofEntries(
Map.entry("parallelism", 4),
Map.entry("replicaCompletionCount", 1)
)),
Map.entry("replicaRetryLimit", 10),
Map.entry("replicaTimeout", 10),
Map.entry("triggerType", "Manual")
))
.environmentId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube")
.jobName("testcontainerAppsJob0")
.location("East US")
.resourceGroupName("rg")
.template(Map.ofEntries(
Map.entry("containers", Map.ofEntries(
Map.entry("image", "repo/testcontainerAppsJob0:v1"),
Map.entry("name", "testcontainerAppsJob0"),
Map.entry("probes", Map.ofEntries(
Map.entry("httpGet", Map.ofEntries(
Map.entry("httpHeaders", Map.ofEntries(
Map.entry("name", "Custom-Header"),
Map.entry("value", "Awesome")
)),
Map.entry("path", "/health"),
Map.entry("port", 8080)
)),
Map.entry("initialDelaySeconds", 5),
Map.entry("periodSeconds", 3),
Map.entry("type", "Liveness")
))
)),
Map.entry("initContainers", Map.ofEntries(
Map.entry("args",
"-c",
"while true; do echo hello; sleep 10;done"),
Map.entry("command", "/bin/sh"),
Map.entry("image", "repo/testcontainerAppsJob0:v4"),
Map.entry("name", "testinitcontainerAppsJob0"),
Map.entry("resources", Map.ofEntries(
Map.entry("cpu", 0.2),
Map.entry("memory", "100Mi")
))
))
))
.build());
}
}
Content copied to clipboard
Create or Update Container Apps Job With Event Driven Trigger
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var job = new AzureNative.App.Job("job", new()
{
Configuration = new AzureNative.App.Inputs.JobConfigurationArgs
{
EventTriggerConfig = new AzureNative.App.Inputs.JobConfigurationEventTriggerConfigArgs
{
Parallelism = 4,
ReplicaCompletionCount = 1,
Scale = new AzureNative.App.Inputs.JobScaleArgs
{
MaxExecutions = 5,
MinExecutions = 1,
PollingInterval = 40,
Rules = new[]
{
new AzureNative.App.Inputs.JobScaleRuleArgs
{
Metadata =
{
{ "topicName", "my-topic" },
},
Name = "servicebuscalingrule",
Type = "azure-servicebus",
},
},
},
},
ReplicaRetryLimit = 10,
ReplicaTimeout = 10,
TriggerType = "Event",
},
EnvironmentId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
JobName = "testcontainerAppsJob0",
Location = "East US",
ResourceGroupName = "rg",
Template = new AzureNative.App.Inputs.JobTemplateArgs
{
Containers = new[]
{
new AzureNative.App.Inputs.ContainerArgs
{
Image = "repo/testcontainerAppsJob0:v1",
Name = "testcontainerAppsJob0",
},
},
InitContainers = new[]
{
new AzureNative.App.Inputs.InitContainerArgs
{
Args = new[]
{
"-c",
"while true; do echo hello; sleep 10;done",
},
Command = new[]
{
"/bin/sh",
},
Image = "repo/testcontainerAppsJob0:v4",
Name = "testinitcontainerAppsJob0",
Resources = new AzureNative.App.Inputs.ContainerResourcesArgs
{
Cpu = 0.2,
Memory = "100Mi",
},
},
},
},
});
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-azure-native-sdk/app/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := app.NewJob(ctx, "job", &app.JobArgs{
Configuration: app.JobConfigurationResponse{
EventTriggerConfig: interface{}{
Parallelism: pulumi.Int(4),
ReplicaCompletionCount: pulumi.Int(1),
Scale: interface{}{
MaxExecutions: pulumi.Int(5),
MinExecutions: pulumi.Int(1),
PollingInterval: pulumi.Int(40),
Rules: app.JobScaleRuleArray{
&app.JobScaleRuleArgs{
Metadata: pulumi.Any{
TopicName: "my-topic",
},
Name: pulumi.String("servicebuscalingrule"),
Type: pulumi.String("azure-servicebus"),
},
},
},
},
ReplicaRetryLimit: pulumi.Int(10),
ReplicaTimeout: pulumi.Int(10),
TriggerType: pulumi.String("Event"),
},
EnvironmentId: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
JobName: pulumi.String("testcontainerAppsJob0"),
Location: pulumi.String("East US"),
ResourceGroupName: pulumi.String("rg"),
Template: app.JobTemplateResponse{
Containers: app.ContainerArray{
&app.ContainerArgs{
Image: pulumi.String("repo/testcontainerAppsJob0:v1"),
Name: pulumi.String("testcontainerAppsJob0"),
},
},
InitContainers: app.InitContainerArray{
interface{}{
Args: pulumi.StringArray{
pulumi.String("-c"),
pulumi.String("while true; do echo hello; sleep 10;done"),
},
Command: pulumi.StringArray{
pulumi.String("/bin/sh"),
},
Image: pulumi.String("repo/testcontainerAppsJob0:v4"),
Name: pulumi.String("testinitcontainerAppsJob0"),
Resources: &app.ContainerResourcesArgs{
Cpu: pulumi.Float64(0.2),
Memory: pulumi.String("100Mi"),
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.app.Job;
import com.pulumi.azurenative.app.JobArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var job = new Job("job", JobArgs.builder()
.configuration(Map.ofEntries(
Map.entry("eventTriggerConfig", Map.ofEntries(
Map.entry("parallelism", 4),
Map.entry("replicaCompletionCount", 1),
Map.entry("scale", Map.ofEntries(
Map.entry("maxExecutions", 5),
Map.entry("minExecutions", 1),
Map.entry("pollingInterval", 40),
Map.entry("rules", Map.ofEntries(
Map.entry("metadata", Map.of("topicName", "my-topic")),
Map.entry("name", "servicebuscalingrule"),
Map.entry("type", "azure-servicebus")
))
))
)),
Map.entry("replicaRetryLimit", 10),
Map.entry("replicaTimeout", 10),
Map.entry("triggerType", "Event")
))
.environmentId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube")
.jobName("testcontainerAppsJob0")
.location("East US")
.resourceGroupName("rg")
.template(Map.ofEntries(
Map.entry("containers", Map.ofEntries(
Map.entry("image", "repo/testcontainerAppsJob0:v1"),
Map.entry("name", "testcontainerAppsJob0")
)),
Map.entry("initContainers", Map.ofEntries(
Map.entry("args",
"-c",
"while true; do echo hello; sleep 10;done"),
Map.entry("command", "/bin/sh"),
Map.entry("image", "repo/testcontainerAppsJob0:v4"),
Map.entry("name", "testinitcontainerAppsJob0"),
Map.entry("resources", Map.ofEntries(
Map.entry("cpu", 0.2),
Map.entry("memory", "100Mi")
))
))
))
.build());
}
}
Content copied to clipboard
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:app:Job testcontainerAppsJob0 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}
Content copied to clipboard
Constructors
Link copied to clipboard
fun JobArgs(configuration: Output<JobConfigurationArgs>? = null, environmentId: Output<String>? = null, identity: Output<ManagedServiceIdentityArgs>? = null, jobName: Output<String>? = null, location: Output<String>? = null, resourceGroupName: Output<String>? = null, tags: Output<Map<String, String>>? = null, template: Output<JobTemplateArgs>? = null, workloadProfileName: Output<String>? = null)