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

com.pulumi.azure.securitycenter.kotlin.StorageDefender.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

/**
 * Builder for [StorageDefender].
 */
@PulumiTagMarker
public class StorageDefenderResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: StorageDefenderArgs = StorageDefenderArgs()

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

/**
 * Manages the Defender for Storage.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-rg",
 *     location: "westus2",
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "exampleacc",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const exampleStorageDefender = new azure.securitycenter.StorageDefender("example", {storageAccountId: exampleAccount.id});
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-rg",
 *     location="westus2")
 * example_account = azure.storage.Account("example",
 *     name="exampleacc",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     account_tier="Standard",
 *     account_replication_type="LRS")
 * example_storage_defender = azure.securitycenter.StorageDefender("example", storage_account_id=example_account.id)
 * ```
 * ```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-rg",
 *         Location = "westus2",
 *     });
 *     var exampleAccount = new Azure.Storage.Account("example", new()
 *     {
 *         Name = "exampleacc",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *     });
 *     var exampleStorageDefender = new Azure.SecurityCenter.StorageDefender("example", new()
 *     {
 *         StorageAccountId = exampleAccount.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/securitycenter"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
 * 	"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-rg"),
 * 			Location: pulumi.String("westus2"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
 * 			Name:                   pulumi.String("exampleacc"),
 * 			ResourceGroupName:      example.Name,
 * 			Location:               example.Location,
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("LRS"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = securitycenter.NewStorageDefender(ctx, "example", &securitycenter.StorageDefenderArgs{
 * 			StorageAccountId: exampleAccount.ID(),
 * 		})
 * 		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.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.securitycenter.StorageDefender;
 * import com.pulumi.azure.securitycenter.StorageDefenderArgs;
 * 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-rg")
 *             .location("westus2")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("exampleacc")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var exampleStorageDefender = new StorageDefender("exampleStorageDefender", StorageDefenderArgs.builder()
 *             .storageAccountId(exampleAccount.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-rg
 *       location: westus2
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: exampleacc
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *   exampleStorageDefender:
 *     type: azure:securitycenter:StorageDefender
 *     name: example
 *     properties:
 *       storageAccountId: ${exampleAccount.id}
 * ```
 * 
 * ## Import
 * The setting can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:securitycenter/storageDefender:StorageDefender example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Storage/storageAccounts/storageacc
 * ```
 */
public class StorageDefender internal constructor(
    override val javaResource: com.pulumi.azure.securitycenter.StorageDefender,
) : KotlinCustomResource(javaResource, StorageDefenderMapper) {
    /**
     * The max GB to be scanned per Month. Must be `-1` or above `0`. Omit this property or set to `-1` if no capping is needed. Defaults to `-1`.
     */
    public val malwareScanningOnUploadCapGbPerMonth: Output?
        get() = javaResource.malwareScanningOnUploadCapGbPerMonth().applyValue({ args0 ->
            args0.map({ args0 -> args0 }).orElse(null)
        })

    /**
     * Whether On Upload malware scanning should be enabled. Defaults to `false`.
     */
    public val malwareScanningOnUploadEnabled: Output?
        get() = javaResource.malwareScanningOnUploadEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Whether the settings defined for this storage account should override the settings defined for the subscription. Defaults to `false`.
     */
    public val overrideSubscriptionSettingsEnabled: Output?
        get() = javaResource.overrideSubscriptionSettingsEnabled().applyValue({ args0 ->
            args0.map({ args0 -> args0 }).orElse(null)
        })

    /**
     * The Event Grid Topic where every scan result will be sent to. When you set an Event Grid custom topic, you must set `override_subscription_settings_enabled` to `true` to override the subscription-level settings.
     */
    public val scanResultsEventGridTopicId: Output?
        get() = javaResource.scanResultsEventGridTopicId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Whether Sensitive Data Discovery should be enabled. Defaults to `false`.
     */
    public val sensitiveDataDiscoveryEnabled: Output?
        get() = javaResource.sensitiveDataDiscoveryEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID of the storage account the defender applied to. Changing this forces a new resource to be created.
     */
    public val storageAccountId: Output
        get() = javaResource.storageAccountId().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy