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

com.pulumi.azurenative.policyinsights.kotlin.RemediationAtResource.kt Maven / Gradle / Ivy

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

package com.pulumi.azurenative.policyinsights.kotlin

import com.pulumi.azurenative.policyinsights.kotlin.outputs.RemediationDeploymentSummaryResponse
import com.pulumi.azurenative.policyinsights.kotlin.outputs.RemediationFiltersResponse
import com.pulumi.azurenative.policyinsights.kotlin.outputs.RemediationPropertiesResponseFailureThreshold
import com.pulumi.azurenative.policyinsights.kotlin.outputs.SystemDataResponse
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
import com.pulumi.azurenative.policyinsights.kotlin.outputs.RemediationDeploymentSummaryResponse.Companion.toKotlin as remediationDeploymentSummaryResponseToKotlin
import com.pulumi.azurenative.policyinsights.kotlin.outputs.RemediationFiltersResponse.Companion.toKotlin as remediationFiltersResponseToKotlin
import com.pulumi.azurenative.policyinsights.kotlin.outputs.RemediationPropertiesResponseFailureThreshold.Companion.toKotlin as remediationPropertiesResponseFailureThresholdToKotlin
import com.pulumi.azurenative.policyinsights.kotlin.outputs.SystemDataResponse.Companion.toKotlin as systemDataResponseToKotlin

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

    public var args: RemediationAtResourceArgs = RemediationAtResourceArgs()

    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 RemediationAtResourceArgsBuilder.() -> Unit) {
        val builder = RemediationAtResourceArgsBuilder()
        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(): RemediationAtResource {
        val builtJavaResource =
            com.pulumi.azurenative.policyinsights.RemediationAtResource(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return RemediationAtResource(builtJavaResource)
    }
}

/**
 * The remediation definition.
 * Azure REST API version: 2021-10-01. Prior API version in Azure Native 1.x: 2019-07-01.
 * Other available API versions: 2018-07-01-preview.
 * ## Example Usage
 * ### Create remediation at individual resource scope
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var remediationAtResource = new AzureNative.PolicyInsights.RemediationAtResource("remediationAtResource", new()
 *     {
 *         PolicyAssignmentId = "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourceGroups/myResourceGroup/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5",
 *         RemediationName = "storageRemediation",
 *         ResourceId = "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	policyinsights "github.com/pulumi/pulumi-azure-native-sdk/policyinsights/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := policyinsights.NewRemediationAtResource(ctx, "remediationAtResource", &policyinsights.RemediationAtResourceArgs{
 * 			PolicyAssignmentId: pulumi.String("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourceGroups/myResourceGroup/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
 * 			RemediationName:    pulumi.String("storageRemediation"),
 * 			ResourceId:         pulumi.String("subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1"),
 * 		})
 * 		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.azurenative.policyinsights.RemediationAtResource;
 * import com.pulumi.azurenative.policyinsights.RemediationAtResourceArgs;
 * 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 remediationAtResource = new RemediationAtResource("remediationAtResource", RemediationAtResourceArgs.builder()
 *             .policyAssignmentId("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourceGroups/myResourceGroup/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5")
 *             .remediationName("storageRemediation")
 *             .resourceId("subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1")
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:policyinsights:RemediationAtResource storageRemediation /{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}
 * ```
 */
public class RemediationAtResource internal constructor(
    override val javaResource: com.pulumi.azurenative.policyinsights.RemediationAtResource,
) : KotlinCustomResource(javaResource, RemediationAtResourceMapper) {
    /**
     * The remediation correlation Id. Can be used to find events related to the remediation in the activity log.
     */
    public val correlationId: Output
        get() = javaResource.correlationId().applyValue({ args0 -> args0 })

    /**
     * The time at which the remediation was created.
     */
    public val createdOn: Output
        get() = javaResource.createdOn().applyValue({ args0 -> args0 })

    /**
     * The deployment status summary for all deployments created by the remediation.
     */
    public val deploymentStatus: Output
        get() = javaResource.deploymentStatus().applyValue({ args0 ->
            args0.let({ args0 ->
                remediationDeploymentSummaryResponseToKotlin(args0)
            })
        })

    /**
     * The remediation failure threshold settings
     */
    public val failureThreshold: Output?
        get() = javaResource.failureThreshold().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    remediationPropertiesResponseFailureThresholdToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The filters that will be applied to determine which resources to remediate.
     */
    public val filters: Output?
        get() = javaResource.filters().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    remediationFiltersResponseToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The time at which the remediation was last updated.
     */
    public val lastUpdatedOn: Output
        get() = javaResource.lastUpdatedOn().applyValue({ args0 -> args0 })

    /**
     * The name of the remediation.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Determines how many resources to remediate at any given time. Can be used to increase or reduce the pace of the remediation. If not provided, the default parallel deployments value is used.
     */
    public val parallelDeployments: Output?
        get() = javaResource.parallelDeployments().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The resource ID of the policy assignment that should be remediated.
     */
    public val policyAssignmentId: Output?
        get() = javaResource.policyAssignmentId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The policy definition reference ID of the individual definition that should be remediated. Required when the policy assignment being remediated assigns a policy set definition.
     */
    public val policyDefinitionReferenceId: Output?
        get() = javaResource.policyDefinitionReferenceId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The status of the remediation. This refers to the entire remediation task, not individual deployments. Allowed values are Evaluating, Canceled, Cancelling, Failed, Complete, or Succeeded.
     */
    public val provisioningState: Output
        get() = javaResource.provisioningState().applyValue({ args0 -> args0 })

    /**
     * Determines the max number of resources that can be remediated by the remediation job. If not provided, the default resource count is used.
     */
    public val resourceCount: Output?
        get() = javaResource.resourceCount().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The way resources to remediate are discovered. Defaults to ExistingNonCompliant if not specified.
     */
    public val resourceDiscoveryMode: Output?
        get() = javaResource.resourceDiscoveryMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The remediation status message. Provides additional details regarding the state of the remediation.
     */
    public val statusMessage: Output
        get() = javaResource.statusMessage().applyValue({ args0 -> args0 })

    /**
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    public val systemData: Output
        get() = javaResource.systemData().applyValue({ args0 ->
            args0.let({ args0 ->
                systemDataResponseToKotlin(args0)
            })
        })

    /**
     * The type of the remediation.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object RemediationAtResourceMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azurenative.policyinsights.RemediationAtResource::class == javaResource::class

    override fun map(javaResource: Resource): RemediationAtResource =
        RemediationAtResource(
            javaResource as
                com.pulumi.azurenative.policyinsights.RemediationAtResource,
        )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy