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.azurenative.policyinsights.kotlin.RemediationAtSubscription.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 [RemediationAtSubscription].
*/
@PulumiTagMarker
public class RemediationAtSubscriptionResourceBuilder internal constructor() {
public var name: String? = null
public var args: RemediationAtSubscriptionArgs = RemediationAtSubscriptionArgs()
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 RemediationAtSubscriptionArgsBuilder.() -> Unit) {
val builder = RemediationAtSubscriptionArgsBuilder()
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(): RemediationAtSubscription {
val builtJavaResource =
com.pulumi.azurenative.policyinsights.RemediationAtSubscription(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return RemediationAtSubscription(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 subscription scope
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using AzureNative = Pulumi.AzureNative;
* return await Deployment.RunAsync(() =>
* {
* var remediationAtSubscription = new AzureNative.PolicyInsights.RemediationAtSubscription("remediationAtSubscription", new()
* {
* PolicyAssignmentId = "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5",
* RemediationName = "storageRemediation",
* });
* });
* ```
* ```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.NewRemediationAtSubscription(ctx, "remediationAtSubscription", &policyinsights.RemediationAtSubscriptionArgs{
* PolicyAssignmentId: pulumi.String("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
* RemediationName: pulumi.String("storageRemediation"),
* })
* 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.RemediationAtSubscription;
* import com.pulumi.azurenative.policyinsights.RemediationAtSubscriptionArgs;
* 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 remediationAtSubscription = new RemediationAtSubscription("remediationAtSubscription", RemediationAtSubscriptionArgs.builder()
* .policyAssignmentId("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5")
* .remediationName("storageRemediation")
* .build());
* }
* }
* ```
* ### Create remediation at subscription scope with all properties
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using AzureNative = Pulumi.AzureNative;
* return await Deployment.RunAsync(() =>
* {
* var remediationAtSubscription = new AzureNative.PolicyInsights.RemediationAtSubscription("remediationAtSubscription", new()
* {
* FailureThreshold = new AzureNative.PolicyInsights.Inputs.RemediationPropertiesFailureThresholdArgs
* {
* Percentage = 0.1,
* },
* Filters = new AzureNative.PolicyInsights.Inputs.RemediationFiltersArgs
* {
* Locations = new[]
* {
* "eastus",
* "westus",
* },
* },
* ParallelDeployments = 6,
* PolicyAssignmentId = "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5",
* PolicyDefinitionReferenceId = "8c8fa9e4",
* RemediationName = "storageRemediation",
* ResourceCount = 42,
* ResourceDiscoveryMode = AzureNative.PolicyInsights.ResourceDiscoveryMode.ReEvaluateCompliance,
* });
* });
* ```
* ```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.NewRemediationAtSubscription(ctx, "remediationAtSubscription", &policyinsights.RemediationAtSubscriptionArgs{
* FailureThreshold: &policyinsights.RemediationPropertiesFailureThresholdArgs{
* Percentage: pulumi.Float64(0.1),
* },
* Filters: &policyinsights.RemediationFiltersArgs{
* Locations: pulumi.StringArray{
* pulumi.String("eastus"),
* pulumi.String("westus"),
* },
* },
* ParallelDeployments: pulumi.Int(6),
* PolicyAssignmentId: pulumi.String("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
* PolicyDefinitionReferenceId: pulumi.String("8c8fa9e4"),
* RemediationName: pulumi.String("storageRemediation"),
* ResourceCount: pulumi.Int(42),
* ResourceDiscoveryMode: pulumi.String(policyinsights.ResourceDiscoveryModeReEvaluateCompliance),
* })
* 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.RemediationAtSubscription;
* import com.pulumi.azurenative.policyinsights.RemediationAtSubscriptionArgs;
* import com.pulumi.azurenative.policyinsights.inputs.RemediationPropertiesFailureThresholdArgs;
* import com.pulumi.azurenative.policyinsights.inputs.RemediationFiltersArgs;
* 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 remediationAtSubscription = new RemediationAtSubscription("remediationAtSubscription", RemediationAtSubscriptionArgs.builder()
* .failureThreshold(RemediationPropertiesFailureThresholdArgs.builder()
* .percentage(0.1)
* .build())
* .filters(RemediationFiltersArgs.builder()
* .locations(
* "eastus",
* "westus")
* .build())
* .parallelDeployments(6)
* .policyAssignmentId("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5")
* .policyDefinitionReferenceId("8c8fa9e4")
* .remediationName("storageRemediation")
* .resourceCount(42)
* .resourceDiscoveryMode("ReEvaluateCompliance")
* .build());
* }
* }
* ```
* ## Import
* An existing resource can be imported using its type token, name, and identifier, e.g.
* ```sh
* $ pulumi import azure-native:policyinsights:RemediationAtSubscription storageRemediation /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}
* ```
*/
public class RemediationAtSubscription internal constructor(
override val javaResource: com.pulumi.azurenative.policyinsights.RemediationAtSubscription,
) : KotlinCustomResource(javaResource, RemediationAtSubscriptionMapper) {
/**
* 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 RemediationAtSubscriptionMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azurenative.policyinsights.RemediationAtSubscription::class == javaResource::class
override fun map(javaResource: Resource): RemediationAtSubscription =
RemediationAtSubscription(
javaResource as
com.pulumi.azurenative.policyinsights.RemediationAtSubscription,
)
}
/**
* @see [RemediationAtSubscription].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [RemediationAtSubscription].
*/
public suspend fun remediationAtSubscription(
name: String,
block: suspend RemediationAtSubscriptionResourceBuilder.() -> Unit,
): RemediationAtSubscription {
val builder = RemediationAtSubscriptionResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [RemediationAtSubscription].
* @param name The _unique_ name of the resulting resource.
*/
public fun remediationAtSubscription(name: String): RemediationAtSubscription {
val builder = RemediationAtSubscriptionResourceBuilder()
builder.name(name)
return builder.build()
}