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

com.pulumi.gcp.gkehub.kotlin.Fleet.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.12.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.gkehub.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.gkehub.kotlin.outputs.FleetDefaultClusterConfig
import com.pulumi.gcp.gkehub.kotlin.outputs.FleetState
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.gkehub.kotlin.outputs.FleetDefaultClusterConfig.Companion.toKotlin as fleetDefaultClusterConfigToKotlin
import com.pulumi.gcp.gkehub.kotlin.outputs.FleetState.Companion.toKotlin as fleetStateToKotlin

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

    public var args: FleetArgs = FleetArgs()

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

/**
 * Fleet contains information about a group of clusters.
 * To get more information about Fleet, see:
 * * [API documentation](https://cloud.google.com/anthos/multicluster-management/reference/rest/v1/projects.locations.fleets)
 * * How-to Guides
 *     * [Registering a Cluster to a Fleet](https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster#register_cluster)
 * ## Example Usage
 * ### Gkehub Fleet Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.gkehub.Fleet("default", {
 *     displayName: "my production fleet",
 *     defaultClusterConfig: {
 *         securityPostureConfig: {
 *             mode: "DISABLED",
 *             vulnerabilityMode: "VULNERABILITY_DISABLED",
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.gkehub.Fleet("default",
 *     display_name="my production fleet",
 *     default_cluster_config=gcp.gkehub.FleetDefaultClusterConfigArgs(
 *         security_posture_config=gcp.gkehub.FleetDefaultClusterConfigSecurityPostureConfigArgs(
 *             mode="DISABLED",
 *             vulnerability_mode="VULNERABILITY_DISABLED",
 *         ),
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.GkeHub.Fleet("default", new()
 *     {
 *         DisplayName = "my production fleet",
 *         DefaultClusterConfig = new Gcp.GkeHub.Inputs.FleetDefaultClusterConfigArgs
 *         {
 *             SecurityPostureConfig = new Gcp.GkeHub.Inputs.FleetDefaultClusterConfigSecurityPostureConfigArgs
 *             {
 *                 Mode = "DISABLED",
 *                 VulnerabilityMode = "VULNERABILITY_DISABLED",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkehub"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := gkehub.NewFleet(ctx, "default", &gkehub.FleetArgs{
 * 			DisplayName: pulumi.String("my production fleet"),
 * 			DefaultClusterConfig: &gkehub.FleetDefaultClusterConfigArgs{
 * 				SecurityPostureConfig: &gkehub.FleetDefaultClusterConfigSecurityPostureConfigArgs{
 * 					Mode:              pulumi.String("DISABLED"),
 * 					VulnerabilityMode: pulumi.String("VULNERABILITY_DISABLED"),
 * 				},
 * 			},
 * 		})
 * 		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.gkehub.Fleet;
 * import com.pulumi.gcp.gkehub.FleetArgs;
 * import com.pulumi.gcp.gkehub.inputs.FleetDefaultClusterConfigArgs;
 * import com.pulumi.gcp.gkehub.inputs.FleetDefaultClusterConfigSecurityPostureConfigArgs;
 * 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 default_ = new Fleet("default", FleetArgs.builder()
 *             .displayName("my production fleet")
 *             .defaultClusterConfig(FleetDefaultClusterConfigArgs.builder()
 *                 .securityPostureConfig(FleetDefaultClusterConfigSecurityPostureConfigArgs.builder()
 *                     .mode("DISABLED")
 *                     .vulnerabilityMode("VULNERABILITY_DISABLED")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:gkehub:Fleet
 *     properties:
 *       displayName: my production fleet
 *       defaultClusterConfig:
 *         securityPostureConfig:
 *           mode: DISABLED
 *           vulnerabilityMode: VULNERABILITY_DISABLED
 * ```
 * 
 * ## Import
 * Fleet can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/global/fleets/default`
 * * `{{project}}`
 * When using the `pulumi import` command, Fleet can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:gkehub/fleet:Fleet default projects/{{project}}/locations/global/fleets/default
 * ```
 * ```sh
 * $ pulumi import gcp:gkehub/fleet:Fleet default {{project}}
 * ```
 */
public class Fleet internal constructor(
    override val javaResource: com.pulumi.gcp.gkehub.Fleet,
) : KotlinCustomResource(javaResource, FleetMapper) {
    /**
     * The time the fleet was created, in RFC3339 text format.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * The default cluster configurations to apply across the fleet.
     * Structure is documented below.
     */
    public val defaultClusterConfig: Output?
        get() = javaResource.defaultClusterConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> fleetDefaultClusterConfigToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The time the fleet was deleted, in RFC3339 text format.
     */
    public val deleteTime: Output
        get() = javaResource.deleteTime().applyValue({ args0 -> args0 })

    /**
     * A user-assigned display name of the Fleet. When present, it must be between 4 to 30 characters.
     * Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point.
     */
    public val displayName: Output?
        get() = javaResource.displayName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The state of the fleet resource.
     * Structure is documented below.
     */
    public val states: Output>
        get() = javaResource.states().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    fleetStateToKotlin(args0)
                })
            })
        })

    /**
     * Google-generated UUID for this resource. This is unique across all
     * Fleet resources. If a Fleet resource is deleted and another
     * resource with the same name is created, it gets a different uid.
     */
    public val uid: Output
        get() = javaResource.uid().applyValue({ args0 -> args0 })

    /**
     * The time the fleet was last updated, in RFC3339 text format.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object FleetMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.gkehub.Fleet::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy