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

com.pulumi.azure.videoanalyzer.kotlin.Analyzer.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.videoanalyzer.kotlin

import com.pulumi.azure.videoanalyzer.kotlin.outputs.AnalyzerIdentity
import com.pulumi.azure.videoanalyzer.kotlin.outputs.AnalyzerStorageAccount
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.Map
import com.pulumi.azure.videoanalyzer.kotlin.outputs.AnalyzerIdentity.Companion.toKotlin as analyzerIdentityToKotlin
import com.pulumi.azure.videoanalyzer.kotlin.outputs.AnalyzerStorageAccount.Companion.toKotlin as analyzerStorageAccountToKotlin

/**
 * Builder for [Analyzer].
 */
@PulumiTagMarker
public class AnalyzerResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: AnalyzerArgs = AnalyzerArgs()

    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 AnalyzerArgsBuilder.() -> Unit) {
        val builder = AnalyzerArgsBuilder()
        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(): Analyzer {
        val builtJavaResource = com.pulumi.azure.videoanalyzer.Analyzer(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Analyzer(builtJavaResource)
    }
}

/**
 * Manages a Video Analyzer.
 * !> Video Analyzer (Preview) is now Deprecated and will be Retired on 2022-11-30 - as such the `azure.videoanalyzer.Analyzer` resource is deprecated and will be removed in v4.0 of the AzureRM Provider.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "video-analyzer-resources",
 *     location: "West Europe",
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "examplestoracc",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "GRS",
 * });
 * const exampleUserAssignedIdentity = new azure.authorization.UserAssignedIdentity("example", {
 *     name: "exampleidentity",
 *     resourceGroupName: example.name,
 *     location: example.location,
 * });
 * const contributor = new azure.authorization.Assignment("contributor", {
 *     scope: exampleAccount.id,
 *     roleDefinitionName: "Storage Blob Data Contributor",
 *     principalId: exampleUserAssignedIdentity.principalId,
 * });
 * const reader = new azure.authorization.Assignment("reader", {
 *     scope: exampleAccount.id,
 *     roleDefinitionName: "Reader",
 *     principalId: exampleUserAssignedIdentity.principalId,
 * });
 * const exampleAnalyzer = new azure.videoanalyzer.Analyzer("example", {
 *     name: "exampleanalyzer",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     storageAccount: {
 *         id: exampleAccount.id,
 *         userAssignedIdentityId: exampleUserAssignedIdentity.id,
 *     },
 *     identity: {
 *         type: "UserAssigned",
 *         identityIds: [exampleUserAssignedIdentity.id],
 *     },
 *     tags: {
 *         environment: "staging",
 *     },
 * }, {
 *     dependsOn: [
 *         contributor,
 *         reader,
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="video-analyzer-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_user_assigned_identity = azure.authorization.UserAssignedIdentity("example",
 *     name="exampleidentity",
 *     resource_group_name=example.name,
 *     location=example.location)
 * contributor = azure.authorization.Assignment("contributor",
 *     scope=example_account.id,
 *     role_definition_name="Storage Blob Data Contributor",
 *     principal_id=example_user_assigned_identity.principal_id)
 * reader = azure.authorization.Assignment("reader",
 *     scope=example_account.id,
 *     role_definition_name="Reader",
 *     principal_id=example_user_assigned_identity.principal_id)
 * example_analyzer = azure.videoanalyzer.Analyzer("example",
 *     name="exampleanalyzer",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     storage_account={
 *         "id": example_account.id,
 *         "user_assigned_identity_id": example_user_assigned_identity.id,
 *     },
 *     identity={
 *         "type": "UserAssigned",
 *         "identity_ids": [example_user_assigned_identity.id],
 *     },
 *     tags={
 *         "environment": "staging",
 *     },
 *     opts = pulumi.ResourceOptions(depends_on=[
 *             contributor,
 *             reader,
 *         ]))
 * ```
 * ```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 = "video-analyzer-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 exampleUserAssignedIdentity = new Azure.Authorization.UserAssignedIdentity("example", new()
 *     {
 *         Name = "exampleidentity",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *     });
 *     var contributor = new Azure.Authorization.Assignment("contributor", new()
 *     {
 *         Scope = exampleAccount.Id,
 *         RoleDefinitionName = "Storage Blob Data Contributor",
 *         PrincipalId = exampleUserAssignedIdentity.PrincipalId,
 *     });
 *     var reader = new Azure.Authorization.Assignment("reader", new()
 *     {
 *         Scope = exampleAccount.Id,
 *         RoleDefinitionName = "Reader",
 *         PrincipalId = exampleUserAssignedIdentity.PrincipalId,
 *     });
 *     var exampleAnalyzer = new Azure.VideoAnalyzer.Analyzer("example", new()
 *     {
 *         Name = "exampleanalyzer",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         StorageAccount = new Azure.VideoAnalyzer.Inputs.AnalyzerStorageAccountArgs
 *         {
 *             Id = exampleAccount.Id,
 *             UserAssignedIdentityId = exampleUserAssignedIdentity.Id,
 *         },
 *         Identity = new Azure.VideoAnalyzer.Inputs.AnalyzerIdentityArgs
 *         {
 *             Type = "UserAssigned",
 *             IdentityIds = new[]
 *             {
 *                 exampleUserAssignedIdentity.Id,
 *             },
 *         },
 *         Tags =
 *         {
 *             { "environment", "staging" },
 *         },
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             contributor,
 *             reader,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/videoanalyzer"
 * 	"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("video-analyzer-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
 * 		}
 * 		exampleUserAssignedIdentity, err := authorization.NewUserAssignedIdentity(ctx, "example", &authorization.UserAssignedIdentityArgs{
 * 			Name:              pulumi.String("exampleidentity"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		contributor, err := authorization.NewAssignment(ctx, "contributor", &authorization.AssignmentArgs{
 * 			Scope:              exampleAccount.ID(),
 * 			RoleDefinitionName: pulumi.String("Storage Blob Data Contributor"),
 * 			PrincipalId:        exampleUserAssignedIdentity.PrincipalId,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		reader, err := authorization.NewAssignment(ctx, "reader", &authorization.AssignmentArgs{
 * 			Scope:              exampleAccount.ID(),
 * 			RoleDefinitionName: pulumi.String("Reader"),
 * 			PrincipalId:        exampleUserAssignedIdentity.PrincipalId,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = videoanalyzer.NewAnalyzer(ctx, "example", &videoanalyzer.AnalyzerArgs{
 * 			Name:              pulumi.String("exampleanalyzer"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			StorageAccount: &videoanalyzer.AnalyzerStorageAccountArgs{
 * 				Id:                     exampleAccount.ID(),
 * 				UserAssignedIdentityId: exampleUserAssignedIdentity.ID(),
 * 			},
 * 			Identity: &videoanalyzer.AnalyzerIdentityArgs{
 * 				Type: pulumi.String("UserAssigned"),
 * 				IdentityIds: pulumi.StringArray{
 * 					exampleUserAssignedIdentity.ID(),
 * 				},
 * 			},
 * 			Tags: pulumi.StringMap{
 * 				"environment": pulumi.String("staging"),
 * 			},
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			contributor,
 * 			reader,
 * 		}))
 * 		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.authorization.UserAssignedIdentity;
 * import com.pulumi.azure.authorization.UserAssignedIdentityArgs;
 * import com.pulumi.azure.authorization.Assignment;
 * import com.pulumi.azure.authorization.AssignmentArgs;
 * import com.pulumi.azure.videoanalyzer.Analyzer;
 * import com.pulumi.azure.videoanalyzer.AnalyzerArgs;
 * import com.pulumi.azure.videoanalyzer.inputs.AnalyzerStorageAccountArgs;
 * import com.pulumi.azure.videoanalyzer.inputs.AnalyzerIdentityArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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("video-analyzer-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 exampleUserAssignedIdentity = new UserAssignedIdentity("exampleUserAssignedIdentity", UserAssignedIdentityArgs.builder()
 *             .name("exampleidentity")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .build());
 *         var contributor = new Assignment("contributor", AssignmentArgs.builder()
 *             .scope(exampleAccount.id())
 *             .roleDefinitionName("Storage Blob Data Contributor")
 *             .principalId(exampleUserAssignedIdentity.principalId())
 *             .build());
 *         var reader = new Assignment("reader", AssignmentArgs.builder()
 *             .scope(exampleAccount.id())
 *             .roleDefinitionName("Reader")
 *             .principalId(exampleUserAssignedIdentity.principalId())
 *             .build());
 *         var exampleAnalyzer = new Analyzer("exampleAnalyzer", AnalyzerArgs.builder()
 *             .name("exampleanalyzer")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .storageAccount(AnalyzerStorageAccountArgs.builder()
 *                 .id(exampleAccount.id())
 *                 .userAssignedIdentityId(exampleUserAssignedIdentity.id())
 *                 .build())
 *             .identity(AnalyzerIdentityArgs.builder()
 *                 .type("UserAssigned")
 *                 .identityIds(exampleUserAssignedIdentity.id())
 *                 .build())
 *             .tags(Map.of("environment", "staging"))
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(
 *                     contributor,
 *                     reader)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: video-analyzer-resources
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: examplestoracc
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: GRS
 *   exampleUserAssignedIdentity:
 *     type: azure:authorization:UserAssignedIdentity
 *     name: example
 *     properties:
 *       name: exampleidentity
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *   contributor:
 *     type: azure:authorization:Assignment
 *     properties:
 *       scope: ${exampleAccount.id}
 *       roleDefinitionName: Storage Blob Data Contributor
 *       principalId: ${exampleUserAssignedIdentity.principalId}
 *   reader:
 *     type: azure:authorization:Assignment
 *     properties:
 *       scope: ${exampleAccount.id}
 *       roleDefinitionName: Reader
 *       principalId: ${exampleUserAssignedIdentity.principalId}
 *   exampleAnalyzer:
 *     type: azure:videoanalyzer:Analyzer
 *     name: example
 *     properties:
 *       name: exampleanalyzer
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       storageAccount:
 *         id: ${exampleAccount.id}
 *         userAssignedIdentityId: ${exampleUserAssignedIdentity.id}
 *       identity:
 *         type: UserAssigned
 *         identityIds:
 *           - ${exampleUserAssignedIdentity.id}
 *       tags:
 *         environment: staging
 *     options:
 *       dependson:
 *         - ${contributor}
 *         - ${reader}
 * ```
 * 
 * ## Import
 * Video Analyzer can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:videoanalyzer/analyzer:Analyzer analyzer /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Media/videoAnalyzers/analyzer1
 * ```
 */
public class Analyzer internal constructor(
    override val javaResource: com.pulumi.azure.videoanalyzer.Analyzer,
) : KotlinCustomResource(javaResource, AnalyzerMapper) {
    /**
     * An `identity` block as defined below.
     */
    public val identity: Output
        get() = javaResource.identity().applyValue({ args0 ->
            args0.let({ args0 ->
                analyzerIdentityToKotlin(args0)
            })
        })

    /**
     * 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 })

    /**
     * Specifies the name of the Video Analyzer. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the resource group in which to create the Video Analyzer. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A `storage_account` block as defined below.
     */
    public val storageAccount: Output
        get() = javaResource.storageAccount().applyValue({ args0 ->
            args0.let({ args0 ->
                analyzerStorageAccountToKotlin(args0)
            })
        })

    /**
     * A mapping of tags assigned 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)
        })
}

public object AnalyzerMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.videoanalyzer.Analyzer::class == javaResource::class

    override fun map(javaResource: Resource): Analyzer = Analyzer(
        javaResource as
            com.pulumi.azure.videoanalyzer.Analyzer,
    )
}

/**
 * @see [Analyzer].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Analyzer].
 */
public suspend fun analyzer(name: String, block: suspend AnalyzerResourceBuilder.() -> Unit): Analyzer {
    val builder = AnalyzerResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Analyzer].
 * @param name The _unique_ name of the resulting resource.
 */
public fun analyzer(name: String): Analyzer {
    val builder = AnalyzerResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy