
com.pulumi.azure.iot.kotlin.Certificate.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@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 [Certificate].
*/
@PulumiTagMarker
public class CertificateResourceBuilder internal constructor() {
public var name: String? = null
public var args: CertificateArgs = CertificateArgs()
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 CertificateArgsBuilder.() -> Unit) {
val builder = CertificateArgsBuilder()
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(): Certificate {
val builtJavaResource = com.pulumi.azure.iot.Certificate(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Certificate(builtJavaResource)
}
}
/**
* Manages an IotHub Certificate.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* import * as std from "@pulumi/std";
* 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: "B1",
* capacity: 1,
* },
* });
* const exampleCertificate = new azure.iot.Certificate("example", {
* name: "example",
* resourceGroupName: example.name,
* iothubName: exampleIoTHub.name,
* isVerified: true,
* certificateContent: std.filebase64({
* input: "example.cer",
* }).then(invoke => invoke.result),
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* import pulumi_std as std
* 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=azure.iot.IoTHubSkuArgs(
* name="B1",
* capacity=1,
* ))
* example_certificate = azure.iot.Certificate("example",
* name="example",
* resource_group_name=example.name,
* iothub_name=example_io_t_hub.name,
* is_verified=True,
* certificate_content=std.filebase64(input="example.cer").result)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* using Std = Pulumi.Std;
* 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 = "B1",
* Capacity = 1,
* },
* });
* var exampleCertificate = new Azure.Iot.Certificate("example", new()
* {
* Name = "example",
* ResourceGroupName = example.Name,
* IothubName = exampleIoTHub.Name,
* IsVerified = true,
* CertificateContent = Std.Filebase64.Invoke(new()
* {
* Input = "example.cer",
* }).Apply(invoke => invoke.Result),
* });
* });
* ```
* ```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-std/sdk/go/std"
* "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("B1"),
* Capacity: pulumi.Int(1),
* },
* })
* if err != nil {
* return err
* }
* invokeFilebase64, err := std.Filebase64(ctx, &std.Filebase64Args{
* Input: "example.cer",
* }, nil)
* if err != nil {
* return err
* }
* _, err = iot.NewCertificate(ctx, "example", &iot.CertificateArgs{
* Name: pulumi.String("example"),
* ResourceGroupName: example.Name,
* IothubName: exampleIoTHub.Name,
* IsVerified: pulumi.Bool(true),
* CertificateContent: invokeFilebase64.Result,
* })
* 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.Certificate;
* import com.pulumi.azure.iot.CertificateArgs;
* 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("B1")
* .capacity("1")
* .build())
* .build());
* var exampleCertificate = new Certificate("exampleCertificate", CertificateArgs.builder()
* .name("example")
* .resourceGroupName(example.name())
* .iothubName(exampleIoTHub.name())
* .isVerified(true)
* .certificateContent(StdFunctions.filebase64(Filebase64Args.builder()
* .input("example.cer")
* .build()).result())
* .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: B1
* capacity: '1'
* exampleCertificate:
* type: azure:iot:Certificate
* name: example
* properties:
* name: example
* resourceGroupName: ${example.name}
* iothubName: ${exampleIoTHub.name}
* isVerified: true
* certificateContent:
* fn::invoke:
* Function: std:filebase64
* Arguments:
* input: example.cer
* Return: result
* ```
*
* ## Import
* IoTHub Certificates can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:iot/certificate:Certificate example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/iotHubs/example/certificates/example
* ```
*/
public class Certificate internal constructor(
override val javaResource: com.pulumi.azure.iot.Certificate,
) : KotlinCustomResource(javaResource, CertificateMapper) {
/**
* The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
*/
public val certificateContent: Output
get() = javaResource.certificateContent().applyValue({ args0 -> args0 })
/**
* The name of the IoTHub that this certificate will be attached to. Changing this forces a new resource to be created.
*/
public val iothubName: Output
get() = javaResource.iothubName().applyValue({ args0 -> args0 })
/**
* Is the certificate verified? Defaults to `false`.
*/
public val isVerified: Output?
get() = javaResource.isVerified().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Specifies the name of the IotHub Certificate resource. 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 under which the IotHub Certificate resource has to be created. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
}
public object CertificateMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.iot.Certificate::class == javaResource::class
override fun map(javaResource: Resource): Certificate = Certificate(
javaResource as
com.pulumi.azure.iot.Certificate,
)
}
/**
* @see [Certificate].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Certificate].
*/
public suspend fun certificate(name: String, block: suspend CertificateResourceBuilder.() -> Unit):
Certificate {
val builder = CertificateResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Certificate].
* @param name The _unique_ name of the resulting resource.
*/
public fun certificate(name: String): Certificate {
val builder = CertificateResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy