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.SecurityDeviceGroup.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.iot.kotlin
import com.pulumi.azure.iot.kotlin.outputs.SecurityDeviceGroupAllowRule
import com.pulumi.azure.iot.kotlin.outputs.SecurityDeviceGroupRangeRule
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.iot.kotlin.outputs.SecurityDeviceGroupAllowRule.Companion.toKotlin as securityDeviceGroupAllowRuleToKotlin
import com.pulumi.azure.iot.kotlin.outputs.SecurityDeviceGroupRangeRule.Companion.toKotlin as securityDeviceGroupRangeRuleToKotlin
/**
* Builder for [SecurityDeviceGroup].
*/
@PulumiTagMarker
public class SecurityDeviceGroupResourceBuilder internal constructor() {
public var name: String? = null
public var args: SecurityDeviceGroupArgs = SecurityDeviceGroupArgs()
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 SecurityDeviceGroupArgsBuilder.() -> Unit) {
val builder = SecurityDeviceGroupArgsBuilder()
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(): SecurityDeviceGroup {
val builtJavaResource = com.pulumi.azure.iot.SecurityDeviceGroup(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return SecurityDeviceGroup(builtJavaResource)
}
}
/**
* Manages a Iot Security Device Group.
* ## 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-IoTHub",
* resourceGroupName: example.name,
* location: example.location,
* sku: {
* name: "S1",
* capacity: 1,
* },
* });
* const exampleSecuritySolution = new azure.iot.SecuritySolution("example", {
* name: "example-Iot-Security-Solution",
* resourceGroupName: example.name,
* location: example.location,
* displayName: "Iot Security Solution",
* iothubIds: [exampleIoTHub.id],
* });
* const exampleSecurityDeviceGroup = new azure.iot.SecurityDeviceGroup("example", {
* name: "example-device-security-group",
* iothubId: exampleIoTHub.id,
* allowRule: {
* connectionToIpsNotAlloweds: ["10.0.0.0/24"],
* },
* rangeRules: [{
* type: "ActiveConnectionsNotInAllowedRange",
* min: 0,
* max: 30,
* duration: "PT5M",
* }],
* }, {
* dependsOn: [exampleSecuritySolution],
* });
* ```
* ```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-IoTHub",
* resource_group_name=example.name,
* location=example.location,
* sku={
* "name": "S1",
* "capacity": 1,
* })
* example_security_solution = azure.iot.SecuritySolution("example",
* name="example-Iot-Security-Solution",
* resource_group_name=example.name,
* location=example.location,
* display_name="Iot Security Solution",
* iothub_ids=[example_io_t_hub.id])
* example_security_device_group = azure.iot.SecurityDeviceGroup("example",
* name="example-device-security-group",
* iothub_id=example_io_t_hub.id,
* allow_rule={
* "connection_to_ips_not_alloweds": ["10.0.0.0/24"],
* },
* range_rules=[{
* "type": "ActiveConnectionsNotInAllowedRange",
* "min": 0,
* "max": 30,
* "duration": "PT5M",
* }],
* opts = pulumi.ResourceOptions(depends_on=[example_security_solution]))
* ```
* ```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-IoTHub",
* ResourceGroupName = example.Name,
* Location = example.Location,
* Sku = new Azure.Iot.Inputs.IoTHubSkuArgs
* {
* Name = "S1",
* Capacity = 1,
* },
* });
* var exampleSecuritySolution = new Azure.Iot.SecuritySolution("example", new()
* {
* Name = "example-Iot-Security-Solution",
* ResourceGroupName = example.Name,
* Location = example.Location,
* DisplayName = "Iot Security Solution",
* IothubIds = new[]
* {
* exampleIoTHub.Id,
* },
* });
* var exampleSecurityDeviceGroup = new Azure.Iot.SecurityDeviceGroup("example", new()
* {
* Name = "example-device-security-group",
* IothubId = exampleIoTHub.Id,
* AllowRule = new Azure.Iot.Inputs.SecurityDeviceGroupAllowRuleArgs
* {
* ConnectionToIpsNotAlloweds = new[]
* {
* "10.0.0.0/24",
* },
* },
* RangeRules = new[]
* {
* new Azure.Iot.Inputs.SecurityDeviceGroupRangeRuleArgs
* {
* Type = "ActiveConnectionsNotInAllowedRange",
* Min = 0,
* Max = 30,
* Duration = "PT5M",
* },
* },
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* exampleSecuritySolution,
* },
* });
* });
* ```
* ```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-IoTHub"),
* ResourceGroupName: example.Name,
* Location: example.Location,
* Sku: &iot.IoTHubSkuArgs{
* Name: pulumi.String("S1"),
* Capacity: pulumi.Int(1),
* },
* })
* if err != nil {
* return err
* }
* exampleSecuritySolution, err := iot.NewSecuritySolution(ctx, "example", &iot.SecuritySolutionArgs{
* Name: pulumi.String("example-Iot-Security-Solution"),
* ResourceGroupName: example.Name,
* Location: example.Location,
* DisplayName: pulumi.String("Iot Security Solution"),
* IothubIds: pulumi.StringArray{
* exampleIoTHub.ID(),
* },
* })
* if err != nil {
* return err
* }
* _, err = iot.NewSecurityDeviceGroup(ctx, "example", &iot.SecurityDeviceGroupArgs{
* Name: pulumi.String("example-device-security-group"),
* IothubId: exampleIoTHub.ID(),
* AllowRule: &iot.SecurityDeviceGroupAllowRuleArgs{
* ConnectionToIpsNotAlloweds: pulumi.StringArray{
* pulumi.String("10.0.0.0/24"),
* },
* },
* RangeRules: iot.SecurityDeviceGroupRangeRuleArray{
* &iot.SecurityDeviceGroupRangeRuleArgs{
* Type: pulumi.String("ActiveConnectionsNotInAllowedRange"),
* Min: pulumi.Int(0),
* Max: pulumi.Int(30),
* Duration: pulumi.String("PT5M"),
* },
* },
* }, pulumi.DependsOn([]pulumi.Resource{
* exampleSecuritySolution,
* }))
* 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.SecuritySolution;
* import com.pulumi.azure.iot.SecuritySolutionArgs;
* import com.pulumi.azure.iot.SecurityDeviceGroup;
* import com.pulumi.azure.iot.SecurityDeviceGroupArgs;
* import com.pulumi.azure.iot.inputs.SecurityDeviceGroupAllowRuleArgs;
* import com.pulumi.azure.iot.inputs.SecurityDeviceGroupRangeRuleArgs;
* 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("example-resources")
* .location("West Europe")
* .build());
* var exampleIoTHub = new IoTHub("exampleIoTHub", IoTHubArgs.builder()
* .name("example-IoTHub")
* .resourceGroupName(example.name())
* .location(example.location())
* .sku(IoTHubSkuArgs.builder()
* .name("S1")
* .capacity("1")
* .build())
* .build());
* var exampleSecuritySolution = new SecuritySolution("exampleSecuritySolution", SecuritySolutionArgs.builder()
* .name("example-Iot-Security-Solution")
* .resourceGroupName(example.name())
* .location(example.location())
* .displayName("Iot Security Solution")
* .iothubIds(exampleIoTHub.id())
* .build());
* var exampleSecurityDeviceGroup = new SecurityDeviceGroup("exampleSecurityDeviceGroup", SecurityDeviceGroupArgs.builder()
* .name("example-device-security-group")
* .iothubId(exampleIoTHub.id())
* .allowRule(SecurityDeviceGroupAllowRuleArgs.builder()
* .connectionToIpsNotAlloweds("10.0.0.0/24")
* .build())
* .rangeRules(SecurityDeviceGroupRangeRuleArgs.builder()
* .type("ActiveConnectionsNotInAllowedRange")
* .min(0)
* .max(30)
* .duration("PT5M")
* .build())
* .build(), CustomResourceOptions.builder()
* .dependsOn(exampleSecuritySolution)
* .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-IoTHub
* resourceGroupName: ${example.name}
* location: ${example.location}
* sku:
* name: S1
* capacity: '1'
* exampleSecuritySolution:
* type: azure:iot:SecuritySolution
* name: example
* properties:
* name: example-Iot-Security-Solution
* resourceGroupName: ${example.name}
* location: ${example.location}
* displayName: Iot Security Solution
* iothubIds:
* - ${exampleIoTHub.id}
* exampleSecurityDeviceGroup:
* type: azure:iot:SecurityDeviceGroup
* name: example
* properties:
* name: example-device-security-group
* iothubId: ${exampleIoTHub.id}
* allowRule:
* connectionToIpsNotAlloweds:
* - 10.0.0.0/24
* rangeRules:
* - type: ActiveConnectionsNotInAllowedRange
* min: 0
* max: 30
* duration: PT5M
* options:
* dependson:
* - ${exampleSecuritySolution}
* ```
*
* ## Import
* Iot Security Device Group can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:iot/securityDeviceGroup:SecurityDeviceGroup example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.Devices/iotHubs/hub1/providers/Microsoft.Security/deviceSecurityGroups/group1
* ```
*/
public class SecurityDeviceGroup internal constructor(
override val javaResource: com.pulumi.azure.iot.SecurityDeviceGroup,
) : KotlinCustomResource(javaResource, SecurityDeviceGroupMapper) {
/**
* an `allow_rule` blocks as defined below.
*/
public val allowRule: Output?
get() = javaResource.allowRule().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
securityDeviceGroupAllowRuleToKotlin(args0)
})
}).orElse(null)
})
/**
* The ID of the IoT Hub which to link the Security Device Group to. Changing this forces a new resource to be created.
*/
public val iothubId: Output
get() = javaResource.iothubId().applyValue({ args0 -> args0 })
/**
* Specifies the name of the Device Security Group. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* One or more `range_rule` blocks as defined below.
*/
public val rangeRules: Output>?
get() = javaResource.rangeRules().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> securityDeviceGroupRangeRuleToKotlin(args0) })
})
}).orElse(null)
})
}
public object SecurityDeviceGroupMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.iot.SecurityDeviceGroup::class == javaResource::class
override fun map(javaResource: Resource): SecurityDeviceGroup = SecurityDeviceGroup(
javaResource
as com.pulumi.azure.iot.SecurityDeviceGroup,
)
}
/**
* @see [SecurityDeviceGroup].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [SecurityDeviceGroup].
*/
public suspend fun securityDeviceGroup(
name: String,
block: suspend SecurityDeviceGroupResourceBuilder.() -> Unit,
): SecurityDeviceGroup {
val builder = SecurityDeviceGroupResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [SecurityDeviceGroup].
* @param name The _unique_ name of the resulting resource.
*/
public fun securityDeviceGroup(name: String): SecurityDeviceGroup {
val builder = SecurityDeviceGroupResourceBuilder()
builder.name(name)
return builder.build()
}