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

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

package com.pulumi.gcp.developerconnect.kotlin

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.Map

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

    public var args: GitRepositoryLinkArgs = GitRepositoryLinkArgs()

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

/**
 * ## Example Usage
 * ### Developer Connect Git Repository Link Github Doc
 * 
 * ```yaml
 * resources:
 *   github-token-secret:
 *     type: gcp:secretmanager:Secret
 *     properties:
 *       secretId: github-token-secret
 *       replication:
 *         auto: {}
 *   github-token-secret-version:
 *     type: gcp:secretmanager:SecretVersion
 *     properties:
 *       secret: ${["github-token-secret"].id}
 *       secretData:
 *         fn::invoke:
 *           function: std:file
 *           arguments:
 *             input: my-github-token.txt
 *           return: result
 *   policy:
 *     type: gcp:secretmanager:SecretIamPolicy
 *     properties:
 *       secretId: ${["github-token-secret"].secretId}
 *       policyData: ${["p4sa-secretAccessor"].policyData}
 *   my-connection:
 *     type: gcp:developerconnect:Connection
 *     properties:
 *       location: us-central1
 *       connectionId: my-connection
 *       githubConfig:
 *         githubApp: DEVELOPER_CONNECT
 *         appInstallationId: 123123
 *         authorizerCredential:
 *           oauthTokenSecretVersion: ${["github-token-secret-version"].id}
 *   my-repository:
 *     type: gcp:developerconnect:GitRepositoryLink
 *     properties:
 *       location: us-central1
 *       gitRepositoryLinkId: my-repo
 *       parentConnection: ${["my-connection"].connectionId}
 *       remoteUri: https://github.com/myuser/myrepo.git
 * variables:
 *   p4sa-secretAccessor:
 *     fn::invoke:
 *       function: gcp:organizations:getIAMPolicy
 *       arguments:
 *         bindings:
 *           - role: roles/secretmanager.secretAccessor
 *             members:
 *               - serviceAccount:[email protected]
 * ```
 * 
 * ## Import
 * GitRepositoryLink can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks/{{git_repository_link_id}}`
 * * `{{project}}/{{location}}/{{parent_connection}}/{{git_repository_link_id}}`
 * * `{{location}}/{{parent_connection}}/{{git_repository_link_id}}`
 * When using the `pulumi import` command, GitRepositoryLink can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:developerconnect/gitRepositoryLink:GitRepositoryLink default projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks/{{git_repository_link_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:developerconnect/gitRepositoryLink:GitRepositoryLink default {{project}}/{{location}}/{{parent_connection}}/{{git_repository_link_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:developerconnect/gitRepositoryLink:GitRepositoryLink default {{location}}/{{parent_connection}}/{{git_repository_link_id}}
 * ```
 */
public class GitRepositoryLink internal constructor(
    override val javaResource: com.pulumi.gcp.developerconnect.GitRepositoryLink,
) : KotlinCustomResource(javaResource, GitRepositoryLinkMapper) {
    /**
     * Optional. Allows clients to store small amounts of arbitrary data.
     * **Note**: This field is non-authoritative, and will only manage the annotations present in your configuration.
     * Please refer to the field `effective_annotations` for all of the annotations present on the resource.
     */
    public val annotations: Output>?
        get() = javaResource.annotations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Required. Git Clone URI.
     */
    public val cloneUri: Output
        get() = javaResource.cloneUri().applyValue({ args0 -> args0 })

    /**
     * Output only. [Output only] Create timestamp
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * Output only. [Output only] Delete timestamp
     */
    public val deleteTime: Output
        get() = javaResource.deleteTime().applyValue({ args0 -> args0 })

    public val effectiveAnnotations: Output>
        get() = javaResource.effectiveAnnotations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
     */
    public val effectiveLabels: Output>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Optional. This checksum is computed by the server based on the value of other
     * fields, and may be sent on update and delete requests to ensure the
     * client has an up-to-date value before proceeding.
     */
    public val etag: Output?
        get() = javaResource.etag().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Required. The ID to use for the repository, which will become the final component of
     * the repository's resource name. This ID should be unique in the connection.
     * Allows alphanumeric characters and any of -._~%!$&'()*+,;=@.
     * - - -
     */
    public val gitRepositoryLinkId: Output
        get() = javaResource.gitRepositoryLinkId().applyValue({ args0 -> args0 })

    /**
     * Optional. Labels as key value pairs
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. See documentation for resource type `developerconnect.googleapis.com/GitRepositoryLink`.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Identifier. Resource name of the repository, in the format
     * `projects/*/locations/*/connections/*/gitRepositoryLinks/*`.
     * */*/*/*/
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. See documentation for resource type `developerconnect.googleapis.com/GitRepositoryLink`.
     */
    public val parentConnection: Output
        get() = javaResource.parentConnection().applyValue({ args0 -> args0 })

    /**
     * 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 combination of labels configured directly on the resource
     * and default labels configured on the provider.
     */
    public val pulumiLabels: Output>
        get() = javaResource.pulumiLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Output only. Set to true when the connection is being set up or updated in the
     * background.
     */
    public val reconciling: Output
        get() = javaResource.reconciling().applyValue({ args0 -> args0 })

    /**
     * Output only. A system-assigned unique identifier for a the GitRepositoryLink.
     */
    public val uid: Output
        get() = javaResource.uid().applyValue({ args0 -> args0 })

    /**
     * Output only. [Output only] Update timestamp
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object GitRepositoryLinkMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.developerconnect.GitRepositoryLink::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy