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.iot.kotlin.DpsSharedAccessPolicy.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.iot.kotlin
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
/**
* Builder for [DpsSharedAccessPolicy].
*/
@PulumiTagMarker
public class DpsSharedAccessPolicyResourceBuilder internal constructor() {
public var name: String? = null
public var args: DpsSharedAccessPolicyArgs = DpsSharedAccessPolicyArgs()
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 DpsSharedAccessPolicyArgsBuilder.() -> Unit) {
val builder = DpsSharedAccessPolicyArgsBuilder()
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(): DpsSharedAccessPolicy {
val builtJavaResource = com.pulumi.azure.iot.DpsSharedAccessPolicy(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return DpsSharedAccessPolicy(builtJavaResource)
}
}
/**
* Manages an IotHub Device Provisioning Service 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 exampleIotHubDps = new azure.iot.IotHubDps("example", {
* name: "example",
* resourceGroupName: example.name,
* location: example.location,
* sku: {
* name: "S1",
* capacity: 1,
* },
* });
* const exampleDpsSharedAccessPolicy = new azure.iot.DpsSharedAccessPolicy("example", {
* name: "example",
* resourceGroupName: example.name,
* iothubDpsName: exampleIotHubDps.name,
* enrollmentWrite: true,
* enrollmentRead: true,
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-resources",
* location="West Europe")
* example_iot_hub_dps = azure.iot.IotHubDps("example",
* name="example",
* resource_group_name=example.name,
* location=example.location,
* sku={
* "name": "S1",
* "capacity": 1,
* })
* example_dps_shared_access_policy = azure.iot.DpsSharedAccessPolicy("example",
* name="example",
* resource_group_name=example.name,
* iothub_dps_name=example_iot_hub_dps.name,
* enrollment_write=True,
* enrollment_read=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 exampleIotHubDps = new Azure.Iot.IotHubDps("example", new()
* {
* Name = "example",
* ResourceGroupName = example.Name,
* Location = example.Location,
* Sku = new Azure.Iot.Inputs.IotHubDpsSkuArgs
* {
* Name = "S1",
* Capacity = 1,
* },
* });
* var exampleDpsSharedAccessPolicy = new Azure.Iot.DpsSharedAccessPolicy("example", new()
* {
* Name = "example",
* ResourceGroupName = example.Name,
* IothubDpsName = exampleIotHubDps.Name,
* EnrollmentWrite = true,
* EnrollmentRead = 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
* }
* exampleIotHubDps, err := iot.NewIotHubDps(ctx, "example", &iot.IotHubDpsArgs{
* Name: pulumi.String("example"),
* ResourceGroupName: example.Name,
* Location: example.Location,
* Sku: &iot.IotHubDpsSkuArgs{
* Name: pulumi.String("S1"),
* Capacity: pulumi.Int(1),
* },
* })
* if err != nil {
* return err
* }
* _, err = iot.NewDpsSharedAccessPolicy(ctx, "example", &iot.DpsSharedAccessPolicyArgs{
* Name: pulumi.String("example"),
* ResourceGroupName: example.Name,
* IothubDpsName: exampleIotHubDps.Name,
* EnrollmentWrite: pulumi.Bool(true),
* EnrollmentRead: 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.IotHubDps;
* import com.pulumi.azure.iot.IotHubDpsArgs;
* import com.pulumi.azure.iot.inputs.IotHubDpsSkuArgs;
* import com.pulumi.azure.iot.DpsSharedAccessPolicy;
* import com.pulumi.azure.iot.DpsSharedAccessPolicyArgs;
* 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 exampleIotHubDps = new IotHubDps("exampleIotHubDps", IotHubDpsArgs.builder()
* .name("example")
* .resourceGroupName(example.name())
* .location(example.location())
* .sku(IotHubDpsSkuArgs.builder()
* .name("S1")
* .capacity("1")
* .build())
* .build());
* var exampleDpsSharedAccessPolicy = new DpsSharedAccessPolicy("exampleDpsSharedAccessPolicy", DpsSharedAccessPolicyArgs.builder()
* .name("example")
* .resourceGroupName(example.name())
* .iothubDpsName(exampleIotHubDps.name())
* .enrollmentWrite(true)
* .enrollmentRead(true)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-resources
* location: West Europe
* exampleIotHubDps:
* type: azure:iot:IotHubDps
* name: example
* properties:
* name: example
* resourceGroupName: ${example.name}
* location: ${example.location}
* sku:
* name: S1
* capacity: '1'
* exampleDpsSharedAccessPolicy:
* type: azure:iot:DpsSharedAccessPolicy
* name: example
* properties:
* name: example
* resourceGroupName: ${example.name}
* iothubDpsName: ${exampleIotHubDps.name}
* enrollmentWrite: true
* enrollmentRead: true
* ```
*
* ## Import
* IoTHub Device Provisioning Service Shared Access Policies can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:iot/dpsSharedAccessPolicy:DpsSharedAccessPolicy shared_access_policy1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/provisioningServices/dps1/keys/shared_access_policy1
* ```
*/
public class DpsSharedAccessPolicy internal constructor(
override val javaResource: com.pulumi.azure.iot.DpsSharedAccessPolicy,
) : KotlinCustomResource(javaResource, DpsSharedAccessPolicyMapper) {
/**
* Adds `EnrollmentRead` permission to this Shared Access Account. It allows read access to enrollment data.
* > **NOTE** When `enrollment_read` is set to `true`, `registration_read` must also be set to true. This is a limitation of the Azure REST API
*/
public val enrollmentRead: Output?
get() = javaResource.enrollmentRead().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Adds `EnrollmentWrite` permission to this Shared Access Account. It allows write access to enrollment data.
* > **NOTE** When `registration_write` is set to `true`, `enrollment_read`, `registration_read`, and `registration_write` must also be set to true. This is a requirement of the Azure API.
*/
public val enrollmentWrite: Output?
get() = javaResource.enrollmentWrite().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The name of the IoT Hub Device Provisioning service to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
*/
public val iothubDpsName: Output
get() = javaResource.iothubDpsName().applyValue({ args0 -> args0 })
/**
* Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The primary connection string of the Shared Access Policy.
*/
public val primaryConnectionString: Output
get() = javaResource.primaryConnectionString().applyValue({ args0 -> args0 })
/**
* The primary key used to create the authentication token.
*/
public val primaryKey: Output
get() = javaResource.primaryKey().applyValue({ args0 -> args0 })
/**
* Adds `RegistrationStatusRead` permission to this Shared Access Account. It allows read access to device registrations.
*/
public val registrationRead: Output?
get() = javaResource.registrationRead().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Adds `RegistrationStatusWrite` permission to this Shared Access Account. It allows write access to device registrations.
* > **NOTE** When `registration_write` is set to `true`, `registration_read` must also be set to true. This is a requirement of the Azure API.
*/
public val registrationWrite: Output?
get() = javaResource.registrationWrite().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* 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.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* The secondary connection string of the Shared Access Policy.
*/
public val secondaryConnectionString: Output
get() = javaResource.secondaryConnectionString().applyValue({ args0 -> args0 })
/**
* The secondary key used to create the authentication token.
*/
public val secondaryKey: Output
get() = javaResource.secondaryKey().applyValue({ args0 -> args0 })
/**
* Adds `ServiceConfig` permission to this Shared Access Account. It allows configuration of the Device Provisioning Service.
* > **NOTE** At least one of `registration_read`, `registration_write`, `service_config`, `enrollment_read`, `enrollment_write` permissions must be set to `true`.
*/
public val serviceConfig: Output?
get() = javaResource.serviceConfig().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
}
public object DpsSharedAccessPolicyMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.iot.DpsSharedAccessPolicy::class == javaResource::class
override fun map(javaResource: Resource): DpsSharedAccessPolicy =
DpsSharedAccessPolicy(javaResource as com.pulumi.azure.iot.DpsSharedAccessPolicy)
}
/**
* @see [DpsSharedAccessPolicy].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [DpsSharedAccessPolicy].
*/
public suspend fun dpsSharedAccessPolicy(
name: String,
block: suspend DpsSharedAccessPolicyResourceBuilder.() -> Unit,
): DpsSharedAccessPolicy {
val builder = DpsSharedAccessPolicyResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [DpsSharedAccessPolicy].
* @param name The _unique_ name of the resulting resource.
*/
public fun dpsSharedAccessPolicy(name: String): DpsSharedAccessPolicy {
val builder = DpsSharedAccessPolicyResourceBuilder()
builder.name(name)
return builder.build()
}