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

com.pulumi.gcp.artifactregistry.kotlin.ArtifactregistryFunctions.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.artifactregistry.kotlin

import com.pulumi.gcp.artifactregistry.ArtifactregistryFunctions.getRepositoryIamPolicyPlain
import com.pulumi.gcp.artifactregistry.ArtifactregistryFunctions.getRepositoryPlain
import com.pulumi.gcp.artifactregistry.kotlin.inputs.GetRepositoryIamPolicyPlainArgs
import com.pulumi.gcp.artifactregistry.kotlin.inputs.GetRepositoryIamPolicyPlainArgsBuilder
import com.pulumi.gcp.artifactregistry.kotlin.inputs.GetRepositoryPlainArgs
import com.pulumi.gcp.artifactregistry.kotlin.inputs.GetRepositoryPlainArgsBuilder
import com.pulumi.gcp.artifactregistry.kotlin.outputs.GetRepositoryIamPolicyResult
import com.pulumi.gcp.artifactregistry.kotlin.outputs.GetRepositoryResult
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.gcp.artifactregistry.kotlin.outputs.GetRepositoryIamPolicyResult.Companion.toKotlin as getRepositoryIamPolicyResultToKotlin
import com.pulumi.gcp.artifactregistry.kotlin.outputs.GetRepositoryResult.Companion.toKotlin as getRepositoryResultToKotlin

public object ArtifactregistryFunctions {
    /**
     * Get information about a Google Artifact Registry Repository. For more information see
     * the [official documentation](https://cloud.google.com/artifact-registry/docs/)
     * and [API](https://cloud.google.com/artifact-registry/docs/apis).
     * ## Example Usage
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as gcp from "@pulumi/gcp";
     * const my-repo = gcp.artifactregistry.getRepository({
     *     location: "us-central1",
     *     repositoryId: "my-repository",
     * });
     * ```
     * ```python
     * import pulumi
     * import pulumi_gcp as gcp
     * my_repo = gcp.artifactregistry.get_repository(location="us-central1",
     *     repository_id="my-repository")
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Gcp = Pulumi.Gcp;
     * return await Deployment.RunAsync(() =>
     * {
     *     var my_repo = Gcp.ArtifactRegistry.GetRepository.Invoke(new()
     *     {
     *         Location = "us-central1",
     *         RepositoryId = "my-repository",
     *     });
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/artifactregistry"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		_, err := artifactregistry.LookupRepository(ctx, &artifactregistry.LookupRepositoryArgs{
     * 			Location:     "us-central1",
     * 			RepositoryId: "my-repository",
     * 		}, nil)
     * 		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.artifactregistry.ArtifactregistryFunctions;
     * import com.pulumi.gcp.artifactregistry.inputs.GetRepositoryArgs;
     * 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) {
     *         final var my-repo = ArtifactregistryFunctions.getRepository(GetRepositoryArgs.builder()
     *             .location("us-central1")
     *             .repositoryId("my-repository")
     *             .build());
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   my-repo:
     *     fn::invoke:
     *       Function: gcp:artifactregistry:getRepository
     *       Arguments:
     *         location: us-central1
     *         repositoryId: my-repository
     * ```
     * 
     * @param argument A collection of arguments for invoking getRepository.
     * @return A collection of values returned by getRepository.
     */
    public suspend fun getRepository(argument: GetRepositoryPlainArgs): GetRepositoryResult =
        getRepositoryResultToKotlin(getRepositoryPlain(argument.toJava()).await())

    /**
     * @see [getRepository].
     * @param location The location of the artifact registry repository. eg us-central1
     * - - -
     * @param project The project in which the resource belongs. If it
     * is not provided, the provider project is used.
     * @param repositoryId The last part of the repository name.
     * @return A collection of values returned by getRepository.
     */
    public suspend fun getRepository(
        location: String,
        project: String? = null,
        repositoryId: String,
    ): GetRepositoryResult {
        val argument = GetRepositoryPlainArgs(
            location = location,
            project = project,
            repositoryId = repositoryId,
        )
        return getRepositoryResultToKotlin(getRepositoryPlain(argument.toJava()).await())
    }

    /**
     * @see [getRepository].
     * @param argument Builder for [com.pulumi.gcp.artifactregistry.kotlin.inputs.GetRepositoryPlainArgs].
     * @return A collection of values returned by getRepository.
     */
    public suspend fun getRepository(argument: suspend GetRepositoryPlainArgsBuilder.() -> Unit): GetRepositoryResult {
        val builder = GetRepositoryPlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return getRepositoryResultToKotlin(getRepositoryPlain(builtArgument.toJava()).await())
    }

    /**
     * Retrieves the current IAM policy data for repository
     * ## example
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as gcp from "@pulumi/gcp";
     * const policy = gcp.artifactregistry.getRepositoryIamPolicy({
     *     project: my_repo.project,
     *     location: my_repo.location,
     *     repository: my_repo.name,
     * });
     * ```
     * ```python
     * import pulumi
     * import pulumi_gcp as gcp
     * policy = gcp.artifactregistry.get_repository_iam_policy(project=my_repo["project"],
     *     location=my_repo["location"],
     *     repository=my_repo["name"])
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Gcp = Pulumi.Gcp;
     * return await Deployment.RunAsync(() =>
     * {
     *     var policy = Gcp.ArtifactRegistry.GetRepositoryIamPolicy.Invoke(new()
     *     {
     *         Project = my_repo.Project,
     *         Location = my_repo.Location,
     *         Repository = my_repo.Name,
     *     });
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/artifactregistry"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		_, err := artifactregistry.LookupRepositoryIamPolicy(ctx, &artifactregistry.LookupRepositoryIamPolicyArgs{
     * 			Project:    pulumi.StringRef(my_repo.Project),
     * 			Location:   pulumi.StringRef(my_repo.Location),
     * 			Repository: my_repo.Name,
     * 		}, nil)
     * 		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.artifactregistry.ArtifactregistryFunctions;
     * import com.pulumi.gcp.artifactregistry.inputs.GetRepositoryIamPolicyArgs;
     * 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) {
     *         final var policy = ArtifactregistryFunctions.getRepositoryIamPolicy(GetRepositoryIamPolicyArgs.builder()
     *             .project(my_repo.project())
     *             .location(my_repo.location())
     *             .repository(my_repo.name())
     *             .build());
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   policy:
     *     fn::invoke:
     *       Function: gcp:artifactregistry:getRepositoryIamPolicy
     *       Arguments:
     *         project: ${["my-repo"].project}
     *         location: ${["my-repo"].location}
     *         repository: ${["my-repo"].name}
     * ```
     * 
     * @param argument A collection of arguments for invoking getRepositoryIamPolicy.
     * @return A collection of values returned by getRepositoryIamPolicy.
     */
    public suspend fun getRepositoryIamPolicy(argument: GetRepositoryIamPolicyPlainArgs): GetRepositoryIamPolicyResult =
        getRepositoryIamPolicyResultToKotlin(getRepositoryIamPolicyPlain(argument.toJava()).await())

    /**
     * @see [getRepositoryIamPolicy].
     * @param location The name of the location this repository is located in.
     * Used to find the parent resource to bind the IAM policy to
     * @param project The ID of the project in which the resource belongs.
     * If it is not provided, the project will be parsed from the identifier of the parent resource. If no project is provided in the parent identifier and no project is specified, the provider project is used.
     * @param repository Used to find the parent resource to bind the IAM policy to
     * @return A collection of values returned by getRepositoryIamPolicy.
     */
    public suspend fun getRepositoryIamPolicy(
        location: String? = null,
        project: String? = null,
        repository: String,
    ): GetRepositoryIamPolicyResult {
        val argument = GetRepositoryIamPolicyPlainArgs(
            location = location,
            project = project,
            repository = repository,
        )
        return getRepositoryIamPolicyResultToKotlin(getRepositoryIamPolicyPlain(argument.toJava()).await())
    }

    /**
     * @see [getRepositoryIamPolicy].
     * @param argument Builder for [com.pulumi.gcp.artifactregistry.kotlin.inputs.GetRepositoryIamPolicyPlainArgs].
     * @return A collection of values returned by getRepositoryIamPolicy.
     */
    public suspend fun getRepositoryIamPolicy(argument: suspend GetRepositoryIamPolicyPlainArgsBuilder.() -> Unit): GetRepositoryIamPolicyResult {
        val builder = GetRepositoryIamPolicyPlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return getRepositoryIamPolicyResultToKotlin(getRepositoryIamPolicyPlain(builtArgument.toJava()).await())
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy