com.pulumi.gcp.sourcerepo.kotlin.Repository.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.core.Output
import com.pulumi.gcp.sourcerepo.kotlin.outputs.RepositoryPubsubConfig
import com.pulumi.gcp.sourcerepo.kotlin.outputs.RepositoryPubsubConfig.Companion.toKotlin
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
/**
* Builder for [Repository].
*/
@PulumiTagMarker
public class RepositoryResourceBuilder internal constructor() {
public var name: String? = null
public var args: RepositoryArgs = RepositoryArgs()
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 RepositoryArgsBuilder.() -> Unit) {
val builder = RepositoryArgsBuilder()
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(): Repository {
val builtJavaResource = com.pulumi.gcp.sourcerepo.Repository(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Repository(builtJavaResource)
}
}
/**
* A repository (or repo) is a Git repository storing versioned source content.
* To get more information about Repository, see:
* * [API documentation](https://cloud.google.com/source-repositories/docs/reference/rest/v1/projects.repos)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/source-repositories/)
* ## Example Usage
* ### Sourcerepo Repository Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const my_repo = new gcp.sourcerepo.Repository("my-repo", {name: "my/repository"});
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* my_repo = gcp.sourcerepo.Repository("my-repo", name="my/repository")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var my_repo = new Gcp.SourceRepo.Repository("my-repo", 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.NewRepository(ctx, "my-repo", &sourcerepo.RepositoryArgs{
* Name: pulumi.String("my/repository"),
* })
* 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.Repository;
* import com.pulumi.gcp.sourcerepo.RepositoryArgs;
* 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 my_repo = new Repository("my-repo", RepositoryArgs.builder()
* .name("my/repository")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* my-repo:
* type: gcp:sourcerepo:Repository
* properties:
* name: my/repository
* ```
*
* ### Sourcerepo Repository Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const testAccount = new gcp.serviceaccount.Account("test_account", {
* accountId: "my-account",
* displayName: "Test Service Account",
* });
* const topic = new gcp.pubsub.Topic("topic", {name: "my-topic"});
* const my_repo = new gcp.sourcerepo.Repository("my-repo", {
* name: "my-repository",
* pubsubConfigs: [{
* topic: topic.id,
* messageFormat: "JSON",
* serviceAccountEmail: testAccount.email,
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* test_account = gcp.serviceaccount.Account("test_account",
* account_id="my-account",
* display_name="Test Service Account")
* topic = gcp.pubsub.Topic("topic", name="my-topic")
* my_repo = gcp.sourcerepo.Repository("my-repo",
* name="my-repository",
* pubsub_configs=[gcp.sourcerepo.RepositoryPubsubConfigArgs(
* topic=topic.id,
* message_format="JSON",
* service_account_email=test_account.email,
* )])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var testAccount = new Gcp.ServiceAccount.Account("test_account", new()
* {
* AccountId = "my-account",
* DisplayName = "Test Service Account",
* });
* var topic = new Gcp.PubSub.Topic("topic", new()
* {
* Name = "my-topic",
* });
* var my_repo = new Gcp.SourceRepo.Repository("my-repo", new()
* {
* Name = "my-repository",
* PubsubConfigs = new[]
* {
* new Gcp.SourceRepo.Inputs.RepositoryPubsubConfigArgs
* {
* Topic = topic.Id,
* MessageFormat = "JSON",
* ServiceAccountEmail = testAccount.Email,
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/serviceaccount"
* "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 {
* testAccount, err := serviceaccount.NewAccount(ctx, "test_account", &serviceaccount.AccountArgs{
* AccountId: pulumi.String("my-account"),
* DisplayName: pulumi.String("Test Service Account"),
* })
* if err != nil {
* return err
* }
* topic, err := pubsub.NewTopic(ctx, "topic", &pubsub.TopicArgs{
* Name: pulumi.String("my-topic"),
* })
* if err != nil {
* return err
* }
* _, err = sourcerepo.NewRepository(ctx, "my-repo", &sourcerepo.RepositoryArgs{
* Name: pulumi.String("my-repository"),
* PubsubConfigs: sourcerepo.RepositoryPubsubConfigArray{
* &sourcerepo.RepositoryPubsubConfigArgs{
* Topic: topic.ID(),
* MessageFormat: pulumi.String("JSON"),
* ServiceAccountEmail: testAccount.Email,
* },
* },
* })
* 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.serviceaccount.Account;
* import com.pulumi.gcp.serviceaccount.AccountArgs;
* import com.pulumi.gcp.pubsub.Topic;
* import com.pulumi.gcp.pubsub.TopicArgs;
* import com.pulumi.gcp.sourcerepo.Repository;
* import com.pulumi.gcp.sourcerepo.RepositoryArgs;
* import com.pulumi.gcp.sourcerepo.inputs.RepositoryPubsubConfigArgs;
* 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 testAccount = new Account("testAccount", AccountArgs.builder()
* .accountId("my-account")
* .displayName("Test Service Account")
* .build());
* var topic = new Topic("topic", TopicArgs.builder()
* .name("my-topic")
* .build());
* var my_repo = new Repository("my-repo", RepositoryArgs.builder()
* .name("my-repository")
* .pubsubConfigs(RepositoryPubsubConfigArgs.builder()
* .topic(topic.id())
* .messageFormat("JSON")
* .serviceAccountEmail(testAccount.email())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* testAccount:
* type: gcp:serviceaccount:Account
* name: test_account
* properties:
* accountId: my-account
* displayName: Test Service Account
* topic:
* type: gcp:pubsub:Topic
* properties:
* name: my-topic
* my-repo:
* type: gcp:sourcerepo:Repository
* properties:
* name: my-repository
* pubsubConfigs:
* - topic: ${topic.id}
* messageFormat: JSON
* serviceAccountEmail: ${testAccount.email}
* ```
*
* ## Import
* Repository can be imported using any of these accepted formats:
* * `projects/{{project}}/repos/{{name}}`
* * `{{name}}`
* When using the `pulumi import` command, Repository can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:sourcerepo/repository:Repository default projects/{{project}}/repos/{{name}}
* ```
* ```sh
* $ pulumi import gcp:sourcerepo/repository:Repository default {{name}}
* ```
*/
public class Repository internal constructor(
override val javaResource: com.pulumi.gcp.sourcerepo.Repository,
) : KotlinCustomResource(javaResource, RepositoryMapper) {
/**
* Resource name of the repository, of the form `{{repo}}`.
* The repo name may contain slashes. eg, `name/with/slash`
* - - -
*/
public val name: Output
get() = javaResource.name().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 })
/**
* How this repository publishes a change in the repository through Cloud Pub/Sub.
* Keyed by the topic names.
* Structure is documented below.
*/
public val pubsubConfigs: Output>?
get() = javaResource.pubsubConfigs().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 -> args0.let({ args0 -> toKotlin(args0) }) })
}).orElse(null)
})
/**
* The disk usage of the repo, in bytes.
*/
public val size: Output
get() = javaResource.size().applyValue({ args0 -> args0 })
/**
* URL to clone the repository from Google Cloud Source Repositories.
*/
public val url: Output
get() = javaResource.url().applyValue({ args0 -> args0 })
}
public object RepositoryMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.sourcerepo.Repository::class == javaResource::class
override fun map(javaResource: Resource): Repository = Repository(
javaResource as
com.pulumi.gcp.sourcerepo.Repository,
)
}
/**
* @see [Repository].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Repository].
*/
public suspend fun repository(name: String, block: suspend RepositoryResourceBuilder.() -> Unit): Repository {
val builder = RepositoryResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Repository].
* @param name The _unique_ name of the resulting resource.
*/
public fun repository(name: String): Repository {
val builder = RepositoryResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy