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

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

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.containeranalysis.OccurenceArgs.builder
import com.pulumi.gcp.containeranalysis.kotlin.inputs.OccurenceAttestationArgs
import com.pulumi.gcp.containeranalysis.kotlin.inputs.OccurenceAttestationArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmName

/**
 * An occurrence is an instance of a Note, or type of analysis that
 * can be done for a resource.
 * To get more information about Occurrence, see:
 * * [API documentation](https://cloud.google.com/container-analysis/api/reference/rest/)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/container-analysis/)
 * ## Example Usage
 * ### Container Analysis Occurrence Kms
 * 
 * ```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 com.pulumi.gcp.kms.KmsFunctions;
 * import com.pulumi.gcp.kms.inputs.GetKMSKeyRingArgs;
 * import com.pulumi.gcp.kms.inputs.GetKMSCryptoKeyArgs;
 * import com.pulumi.gcp.kms.inputs.GetKMSCryptoKeyVersionArgs;
 * import com.pulumi.gcp.binaryauthorization.Attestor;
 * import com.pulumi.gcp.binaryauthorization.AttestorArgs;
 * import com.pulumi.gcp.binaryauthorization.inputs.AttestorAttestationAuthorityNoteArgs;
 * import com.pulumi.gcp.containeranalysis.Occurence;
 * import com.pulumi.gcp.containeranalysis.OccurenceArgs;
 * import com.pulumi.gcp.containeranalysis.inputs.OccurenceAttestationArgs;
 * 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("attestation-note")
 *             .attestationAuthority(NoteAttestationAuthorityArgs.builder()
 *                 .hint(NoteAttestationAuthorityHintArgs.builder()
 *                     .humanReadableName("Attestor Note")
 *                     .build())
 *                 .build())
 *             .build());
 *         final var keyring = KmsFunctions.getKMSKeyRing(GetKMSKeyRingArgs.builder()
 *             .name("my-key-ring")
 *             .location("global")
 *             .build());
 *         final var crypto-key = KmsFunctions.getKMSCryptoKey(GetKMSCryptoKeyArgs.builder()
 *             .name("my-key")
 *             .keyRing(keyring.applyValue(getKMSKeyRingResult -> getKMSKeyRingResult.id()))
 *             .build());
 *         final var version = KmsFunctions.getKMSCryptoKeyVersion(GetKMSCryptoKeyVersionArgs.builder()
 *             .cryptoKey(crypto_key.id())
 *             .build());
 *         var attestor = new Attestor("attestor", AttestorArgs.builder()
 *             .name("attestor")
 *             .attestationAuthorityNote(AttestorAttestationAuthorityNoteArgs.builder()
 *                 .noteReference(note.name())
 *                 .publicKeys(AttestorAttestationAuthorityNotePublicKeyArgs.builder()
 *                     .id(version.applyValue(getKMSCryptoKeyVersionResult -> getKMSCryptoKeyVersionResult.id()))
 *                     .pkixPublicKey(AttestorAttestationAuthorityNotePublicKeyPkixPublicKeyArgs.builder()
 *                         .publicKeyPem(version.applyValue(getKMSCryptoKeyVersionResult -> getKMSCryptoKeyVersionResult.publicKeys()[0].pem()))
 *                         .signatureAlgorithm(version.applyValue(getKMSCryptoKeyVersionResult -> getKMSCryptoKeyVersionResult.publicKeys()[0].algorithm()))
 *                         .build())
 *                     .build())
 *                 .build())
 *             .build());
 *         var occurrence = new Occurence("occurrence", OccurenceArgs.builder()
 *             .resourceUri("gcr.io/my-project/my-image")
 *             .noteName(note.id())
 *             .attestation(OccurenceAttestationArgs.builder()
 *                 .serializedPayload(StdFunctions.filebase64(Filebase64Args.builder()
 *                     .input("path/to/my/payload.json")
 *                     .build()).result())
 *                 .signatures(OccurenceAttestationSignatureArgs.builder()
 *                     .publicKeyId(version.applyValue(getKMSCryptoKeyVersionResult -> getKMSCryptoKeyVersionResult.id()))
 *                     .serializedPayload(StdFunctions.filebase64(Filebase64Args.builder()
 *                         .input("path/to/my/payload.json.sig")
 *                         .build()).result())
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   attestor:
 *     type: gcp:binaryauthorization:Attestor
 *     properties:
 *       name: attestor
 *       attestationAuthorityNote:
 *         noteReference: ${note.name}
 *         publicKeys:
 *           - id: ${version.id}
 *             pkixPublicKey:
 *               publicKeyPem: ${version.publicKeys[0].pem}
 *               signatureAlgorithm: ${version.publicKeys[0].algorithm}
 *   note:
 *     type: gcp:containeranalysis:Note
 *     properties:
 *       name: attestation-note
 *       attestationAuthority:
 *         hint:
 *           humanReadableName: Attestor Note
 *   occurrence:
 *     type: gcp:containeranalysis:Occurence
 *     properties:
 *       resourceUri: gcr.io/my-project/my-image
 *       noteName: ${note.id}
 *       attestation:
 *         serializedPayload:
 *           fn::invoke:
 *             Function: std:filebase64
 *             Arguments:
 *               input: path/to/my/payload.json
 *             Return: result
 *         signatures:
 *           - publicKeyId: ${version.id}
 *             serializedPayload:
 *               fn::invoke:
 *                 Function: std:filebase64
 *                 Arguments:
 *                   input: path/to/my/payload.json.sig
 *                 Return: result
 * variables:
 *   keyring:
 *     fn::invoke:
 *       Function: gcp:kms:getKMSKeyRing
 *       Arguments:
 *         name: my-key-ring
 *         location: global
 *   crypto-key:
 *     fn::invoke:
 *       Function: gcp:kms:getKMSCryptoKey
 *       Arguments:
 *         name: my-key
 *         keyRing: ${keyring.id}
 *   version:
 *     fn::invoke:
 *       Function: gcp:kms:getKMSCryptoKeyVersion
 *       Arguments:
 *         cryptoKey: ${["crypto-key"].id}
 * ```
 * 
 * ## Import
 * Occurrence can be imported using any of these accepted formats:
 * * `projects/{{project}}/occurrences/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, Occurrence can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:containeranalysis/occurence:Occurence default projects/{{project}}/occurrences/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:containeranalysis/occurence:Occurence default {{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:containeranalysis/occurence:Occurence default {{name}}
 * ```
 * @property attestation Occurrence that represents a single "attestation". The authenticity
 * of an attestation can be verified using the attached signature.
 * If the verifier trusts the public key of the signer, then verifying
 * the signature is sufficient to establish trust. In this circumstance,
 * the authority to which this attestation is attached is primarily
 * useful for lookup (how to find this attestation if you already
 * know the authority and artifact to be verified) and intent (for
 * which authority this attestation was intended to sign.
 * Structure is documented below.
 * @property noteName The analysis note associated with this occurrence, in the form of
 * projects/[PROJECT]/notes/[NOTE_ID]. This field can be used as a
 * filter in list requests.
 * @property project
 * @property remediation A description of actions that can be taken to remedy the note.
 * @property resourceUri Required. Immutable. A URI that represents the resource for which
 * the occurrence applies. For example,
 * https://gcr.io/project/image@sha256:123abc for a Docker image.
 */
public data class OccurenceArgs(
    public val attestation: Output? = null,
    public val noteName: Output? = null,
    public val project: Output? = null,
    public val remediation: Output? = null,
    public val resourceUri: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.containeranalysis.OccurenceArgs =
        com.pulumi.gcp.containeranalysis.OccurenceArgs.builder()
            .attestation(attestation?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .noteName(noteName?.applyValue({ args0 -> args0 }))
            .project(project?.applyValue({ args0 -> args0 }))
            .remediation(remediation?.applyValue({ args0 -> args0 }))
            .resourceUri(resourceUri?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [OccurenceArgs].
 */
@PulumiTagMarker
public class OccurenceArgsBuilder internal constructor() {
    private var attestation: Output? = null

    private var noteName: Output? = null

    private var project: Output? = null

    private var remediation: Output? = null

    private var resourceUri: Output? = null

    /**
     * @param value Occurrence that represents a single "attestation". The authenticity
     * of an attestation can be verified using the attached signature.
     * If the verifier trusts the public key of the signer, then verifying
     * the signature is sufficient to establish trust. In this circumstance,
     * the authority to which this attestation is attached is primarily
     * useful for lookup (how to find this attestation if you already
     * know the authority and artifact to be verified) and intent (for
     * which authority this attestation was intended to sign.
     * Structure is documented below.
     */
    @JvmName("quimyipepobyfpqk")
    public suspend fun attestation(`value`: Output) {
        this.attestation = value
    }

    /**
     * @param value The analysis note associated with this occurrence, in the form of
     * projects/[PROJECT]/notes/[NOTE_ID]. This field can be used as a
     * filter in list requests.
     */
    @JvmName("xctndjyjywnwqakg")
    public suspend fun noteName(`value`: Output) {
        this.noteName = value
    }

    /**
     * @param value
     */
    @JvmName("lnptcymxybmfdenu")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value A description of actions that can be taken to remedy the note.
     */
    @JvmName("yrfgyawpbbrplfpu")
    public suspend fun remediation(`value`: Output) {
        this.remediation = value
    }

    /**
     * @param value Required. Immutable. A URI that represents the resource for which
     * the occurrence applies. For example,
     * https://gcr.io/project/image@sha256:123abc for a Docker image.
     */
    @JvmName("ynhyunivuaijgdli")
    public suspend fun resourceUri(`value`: Output) {
        this.resourceUri = value
    }

    /**
     * @param value Occurrence that represents a single "attestation". The authenticity
     * of an attestation can be verified using the attached signature.
     * If the verifier trusts the public key of the signer, then verifying
     * the signature is sufficient to establish trust. In this circumstance,
     * the authority to which this attestation is attached is primarily
     * useful for lookup (how to find this attestation if you already
     * know the authority and artifact to be verified) and intent (for
     * which authority this attestation was intended to sign.
     * Structure is documented below.
     */
    @JvmName("osbulxxxaidmmood")
    public suspend fun attestation(`value`: OccurenceAttestationArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.attestation = mapped
    }

    /**
     * @param argument Occurrence that represents a single "attestation". The authenticity
     * of an attestation can be verified using the attached signature.
     * If the verifier trusts the public key of the signer, then verifying
     * the signature is sufficient to establish trust. In this circumstance,
     * the authority to which this attestation is attached is primarily
     * useful for lookup (how to find this attestation if you already
     * know the authority and artifact to be verified) and intent (for
     * which authority this attestation was intended to sign.
     * Structure is documented below.
     */
    @JvmName("dyokemslfvsurlnw")
    public suspend fun attestation(argument: suspend OccurenceAttestationArgsBuilder.() -> Unit) {
        val toBeMapped = OccurenceAttestationArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.attestation = mapped
    }

    /**
     * @param value The analysis note associated with this occurrence, in the form of
     * projects/[PROJECT]/notes/[NOTE_ID]. This field can be used as a
     * filter in list requests.
     */
    @JvmName("sgqglvvdplpdeohr")
    public suspend fun noteName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.noteName = mapped
    }

    /**
     * @param value
     */
    @JvmName("llutipswcvuwknjd")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value A description of actions that can be taken to remedy the note.
     */
    @JvmName("ubcdjgxcbafbcnne")
    public suspend fun remediation(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.remediation = mapped
    }

    /**
     * @param value Required. Immutable. A URI that represents the resource for which
     * the occurrence applies. For example,
     * https://gcr.io/project/image@sha256:123abc for a Docker image.
     */
    @JvmName("xgxxhdrrpiirvckt")
    public suspend fun resourceUri(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceUri = mapped
    }

    internal fun build(): OccurenceArgs = OccurenceArgs(
        attestation = attestation,
        noteName = noteName,
        project = project,
        remediation = remediation,
        resourceUri = resourceUri,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy