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

com.pulumi.azurenative.iotoperations.kotlin.BrokerAuthorization.kt Maven / Gradle / Ivy

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

package com.pulumi.azurenative.iotoperations.kotlin

import com.pulumi.azurenative.iotoperations.kotlin.outputs.BrokerAuthorizationPropertiesResponse
import com.pulumi.azurenative.iotoperations.kotlin.outputs.ExtendedLocationResponse
import com.pulumi.azurenative.iotoperations.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 com.pulumi.azurenative.iotoperations.kotlin.outputs.BrokerAuthorizationPropertiesResponse.Companion.toKotlin as brokerAuthorizationPropertiesResponseToKotlin
import com.pulumi.azurenative.iotoperations.kotlin.outputs.ExtendedLocationResponse.Companion.toKotlin as extendedLocationResponseToKotlin
import com.pulumi.azurenative.iotoperations.kotlin.outputs.SystemDataResponse.Companion.toKotlin as systemDataResponseToKotlin

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

    public var args: BrokerAuthorizationArgs = BrokerAuthorizationArgs()

    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 BrokerAuthorizationArgsBuilder.() -> Unit) {
        val builder = BrokerAuthorizationArgsBuilder()
        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(): BrokerAuthorization {
        val builtJavaResource =
            com.pulumi.azurenative.iotoperations.BrokerAuthorization(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return BrokerAuthorization(builtJavaResource)
    }
}

/**
 * Instance broker authorizations resource
 * Azure REST API version: 2024-07-01-preview.
 * Other available API versions: 2024-08-15-preview.
 * ## Example Usage
 * ### BrokerAuthorization_CreateOrUpdate
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var brokerAuthorization = new AzureNative.IoTOperations.BrokerAuthorization("brokerAuthorization", new()
 *     {
 *         AuthorizationName = "aio-authorization",
 *         BrokerName = "aio-broker",
 *         ExtendedLocation = new AzureNative.IoTOperations.Inputs.ExtendedLocationArgs
 *         {
 *             Name = "ycsyubcxttlusbhfdqaynmkaatnbyv",
 *             Type = AzureNative.IoTOperations.ExtendedLocationType.CustomLocation,
 *         },
 *         InstanceName = "aio-instance",
 *         Properties = new AzureNative.IoTOperations.Inputs.BrokerAuthorizationPropertiesArgs
 *         {
 *             AuthorizationPolicies = new AzureNative.IoTOperations.Inputs.AuthorizationConfigArgs
 *             {
 *                 Cache = AzureNative.IoTOperations.OperationalMode.Enabled,
 *                 Rules = new[]
 *                 {
 *                     new AzureNative.IoTOperations.Inputs.AuthorizationRuleArgs
 *                     {
 *                         BrokerResources = new[]
 *                         {
 *                             new AzureNative.IoTOperations.Inputs.BrokerResourceRuleArgs
 *                             {
 *                                 Method = AzureNative.IoTOperations.BrokerResourceDefinitionMethods.Connect,
 *                                 Topics = new[]
 *                                 {
 *                                     "afmj",
 *                                 },
 *                             },
 *                         },
 *                         Principals = new AzureNative.IoTOperations.Inputs.PrincipalDefinitionArgs
 *                         {
 *                             Attributes = new[]
 *                             {
 *                                 {
 *                                     { "key1225", "szvjlbpctnpjmyjq" },
 *                                 },
 *                             },
 *                             ClientIds = new[]
 *                             {
 *                                 "zfamfwk",
 *                             },
 *                             Usernames = new[]
 *                             {
 *                                 "udobrmzkzubuqbvnbabovvr",
 *                             },
 *                         },
 *                         StateStoreResources = new[]
 *                         {
 *                             new AzureNative.IoTOperations.Inputs.StateStoreResourceRuleArgs
 *                             {
 *                                 KeyType = AzureNative.IoTOperations.StateStoreResourceKeyTypes.Pattern,
 *                                 Keys = new[]
 *                                 {
 *                                     "tttdjfmf",
 *                                 },
 *                                 Method = AzureNative.IoTOperations.StateStoreResourceDefinitionMethods.Read,
 *                             },
 *                         },
 *                     },
 *                 },
 *             },
 *         },
 *         ResourceGroupName = "rgiotoperations",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	iotoperations "github.com/pulumi/pulumi-azure-native-sdk/iotoperations/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := iotoperations.NewBrokerAuthorization(ctx, "brokerAuthorization", &iotoperations.BrokerAuthorizationArgs{
 * 			AuthorizationName: pulumi.String("aio-authorization"),
 * 			BrokerName:        pulumi.String("aio-broker"),
 * 			ExtendedLocation: &iotoperations.ExtendedLocationArgs{
 * 				Name: pulumi.String("ycsyubcxttlusbhfdqaynmkaatnbyv"),
 * 				Type: pulumi.String(iotoperations.ExtendedLocationTypeCustomLocation),
 * 			},
 * 			InstanceName: pulumi.String("aio-instance"),
 * 			Properties: &iotoperations.BrokerAuthorizationPropertiesArgs{
 * 				AuthorizationPolicies: &iotoperations.AuthorizationConfigArgs{
 * 					Cache: pulumi.String(iotoperations.OperationalModeEnabled),
 * 					Rules: iotoperations.AuthorizationRuleArray{
 * 						&iotoperations.AuthorizationRuleArgs{
 * 							BrokerResources: iotoperations.BrokerResourceRuleArray{
 * 								&iotoperations.BrokerResourceRuleArgs{
 * 									Method: pulumi.String(iotoperations.BrokerResourceDefinitionMethodsConnect),
 * 									Topics: pulumi.StringArray{
 * 										pulumi.String("afmj"),
 * 									},
 * 								},
 * 							},
 * 							Principals: &iotoperations.PrincipalDefinitionArgs{
 * 								Attributes: pulumi.StringMapArray{
 * 									pulumi.StringMap{
 * 										"key1225": pulumi.String("szvjlbpctnpjmyjq"),
 * 									},
 * 								},
 * 								ClientIds: pulumi.StringArray{
 * 									pulumi.String("zfamfwk"),
 * 								},
 * 								Usernames: pulumi.StringArray{
 * 									pulumi.String("udobrmzkzubuqbvnbabovvr"),
 * 								},
 * 							},
 * 							StateStoreResources: iotoperations.StateStoreResourceRuleArray{
 * 								&iotoperations.StateStoreResourceRuleArgs{
 * 									KeyType: pulumi.String(iotoperations.StateStoreResourceKeyTypesPattern),
 * 									Keys: pulumi.StringArray{
 * 										pulumi.String("tttdjfmf"),
 * 									},
 * 									Method: pulumi.String(iotoperations.StateStoreResourceDefinitionMethodsRead),
 * 								},
 * 							},
 * 						},
 * 					},
 * 				},
 * 			},
 * 			ResourceGroupName: pulumi.String("rgiotoperations"),
 * 		})
 * 		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.iotoperations.BrokerAuthorization;
 * import com.pulumi.azurenative.iotoperations.BrokerAuthorizationArgs;
 * import com.pulumi.azurenative.iotoperations.inputs.ExtendedLocationArgs;
 * import com.pulumi.azurenative.iotoperations.inputs.BrokerAuthorizationPropertiesArgs;
 * import com.pulumi.azurenative.iotoperations.inputs.AuthorizationConfigArgs;
 * 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 brokerAuthorization = new BrokerAuthorization("brokerAuthorization", BrokerAuthorizationArgs.builder()
 *             .authorizationName("aio-authorization")
 *             .brokerName("aio-broker")
 *             .extendedLocation(ExtendedLocationArgs.builder()
 *                 .name("ycsyubcxttlusbhfdqaynmkaatnbyv")
 *                 .type("CustomLocation")
 *                 .build())
 *             .instanceName("aio-instance")
 *             .properties(BrokerAuthorizationPropertiesArgs.builder()
 *                 .authorizationPolicies(AuthorizationConfigArgs.builder()
 *                     .cache("Enabled")
 *                     .rules(AuthorizationRuleArgs.builder()
 *                         .brokerResources(BrokerResourceRuleArgs.builder()
 *                             .method("Connect")
 *                             .topics("afmj")
 *                             .build())
 *                         .principals(PrincipalDefinitionArgs.builder()
 *                             .attributes(Map.of("key1225", "szvjlbpctnpjmyjq"))
 *                             .clientIds("zfamfwk")
 *                             .usernames("udobrmzkzubuqbvnbabovvr")
 *                             .build())
 *                         .stateStoreResources(StateStoreResourceRuleArgs.builder()
 *                             .keyType("Pattern")
 *                             .keys("tttdjfmf")
 *                             .method("Read")
 *                             .build())
 *                         .build())
 *                     .build())
 *                 .build())
 *             .resourceGroupName("rgiotoperations")
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:iotoperations:BrokerAuthorization jsocsnglgrxciedpqzbm /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName}
 * ```
 */
public class BrokerAuthorization internal constructor(
    override val javaResource: com.pulumi.azurenative.iotoperations.BrokerAuthorization,
) : KotlinCustomResource(javaResource, BrokerAuthorizationMapper) {
    /**
     * Edge location of the resource.
     */
    public val extendedLocation: Output
        get() = javaResource.extendedLocation().applyValue({ args0 ->
            args0.let({ args0 ->
                extendedLocationResponseToKotlin(args0)
            })
        })

    /**
     * The name of the resource
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The resource-specific properties for this resource.
     */
    public val properties: Output
        get() = javaResource.properties().applyValue({ args0 ->
            args0.let({ args0 ->
                brokerAuthorizationPropertiesResponseToKotlin(args0)
            })
        })

    /**
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    public val systemData: Output
        get() = javaResource.systemData().applyValue({ args0 ->
            args0.let({ args0 ->
                systemDataResponseToKotlin(args0)
            })
        })

    /**
     * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object BrokerAuthorizationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azurenative.iotoperations.BrokerAuthorization::class == javaResource::class

    override fun map(javaResource: Resource): BrokerAuthorization = BrokerAuthorization(
        javaResource
            as com.pulumi.azurenative.iotoperations.BrokerAuthorization,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy