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

com.pulumi.azure.securitycenter.kotlin.Contact.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.securitycenter.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 [Contact].
 */
@PulumiTagMarker
public class ContactResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ContactArgs = ContactArgs()

    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 ContactArgsBuilder.() -> Unit) {
        val builder = ContactArgsBuilder()
        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(): Contact {
        val builtJavaResource = com.pulumi.azure.securitycenter.Contact(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Contact(builtJavaResource)
    }
}

/**
 * Manages the subscription's Security Center Contact.
 * > **NOTE:** Owner access permission is required.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.securitycenter.Contact("example", {
 *     name: "contact",
 *     email: "[email protected]",
 *     phone: "+1-555-555-5555",
 *     alertNotifications: true,
 *     alertsToAdmins: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.securitycenter.Contact("example",
 *     name="contact",
 *     email="[email protected]",
 *     phone="+1-555-555-5555",
 *     alert_notifications=True,
 *     alerts_to_admins=True)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.SecurityCenter.Contact("example", new()
 *     {
 *         Name = "contact",
 *         Email = "[email protected]",
 *         Phone = "+1-555-555-5555",
 *         AlertNotifications = true,
 *         AlertsToAdmins = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/securitycenter"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := securitycenter.NewContact(ctx, "example", &securitycenter.ContactArgs{
 * 			Name:               pulumi.String("contact"),
 * 			Email:              pulumi.String("[email protected]"),
 * 			Phone:              pulumi.String("+1-555-555-5555"),
 * 			AlertNotifications: pulumi.Bool(true),
 * 			AlertsToAdmins:     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.securitycenter.Contact;
 * import com.pulumi.azure.securitycenter.ContactArgs;
 * 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 Contact("example", ContactArgs.builder()
 *             .name("contact")
 *             .email("[email protected]")
 *             .phone("+1-555-555-5555")
 *             .alertNotifications(true)
 *             .alertsToAdmins(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:securitycenter:Contact
 *     properties:
 *       name: contact
 *       email: [email protected]
 *       phone: +1-555-555-5555
 *       alertNotifications: true
 *       alertsToAdmins: true
 * ```
 * 
 * ## Import
 * The contact can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:securitycenter/contact:Contact example /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/securityContacts/default1
 * ```
 */
public class Contact internal constructor(
    override val javaResource: com.pulumi.azure.securitycenter.Contact,
) : KotlinCustomResource(javaResource, ContactMapper) {
    /**
     * Whether to send security alerts notifications to the security contact.
     */
    public val alertNotifications: Output
        get() = javaResource.alertNotifications().applyValue({ args0 -> args0 })

    /**
     * Whether to send security alerts notifications to subscription admins.
     */
    public val alertsToAdmins: Output
        get() = javaResource.alertsToAdmins().applyValue({ args0 -> args0 })

    /**
     * The email of the Security Center Contact.
     */
    public val email: Output
        get() = javaResource.email().applyValue({ args0 -> args0 })

    /**
     * The name of the Security Center Contact. Defaults to `default1`.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The phone number of the Security Center Contact.
     */
    public val phone: Output?
        get() = javaResource.phone().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object ContactMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.securitycenter.Contact::class == javaResource::class

    override fun map(javaResource: Resource): Contact = Contact(
        javaResource as
            com.pulumi.azure.securitycenter.Contact,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy