com.pulumi.aws.computeoptimizer.kotlin.RecommendationPreferences.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-aws-kotlin Show documentation
Show all versions of pulumi-aws-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.aws.computeoptimizer.kotlin
import com.pulumi.aws.computeoptimizer.kotlin.outputs.RecommendationPreferencesExternalMetricsPreference
import com.pulumi.aws.computeoptimizer.kotlin.outputs.RecommendationPreferencesPreferredResource
import com.pulumi.aws.computeoptimizer.kotlin.outputs.RecommendationPreferencesScope
import com.pulumi.aws.computeoptimizer.kotlin.outputs.RecommendationPreferencesUtilizationPreference
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
import kotlin.collections.List
import com.pulumi.aws.computeoptimizer.kotlin.outputs.RecommendationPreferencesExternalMetricsPreference.Companion.toKotlin as recommendationPreferencesExternalMetricsPreferenceToKotlin
import com.pulumi.aws.computeoptimizer.kotlin.outputs.RecommendationPreferencesPreferredResource.Companion.toKotlin as recommendationPreferencesPreferredResourceToKotlin
import com.pulumi.aws.computeoptimizer.kotlin.outputs.RecommendationPreferencesScope.Companion.toKotlin as recommendationPreferencesScopeToKotlin
import com.pulumi.aws.computeoptimizer.kotlin.outputs.RecommendationPreferencesUtilizationPreference.Companion.toKotlin as recommendationPreferencesUtilizationPreferenceToKotlin
/**
* Builder for [RecommendationPreferences].
*/
@PulumiTagMarker
public class RecommendationPreferencesResourceBuilder internal constructor() {
public var name: String? = null
public var args: RecommendationPreferencesArgs = RecommendationPreferencesArgs()
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 RecommendationPreferencesArgsBuilder.() -> Unit) {
val builder = RecommendationPreferencesArgsBuilder()
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(): RecommendationPreferences {
val builtJavaResource =
com.pulumi.aws.computeoptimizer.RecommendationPreferences(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return RecommendationPreferences(builtJavaResource)
}
}
/**
* Manages AWS Compute Optimizer recommendation preferences.
* ## Example Usage
* ### Lookback Period Preference
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.computeoptimizer.RecommendationPreferences("example", {
* resourceType: "Ec2Instance",
* scope: {
* name: "AccountId",
* value: "123456789012",
* },
* lookBackPeriod: "DAYS_32",
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.computeoptimizer.RecommendationPreferences("example",
* resource_type="Ec2Instance",
* scope={
* "name": "AccountId",
* "value": "123456789012",
* },
* look_back_period="DAYS_32")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.ComputeOptimizer.RecommendationPreferences("example", new()
* {
* ResourceType = "Ec2Instance",
* Scope = new Aws.ComputeOptimizer.Inputs.RecommendationPreferencesScopeArgs
* {
* Name = "AccountId",
* Value = "123456789012",
* },
* LookBackPeriod = "DAYS_32",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/computeoptimizer"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := computeoptimizer.NewRecommendationPreferences(ctx, "example", &computeoptimizer.RecommendationPreferencesArgs{
* ResourceType: pulumi.String("Ec2Instance"),
* Scope: &computeoptimizer.RecommendationPreferencesScopeArgs{
* Name: pulumi.String("AccountId"),
* Value: pulumi.String("123456789012"),
* },
* LookBackPeriod: pulumi.String("DAYS_32"),
* })
* 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.aws.computeoptimizer.RecommendationPreferences;
* import com.pulumi.aws.computeoptimizer.RecommendationPreferencesArgs;
* import com.pulumi.aws.computeoptimizer.inputs.RecommendationPreferencesScopeArgs;
* 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 RecommendationPreferences("example", RecommendationPreferencesArgs.builder()
* .resourceType("Ec2Instance")
* .scope(RecommendationPreferencesScopeArgs.builder()
* .name("AccountId")
* .value("123456789012")
* .build())
* .lookBackPeriod("DAYS_32")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:computeoptimizer:RecommendationPreferences
* properties:
* resourceType: Ec2Instance
* scope:
* name: AccountId
* value: '123456789012'
* lookBackPeriod: DAYS_32
* ```
*
* ### Multiple Preferences
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.computeoptimizer.RecommendationPreferences("example", {
* resourceType: "Ec2Instance",
* scope: {
* name: "AccountId",
* value: "123456789012",
* },
* enhancedInfrastructureMetrics: "Active",
* externalMetricsPreference: {
* source: "Datadog",
* },
* preferredResources: [{
* includeLists: [
* "m5.xlarge",
* "r5",
* ],
* name: "Ec2InstanceTypes",
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.computeoptimizer.RecommendationPreferences("example",
* resource_type="Ec2Instance",
* scope={
* "name": "AccountId",
* "value": "123456789012",
* },
* enhanced_infrastructure_metrics="Active",
* external_metrics_preference={
* "source": "Datadog",
* },
* preferred_resources=[{
* "include_lists": [
* "m5.xlarge",
* "r5",
* ],
* "name": "Ec2InstanceTypes",
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.ComputeOptimizer.RecommendationPreferences("example", new()
* {
* ResourceType = "Ec2Instance",
* Scope = new Aws.ComputeOptimizer.Inputs.RecommendationPreferencesScopeArgs
* {
* Name = "AccountId",
* Value = "123456789012",
* },
* EnhancedInfrastructureMetrics = "Active",
* ExternalMetricsPreference = new Aws.ComputeOptimizer.Inputs.RecommendationPreferencesExternalMetricsPreferenceArgs
* {
* Source = "Datadog",
* },
* PreferredResources = new[]
* {
* new Aws.ComputeOptimizer.Inputs.RecommendationPreferencesPreferredResourceArgs
* {
* IncludeLists = new[]
* {
* "m5.xlarge",
* "r5",
* },
* Name = "Ec2InstanceTypes",
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/computeoptimizer"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := computeoptimizer.NewRecommendationPreferences(ctx, "example", &computeoptimizer.RecommendationPreferencesArgs{
* ResourceType: pulumi.String("Ec2Instance"),
* Scope: &computeoptimizer.RecommendationPreferencesScopeArgs{
* Name: pulumi.String("AccountId"),
* Value: pulumi.String("123456789012"),
* },
* EnhancedInfrastructureMetrics: pulumi.String("Active"),
* ExternalMetricsPreference: &computeoptimizer.RecommendationPreferencesExternalMetricsPreferenceArgs{
* Source: pulumi.String("Datadog"),
* },
* PreferredResources: computeoptimizer.RecommendationPreferencesPreferredResourceArray{
* &computeoptimizer.RecommendationPreferencesPreferredResourceArgs{
* IncludeLists: pulumi.StringArray{
* pulumi.String("m5.xlarge"),
* pulumi.String("r5"),
* },
* Name: pulumi.String("Ec2InstanceTypes"),
* },
* },
* })
* 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.aws.computeoptimizer.RecommendationPreferences;
* import com.pulumi.aws.computeoptimizer.RecommendationPreferencesArgs;
* import com.pulumi.aws.computeoptimizer.inputs.RecommendationPreferencesScopeArgs;
* import com.pulumi.aws.computeoptimizer.inputs.RecommendationPreferencesExternalMetricsPreferenceArgs;
* import com.pulumi.aws.computeoptimizer.inputs.RecommendationPreferencesPreferredResourceArgs;
* 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 RecommendationPreferences("example", RecommendationPreferencesArgs.builder()
* .resourceType("Ec2Instance")
* .scope(RecommendationPreferencesScopeArgs.builder()
* .name("AccountId")
* .value("123456789012")
* .build())
* .enhancedInfrastructureMetrics("Active")
* .externalMetricsPreference(RecommendationPreferencesExternalMetricsPreferenceArgs.builder()
* .source("Datadog")
* .build())
* .preferredResources(RecommendationPreferencesPreferredResourceArgs.builder()
* .includeLists(
* "m5.xlarge",
* "r5")
* .name("Ec2InstanceTypes")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:computeoptimizer:RecommendationPreferences
* properties:
* resourceType: Ec2Instance
* scope:
* name: AccountId
* value: '123456789012'
* enhancedInfrastructureMetrics: Active
* externalMetricsPreference:
* source: Datadog
* preferredResources:
* - includeLists:
* - m5.xlarge
* - r5
* name: Ec2InstanceTypes
* ```
*
* ## Import
* Using `pulumi import`, import recommendation preferences using the resource type, scope name and scope value. For example:
* ```sh
* $ pulumi import aws:computeoptimizer/recommendationPreferences:RecommendationPreferences example Ec2Instance,AccountId,123456789012
* ```
*/
public class RecommendationPreferences internal constructor(
override val javaResource: com.pulumi.aws.computeoptimizer.RecommendationPreferences,
) : KotlinCustomResource(javaResource, RecommendationPreferencesMapper) {
/**
* The status of the enhanced infrastructure metrics recommendation preference. Valid values: `Active`, `Inactive`.
*/
public val enhancedInfrastructureMetrics: Output?
get() = javaResource.enhancedInfrastructureMetrics().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The provider of the external metrics recommendation preference. See External Metrics Preference below.
*/
public val externalMetricsPreference: Output?
get() = javaResource.externalMetricsPreference().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
recommendationPreferencesExternalMetricsPreferenceToKotlin(args0)
})
}).orElse(null)
})
/**
* The status of the inferred workload types recommendation preference. Valid values: `Active`, `Inactive`.
*/
public val inferredWorkloadTypes: Output?
get() = javaResource.inferredWorkloadTypes().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The preference to control the number of days the utilization metrics of the AWS resource are analyzed. Valid values: `DAYS_14`, `DAYS_32`, `DAYS_93`.
*/
public val lookBackPeriod: Output
get() = javaResource.lookBackPeriod().applyValue({ args0 -> args0 })
/**
* The preference to control which resource type values are considered when generating rightsizing recommendations. See Preferred Resources below.
*/
public val preferredResources: Output>?
get() = javaResource.preferredResources().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
recommendationPreferencesPreferredResourceToKotlin(args0)
})
})
}).orElse(null)
})
/**
* The target resource type of the recommendation preferences. Valid values: `Ec2Instance`, `AutoScalingGroup`, `RdsDBInstance`.
*/
public val resourceType: Output
get() = javaResource.resourceType().applyValue({ args0 -> args0 })
/**
* The status of the savings estimation mode preference. Valid values: `AfterDiscounts`, `BeforeDiscounts`.
*/
public val savingsEstimationMode: Output?
get() = javaResource.savingsEstimationMode().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The scope of the recommendation preferences. See Scope below.
*/
public val scope: Output?
get() = javaResource.scope().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
recommendationPreferencesScopeToKotlin(args0)
})
}).orElse(null)
})
/**
* The preference to control the resource’s CPU utilization threshold, CPU utilization headroom, and memory utilization headroom. See Utilization Preferences below.
*/
public val utilizationPreferences: Output>?
get() = javaResource.utilizationPreferences().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
recommendationPreferencesUtilizationPreferenceToKotlin(args0)
})
})
}).orElse(null)
})
}
public object RecommendationPreferencesMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.aws.computeoptimizer.RecommendationPreferences::class == javaResource::class
override fun map(javaResource: Resource): RecommendationPreferences =
RecommendationPreferences(
javaResource as
com.pulumi.aws.computeoptimizer.RecommendationPreferences,
)
}
/**
* @see [RecommendationPreferences].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [RecommendationPreferences].
*/
public suspend fun recommendationPreferences(
name: String,
block: suspend RecommendationPreferencesResourceBuilder.() -> Unit,
): RecommendationPreferences {
val builder = RecommendationPreferencesResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [RecommendationPreferences].
* @param name The _unique_ name of the resulting resource.
*/
public fun recommendationPreferences(name: String): RecommendationPreferences {
val builder = RecommendationPreferencesResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy