Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.azurenative.app.kotlin.Job.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azurenative.app.kotlin
import com.pulumi.azurenative.app.kotlin.outputs.JobConfigurationResponse
import com.pulumi.azurenative.app.kotlin.outputs.JobTemplateResponse
import com.pulumi.azurenative.app.kotlin.outputs.ManagedServiceIdentityResponse
import com.pulumi.azurenative.app.kotlin.outputs.SystemDataResponse
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azurenative.app.kotlin.outputs.JobConfigurationResponse.Companion.toKotlin as jobConfigurationResponseToKotlin
import com.pulumi.azurenative.app.kotlin.outputs.JobTemplateResponse.Companion.toKotlin as jobTemplateResponseToKotlin
import com.pulumi.azurenative.app.kotlin.outputs.ManagedServiceIdentityResponse.Companion.toKotlin as managedServiceIdentityResponseToKotlin
import com.pulumi.azurenative.app.kotlin.outputs.SystemDataResponse.Companion.toKotlin as systemDataResponseToKotlin
/**
* Builder for [Job].
*/
@PulumiTagMarker
public class JobResourceBuilder internal constructor() {
public var name: String? = null
public var args: JobArgs = JobArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend JobArgsBuilder.() -> Unit) {
val builder = JobArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): Job {
val builtJavaResource = com.pulumi.azurenative.app.Job(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Job(builtJavaResource)
}
}
/**
* Container App Job
* Azure REST API version: 2023-04-01-preview.
* Other available API versions: 2023-05-01, 2023-05-02-preview, 2023-08-01-preview, 2023-11-02-preview, 2024-02-02-preview, 2024-03-01.
* ## Example Usage
* ### Create or Update Container Apps Job
* ```csharp
* 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 = AzureNative.App.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 = AzureNative.App.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.5,
* Memory = "1Gi",
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* app "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.JobConfigurationArgs{
* ManualTriggerConfig: &app.JobConfigurationManualTriggerConfigArgs{
* Parallelism: pulumi.Int(4),
* ReplicaCompletionCount: pulumi.Int(1),
* },
* ReplicaRetryLimit: pulumi.Int(10),
* ReplicaTimeout: pulumi.Int(10),
* TriggerType: pulumi.String(app.TriggerTypeManual),
* },
* 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.JobTemplateArgs{
* Containers: app.ContainerArray{
* &app.ContainerArgs{
* Image: pulumi.String("repo/testcontainerappsjob0:v1"),
* Name: pulumi.String("testcontainerappsjob0"),
* Probes: app.ContainerAppProbeArray{
* &app.ContainerAppProbeArgs{
* HttpGet: &app.ContainerAppProbeHttpGetArgs{
* 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(app.TypeLiveness),
* },
* },
* },
* },
* InitContainers: app.InitContainerArray{
* &app.InitContainerArgs{
* 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.5),
* Memory: pulumi.String("1Gi"),
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* 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 com.pulumi.azurenative.app.inputs.JobConfigurationArgs;
* import com.pulumi.azurenative.app.inputs.JobConfigurationManualTriggerConfigArgs;
* import com.pulumi.azurenative.app.inputs.JobTemplateArgs;
* 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(JobConfigurationArgs.builder()
* .manualTriggerConfig(JobConfigurationManualTriggerConfigArgs.builder()
* .parallelism(4)
* .replicaCompletionCount(1)
* .build())
* .replicaRetryLimit(10)
* .replicaTimeout(10)
* .triggerType("Manual")
* .build())
* .environmentId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube")
* .jobName("testcontainerappsjob0")
* .location("East US")
* .resourceGroupName("rg")
* .template(JobTemplateArgs.builder()
* .containers(ContainerArgs.builder()
* .image("repo/testcontainerappsjob0:v1")
* .name("testcontainerappsjob0")
* .probes(ContainerAppProbeArgs.builder()
* .httpGet(ContainerAppProbeHttpGetArgs.builder()
* .httpHeaders(ContainerAppProbeHttpHeadersArgs.builder()
* .name("Custom-Header")
* .value("Awesome")
* .build())
* .path("/health")
* .port(8080)
* .build())
* .initialDelaySeconds(5)
* .periodSeconds(3)
* .type("Liveness")
* .build())
* .build())
* .initContainers(InitContainerArgs.builder()
* .args(
* "-c",
* "while true; do echo hello; sleep 10;done")
* .command("/bin/sh")
* .image("repo/testcontainerappsjob0:v4")
* .name("testinitcontainerAppsJob0")
* .resources(ContainerResourcesArgs.builder()
* .cpu(0.5)
* .memory("1Gi")
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ### Create or Update Container Apps Job With Event Driven Trigger
* ```csharp
* 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 = new Dictionary
* {
* ["topicName"] = "my-topic",
* },
* Name = "servicebuscalingrule",
* Type = "azure-servicebus",
* },
* },
* },
* },
* ReplicaRetryLimit = 10,
* ReplicaTimeout = 10,
* TriggerType = AzureNative.App.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.5,
* Memory = "1Gi",
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* app "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.JobConfigurationArgs{
* EventTriggerConfig: &app.JobConfigurationEventTriggerConfigArgs{
* Parallelism: pulumi.Int(4),
* ReplicaCompletionCount: pulumi.Int(1),
* Scale: &app.JobScaleArgs{
* MaxExecutions: pulumi.Int(5),
* MinExecutions: pulumi.Int(1),
* PollingInterval: pulumi.Int(40),
* Rules: app.JobScaleRuleArray{
* &app.JobScaleRuleArgs{
* Metadata: pulumi.Any(map[string]interface{}{
* "topicName": "my-topic",
* }),
* Name: pulumi.String("servicebuscalingrule"),
* Type: pulumi.String("azure-servicebus"),
* },
* },
* },
* },
* ReplicaRetryLimit: pulumi.Int(10),
* ReplicaTimeout: pulumi.Int(10),
* TriggerType: pulumi.String(app.TriggerTypeEvent),
* },
* 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.JobTemplateArgs{
* Containers: app.ContainerArray{
* &app.ContainerArgs{
* Image: pulumi.String("repo/testcontainerappsjob0:v1"),
* Name: pulumi.String("testcontainerappsjob0"),
* },
* },
* InitContainers: app.InitContainerArray{
* &app.InitContainerArgs{
* 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.5),
* Memory: pulumi.String("1Gi"),
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* 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 com.pulumi.azurenative.app.inputs.JobConfigurationArgs;
* import com.pulumi.azurenative.app.inputs.JobConfigurationEventTriggerConfigArgs;
* import com.pulumi.azurenative.app.inputs.JobScaleArgs;
* import com.pulumi.azurenative.app.inputs.JobTemplateArgs;
* 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(JobConfigurationArgs.builder()
* .eventTriggerConfig(JobConfigurationEventTriggerConfigArgs.builder()
* .parallelism(4)
* .replicaCompletionCount(1)
* .scale(JobScaleArgs.builder()
* .maxExecutions(5)
* .minExecutions(1)
* .pollingInterval(40)
* .rules(JobScaleRuleArgs.builder()
* .metadata(Map.of("topicName", "my-topic"))
* .name("servicebuscalingrule")
* .type("azure-servicebus")
* .build())
* .build())
* .build())
* .replicaRetryLimit(10)
* .replicaTimeout(10)
* .triggerType("Event")
* .build())
* .environmentId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube")
* .jobName("testcontainerappsjob0")
* .location("East US")
* .resourceGroupName("rg")
* .template(JobTemplateArgs.builder()
* .containers(ContainerArgs.builder()
* .image("repo/testcontainerappsjob0:v1")
* .name("testcontainerappsjob0")
* .build())
* .initContainers(InitContainerArgs.builder()
* .args(
* "-c",
* "while true; do echo hello; sleep 10;done")
* .command("/bin/sh")
* .image("repo/testcontainerappsjob0:v4")
* .name("testinitcontainerAppsJob0")
* .resources(ContainerResourcesArgs.builder()
* .cpu(0.5)
* .memory("1Gi")
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ## Import
* An existing resource can be imported using its type token, name, and identifier, e.g.
* ```sh
* $ pulumi import azure-native:app:Job testcontainerappsjob0 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}
* ```
*/
public class Job internal constructor(
override val javaResource: com.pulumi.azurenative.app.Job,
) : KotlinCustomResource(javaResource, JobMapper) {
/**
* Container Apps Job configuration properties.
*/
public val configuration: Output?
get() = javaResource.configuration().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> jobConfigurationResponseToKotlin(args0) })
}).orElse(null)
})
/**
* Resource ID of environment.
*/
public val environmentId: Output?
get() = javaResource.environmentId().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The endpoint of the eventstream of the container apps job.
*/
public val eventStreamEndpoint: Output
get() = javaResource.eventStreamEndpoint().applyValue({ args0 -> args0 })
/**
* Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code.
*/
public val identity: Output?
get() = javaResource.identity().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
managedServiceIdentityResponseToKotlin(args0)
})
}).orElse(null)
})
/**
* The geo-location where the resource lives
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* The name of the resource
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Outbound IP Addresses of a container apps job.
*/
public val outboundIpAddresses: Output>
get() = javaResource.outboundIpAddresses().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
/**
* Provisioning state of the Container Apps Job.
*/
public val provisioningState: Output
get() = javaResource.provisioningState().applyValue({ args0 -> args0 })
/**
* Azure Resource Manager metadata containing createdBy and modifiedBy information.
*/
public val systemData: Output
get() = javaResource.systemData().applyValue({ args0 ->
args0.let({ args0 ->
systemDataResponseToKotlin(args0)
})
})
/**
* Resource tags.
*/
public val tags: Output>?
get() = javaResource.tags().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
}).orElse(null)
})
/**
* Container Apps job definition.
*/
public val template: Output?
get() = javaResource.template().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
jobTemplateResponseToKotlin(args0)
})
}).orElse(null)
})
/**
* The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
*/
public val type: Output
get() = javaResource.type().applyValue({ args0 -> args0 })
/**
* Workload profile name to pin for container apps job execution.
*/
public val workloadProfileName: Output?
get() = javaResource.workloadProfileName().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
}
public object JobMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azurenative.app.Job::class == javaResource::class
override fun map(javaResource: Resource): Job = Job(
javaResource as
com.pulumi.azurenative.app.Job,
)
}
/**
* @see [Job].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Job].
*/
public suspend fun job(name: String, block: suspend JobResourceBuilder.() -> Unit): Job {
val builder = JobResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Job].
* @param name The _unique_ name of the resulting resource.
*/
public fun job(name: String): Job {
val builder = JobResourceBuilder()
builder.name(name)
return builder.build()
}