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

com.pulumi.gcp.osconfig.kotlin.OsPolicyAssignment.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.osconfig.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.osconfig.kotlin.outputs.OsPolicyAssignmentInstanceFilter
import com.pulumi.gcp.osconfig.kotlin.outputs.OsPolicyAssignmentOsPolicy
import com.pulumi.gcp.osconfig.kotlin.outputs.OsPolicyAssignmentRollout
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.gcp.osconfig.kotlin.outputs.OsPolicyAssignmentInstanceFilter.Companion.toKotlin as osPolicyAssignmentInstanceFilterToKotlin
import com.pulumi.gcp.osconfig.kotlin.outputs.OsPolicyAssignmentOsPolicy.Companion.toKotlin as osPolicyAssignmentOsPolicyToKotlin
import com.pulumi.gcp.osconfig.kotlin.outputs.OsPolicyAssignmentRollout.Companion.toKotlin as osPolicyAssignmentRolloutToKotlin

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

    public var args: OsPolicyAssignmentArgs = OsPolicyAssignmentArgs()

    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 OsPolicyAssignmentArgsBuilder.() -> Unit) {
        val builder = OsPolicyAssignmentArgsBuilder()
        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(): OsPolicyAssignment {
        val builtJavaResource = com.pulumi.gcp.osconfig.OsPolicyAssignment(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return OsPolicyAssignment(builtJavaResource)
    }
}

/**
 * OS policy assignment is an API resource that is used to apply a set of OS
 * policies to a dynamically targeted group of Compute Engine VM instances. An OS
 * policy is used to define the desired state configuration for a Compute Engine VM
 * instance through a set of configuration resources that provide capabilities such
 * as installing or removing software packages, or executing a script. For more
 * information about the OS policy resource definitions and examples, see
 * [OS policy and OS policy assignment](https://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies).
 * To get more information about OSPolicyAssignment, see:
 * *   [API documentation](https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments)
 * *   How-to Guides
 *     *   [Official Documentation](https://cloud.google.com/compute/docs/os-configuration-management/create-os-policy-assignment)
 * ## Example Usage
 * ### Os Config Os Policy Assignment Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const primary = new gcp.osconfig.OsPolicyAssignment("primary", {
 *     instanceFilter: {
 *         all: false,
 *         exclusionLabels: [{
 *             labels: {
 *                 "label-two": "value-two",
 *             },
 *         }],
 *         inclusionLabels: [{
 *             labels: {
 *                 "label-one": "value-one",
 *             },
 *         }],
 *         inventories: [{
 *             osShortName: "centos",
 *             osVersion: "8.*",
 *         }],
 *     },
 *     location: "us-central1-a",
 *     name: "policy-assignment",
 *     osPolicies: [{
 *         id: "policy",
 *         mode: "VALIDATION",
 *         resourceGroups: [{
 *             resources: [
 *                 {
 *                     id: "apt-to-yum",
 *                     repository: {
 *                         apt: {
 *                             archiveType: "DEB",
 *                             components: ["doc"],
 *                             distribution: "debian",
 *                             uri: "https://atl.mirrors.clouvider.net/debian",
 *                             gpgKey: ".gnupg/pubring.kbx",
 *                         },
 *                     },
 *                 },
 *                 {
 *                     id: "exec1",
 *                     exec: {
 *                         validate: {
 *                             interpreter: "SHELL",
 *                             args: ["arg1"],
 *                             file: {
 *                                 localPath: "$HOME/script.sh",
 *                             },
 *                             outputFilePath: "$HOME/out",
 *                         },
 *                         enforce: {
 *                             interpreter: "SHELL",
 *                             args: ["arg1"],
 *                             file: {
 *                                 allowInsecure: true,
 *                                 remote: {
 *                                     uri: "https://www.example.com/script.sh",
 *                                     sha256Checksum: "c7938fed83afdccbb0e86a2a2e4cad7d5035012ca3214b4a61268393635c3063",
 *                                 },
 *                             },
 *                             outputFilePath: "$HOME/out",
 *                         },
 *                     },
 *                 },
 *             ],
 *             inventoryFilters: [{
 *                 osShortName: "centos",
 *                 osVersion: "8.*",
 *             }],
 *         }],
 *         allowNoResourceGroupMatch: false,
 *         description: "A test os policy",
 *     }],
 *     rollout: {
 *         disruptionBudget: {
 *             percent: 100,
 *         },
 *         minWaitDuration: "3s",
 *     },
 *     description: "A test os policy assignment",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * primary = gcp.osconfig.OsPolicyAssignment("primary",
 *     instance_filter=gcp.osconfig.OsPolicyAssignmentInstanceFilterArgs(
 *         all=False,
 *         exclusion_labels=[gcp.osconfig.OsPolicyAssignmentInstanceFilterExclusionLabelArgs(
 *             labels={
 *                 "label-two": "value-two",
 *             },
 *         )],
 *         inclusion_labels=[gcp.osconfig.OsPolicyAssignmentInstanceFilterInclusionLabelArgs(
 *             labels={
 *                 "label-one": "value-one",
 *             },
 *         )],
 *         inventories=[gcp.osconfig.OsPolicyAssignmentInstanceFilterInventoryArgs(
 *             os_short_name="centos",
 *             os_version="8.*",
 *         )],
 *     ),
 *     location="us-central1-a",
 *     name="policy-assignment",
 *     os_policies=[gcp.osconfig.OsPolicyAssignmentOsPolicyArgs(
 *         id="policy",
 *         mode="VALIDATION",
 *         resource_groups=[gcp.osconfig.OsPolicyAssignmentOsPolicyResourceGroupArgs(
 *             resources=[
 *                 gcp.osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceArgs(
 *                     id="apt-to-yum",
 *                     repository=gcp.osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceRepositoryArgs(
 *                         apt=gcp.osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceRepositoryAptArgs(
 *                             archive_type="DEB",
 *                             components=["doc"],
 *                             distribution="debian",
 *                             uri="https://atl.mirrors.clouvider.net/debian",
 *                             gpg_key=".gnupg/pubring.kbx",
 *                         ),
 *                     ),
 *                 ),
 *                 gcp.osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceArgs(
 *                     id="exec1",
 *                     exec_=gcp.osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceExecArgs(
 *                         validate=gcp.osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceExecValidateArgs(
 *                             interpreter="SHELL",
 *                             args=["arg1"],
 *                             file=gcp.osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceExecValidateFileArgs(
 *                                 local_path="$HOME/script.sh",
 *                             ),
 *                             output_file_path="$HOME/out",
 *                         ),
 *                         enforce=gcp.osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceExecEnforceArgs(
 *                             interpreter="SHELL",
 *                             args=["arg1"],
 *                             file=gcp.osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceExecEnforceFileArgs(
 *                                 allow_insecure=True,
 *                                 remote=gcp.osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceExecEnforceFileRemoteArgs(
 *                                     uri="https://www.example.com/script.sh",
 *                                     sha256_checksum="c7938fed83afdccbb0e86a2a2e4cad7d5035012ca3214b4a61268393635c3063",
 *                                 ),
 *                             ),
 *                             output_file_path="$HOME/out",
 *                         ),
 *                     ),
 *                 ),
 *             ],
 *             inventory_filters=[gcp.osconfig.OsPolicyAssignmentOsPolicyResourceGroupInventoryFilterArgs(
 *                 os_short_name="centos",
 *                 os_version="8.*",
 *             )],
 *         )],
 *         allow_no_resource_group_match=False,
 *         description="A test os policy",
 *     )],
 *     rollout=gcp.osconfig.OsPolicyAssignmentRolloutArgs(
 *         disruption_budget=gcp.osconfig.OsPolicyAssignmentRolloutDisruptionBudgetArgs(
 *             percent=100,
 *         ),
 *         min_wait_duration="3s",
 *     ),
 *     description="A test os policy assignment")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var primary = new Gcp.OsConfig.OsPolicyAssignment("primary", new()
 *     {
 *         InstanceFilter = new Gcp.OsConfig.Inputs.OsPolicyAssignmentInstanceFilterArgs
 *         {
 *             All = false,
 *             ExclusionLabels = new[]
 *             {
 *                 new Gcp.OsConfig.Inputs.OsPolicyAssignmentInstanceFilterExclusionLabelArgs
 *                 {
 *                     Labels =
 *                     {
 *                         { "label-two", "value-two" },
 *                     },
 *                 },
 *             },
 *             InclusionLabels = new[]
 *             {
 *                 new Gcp.OsConfig.Inputs.OsPolicyAssignmentInstanceFilterInclusionLabelArgs
 *                 {
 *                     Labels =
 *                     {
 *                         { "label-one", "value-one" },
 *                     },
 *                 },
 *             },
 *             Inventories = new[]
 *             {
 *                 new Gcp.OsConfig.Inputs.OsPolicyAssignmentInstanceFilterInventoryArgs
 *                 {
 *                     OsShortName = "centos",
 *                     OsVersion = "8.*",
 *                 },
 *             },
 *         },
 *         Location = "us-central1-a",
 *         Name = "policy-assignment",
 *         OsPolicies = new[]
 *         {
 *             new Gcp.OsConfig.Inputs.OsPolicyAssignmentOsPolicyArgs
 *             {
 *                 Id = "policy",
 *                 Mode = "VALIDATION",
 *                 ResourceGroups = new[]
 *                 {
 *                     new Gcp.OsConfig.Inputs.OsPolicyAssignmentOsPolicyResourceGroupArgs
 *                     {
 *                         Resources = new[]
 *                         {
 *                             new Gcp.OsConfig.Inputs.OsPolicyAssignmentOsPolicyResourceGroupResourceArgs
 *                             {
 *                                 Id = "apt-to-yum",
 *                                 Repository = new Gcp.OsConfig.Inputs.OsPolicyAssignmentOsPolicyResourceGroupResourceRepositoryArgs
 *                                 {
 *                                     Apt = new Gcp.OsConfig.Inputs.OsPolicyAssignmentOsPolicyResourceGroupResourceRepositoryAptArgs
 *                                     {
 *                                         ArchiveType = "DEB",
 *                                         Components = new[]
 *                                         {
 *                                             "doc",
 *                                         },
 *                                         Distribution = "debian",
 *                                         Uri = "https://atl.mirrors.clouvider.net/debian",
 *                                         GpgKey = ".gnupg/pubring.kbx",
 *                                     },
 *                                 },
 *                             },
 *                             new Gcp.OsConfig.Inputs.OsPolicyAssignmentOsPolicyResourceGroupResourceArgs
 *                             {
 *                                 Id = "exec1",
 *                                 Exec = new Gcp.OsConfig.Inputs.OsPolicyAssignmentOsPolicyResourceGroupResourceExecArgs
 *                                 {
 *                                     Validate = new Gcp.OsConfig.Inputs.OsPolicyAssignmentOsPolicyResourceGroupResourceExecValidateArgs
 *                                     {
 *                                         Interpreter = "SHELL",
 *                                         Args = new[]
 *                                         {
 *                                             "arg1",
 *                                         },
 *                                         File = new Gcp.OsConfig.Inputs.OsPolicyAssignmentOsPolicyResourceGroupResourceExecValidateFileArgs
 *                                         {
 *                                             LocalPath = "$HOME/script.sh",
 *                                         },
 *                                         OutputFilePath = "$HOME/out",
 *                                     },
 *                                     Enforce = new Gcp.OsConfig.Inputs.OsPolicyAssignmentOsPolicyResourceGroupResourceExecEnforceArgs
 *                                     {
 *                                         Interpreter = "SHELL",
 *                                         Args = new[]
 *                                         {
 *                                             "arg1",
 *                                         },
 *                                         File = new Gcp.OsConfig.Inputs.OsPolicyAssignmentOsPolicyResourceGroupResourceExecEnforceFileArgs
 *                                         {
 *                                             AllowInsecure = true,
 *                                             Remote = new Gcp.OsConfig.Inputs.OsPolicyAssignmentOsPolicyResourceGroupResourceExecEnforceFileRemoteArgs
 *                                             {
 *                                                 Uri = "https://www.example.com/script.sh",
 *                                                 Sha256Checksum = "c7938fed83afdccbb0e86a2a2e4cad7d5035012ca3214b4a61268393635c3063",
 *                                             },
 *                                         },
 *                                         OutputFilePath = "$HOME/out",
 *                                     },
 *                                 },
 *                             },
 *                         },
 *                         InventoryFilters = new[]
 *                         {
 *                             new Gcp.OsConfig.Inputs.OsPolicyAssignmentOsPolicyResourceGroupInventoryFilterArgs
 *                             {
 *                                 OsShortName = "centos",
 *                                 OsVersion = "8.*",
 *                             },
 *                         },
 *                     },
 *                 },
 *                 AllowNoResourceGroupMatch = false,
 *                 Description = "A test os policy",
 *             },
 *         },
 *         Rollout = new Gcp.OsConfig.Inputs.OsPolicyAssignmentRolloutArgs
 *         {
 *             DisruptionBudget = new Gcp.OsConfig.Inputs.OsPolicyAssignmentRolloutDisruptionBudgetArgs
 *             {
 *                 Percent = 100,
 *             },
 *             MinWaitDuration = "3s",
 *         },
 *         Description = "A test os policy assignment",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/osconfig"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := osconfig.NewOsPolicyAssignment(ctx, "primary", &osconfig.OsPolicyAssignmentArgs{
 * 			InstanceFilter: &osconfig.OsPolicyAssignmentInstanceFilterArgs{
 * 				All: pulumi.Bool(false),
 * 				ExclusionLabels: osconfig.OsPolicyAssignmentInstanceFilterExclusionLabelArray{
 * 					&osconfig.OsPolicyAssignmentInstanceFilterExclusionLabelArgs{
 * 						Labels: pulumi.StringMap{
 * 							"label-two": pulumi.String("value-two"),
 * 						},
 * 					},
 * 				},
 * 				InclusionLabels: osconfig.OsPolicyAssignmentInstanceFilterInclusionLabelArray{
 * 					&osconfig.OsPolicyAssignmentInstanceFilterInclusionLabelArgs{
 * 						Labels: pulumi.StringMap{
 * 							"label-one": pulumi.String("value-one"),
 * 						},
 * 					},
 * 				},
 * 				Inventories: osconfig.OsPolicyAssignmentInstanceFilterInventoryArray{
 * 					&osconfig.OsPolicyAssignmentInstanceFilterInventoryArgs{
 * 						OsShortName: pulumi.String("centos"),
 * 						OsVersion:   pulumi.String("8.*"),
 * 					},
 * 				},
 * 			},
 * 			Location: pulumi.String("us-central1-a"),
 * 			Name:     pulumi.String("policy-assignment"),
 * 			OsPolicies: osconfig.OsPolicyAssignmentOsPolicyArray{
 * 				&osconfig.OsPolicyAssignmentOsPolicyArgs{
 * 					Id:   pulumi.String("policy"),
 * 					Mode: pulumi.String("VALIDATION"),
 * 					ResourceGroups: osconfig.OsPolicyAssignmentOsPolicyResourceGroupArray{
 * 						&osconfig.OsPolicyAssignmentOsPolicyResourceGroupArgs{
 * 							Resources: osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceArray{
 * 								&osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceArgs{
 * 									Id: pulumi.String("apt-to-yum"),
 * 									Repository: &osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceRepositoryArgs{
 * 										Apt: &osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceRepositoryAptArgs{
 * 											ArchiveType: pulumi.String("DEB"),
 * 											Components: pulumi.StringArray{
 * 												pulumi.String("doc"),
 * 											},
 * 											Distribution: pulumi.String("debian"),
 * 											Uri:          pulumi.String("https://atl.mirrors.clouvider.net/debian"),
 * 											GpgKey:       pulumi.String(".gnupg/pubring.kbx"),
 * 										},
 * 									},
 * 								},
 * 								&osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceArgs{
 * 									Id: pulumi.String("exec1"),
 * 									Exec: &osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceExecArgs{
 * 										Validate: &osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceExecValidateArgs{
 * 											Interpreter: pulumi.String("SHELL"),
 * 											Args: pulumi.StringArray{
 * 												pulumi.String("arg1"),
 * 											},
 * 											File: &osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceExecValidateFileArgs{
 * 												LocalPath: pulumi.String("$HOME/script.sh"),
 * 											},
 * 											OutputFilePath: pulumi.String("$HOME/out"),
 * 										},
 * 										Enforce: &osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceExecEnforceArgs{
 * 											Interpreter: pulumi.String("SHELL"),
 * 											Args: pulumi.StringArray{
 * 												pulumi.String("arg1"),
 * 											},
 * 											File: &osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceExecEnforceFileArgs{
 * 												AllowInsecure: pulumi.Bool(true),
 * 												Remote: &osconfig.OsPolicyAssignmentOsPolicyResourceGroupResourceExecEnforceFileRemoteArgs{
 * 													Uri:            pulumi.String("https://www.example.com/script.sh"),
 * 													Sha256Checksum: pulumi.String("c7938fed83afdccbb0e86a2a2e4cad7d5035012ca3214b4a61268393635c3063"),
 * 												},
 * 											},
 * 											OutputFilePath: pulumi.String("$HOME/out"),
 * 										},
 * 									},
 * 								},
 * 							},
 * 							InventoryFilters: osconfig.OsPolicyAssignmentOsPolicyResourceGroupInventoryFilterArray{
 * 								&osconfig.OsPolicyAssignmentOsPolicyResourceGroupInventoryFilterArgs{
 * 									OsShortName: pulumi.String("centos"),
 * 									OsVersion:   pulumi.String("8.*"),
 * 								},
 * 							},
 * 						},
 * 					},
 * 					AllowNoResourceGroupMatch: pulumi.Bool(false),
 * 					Description:               pulumi.String("A test os policy"),
 * 				},
 * 			},
 * 			Rollout: &osconfig.OsPolicyAssignmentRolloutArgs{
 * 				DisruptionBudget: &osconfig.OsPolicyAssignmentRolloutDisruptionBudgetArgs{
 * 					Percent: pulumi.Int(100),
 * 				},
 * 				MinWaitDuration: pulumi.String("3s"),
 * 			},
 * 			Description: pulumi.String("A test os policy assignment"),
 * 		})
 * 		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.gcp.osconfig.OsPolicyAssignment;
 * import com.pulumi.gcp.osconfig.OsPolicyAssignmentArgs;
 * import com.pulumi.gcp.osconfig.inputs.OsPolicyAssignmentInstanceFilterArgs;
 * import com.pulumi.gcp.osconfig.inputs.OsPolicyAssignmentOsPolicyArgs;
 * import com.pulumi.gcp.osconfig.inputs.OsPolicyAssignmentRolloutArgs;
 * import com.pulumi.gcp.osconfig.inputs.OsPolicyAssignmentRolloutDisruptionBudgetArgs;
 * 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 primary = new OsPolicyAssignment("primary", OsPolicyAssignmentArgs.builder()
 *             .instanceFilter(OsPolicyAssignmentInstanceFilterArgs.builder()
 *                 .all(false)
 *                 .exclusionLabels(OsPolicyAssignmentInstanceFilterExclusionLabelArgs.builder()
 *                     .labels(Map.of("label-two", "value-two"))
 *                     .build())
 *                 .inclusionLabels(OsPolicyAssignmentInstanceFilterInclusionLabelArgs.builder()
 *                     .labels(Map.of("label-one", "value-one"))
 *                     .build())
 *                 .inventories(OsPolicyAssignmentInstanceFilterInventoryArgs.builder()
 *                     .osShortName("centos")
 *                     .osVersion("8.*")
 *                     .build())
 *                 .build())
 *             .location("us-central1-a")
 *             .name("policy-assignment")
 *             .osPolicies(OsPolicyAssignmentOsPolicyArgs.builder()
 *                 .id("policy")
 *                 .mode("VALIDATION")
 *                 .resourceGroups(OsPolicyAssignmentOsPolicyResourceGroupArgs.builder()
 *                     .resources(
 *                         OsPolicyAssignmentOsPolicyResourceGroupResourceArgs.builder()
 *                             .id("apt-to-yum")
 *                             .repository(OsPolicyAssignmentOsPolicyResourceGroupResourceRepositoryArgs.builder()
 *                                 .apt(OsPolicyAssignmentOsPolicyResourceGroupResourceRepositoryAptArgs.builder()
 *                                     .archiveType("DEB")
 *                                     .components("doc")
 *                                     .distribution("debian")
 *                                     .uri("https://atl.mirrors.clouvider.net/debian")
 *                                     .gpgKey(".gnupg/pubring.kbx")
 *                                     .build())
 *                                 .build())
 *                             .build(),
 *                         OsPolicyAssignmentOsPolicyResourceGroupResourceArgs.builder()
 *                             .id("exec1")
 *                             .exec(OsPolicyAssignmentOsPolicyResourceGroupResourceExecArgs.builder()
 *                                 .validate(OsPolicyAssignmentOsPolicyResourceGroupResourceExecValidateArgs.builder()
 *                                     .interpreter("SHELL")
 *                                     .args("arg1")
 *                                     .file(OsPolicyAssignmentOsPolicyResourceGroupResourceExecValidateFileArgs.builder()
 *                                         .localPath("$HOME/script.sh")
 *                                         .build())
 *                                     .outputFilePath("$HOME/out")
 *                                     .build())
 *                                 .enforce(OsPolicyAssignmentOsPolicyResourceGroupResourceExecEnforceArgs.builder()
 *                                     .interpreter("SHELL")
 *                                     .args("arg1")
 *                                     .file(OsPolicyAssignmentOsPolicyResourceGroupResourceExecEnforceFileArgs.builder()
 *                                         .allowInsecure(true)
 *                                         .remote(OsPolicyAssignmentOsPolicyResourceGroupResourceExecEnforceFileRemoteArgs.builder()
 *                                             .uri("https://www.example.com/script.sh")
 *                                             .sha256Checksum("c7938fed83afdccbb0e86a2a2e4cad7d5035012ca3214b4a61268393635c3063")
 *                                             .build())
 *                                         .build())
 *                                     .outputFilePath("$HOME/out")
 *                                     .build())
 *                                 .build())
 *                             .build())
 *                     .inventoryFilters(OsPolicyAssignmentOsPolicyResourceGroupInventoryFilterArgs.builder()
 *                         .osShortName("centos")
 *                         .osVersion("8.*")
 *                         .build())
 *                     .build())
 *                 .allowNoResourceGroupMatch(false)
 *                 .description("A test os policy")
 *                 .build())
 *             .rollout(OsPolicyAssignmentRolloutArgs.builder()
 *                 .disruptionBudget(OsPolicyAssignmentRolloutDisruptionBudgetArgs.builder()
 *                     .percent(100)
 *                     .build())
 *                 .minWaitDuration("3s")
 *                 .build())
 *             .description("A test os policy assignment")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   primary:
 *     type: gcp:osconfig:OsPolicyAssignment
 *     properties:
 *       instanceFilter:
 *         all: false
 *         exclusionLabels:
 *           - labels:
 *               label-two: value-two
 *         inclusionLabels:
 *           - labels:
 *               label-one: value-one
 *         inventories:
 *           - osShortName: centos
 *             osVersion: 8.*
 *       location: us-central1-a
 *       name: policy-assignment
 *       osPolicies:
 *         - id: policy
 *           mode: VALIDATION
 *           resourceGroups:
 *             - resources:
 *                 - id: apt-to-yum
 *                   repository:
 *                     apt:
 *                       archiveType: DEB
 *                       components:
 *                         - doc
 *                       distribution: debian
 *                       uri: https://atl.mirrors.clouvider.net/debian
 *                       gpgKey: .gnupg/pubring.kbx
 *                 - id: exec1
 *                   exec:
 *                     validate:
 *                       interpreter: SHELL
 *                       args:
 *                         - arg1
 *                       file:
 *                         localPath: $HOME/script.sh
 *                       outputFilePath: $HOME/out
 *                     enforce:
 *                       interpreter: SHELL
 *                       args:
 *                         - arg1
 *                       file:
 *                         allowInsecure: true
 *                         remote:
 *                           uri: https://www.example.com/script.sh
 *                           sha256Checksum: c7938fed83afdccbb0e86a2a2e4cad7d5035012ca3214b4a61268393635c3063
 *                       outputFilePath: $HOME/out
 *               inventoryFilters:
 *                 - osShortName: centos
 *                   osVersion: 8.*
 *           allowNoResourceGroupMatch: false
 *           description: A test os policy
 *       rollout:
 *         disruptionBudget:
 *           percent: 100
 *         minWaitDuration: 3s
 *       description: A test os policy assignment
 * ```
 * 
 * ## Import
 * OSPolicyAssignment can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/osPolicyAssignments/{{name}}`
 * * `{{project}}/{{location}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, OSPolicyAssignment can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:osconfig/osPolicyAssignment:OsPolicyAssignment default projects/{{project}}/locations/{{location}}/osPolicyAssignments/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:osconfig/osPolicyAssignment:OsPolicyAssignment default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:osconfig/osPolicyAssignment:OsPolicyAssignment default {{location}}/{{name}}
 * ```
 */
public class OsPolicyAssignment internal constructor(
    override val javaResource: com.pulumi.gcp.osconfig.OsPolicyAssignment,
) : KotlinCustomResource(javaResource, OsPolicyAssignmentMapper) {
    /**
     * Output only. Indicates that this revision has been successfully
     * rolled out in this zone and new VMs will be assigned OS policies from this
     * revision. For a given OS policy assignment, there is only one revision with
     * a value of `true` for this field.
     */
    public val baseline: Output
        get() = javaResource.baseline().applyValue({ args0 -> args0 })

    /**
     * Output only. Indicates that this revision deletes the OS policy
     * assignment.
     */
    public val deleted: Output
        get() = javaResource.deleted().applyValue({ args0 -> args0 })

    /**
     * OS policy assignment description. Length of the description is limited to 1024 characters.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The etag for this OS policy assignment. If this is provided on
     * update, it must match the server's etag.
     */
    public val etag: Output
        get() = javaResource.etag().applyValue({ args0 -> args0 })

    /**
     * Filter to select VMs. Structure is
     * documented below.
     */
    public val instanceFilter: Output
        get() = javaResource.instanceFilter().applyValue({ args0 ->
            args0.let({ args0 ->
                osPolicyAssignmentInstanceFilterToKotlin(args0)
            })
        })

    /**
     * The location for the resource
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Resource name.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * List of OS policies to be applied to the VMs.
     * Structure is documented below.
     */
    public val osPolicies: Output>
        get() = javaResource.osPolicies().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    osPolicyAssignmentOsPolicyToKotlin(args0)
                })
            })
        })

    /**
     * The project for the resource
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Output only. Indicates that reconciliation is in progress
     * for the revision. This value is `true` when the `rollout_state` is one of:
     */
    public val reconciling: Output
        get() = javaResource.reconciling().applyValue({ args0 -> args0 })

    /**
     * Output only. The timestamp that the revision was
     * created.
     */
    public val revisionCreateTime: Output
        get() = javaResource.revisionCreateTime().applyValue({ args0 -> args0 })

    /**
     * Output only. The assignment revision ID A new revision is
     * committed whenever a rollout is triggered for a OS policy assignment
     */
    public val revisionId: Output
        get() = javaResource.revisionId().applyValue({ args0 -> args0 })

    /**
     * Rollout to deploy the OS policy assignment. A rollout
     * is triggered in the following situations: 1) OSPolicyAssignment is created.
     * 2) OSPolicyAssignment is updated and the update contains changes to one of
     * the following fields: - instance_filter - os_policies 3) OSPolicyAssignment
     * is deleted. Structure is documented below.
     */
    public val rollout: Output
        get() = javaResource.rollout().applyValue({ args0 ->
            args0.let({ args0 ->
                osPolicyAssignmentRolloutToKotlin(args0)
            })
        })

    /**
     * Output only. OS policy assignment rollout state
     */
    public val rolloutState: Output
        get() = javaResource.rolloutState().applyValue({ args0 -> args0 })

    /**
     * Set to true to skip awaiting rollout during resource creation and update.
     */
    public val skipAwaitRollout: Output?
        get() = javaResource.skipAwaitRollout().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Output only. Server generated unique id for the OS policy assignment
     * resource.
     */
    public val uid: Output
        get() = javaResource.uid().applyValue({ args0 -> args0 })
}

public object OsPolicyAssignmentMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.osconfig.OsPolicyAssignment::class == javaResource::class

    override fun map(javaResource: Resource): OsPolicyAssignment = OsPolicyAssignment(
        javaResource as
            com.pulumi.gcp.osconfig.OsPolicyAssignment,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy