All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.media.kotlin.Job.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.media.kotlin

import com.pulumi.azure.media.kotlin.outputs.JobInputAsset
import com.pulumi.azure.media.kotlin.outputs.JobOutputAsset
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 com.pulumi.azure.media.kotlin.outputs.JobInputAsset.Companion.toKotlin as jobInputAssetToKotlin
import com.pulumi.azure.media.kotlin.outputs.JobOutputAsset.Companion.toKotlin as jobOutputAssetToKotlin

/**
 * 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.media.Job(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Job(builtJavaResource)
    }
}

/**
 * Manages a Media Job.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "media-resources",
 *     location: "West Europe",
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "examplestoracc",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "GRS",
 * });
 * const exampleServiceAccount = new azure.media.ServiceAccount("example", {
 *     name: "examplemediaacc",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     storageAccounts: [{
 *         id: exampleAccount.id,
 *         isPrimary: true,
 *     }],
 * });
 * const exampleTransform = new azure.media.Transform("example", {
 *     name: "transform1",
 *     resourceGroupName: example.name,
 *     mediaServicesAccountName: exampleServiceAccount.name,
 *     description: "My transform description",
 *     outputs: [{
 *         relativePriority: "Normal",
 *         onErrorAction: "ContinueJob",
 *         builtinPreset: {
 *             presetName: "AACGoodQualityAudio",
 *         },
 *     }],
 * });
 * const input = new azure.media.Asset("input", {
 *     name: "input",
 *     resourceGroupName: example.name,
 *     mediaServicesAccountName: exampleServiceAccount.name,
 *     description: "Input Asset description",
 * });
 * const output = new azure.media.Asset("output", {
 *     name: "output",
 *     resourceGroupName: example.name,
 *     mediaServicesAccountName: exampleServiceAccount.name,
 *     description: "Output Asset description",
 * });
 * const exampleJob = new azure.media.Job("example", {
 *     name: "job1",
 *     resourceGroupName: example.name,
 *     mediaServicesAccountName: exampleServiceAccount.name,
 *     transformName: exampleTransform.name,
 *     description: "My Job description",
 *     priority: "Normal",
 *     inputAsset: {
 *         name: input.name,
 *     },
 *     outputAssets: [{
 *         name: output.name,
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="media-resources",
 *     location="West Europe")
 * example_account = azure.storage.Account("example",
 *     name="examplestoracc",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     account_tier="Standard",
 *     account_replication_type="GRS")
 * example_service_account = azure.media.ServiceAccount("example",
 *     name="examplemediaacc",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     storage_accounts=[{
 *         "id": example_account.id,
 *         "is_primary": True,
 *     }])
 * example_transform = azure.media.Transform("example",
 *     name="transform1",
 *     resource_group_name=example.name,
 *     media_services_account_name=example_service_account.name,
 *     description="My transform description",
 *     outputs=[{
 *         "relative_priority": "Normal",
 *         "on_error_action": "ContinueJob",
 *         "builtin_preset": {
 *             "preset_name": "AACGoodQualityAudio",
 *         },
 *     }])
 * input = azure.media.Asset("input",
 *     name="input",
 *     resource_group_name=example.name,
 *     media_services_account_name=example_service_account.name,
 *     description="Input Asset description")
 * output = azure.media.Asset("output",
 *     name="output",
 *     resource_group_name=example.name,
 *     media_services_account_name=example_service_account.name,
 *     description="Output Asset description")
 * example_job = azure.media.Job("example",
 *     name="job1",
 *     resource_group_name=example.name,
 *     media_services_account_name=example_service_account.name,
 *     transform_name=example_transform.name,
 *     description="My Job description",
 *     priority="Normal",
 *     input_asset={
 *         "name": input.name,
 *     },
 *     output_assets=[{
 *         "name": output.name,
 *     }])
 * ```
 * ```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 = "media-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleAccount = new Azure.Storage.Account("example", new()
 *     {
 *         Name = "examplestoracc",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "GRS",
 *     });
 *     var exampleServiceAccount = new Azure.Media.ServiceAccount("example", new()
 *     {
 *         Name = "examplemediaacc",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         StorageAccounts = new[]
 *         {
 *             new Azure.Media.Inputs.ServiceAccountStorageAccountArgs
 *             {
 *                 Id = exampleAccount.Id,
 *                 IsPrimary = true,
 *             },
 *         },
 *     });
 *     var exampleTransform = new Azure.Media.Transform("example", new()
 *     {
 *         Name = "transform1",
 *         ResourceGroupName = example.Name,
 *         MediaServicesAccountName = exampleServiceAccount.Name,
 *         Description = "My transform description",
 *         Outputs = new[]
 *         {
 *             new Azure.Media.Inputs.TransformOutputArgs
 *             {
 *                 RelativePriority = "Normal",
 *                 OnErrorAction = "ContinueJob",
 *                 BuiltinPreset = new Azure.Media.Inputs.TransformOutputBuiltinPresetArgs
 *                 {
 *                     PresetName = "AACGoodQualityAudio",
 *                 },
 *             },
 *         },
 *     });
 *     var input = new Azure.Media.Asset("input", new()
 *     {
 *         Name = "input",
 *         ResourceGroupName = example.Name,
 *         MediaServicesAccountName = exampleServiceAccount.Name,
 *         Description = "Input Asset description",
 *     });
 *     var output = new Azure.Media.Asset("output", new()
 *     {
 *         Name = "output",
 *         ResourceGroupName = example.Name,
 *         MediaServicesAccountName = exampleServiceAccount.Name,
 *         Description = "Output Asset description",
 *     });
 *     var exampleJob = new Azure.Media.Job("example", new()
 *     {
 *         Name = "job1",
 *         ResourceGroupName = example.Name,
 *         MediaServicesAccountName = exampleServiceAccount.Name,
 *         TransformName = exampleTransform.Name,
 *         Description = "My Job description",
 *         Priority = "Normal",
 *         InputAsset = new Azure.Media.Inputs.JobInputAssetArgs
 *         {
 *             Name = input.Name,
 *         },
 *         OutputAssets = new[]
 *         {
 *             new Azure.Media.Inputs.JobOutputAssetArgs
 *             {
 *                 Name = output.Name,
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/media"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
 * 	"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("media-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
 * 			Name:                   pulumi.String("examplestoracc"),
 * 			ResourceGroupName:      example.Name,
 * 			Location:               example.Location,
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("GRS"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleServiceAccount, err := media.NewServiceAccount(ctx, "example", &media.ServiceAccountArgs{
 * 			Name:              pulumi.String("examplemediaacc"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			StorageAccounts: media.ServiceAccountStorageAccountArray{
 * 				&media.ServiceAccountStorageAccountArgs{
 * 					Id:        exampleAccount.ID(),
 * 					IsPrimary: pulumi.Bool(true),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleTransform, err := media.NewTransform(ctx, "example", &media.TransformArgs{
 * 			Name:                     pulumi.String("transform1"),
 * 			ResourceGroupName:        example.Name,
 * 			MediaServicesAccountName: exampleServiceAccount.Name,
 * 			Description:              pulumi.String("My transform description"),
 * 			Outputs: media.TransformOutputTypeArray{
 * 				&media.TransformOutputTypeArgs{
 * 					RelativePriority: pulumi.String("Normal"),
 * 					OnErrorAction:    pulumi.String("ContinueJob"),
 * 					BuiltinPreset: &media.TransformOutputBuiltinPresetArgs{
 * 						PresetName: pulumi.String("AACGoodQualityAudio"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		input, err := media.NewAsset(ctx, "input", &media.AssetArgs{
 * 			Name:                     pulumi.String("input"),
 * 			ResourceGroupName:        example.Name,
 * 			MediaServicesAccountName: exampleServiceAccount.Name,
 * 			Description:              pulumi.String("Input Asset description"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		output, err := media.NewAsset(ctx, "output", &media.AssetArgs{
 * 			Name:                     pulumi.String("output"),
 * 			ResourceGroupName:        example.Name,
 * 			MediaServicesAccountName: exampleServiceAccount.Name,
 * 			Description:              pulumi.String("Output Asset description"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = media.NewJob(ctx, "example", &media.JobArgs{
 * 			Name:                     pulumi.String("job1"),
 * 			ResourceGroupName:        example.Name,
 * 			MediaServicesAccountName: exampleServiceAccount.Name,
 * 			TransformName:            exampleTransform.Name,
 * 			Description:              pulumi.String("My Job description"),
 * 			Priority:                 pulumi.String("Normal"),
 * 			InputAsset: &media.JobInputAssetArgs{
 * 				Name: input.Name,
 * 			},
 * 			OutputAssets: media.JobOutputAssetArray{
 * 				&media.JobOutputAssetArgs{
 * 					Name: output.Name,
 * 				},
 * 			},
 * 		})
 * 		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.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.media.ServiceAccount;
 * import com.pulumi.azure.media.ServiceAccountArgs;
 * import com.pulumi.azure.media.inputs.ServiceAccountStorageAccountArgs;
 * import com.pulumi.azure.media.Transform;
 * import com.pulumi.azure.media.TransformArgs;
 * import com.pulumi.azure.media.inputs.TransformOutputArgs;
 * import com.pulumi.azure.media.inputs.TransformOutputBuiltinPresetArgs;
 * import com.pulumi.azure.media.Asset;
 * import com.pulumi.azure.media.AssetArgs;
 * import com.pulumi.azure.media.Job;
 * import com.pulumi.azure.media.JobArgs;
 * import com.pulumi.azure.media.inputs.JobInputAssetArgs;
 * import com.pulumi.azure.media.inputs.JobOutputAssetArgs;
 * 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("media-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("examplestoracc")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("GRS")
 *             .build());
 *         var exampleServiceAccount = new ServiceAccount("exampleServiceAccount", ServiceAccountArgs.builder()
 *             .name("examplemediaacc")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .storageAccounts(ServiceAccountStorageAccountArgs.builder()
 *                 .id(exampleAccount.id())
 *                 .isPrimary(true)
 *                 .build())
 *             .build());
 *         var exampleTransform = new Transform("exampleTransform", TransformArgs.builder()
 *             .name("transform1")
 *             .resourceGroupName(example.name())
 *             .mediaServicesAccountName(exampleServiceAccount.name())
 *             .description("My transform description")
 *             .outputs(TransformOutputArgs.builder()
 *                 .relativePriority("Normal")
 *                 .onErrorAction("ContinueJob")
 *                 .builtinPreset(TransformOutputBuiltinPresetArgs.builder()
 *                     .presetName("AACGoodQualityAudio")
 *                     .build())
 *                 .build())
 *             .build());
 *         var input = new Asset("input", AssetArgs.builder()
 *             .name("input")
 *             .resourceGroupName(example.name())
 *             .mediaServicesAccountName(exampleServiceAccount.name())
 *             .description("Input Asset description")
 *             .build());
 *         var output = new Asset("output", AssetArgs.builder()
 *             .name("output")
 *             .resourceGroupName(example.name())
 *             .mediaServicesAccountName(exampleServiceAccount.name())
 *             .description("Output Asset description")
 *             .build());
 *         var exampleJob = new Job("exampleJob", JobArgs.builder()
 *             .name("job1")
 *             .resourceGroupName(example.name())
 *             .mediaServicesAccountName(exampleServiceAccount.name())
 *             .transformName(exampleTransform.name())
 *             .description("My Job description")
 *             .priority("Normal")
 *             .inputAsset(JobInputAssetArgs.builder()
 *                 .name(input.name())
 *                 .build())
 *             .outputAssets(JobOutputAssetArgs.builder()
 *                 .name(output.name())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: media-resources
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: examplestoracc
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: GRS
 *   exampleServiceAccount:
 *     type: azure:media:ServiceAccount
 *     name: example
 *     properties:
 *       name: examplemediaacc
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       storageAccounts:
 *         - id: ${exampleAccount.id}
 *           isPrimary: true
 *   exampleTransform:
 *     type: azure:media:Transform
 *     name: example
 *     properties:
 *       name: transform1
 *       resourceGroupName: ${example.name}
 *       mediaServicesAccountName: ${exampleServiceAccount.name}
 *       description: My transform description
 *       outputs:
 *         - relativePriority: Normal
 *           onErrorAction: ContinueJob
 *           builtinPreset:
 *             presetName: AACGoodQualityAudio
 *   input:
 *     type: azure:media:Asset
 *     properties:
 *       name: input
 *       resourceGroupName: ${example.name}
 *       mediaServicesAccountName: ${exampleServiceAccount.name}
 *       description: Input Asset description
 *   output:
 *     type: azure:media:Asset
 *     properties:
 *       name: output
 *       resourceGroupName: ${example.name}
 *       mediaServicesAccountName: ${exampleServiceAccount.name}
 *       description: Output Asset description
 *   exampleJob:
 *     type: azure:media:Job
 *     name: example
 *     properties:
 *       name: job1
 *       resourceGroupName: ${example.name}
 *       mediaServicesAccountName: ${exampleServiceAccount.name}
 *       transformName: ${exampleTransform.name}
 *       description: My Job description
 *       priority: Normal
 *       inputAsset:
 *         name: ${input.name}
 *       outputAssets:
 *         - name: ${output.name}
 * ```
 * 
 * ## Import
 * Media Jobs can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:media/job:Job example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.Media/mediaServices/account1/transforms/transform1/jobs/job1
 * ```
 */
public class Job internal constructor(
    override val javaResource: com.pulumi.azure.media.Job,
) : KotlinCustomResource(javaResource, JobMapper) {
    /**
     * Optional customer supplied description of the Job.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A `input_asset` block as defined below. Changing this forces a new Media Job to be created.
     */
    public val inputAsset: Output
        get() = javaResource.inputAsset().applyValue({ args0 ->
            args0.let({ args0 ->
                jobInputAssetToKotlin(args0)
            })
        })

    /**
     * The Media Services account name. Changing this forces a new Transform to be created.
     */
    public val mediaServicesAccountName: Output
        get() = javaResource.mediaServicesAccountName().applyValue({ args0 -> args0 })

    /**
     * The name which should be used for this Media Job. Changing this forces a new Media Job to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * One or more `output_asset` blocks as defined below. Changing this forces a new Media Job to be created.
     */
    public val outputAssets: Output>
        get() = javaResource.outputAssets().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    jobOutputAssetToKotlin(args0)
                })
            })
        })

    /**
     * Priority with which the job should be processed. Higher priority jobs are processed before lower priority jobs. Changing this forces a new Media Job to be created. Possible values are `High`, `Normal` and `Low`. Defaults to `Normal`.
     */
    public val priority: Output?
        get() = javaResource.priority().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name of the Resource Group where the Media Job should exist. Changing this forces a new Media Job to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * The Transform name. Changing this forces a new Media Job to be created.
     */
    public val transformName: Output
        get() = javaResource.transformName().applyValue({ args0 -> args0 })
}

public object JobMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.media.Job::class == javaResource::class

    override fun map(javaResource: Resource): Job = Job(javaResource as com.pulumi.azure.media.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()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy