com.pulumi.gcp.sourcerepo.kotlin.SourcerepoFunctions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.sourcerepo.kotlin
import com.pulumi.gcp.sourcerepo.SourcerepoFunctions.getRepositoryIamPolicyPlain
import com.pulumi.gcp.sourcerepo.SourcerepoFunctions.getRepositoryPlain
import com.pulumi.gcp.sourcerepo.kotlin.inputs.GetRepositoryIamPolicyPlainArgs
import com.pulumi.gcp.sourcerepo.kotlin.inputs.GetRepositoryIamPolicyPlainArgsBuilder
import com.pulumi.gcp.sourcerepo.kotlin.inputs.GetRepositoryPlainArgs
import com.pulumi.gcp.sourcerepo.kotlin.inputs.GetRepositoryPlainArgsBuilder
import com.pulumi.gcp.sourcerepo.kotlin.outputs.GetRepositoryIamPolicyResult
import com.pulumi.gcp.sourcerepo.kotlin.outputs.GetRepositoryResult
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.gcp.sourcerepo.kotlin.outputs.GetRepositoryIamPolicyResult.Companion.toKotlin as getRepositoryIamPolicyResultToKotlin
import com.pulumi.gcp.sourcerepo.kotlin.outputs.GetRepositoryResult.Companion.toKotlin as getRepositoryResultToKotlin
public object SourcerepoFunctions {
/**
* Get infomation about an existing Google Cloud Source Repository.
* For more information see [the official documentation](https://cloud.google.com/source-repositories)
* and
* [API](https://cloud.google.com/source-repositories/docs/reference/rest/v1/projects.repos).
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const my-repo = gcp.sourcerepo.getRepository({
* name: "my-repository",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* my_repo = gcp.sourcerepo.get_repository(name="my-repository")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var my_repo = Gcp.SourceRepo.GetRepository.Invoke(new()
* {
* Name = "my-repository",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sourcerepo"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := sourcerepo.LookupRepository(ctx, &sourcerepo.LookupRepositoryArgs{
* Name: "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.sourcerepo.SourcerepoFunctions;
* import com.pulumi.gcp.sourcerepo.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 = SourcerepoFunctions.getRepository(GetRepositoryArgs.builder()
* .name("my-repository")
* .build());
* }
* }
* ```
* ```yaml
* variables:
* my-repo:
* fn::invoke:
* Function: gcp:sourcerepo:getRepository
* Arguments:
* name: 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 name Resource name of the repository. The repo name may contain slashes. eg, `name/with/slash`
* @param project The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
* @return A collection of values returned by getRepository.
*/
public suspend fun getRepository(name: String, project: String? = null): GetRepositoryResult {
val argument = GetRepositoryPlainArgs(
name = name,
project = project,
)
return getRepositoryResultToKotlin(getRepositoryPlain(argument.toJava()).await())
}
/**
* @see [getRepository].
* @param argument Builder for [com.pulumi.gcp.sourcerepo.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.sourcerepo.getRepositoryIamPolicy({
* project: my_repo.project,
* repository: my_repo.name,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* policy = gcp.sourcerepo.get_repository_iam_policy(project=my_repo["project"],
* 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.SourceRepo.GetRepositoryIamPolicy.Invoke(new()
* {
* Project = my_repo.Project,
* Repository = my_repo.Name,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sourcerepo"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := sourcerepo.LookupRepositoryIamPolicy(ctx, &sourcerepo.LookupRepositoryIamPolicyArgs{
* Project: pulumi.StringRef(my_repo.Project),
* 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.sourcerepo.SourcerepoFunctions;
* import com.pulumi.gcp.sourcerepo.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 = SourcerepoFunctions.getRepositoryIamPolicy(GetRepositoryIamPolicyArgs.builder()
* .project(my_repo.project())
* .repository(my_repo.name())
* .build());
* }
* }
* ```
* ```yaml
* variables:
* policy:
* fn::invoke:
* Function: gcp:sourcerepo:getRepositoryIamPolicy
* Arguments:
* project: ${["my-repo"].project}
* 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 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(project: String? = null, repository: String): GetRepositoryIamPolicyResult {
val argument = GetRepositoryIamPolicyPlainArgs(
project = project,
repository = repository,
)
return getRepositoryIamPolicyResultToKotlin(getRepositoryIamPolicyPlain(argument.toJava()).await())
}
/**
* @see [getRepositoryIamPolicy].
* @param argument Builder for [com.pulumi.gcp.sourcerepo.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