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

com.pulumi.azure.iot.kotlin.SharedAccessPolicyArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.21.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.iot.kotlin

import com.pulumi.azure.iot.SharedAccessPolicyArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * Manages an IotHub Shared Access Policy
 * ## 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 exampleIoTHub = new azure.iot.IoTHub("example", {
 *     name: "example",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     sku: {
 *         name: "S1",
 *         capacity: 1,
 *     },
 * });
 * const exampleSharedAccessPolicy = new azure.iot.SharedAccessPolicy("example", {
 *     name: "example",
 *     resourceGroupName: example.name,
 *     iothubName: exampleIoTHub.name,
 *     registryRead: true,
 *     registryWrite: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_io_t_hub = azure.iot.IoTHub("example",
 *     name="example",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     sku={
 *         "name": "S1",
 *         "capacity": 1,
 *     })
 * example_shared_access_policy = azure.iot.SharedAccessPolicy("example",
 *     name="example",
 *     resource_group_name=example.name,
 *     iothub_name=example_io_t_hub.name,
 *     registry_read=True,
 *     registry_write=True)
 * ```
 * ```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 exampleIoTHub = new Azure.Iot.IoTHub("example", new()
 *     {
 *         Name = "example",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Sku = new Azure.Iot.Inputs.IoTHubSkuArgs
 *         {
 *             Name = "S1",
 *             Capacity = 1,
 *         },
 *     });
 *     var exampleSharedAccessPolicy = new Azure.Iot.SharedAccessPolicy("example", new()
 *     {
 *         Name = "example",
 *         ResourceGroupName = example.Name,
 *         IothubName = exampleIoTHub.Name,
 *         RegistryRead = true,
 *         RegistryWrite = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/iot"
 * 	"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
 * 		}
 * 		exampleIoTHub, err := iot.NewIoTHub(ctx, "example", &iot.IoTHubArgs{
 * 			Name:              pulumi.String("example"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			Sku: &iot.IoTHubSkuArgs{
 * 				Name:     pulumi.String("S1"),
 * 				Capacity: pulumi.Int(1),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = iot.NewSharedAccessPolicy(ctx, "example", &iot.SharedAccessPolicyArgs{
 * 			Name:              pulumi.String("example"),
 * 			ResourceGroupName: example.Name,
 * 			IothubName:        exampleIoTHub.Name,
 * 			RegistryRead:      pulumi.Bool(true),
 * 			RegistryWrite:     pulumi.Bool(true),
 * 		})
 * 		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.iot.IoTHub;
 * import com.pulumi.azure.iot.IoTHubArgs;
 * import com.pulumi.azure.iot.inputs.IoTHubSkuArgs;
 * import com.pulumi.azure.iot.SharedAccessPolicy;
 * import com.pulumi.azure.iot.SharedAccessPolicyArgs;
 * 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 exampleIoTHub = new IoTHub("exampleIoTHub", IoTHubArgs.builder()
 *             .name("example")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .sku(IoTHubSkuArgs.builder()
 *                 .name("S1")
 *                 .capacity("1")
 *                 .build())
 *             .build());
 *         var exampleSharedAccessPolicy = new SharedAccessPolicy("exampleSharedAccessPolicy", SharedAccessPolicyArgs.builder()
 *             .name("example")
 *             .resourceGroupName(example.name())
 *             .iothubName(exampleIoTHub.name())
 *             .registryRead(true)
 *             .registryWrite(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleIoTHub:
 *     type: azure:iot:IoTHub
 *     name: example
 *     properties:
 *       name: example
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       sku:
 *         name: S1
 *         capacity: '1'
 *   exampleSharedAccessPolicy:
 *     type: azure:iot:SharedAccessPolicy
 *     name: example
 *     properties:
 *       name: example
 *       resourceGroupName: ${example.name}
 *       iothubName: ${exampleIoTHub.name}
 *       registryRead: true
 *       registryWrite: true
 * ```
 * 
 * ## Import
 * IoTHub Shared Access Policies can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:iot/sharedAccessPolicy:SharedAccessPolicy shared_access_policy1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/iotHubs/hub1/iotHubKeys/shared_access_policy1
 * ```
 * @property deviceConnect Adds `DeviceConnect` permission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.
 * > **NOTE** At least one of `registry_read`, `registry_write`, `service_connect`, `device_connect` permissions must be set to `true`.
 * @property iothubName The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
 * @property name Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
 * @property registryRead Adds `RegistryRead` permission to this Shared Access Account. It allows read access to the identity registry.
 * @property registryWrite Adds `RegistryWrite` permission to this Shared Access Account. It allows write access to the identity registry.
 * > **NOTE** When `registry_write` is set to `true`, `registry_read` must also be set to true. This is a limitation of the Azure REST API
 * @property resourceGroupName The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
 * @property serviceConnect Adds `ServiceConnect` permission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
 */
public data class SharedAccessPolicyArgs(
    public val deviceConnect: Output? = null,
    public val iothubName: Output? = null,
    public val name: Output? = null,
    public val registryRead: Output? = null,
    public val registryWrite: Output? = null,
    public val resourceGroupName: Output? = null,
    public val serviceConnect: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.iot.SharedAccessPolicyArgs =
        com.pulumi.azure.iot.SharedAccessPolicyArgs.builder()
            .deviceConnect(deviceConnect?.applyValue({ args0 -> args0 }))
            .iothubName(iothubName?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .registryRead(registryRead?.applyValue({ args0 -> args0 }))
            .registryWrite(registryWrite?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .serviceConnect(serviceConnect?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [SharedAccessPolicyArgs].
 */
@PulumiTagMarker
public class SharedAccessPolicyArgsBuilder internal constructor() {
    private var deviceConnect: Output? = null

    private var iothubName: Output? = null

    private var name: Output? = null

    private var registryRead: Output? = null

    private var registryWrite: Output? = null

    private var resourceGroupName: Output? = null

    private var serviceConnect: Output? = null

    /**
     * @param value Adds `DeviceConnect` permission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.
     * > **NOTE** At least one of `registry_read`, `registry_write`, `service_connect`, `device_connect` permissions must be set to `true`.
     */
    @JvmName("grxllwiaxdmmoggt")
    public suspend fun deviceConnect(`value`: Output) {
        this.deviceConnect = value
    }

    /**
     * @param value The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
     */
    @JvmName("xlkwbghihxqdmqrl")
    public suspend fun iothubName(`value`: Output) {
        this.iothubName = value
    }

    /**
     * @param value Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
     */
    @JvmName("dxtoxkfbqukkakoi")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Adds `RegistryRead` permission to this Shared Access Account. It allows read access to the identity registry.
     */
    @JvmName("horxkqccpropdqgp")
    public suspend fun registryRead(`value`: Output) {
        this.registryRead = value
    }

    /**
     * @param value Adds `RegistryWrite` permission to this Shared Access Account. It allows write access to the identity registry.
     * > **NOTE** When `registry_write` is set to `true`, `registry_read` must also be set to true. This is a limitation of the Azure REST API
     */
    @JvmName("xajplosjnymecxbi")
    public suspend fun registryWrite(`value`: Output) {
        this.registryWrite = value
    }

    /**
     * @param value The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
     */
    @JvmName("vejwytvfvjmxysvp")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value Adds `ServiceConnect` permission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
     */
    @JvmName("ouiauvwsnwuwccbw")
    public suspend fun serviceConnect(`value`: Output) {
        this.serviceConnect = value
    }

    /**
     * @param value Adds `DeviceConnect` permission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.
     * > **NOTE** At least one of `registry_read`, `registry_write`, `service_connect`, `device_connect` permissions must be set to `true`.
     */
    @JvmName("byuqcpnnvivliimx")
    public suspend fun deviceConnect(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.deviceConnect = mapped
    }

    /**
     * @param value The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
     */
    @JvmName("drxpheradrufusyl")
    public suspend fun iothubName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.iothubName = mapped
    }

    /**
     * @param value Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
     */
    @JvmName("dsohshrmbtrftncb")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value Adds `RegistryRead` permission to this Shared Access Account. It allows read access to the identity registry.
     */
    @JvmName("gwimjopfqighdxxh")
    public suspend fun registryRead(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.registryRead = mapped
    }

    /**
     * @param value Adds `RegistryWrite` permission to this Shared Access Account. It allows write access to the identity registry.
     * > **NOTE** When `registry_write` is set to `true`, `registry_read` must also be set to true. This is a limitation of the Azure REST API
     */
    @JvmName("hrhsrmbatrvgqfls")
    public suspend fun registryWrite(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.registryWrite = mapped
    }

    /**
     * @param value The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
     */
    @JvmName("wajfmdmgfwtsudnd")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value Adds `ServiceConnect` permission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
     */
    @JvmName("pptvkqrayxokyfel")
    public suspend fun serviceConnect(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.serviceConnect = mapped
    }

    internal fun build(): SharedAccessPolicyArgs = SharedAccessPolicyArgs(
        deviceConnect = deviceConnect,
        iothubName = iothubName,
        name = name,
        registryRead = registryRead,
        registryWrite = registryWrite,
        resourceGroupName = resourceGroupName,
        serviceConnect = serviceConnect,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy