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.azure.containerapp.kotlin.Job.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.containerapp.kotlin
import com.pulumi.azure.containerapp.kotlin.outputs.JobEventTriggerConfig
import com.pulumi.azure.containerapp.kotlin.outputs.JobIdentity
import com.pulumi.azure.containerapp.kotlin.outputs.JobManualTriggerConfig
import com.pulumi.azure.containerapp.kotlin.outputs.JobRegistry
import com.pulumi.azure.containerapp.kotlin.outputs.JobScheduleTriggerConfig
import com.pulumi.azure.containerapp.kotlin.outputs.JobSecret
import com.pulumi.azure.containerapp.kotlin.outputs.JobTemplate
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.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.containerapp.kotlin.outputs.JobEventTriggerConfig.Companion.toKotlin as jobEventTriggerConfigToKotlin
import com.pulumi.azure.containerapp.kotlin.outputs.JobIdentity.Companion.toKotlin as jobIdentityToKotlin
import com.pulumi.azure.containerapp.kotlin.outputs.JobManualTriggerConfig.Companion.toKotlin as jobManualTriggerConfigToKotlin
import com.pulumi.azure.containerapp.kotlin.outputs.JobRegistry.Companion.toKotlin as jobRegistryToKotlin
import com.pulumi.azure.containerapp.kotlin.outputs.JobScheduleTriggerConfig.Companion.toKotlin as jobScheduleTriggerConfigToKotlin
import com.pulumi.azure.containerapp.kotlin.outputs.JobSecret.Companion.toKotlin as jobSecretToKotlin
import com.pulumi.azure.containerapp.kotlin.outputs.JobTemplate.Companion.toKotlin as jobTemplateToKotlin
/**
* 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.azure.containerapp.Job(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Job(builtJavaResource)
}
}
/**
* Manages a Container App Job.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "example-resources",
* location: "West Europe",
* });
* const exampleAnalyticsWorkspace = new azure.operationalinsights.AnalyticsWorkspace("example", {
* name: "example-log-analytics-workspace",
* location: example.location,
* resourceGroupName: example.name,
* sku: "PerGB2018",
* retentionInDays: 30,
* });
* const exampleEnvironment = new azure.containerapp.Environment("example", {
* name: "example-container-app-environment",
* location: example.location,
* resourceGroupName: example.name,
* logAnalyticsWorkspaceId: exampleAnalyticsWorkspace.id,
* });
* const exampleJob = new azure.containerapp.Job("example", {
* name: "example-container-app-job",
* location: example.location,
* resourceGroupName: example.name,
* containerAppEnvironmentId: exampleEnvironment.id,
* replicaTimeoutInSeconds: 10,
* replicaRetryLimit: 10,
* manualTriggerConfig: {
* parallelism: 4,
* replicaCompletionCount: 1,
* },
* template: {
* containers: [{
* image: "repo/testcontainerAppsJob0:v1",
* name: "testcontainerappsjob0",
* readinessProbes: [{
* transport: "HTTP",
* port: 5000,
* }],
* livenessProbes: [{
* transport: "HTTP",
* port: 5000,
* path: "/health",
* headers: [{
* name: "Cache-Control",
* value: "no-cache",
* }],
* initialDelay: 5,
* intervalSeconds: 20,
* timeout: 2,
* failureCountThreshold: 1,
* }],
* startupProbes: [{
* transport: "TCP",
* port: 5000,
* }],
* cpu: 0.5,
* memory: "1Gi",
* }],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-resources",
* location="West Europe")
* example_analytics_workspace = azure.operationalinsights.AnalyticsWorkspace("example",
* name="example-log-analytics-workspace",
* location=example.location,
* resource_group_name=example.name,
* sku="PerGB2018",
* retention_in_days=30)
* example_environment = azure.containerapp.Environment("example",
* name="example-container-app-environment",
* location=example.location,
* resource_group_name=example.name,
* log_analytics_workspace_id=example_analytics_workspace.id)
* example_job = azure.containerapp.Job("example",
* name="example-container-app-job",
* location=example.location,
* resource_group_name=example.name,
* container_app_environment_id=example_environment.id,
* replica_timeout_in_seconds=10,
* replica_retry_limit=10,
* manual_trigger_config={
* "parallelism": 4,
* "replica_completion_count": 1,
* },
* template={
* "containers": [{
* "image": "repo/testcontainerAppsJob0:v1",
* "name": "testcontainerappsjob0",
* "readiness_probes": [{
* "transport": "HTTP",
* "port": 5000,
* }],
* "liveness_probes": [{
* "transport": "HTTP",
* "port": 5000,
* "path": "/health",
* "headers": [{
* "name": "Cache-Control",
* "value": "no-cache",
* }],
* "initial_delay": 5,
* "interval_seconds": 20,
* "timeout": 2,
* "failure_count_threshold": 1,
* }],
* "startup_probes": [{
* "transport": "TCP",
* "port": 5000,
* }],
* "cpu": 0.5,
* "memory": "1Gi",
* }],
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var example = new Azure.Core.ResourceGroup("example", new()
* {
* Name = "example-resources",
* Location = "West Europe",
* });
* var exampleAnalyticsWorkspace = new Azure.OperationalInsights.AnalyticsWorkspace("example", new()
* {
* Name = "example-log-analytics-workspace",
* Location = example.Location,
* ResourceGroupName = example.Name,
* Sku = "PerGB2018",
* RetentionInDays = 30,
* });
* var exampleEnvironment = new Azure.ContainerApp.Environment("example", new()
* {
* Name = "example-container-app-environment",
* Location = example.Location,
* ResourceGroupName = example.Name,
* LogAnalyticsWorkspaceId = exampleAnalyticsWorkspace.Id,
* });
* var exampleJob = new Azure.ContainerApp.Job("example", new()
* {
* Name = "example-container-app-job",
* Location = example.Location,
* ResourceGroupName = example.Name,
* ContainerAppEnvironmentId = exampleEnvironment.Id,
* ReplicaTimeoutInSeconds = 10,
* ReplicaRetryLimit = 10,
* ManualTriggerConfig = new Azure.ContainerApp.Inputs.JobManualTriggerConfigArgs
* {
* Parallelism = 4,
* ReplicaCompletionCount = 1,
* },
* Template = new Azure.ContainerApp.Inputs.JobTemplateArgs
* {
* Containers = new[]
* {
* new Azure.ContainerApp.Inputs.JobTemplateContainerArgs
* {
* Image = "repo/testcontainerAppsJob0:v1",
* Name = "testcontainerappsjob0",
* ReadinessProbes = new[]
* {
* new Azure.ContainerApp.Inputs.JobTemplateContainerReadinessProbeArgs
* {
* Transport = "HTTP",
* Port = 5000,
* },
* },
* LivenessProbes = new[]
* {
* new Azure.ContainerApp.Inputs.JobTemplateContainerLivenessProbeArgs
* {
* Transport = "HTTP",
* Port = 5000,
* Path = "/health",
* Headers = new[]
* {
* new Azure.ContainerApp.Inputs.JobTemplateContainerLivenessProbeHeaderArgs
* {
* Name = "Cache-Control",
* Value = "no-cache",
* },
* },
* InitialDelay = 5,
* IntervalSeconds = 20,
* Timeout = 2,
* FailureCountThreshold = 1,
* },
* },
* StartupProbes = new[]
* {
* new Azure.ContainerApp.Inputs.JobTemplateContainerStartupProbeArgs
* {
* Transport = "TCP",
* Port = 5000,
* },
* },
* Cpu = 0.5,
* Memory = "1Gi",
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/containerapp"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/operationalinsights"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
* Name: pulumi.String("example-resources"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleAnalyticsWorkspace, err := operationalinsights.NewAnalyticsWorkspace(ctx, "example", &operationalinsights.AnalyticsWorkspaceArgs{
* Name: pulumi.String("example-log-analytics-workspace"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* Sku: pulumi.String("PerGB2018"),
* RetentionInDays: pulumi.Int(30),
* })
* if err != nil {
* return err
* }
* exampleEnvironment, err := containerapp.NewEnvironment(ctx, "example", &containerapp.EnvironmentArgs{
* Name: pulumi.String("example-container-app-environment"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* LogAnalyticsWorkspaceId: exampleAnalyticsWorkspace.ID(),
* })
* if err != nil {
* return err
* }
* _, err = containerapp.NewJob(ctx, "example", &containerapp.JobArgs{
* Name: pulumi.String("example-container-app-job"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* ContainerAppEnvironmentId: exampleEnvironment.ID(),
* ReplicaTimeoutInSeconds: pulumi.Int(10),
* ReplicaRetryLimit: pulumi.Int(10),
* ManualTriggerConfig: &containerapp.JobManualTriggerConfigArgs{
* Parallelism: pulumi.Int(4),
* ReplicaCompletionCount: pulumi.Int(1),
* },
* Template: &containerapp.JobTemplateArgs{
* Containers: containerapp.JobTemplateContainerArray{
* &containerapp.JobTemplateContainerArgs{
* Image: pulumi.String("repo/testcontainerAppsJob0:v1"),
* Name: pulumi.String("testcontainerappsjob0"),
* ReadinessProbes: containerapp.JobTemplateContainerReadinessProbeArray{
* &containerapp.JobTemplateContainerReadinessProbeArgs{
* Transport: pulumi.String("HTTP"),
* Port: pulumi.Int(5000),
* },
* },
* LivenessProbes: containerapp.JobTemplateContainerLivenessProbeArray{
* &containerapp.JobTemplateContainerLivenessProbeArgs{
* Transport: pulumi.String("HTTP"),
* Port: pulumi.Int(5000),
* Path: pulumi.String("/health"),
* Headers: containerapp.JobTemplateContainerLivenessProbeHeaderArray{
* &containerapp.JobTemplateContainerLivenessProbeHeaderArgs{
* Name: pulumi.String("Cache-Control"),
* Value: pulumi.String("no-cache"),
* },
* },
* InitialDelay: pulumi.Int(5),
* IntervalSeconds: pulumi.Int(20),
* Timeout: pulumi.Int(2),
* FailureCountThreshold: pulumi.Int(1),
* },
* },
* StartupProbes: containerapp.JobTemplateContainerStartupProbeArray{
* &containerapp.JobTemplateContainerStartupProbeArgs{
* Transport: pulumi.String("TCP"),
* Port: pulumi.Int(5000),
* },
* },
* 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.azure.core.ResourceGroup;
* import com.pulumi.azure.core.ResourceGroupArgs;
* import com.pulumi.azure.operationalinsights.AnalyticsWorkspace;
* import com.pulumi.azure.operationalinsights.AnalyticsWorkspaceArgs;
* import com.pulumi.azure.containerapp.Environment;
* import com.pulumi.azure.containerapp.EnvironmentArgs;
* import com.pulumi.azure.containerapp.Job;
* import com.pulumi.azure.containerapp.JobArgs;
* import com.pulumi.azure.containerapp.inputs.JobManualTriggerConfigArgs;
* import com.pulumi.azure.containerapp.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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
* .name("example-resources")
* .location("West Europe")
* .build());
* var exampleAnalyticsWorkspace = new AnalyticsWorkspace("exampleAnalyticsWorkspace", AnalyticsWorkspaceArgs.builder()
* .name("example-log-analytics-workspace")
* .location(example.location())
* .resourceGroupName(example.name())
* .sku("PerGB2018")
* .retentionInDays(30)
* .build());
* var exampleEnvironment = new Environment("exampleEnvironment", EnvironmentArgs.builder()
* .name("example-container-app-environment")
* .location(example.location())
* .resourceGroupName(example.name())
* .logAnalyticsWorkspaceId(exampleAnalyticsWorkspace.id())
* .build());
* var exampleJob = new Job("exampleJob", JobArgs.builder()
* .name("example-container-app-job")
* .location(example.location())
* .resourceGroupName(example.name())
* .containerAppEnvironmentId(exampleEnvironment.id())
* .replicaTimeoutInSeconds(10)
* .replicaRetryLimit(10)
* .manualTriggerConfig(JobManualTriggerConfigArgs.builder()
* .parallelism(4)
* .replicaCompletionCount(1)
* .build())
* .template(JobTemplateArgs.builder()
* .containers(JobTemplateContainerArgs.builder()
* .image("repo/testcontainerAppsJob0:v1")
* .name("testcontainerappsjob0")
* .readinessProbes(JobTemplateContainerReadinessProbeArgs.builder()
* .transport("HTTP")
* .port(5000)
* .build())
* .livenessProbes(JobTemplateContainerLivenessProbeArgs.builder()
* .transport("HTTP")
* .port(5000)
* .path("/health")
* .headers(JobTemplateContainerLivenessProbeHeaderArgs.builder()
* .name("Cache-Control")
* .value("no-cache")
* .build())
* .initialDelay(5)
* .intervalSeconds(20)
* .timeout(2)
* .failureCountThreshold(1)
* .build())
* .startupProbes(JobTemplateContainerStartupProbeArgs.builder()
* .transport("TCP")
* .port(5000)
* .build())
* .cpu(0.5)
* .memory("1Gi")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-resources
* location: West Europe
* exampleAnalyticsWorkspace:
* type: azure:operationalinsights:AnalyticsWorkspace
* name: example
* properties:
* name: example-log-analytics-workspace
* location: ${example.location}
* resourceGroupName: ${example.name}
* sku: PerGB2018
* retentionInDays: 30
* exampleEnvironment:
* type: azure:containerapp:Environment
* name: example
* properties:
* name: example-container-app-environment
* location: ${example.location}
* resourceGroupName: ${example.name}
* logAnalyticsWorkspaceId: ${exampleAnalyticsWorkspace.id}
* exampleJob:
* type: azure:containerapp:Job
* name: example
* properties:
* name: example-container-app-job
* location: ${example.location}
* resourceGroupName: ${example.name}
* containerAppEnvironmentId: ${exampleEnvironment.id}
* replicaTimeoutInSeconds: 10
* replicaRetryLimit: 10
* manualTriggerConfig:
* parallelism: 4
* replicaCompletionCount: 1
* template:
* containers:
* - image: repo/testcontainerAppsJob0:v1
* name: testcontainerappsjob0
* readinessProbes:
* - transport: HTTP
* port: 5000
* livenessProbes:
* - transport: HTTP
* port: 5000
* path: /health
* headers:
* - name: Cache-Control
* value: no-cache
* initialDelay: 5
* intervalSeconds: 20
* timeout: 2
* failureCountThreshold: 1
* startupProbes:
* - transport: TCP
* port: 5000
* cpu: 0.5
* memory: 1Gi
* ```
*
* ## Import
* A Container App Job can be imported using the resource id, e.g.
* ```sh
* $ pulumi import azure:containerapp/job:Job example "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resources/providers/Microsoft.App/jobs/example-container-app-job"
* ```
*/
public class Job internal constructor(
override val javaResource: com.pulumi.azure.containerapp.Job,
) : KotlinCustomResource(javaResource, JobMapper) {
/**
* The ID of the Container App Environment in which to create the Container App Job. Changing this forces a new resource to be created.
*/
public val containerAppEnvironmentId: Output
get() = javaResource.containerAppEnvironmentId().applyValue({ args0 -> args0 })
/**
* The endpoint for the Container App Job event stream.
*/
public val eventStreamEndpoint: Output
get() = javaResource.eventStreamEndpoint().applyValue({ args0 -> args0 })
/**
* A `event_trigger_config` block as defined below.
*/
public val eventTriggerConfig: Output?
get() = javaResource.eventTriggerConfig().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> jobEventTriggerConfigToKotlin(args0) })
}).orElse(null)
})
/**
* A `identity` block as defined below.
*/
public val identity: Output?
get() = javaResource.identity().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
jobIdentityToKotlin(args0)
})
}).orElse(null)
})
/**
* Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* A `manual_trigger_config` block as defined below.
*/
public val manualTriggerConfig: Output?
get() = javaResource.manualTriggerConfig().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> jobManualTriggerConfigToKotlin(args0) })
}).orElse(null)
})
/**
* Specifies the name of the Container App Job resource. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* A list of the Public IP Addresses which the Container App uses for outbound network access.
*/
public val outboundIpAddresses: Output>
get() = javaResource.outboundIpAddresses().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
@Deprecated(
message = """
`registries` has been renamed to `registry` and will be removed in version 4.0 of the AzureRM
Provider.
""",
)
public val registries: Output>
get() = javaResource.registries().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
jobRegistryToKotlin(args0)
})
})
})
/**
* One or more `registry` blocks as defined below.
*/
public val registry: Output>
get() = javaResource.registry().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
jobRegistryToKotlin(args0)
})
})
})
/**
* The maximum number of times a replica is allowed to retry.
*/
public val replicaRetryLimit: Output?
get() = javaResource.replicaRetryLimit().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The maximum number of seconds a replica is allowed to run.
*/
public val replicaTimeoutInSeconds: Output
get() = javaResource.replicaTimeoutInSeconds().applyValue({ args0 -> args0 })
/**
* The name of the resource group in which to create the Container App Job. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* A `schedule_trigger_config` block as defined below.
* > ** NOTE **: Only one of `manual_trigger_config`, `event_trigger_config` or `schedule_trigger_config` can be specified.
*/
public val scheduleTriggerConfig: Output?
get() = javaResource.scheduleTriggerConfig().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> jobScheduleTriggerConfigToKotlin(args0) })
}).orElse(null)
})
/**
* One or more `secret` blocks as defined below.
*/
public val secret: Output>
get() = javaResource.secret().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
jobSecretToKotlin(args0)
})
})
})
@Deprecated(
message = """
`secrets` has been renamed to `secret` and will be removed in version 4.0 of the AzureRM Provider.
""",
)
public val secrets: Output>
get() = javaResource.secrets().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
jobSecretToKotlin(args0)
})
})
})
/**
* A mapping of tags to assign to the resource.
*/
public val tags: Output>?
get() = javaResource.tags().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
}).orElse(null)
})
/**
* A `template` block as defined below.
*/
public val template: Output
get() = javaResource.template().applyValue({ args0 ->
args0.let({ args0 ->
jobTemplateToKotlin(args0)
})
})
/**
* The name of the workload profile to use for the Container App Job.
*/
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.azure.containerapp.Job::class == javaResource::class
override fun map(javaResource: Resource): Job = Job(
javaResource as
com.pulumi.azure.containerapp.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()
}