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

com.pulumi.gcp.containeranalysis.kotlin.Note.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.containeranalysis.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.containeranalysis.kotlin.outputs.NoteAttestationAuthority
import com.pulumi.gcp.containeranalysis.kotlin.outputs.NoteRelatedUrl
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.containeranalysis.kotlin.outputs.NoteAttestationAuthority.Companion.toKotlin as noteAttestationAuthorityToKotlin
import com.pulumi.gcp.containeranalysis.kotlin.outputs.NoteRelatedUrl.Companion.toKotlin as noteRelatedUrlToKotlin

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

    public var args: NoteArgs = NoteArgs()

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

/**
 * A Container Analysis note is a high-level piece of metadata that
 * describes a type of analysis that can be done for a resource.
 * To get more information about Note, see:
 * * [API documentation](https://cloud.google.com/container-analysis/api/reference/rest/)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/container-analysis/)
 *     * [Creating Attestations (Occurrences)](https://cloud.google.com/binary-authorization/docs/making-attestations)
 * ## Example Usage
 * ### Container Analysis Note Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const note = new gcp.containeranalysis.Note("note", {
 *     name: "attestor-note",
 *     attestationAuthority: {
 *         hint: {
 *             humanReadableName: "Attestor Note",
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * note = gcp.containeranalysis.Note("note",
 *     name="attestor-note",
 *     attestation_authority=gcp.containeranalysis.NoteAttestationAuthorityArgs(
 *         hint=gcp.containeranalysis.NoteAttestationAuthorityHintArgs(
 *             human_readable_name="Attestor Note",
 *         ),
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var note = new Gcp.ContainerAnalysis.Note("note", new()
 *     {
 *         Name = "attestor-note",
 *         AttestationAuthority = new Gcp.ContainerAnalysis.Inputs.NoteAttestationAuthorityArgs
 *         {
 *             Hint = new Gcp.ContainerAnalysis.Inputs.NoteAttestationAuthorityHintArgs
 *             {
 *                 HumanReadableName = "Attestor Note",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/containeranalysis"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := containeranalysis.NewNote(ctx, "note", &containeranalysis.NoteArgs{
 * 			Name: pulumi.String("attestor-note"),
 * 			AttestationAuthority: &containeranalysis.NoteAttestationAuthorityArgs{
 * 				Hint: &containeranalysis.NoteAttestationAuthorityHintArgs{
 * 					HumanReadableName: pulumi.String("Attestor Note"),
 * 				},
 * 			},
 * 		})
 * 		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.containeranalysis.Note;
 * import com.pulumi.gcp.containeranalysis.NoteArgs;
 * import com.pulumi.gcp.containeranalysis.inputs.NoteAttestationAuthorityArgs;
 * import com.pulumi.gcp.containeranalysis.inputs.NoteAttestationAuthorityHintArgs;
 * 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 note = new Note("note", NoteArgs.builder()
 *             .name("attestor-note")
 *             .attestationAuthority(NoteAttestationAuthorityArgs.builder()
 *                 .hint(NoteAttestationAuthorityHintArgs.builder()
 *                     .humanReadableName("Attestor Note")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   note:
 *     type: gcp:containeranalysis:Note
 *     properties:
 *       name: attestor-note
 *       attestationAuthority:
 *         hint:
 *           humanReadableName: Attestor Note
 * ```
 * 
 * ### Container Analysis Note Attestation Full
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const note = new gcp.containeranalysis.Note("note", {
 *     name: "attestor-note",
 *     shortDescription: "test note",
 *     longDescription: "a longer description of test note",
 *     expirationTime: "2120-10-02T15:01:23.045123456Z",
 *     relatedUrls: [
 *         {
 *             url: "some.url",
 *             label: "foo",
 *         },
 *         {
 *             url: "google.com",
 *         },
 *     ],
 *     attestationAuthority: {
 *         hint: {
 *             humanReadableName: "Attestor Note",
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * note = gcp.containeranalysis.Note("note",
 *     name="attestor-note",
 *     short_description="test note",
 *     long_description="a longer description of test note",
 *     expiration_time="2120-10-02T15:01:23.045123456Z",
 *     related_urls=[
 *         gcp.containeranalysis.NoteRelatedUrlArgs(
 *             url="some.url",
 *             label="foo",
 *         ),
 *         gcp.containeranalysis.NoteRelatedUrlArgs(
 *             url="google.com",
 *         ),
 *     ],
 *     attestation_authority=gcp.containeranalysis.NoteAttestationAuthorityArgs(
 *         hint=gcp.containeranalysis.NoteAttestationAuthorityHintArgs(
 *             human_readable_name="Attestor Note",
 *         ),
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var note = new Gcp.ContainerAnalysis.Note("note", new()
 *     {
 *         Name = "attestor-note",
 *         ShortDescription = "test note",
 *         LongDescription = "a longer description of test note",
 *         ExpirationTime = "2120-10-02T15:01:23.045123456Z",
 *         RelatedUrls = new[]
 *         {
 *             new Gcp.ContainerAnalysis.Inputs.NoteRelatedUrlArgs
 *             {
 *                 Url = "some.url",
 *                 Label = "foo",
 *             },
 *             new Gcp.ContainerAnalysis.Inputs.NoteRelatedUrlArgs
 *             {
 *                 Url = "google.com",
 *             },
 *         },
 *         AttestationAuthority = new Gcp.ContainerAnalysis.Inputs.NoteAttestationAuthorityArgs
 *         {
 *             Hint = new Gcp.ContainerAnalysis.Inputs.NoteAttestationAuthorityHintArgs
 *             {
 *                 HumanReadableName = "Attestor Note",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/containeranalysis"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := containeranalysis.NewNote(ctx, "note", &containeranalysis.NoteArgs{
 * 			Name:             pulumi.String("attestor-note"),
 * 			ShortDescription: pulumi.String("test note"),
 * 			LongDescription:  pulumi.String("a longer description of test note"),
 * 			ExpirationTime:   pulumi.String("2120-10-02T15:01:23.045123456Z"),
 * 			RelatedUrls: containeranalysis.NoteRelatedUrlArray{
 * 				&containeranalysis.NoteRelatedUrlArgs{
 * 					Url:   pulumi.String("some.url"),
 * 					Label: pulumi.String("foo"),
 * 				},
 * 				&containeranalysis.NoteRelatedUrlArgs{
 * 					Url: pulumi.String("google.com"),
 * 				},
 * 			},
 * 			AttestationAuthority: &containeranalysis.NoteAttestationAuthorityArgs{
 * 				Hint: &containeranalysis.NoteAttestationAuthorityHintArgs{
 * 					HumanReadableName: pulumi.String("Attestor Note"),
 * 				},
 * 			},
 * 		})
 * 		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.containeranalysis.Note;
 * import com.pulumi.gcp.containeranalysis.NoteArgs;
 * import com.pulumi.gcp.containeranalysis.inputs.NoteRelatedUrlArgs;
 * import com.pulumi.gcp.containeranalysis.inputs.NoteAttestationAuthorityArgs;
 * import com.pulumi.gcp.containeranalysis.inputs.NoteAttestationAuthorityHintArgs;
 * 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 note = new Note("note", NoteArgs.builder()
 *             .name("attestor-note")
 *             .shortDescription("test note")
 *             .longDescription("a longer description of test note")
 *             .expirationTime("2120-10-02T15:01:23.045123456Z")
 *             .relatedUrls(
 *                 NoteRelatedUrlArgs.builder()
 *                     .url("some.url")
 *                     .label("foo")
 *                     .build(),
 *                 NoteRelatedUrlArgs.builder()
 *                     .url("google.com")
 *                     .build())
 *             .attestationAuthority(NoteAttestationAuthorityArgs.builder()
 *                 .hint(NoteAttestationAuthorityHintArgs.builder()
 *                     .humanReadableName("Attestor Note")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   note:
 *     type: gcp:containeranalysis:Note
 *     properties:
 *       name: attestor-note
 *       shortDescription: test note
 *       longDescription: a longer description of test note
 *       expirationTime: 2120-10-02T15:01:23.045123456Z
 *       relatedUrls:
 *         - url: some.url
 *           label: foo
 *         - url: google.com
 *       attestationAuthority:
 *         hint:
 *           humanReadableName: Attestor Note
 * ```
 * 
 * ## Import
 * Note can be imported using any of these accepted formats:
 * * `projects/{{project}}/notes/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, Note can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:containeranalysis/note:Note default projects/{{project}}/notes/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:containeranalysis/note:Note default {{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:containeranalysis/note:Note default {{name}}
 * ```
 */
public class Note internal constructor(
    override val javaResource: com.pulumi.gcp.containeranalysis.Note,
) : KotlinCustomResource(javaResource, NoteMapper) {
    /**
     * Note kind that represents a logical attestation "role" or "authority".
     * For example, an organization might have one AttestationAuthority for
     * "QA" and one for "build". This Note is intended to act strictly as a
     * grouping mechanism for the attached Occurrences (Attestations). This
     * grouping mechanism also provides a security boundary, since IAM ACLs
     * gate the ability for a principle to attach an Occurrence to a given
     * Note. It also provides a single point of lookup to find all attached
     * Attestation Occurrences, even if they don't all live in the same
     * project.
     * Structure is documented below.
     */
    public val attestationAuthority: Output
        get() = javaResource.attestationAuthority().applyValue({ args0 ->
            args0.let({ args0 ->
                noteAttestationAuthorityToKotlin(args0)
            })
        })

    /**
     * The time this note was created.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * Time of expiration for this note. Leave empty if note does not expire.
     */
    public val expirationTime: Output?
        get() = javaResource.expirationTime().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The type of analysis this note describes
     */
    public val kind: Output
        get() = javaResource.kind().applyValue({ args0 -> args0 })

    /**
     * A detailed description of the note
     */
    public val longDescription: Output?
        get() = javaResource.longDescription().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Names of other notes related to this note.
     */
    public val relatedNoteNames: Output>?
        get() = javaResource.relatedNoteNames().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * URLs associated with this note and related metadata.
     */
    public val relatedUrls: Output>?
        get() = javaResource.relatedUrls().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> noteRelatedUrlToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * A one sentence description of the note.
     */
    public val shortDescription: Output?
        get() = javaResource.shortDescription().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The time this note was last updated.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object NoteMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.containeranalysis.Note::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy