Google Cloud (GCP) Classic

v6.39.0 published on Wednesday, Sep 28, 2022 by Pulumi

Repository

A repository (or repo) is a Git repository storing versioned source content.

To get more information about Repository, see:

Example Usage

Sourcerepo Repository Basic

using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var my_repo = new Gcp.SourceRepo.Repository("my-repo");

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/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", nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.sourcerepo.Repository;
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");

    }
}
import pulumi
import pulumi_gcp as gcp

my_repo = gcp.sourcerepo.Repository("my-repo")
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const my_repo = new gcp.sourcerepo.Repository("my-repo", {});
resources:
  my-repo:
    type: gcp:sourcerepo:Repository

Sourcerepo Repository Full

using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var testAccount = new Gcp.ServiceAccount.Account("testAccount", new()
    {
        AccountId = "my-account",
        DisplayName = "Test Service Account",
    });

    var topic = new Gcp.PubSub.Topic("topic");

    var my_repo = new Gcp.SourceRepo.Repository("my-repo", new()
    {
        PubsubConfigs = new[]
        {
            new Gcp.SourceRepo.Inputs.RepositoryPubsubConfigArgs
            {
                Topic = topic.Id,
                MessageFormat = "JSON",
                ServiceAccountEmail = testAccount.Email,
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/pubsub"
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/serviceAccount"
	"github.com/pulumi/pulumi-gcp/sdk/v6/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, "testAccount", &serviceAccount.AccountArgs{
			AccountId:   pulumi.String("my-account"),
			DisplayName: pulumi.String("Test Service Account"),
		})
		if err != nil {
			return err
		}
		topic, err := pubsub.NewTopic(ctx, "topic", nil)
		if err != nil {
			return err
		}
		_, err = sourcerepo.NewRepository(ctx, "my-repo", &sourcerepo.RepositoryArgs{
			PubsubConfigs: sourcerepo.RepositoryPubsubConfigArray{
				&sourcerepo.RepositoryPubsubConfigArgs{
					Topic:               topic.ID(),
					MessageFormat:       pulumi.String("JSON"),
					ServiceAccountEmail: testAccount.Email,
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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.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");

        var my_repo = new Repository("my-repo", RepositoryArgs.builder()        
            .pubsubConfigs(RepositoryPubsubConfigArgs.builder()
                .topic(topic.id())
                .messageFormat("JSON")
                .serviceAccountEmail(testAccount.email())
                .build())
            .build());

    }
}
import pulumi
import pulumi_gcp as gcp

test_account = gcp.service_account.Account("testAccount",
    account_id="my-account",
    display_name="Test Service Account")
topic = gcp.pubsub.Topic("topic")
my_repo = gcp.sourcerepo.Repository("my-repo", pubsub_configs=[gcp.sourcerepo.RepositoryPubsubConfigArgs(
    topic=topic.id,
    message_format="JSON",
    service_account_email=test_account.email,
)])
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const testAccount = new gcp.serviceaccount.Account("testAccount", {
    accountId: "my-account",
    displayName: "Test Service Account",
});
const topic = new gcp.pubsub.Topic("topic", {});
const my_repo = new gcp.sourcerepo.Repository("my-repo", {pubsubConfigs: [{
    topic: topic.id,
    messageFormat: "JSON",
    serviceAccountEmail: testAccount.email,
}]});
resources:
  testAccount:
    type: gcp:serviceAccount:Account
    properties:
      accountId: my-account
      displayName: Test Service Account
  topic:
    type: gcp:pubsub:Topic
  my-repo:
    type: gcp:sourcerepo:Repository
    properties:
      pubsubConfigs:
        - topic: ${topic.id}
          messageFormat: JSON
          serviceAccountEmail: ${testAccount.email}

Create a Repository Resource

new Repository(name: string, args?: RepositoryArgs, opts?: CustomResourceOptions);
@overload
def Repository(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               name: Optional[str] = None,
               project: Optional[str] = None,
               pubsub_configs: Optional[Sequence[RepositoryPubsubConfigArgs]] = None)
@overload
def Repository(resource_name: str,
               args: Optional[RepositoryArgs] = None,
               opts: Optional[ResourceOptions] = None)
func NewRepository(ctx *Context, name string, args *RepositoryArgs, opts ...ResourceOption) (*Repository, error)
public Repository(string name, RepositoryArgs? args = null, CustomResourceOptions? opts = null)
public Repository(String name, RepositoryArgs args)
public Repository(String name, RepositoryArgs args, CustomResourceOptions options)
type: gcp:sourcerepo:Repository
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args RepositoryArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args RepositoryArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args RepositoryArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args RepositoryArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args RepositoryArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Repository Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Repository resource accepts the following input properties:

Name string

Resource name of the repository, of the form {{repo}}. The repo name may contain slashes. eg, name/with/slash

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

PubsubConfigs List<RepositoryPubsubConfigArgs>

How this repository publishes a change in the repository through Cloud Pub/Sub. Keyed by the topic names. Structure is documented below.

Name string

Resource name of the repository, of the form {{repo}}. The repo name may contain slashes. eg, name/with/slash

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

PubsubConfigs []RepositoryPubsubConfigArgs

How this repository publishes a change in the repository through Cloud Pub/Sub. Keyed by the topic names. Structure is documented below.

name String

Resource name of the repository, of the form {{repo}}. The repo name may contain slashes. eg, name/with/slash

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

pubsubConfigs List<RepositoryPubsubConfigArgs>

How this repository publishes a change in the repository through Cloud Pub/Sub. Keyed by the topic names. Structure is documented below.

name string

Resource name of the repository, of the form {{repo}}. The repo name may contain slashes. eg, name/with/slash

project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

pubsubConfigs RepositoryPubsubConfigArgs[]

How this repository publishes a change in the repository through Cloud Pub/Sub. Keyed by the topic names. Structure is documented below.

name str

Resource name of the repository, of the form {{repo}}. The repo name may contain slashes. eg, name/with/slash

project str

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

pubsub_configs Sequence[RepositoryPubsubConfigArgs]

How this repository publishes a change in the repository through Cloud Pub/Sub. Keyed by the topic names. Structure is documented below.

name String

Resource name of the repository, of the form {{repo}}. The repo name may contain slashes. eg, name/with/slash

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

pubsubConfigs List<Property Map>

How this repository publishes a change in the repository through Cloud Pub/Sub. Keyed by the topic names. Structure is documented below.

Outputs

All input properties are implicitly available as output properties. Additionally, the Repository resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Size int

The disk usage of the repo, in bytes.

Url string

URL to clone the repository from Google Cloud Source Repositories.

Id string

The provider-assigned unique ID for this managed resource.

Size int

The disk usage of the repo, in bytes.

Url string

URL to clone the repository from Google Cloud Source Repositories.

id String

The provider-assigned unique ID for this managed resource.

size Integer

The disk usage of the repo, in bytes.

url String

URL to clone the repository from Google Cloud Source Repositories.

id string

The provider-assigned unique ID for this managed resource.

size number

The disk usage of the repo, in bytes.

url string

URL to clone the repository from Google Cloud Source Repositories.

id str

The provider-assigned unique ID for this managed resource.

size int

The disk usage of the repo, in bytes.

url str

URL to clone the repository from Google Cloud Source Repositories.

id String

The provider-assigned unique ID for this managed resource.

size Number

The disk usage of the repo, in bytes.

url String

URL to clone the repository from Google Cloud Source Repositories.

Look up an Existing Repository Resource

Get an existing Repository resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: RepositoryState, opts?: CustomResourceOptions): Repository
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        name: Optional[str] = None,
        project: Optional[str] = None,
        pubsub_configs: Optional[Sequence[RepositoryPubsubConfigArgs]] = None,
        size: Optional[int] = None,
        url: Optional[str] = None) -> Repository
func GetRepository(ctx *Context, name string, id IDInput, state *RepositoryState, opts ...ResourceOption) (*Repository, error)
public static Repository Get(string name, Input<string> id, RepositoryState? state, CustomResourceOptions? opts = null)
public static Repository get(String name, Output<String> id, RepositoryState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Name string

Resource name of the repository, of the form {{repo}}. The repo name may contain slashes. eg, name/with/slash

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

PubsubConfigs List<RepositoryPubsubConfigArgs>

How this repository publishes a change in the repository through Cloud Pub/Sub. Keyed by the topic names. Structure is documented below.

Size int

The disk usage of the repo, in bytes.

Url string

URL to clone the repository from Google Cloud Source Repositories.

Name string

Resource name of the repository, of the form {{repo}}. The repo name may contain slashes. eg, name/with/slash

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

PubsubConfigs []RepositoryPubsubConfigArgs

How this repository publishes a change in the repository through Cloud Pub/Sub. Keyed by the topic names. Structure is documented below.

Size int

The disk usage of the repo, in bytes.

Url string

URL to clone the repository from Google Cloud Source Repositories.

name String

Resource name of the repository, of the form {{repo}}. The repo name may contain slashes. eg, name/with/slash

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

pubsubConfigs List<RepositoryPubsubConfigArgs>

How this repository publishes a change in the repository through Cloud Pub/Sub. Keyed by the topic names. Structure is documented below.

size Integer

The disk usage of the repo, in bytes.

url String

URL to clone the repository from Google Cloud Source Repositories.

name string

Resource name of the repository, of the form {{repo}}. The repo name may contain slashes. eg, name/with/slash

project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

pubsubConfigs RepositoryPubsubConfigArgs[]

How this repository publishes a change in the repository through Cloud Pub/Sub. Keyed by the topic names. Structure is documented below.

size number

The disk usage of the repo, in bytes.

url string

URL to clone the repository from Google Cloud Source Repositories.

name str

Resource name of the repository, of the form {{repo}}. The repo name may contain slashes. eg, name/with/slash

project str

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

pubsub_configs Sequence[RepositoryPubsubConfigArgs]

How this repository publishes a change in the repository through Cloud Pub/Sub. Keyed by the topic names. Structure is documented below.

size int

The disk usage of the repo, in bytes.

url str

URL to clone the repository from Google Cloud Source Repositories.

name String

Resource name of the repository, of the form {{repo}}. The repo name may contain slashes. eg, name/with/slash

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

pubsubConfigs List<Property Map>

How this repository publishes a change in the repository through Cloud Pub/Sub. Keyed by the topic names. Structure is documented below.

size Number

The disk usage of the repo, in bytes.

url String

URL to clone the repository from Google Cloud Source Repositories.

Supporting Types

RepositoryPubsubConfig

MessageFormat string

The format of the Cloud Pub/Sub messages.

  • PROTOBUF: The message payload is a serialized protocol buffer of SourceRepoEvent.
  • JSON: The message payload is a JSON string of SourceRepoEvent. Possible values are PROTOBUF and JSON.
Topic string

The identifier for this object. Format specified above.

ServiceAccountEmail string

Email address of the service account used for publishing Cloud Pub/Sub messages. This service account needs to be in the same project as the PubsubConfig. When added, the caller needs to have iam.serviceAccounts.actAs permission on this service account. If unspecified, it defaults to the compute engine default service account.

MessageFormat string

The format of the Cloud Pub/Sub messages.

  • PROTOBUF: The message payload is a serialized protocol buffer of SourceRepoEvent.
  • JSON: The message payload is a JSON string of SourceRepoEvent. Possible values are PROTOBUF and JSON.
Topic string

The identifier for this object. Format specified above.

ServiceAccountEmail string

Email address of the service account used for publishing Cloud Pub/Sub messages. This service account needs to be in the same project as the PubsubConfig. When added, the caller needs to have iam.serviceAccounts.actAs permission on this service account. If unspecified, it defaults to the compute engine default service account.

messageFormat String

The format of the Cloud Pub/Sub messages.

  • PROTOBUF: The message payload is a serialized protocol buffer of SourceRepoEvent.
  • JSON: The message payload is a JSON string of SourceRepoEvent. Possible values are PROTOBUF and JSON.
topic String

The identifier for this object. Format specified above.

serviceAccountEmail String

Email address of the service account used for publishing Cloud Pub/Sub messages. This service account needs to be in the same project as the PubsubConfig. When added, the caller needs to have iam.serviceAccounts.actAs permission on this service account. If unspecified, it defaults to the compute engine default service account.

messageFormat string

The format of the Cloud Pub/Sub messages.

  • PROTOBUF: The message payload is a serialized protocol buffer of SourceRepoEvent.
  • JSON: The message payload is a JSON string of SourceRepoEvent. Possible values are PROTOBUF and JSON.
topic string

The identifier for this object. Format specified above.

serviceAccountEmail string

Email address of the service account used for publishing Cloud Pub/Sub messages. This service account needs to be in the same project as the PubsubConfig. When added, the caller needs to have iam.serviceAccounts.actAs permission on this service account. If unspecified, it defaults to the compute engine default service account.

message_format str

The format of the Cloud Pub/Sub messages.

  • PROTOBUF: The message payload is a serialized protocol buffer of SourceRepoEvent.
  • JSON: The message payload is a JSON string of SourceRepoEvent. Possible values are PROTOBUF and JSON.
topic str

The identifier for this object. Format specified above.

service_account_email str

Email address of the service account used for publishing Cloud Pub/Sub messages. This service account needs to be in the same project as the PubsubConfig. When added, the caller needs to have iam.serviceAccounts.actAs permission on this service account. If unspecified, it defaults to the compute engine default service account.

messageFormat String

The format of the Cloud Pub/Sub messages.

  • PROTOBUF: The message payload is a serialized protocol buffer of SourceRepoEvent.
  • JSON: The message payload is a JSON string of SourceRepoEvent. Possible values are PROTOBUF and JSON.
topic String

The identifier for this object. Format specified above.

serviceAccountEmail String

Email address of the service account used for publishing Cloud Pub/Sub messages. This service account needs to be in the same project as the PubsubConfig. When added, the caller needs to have iam.serviceAccounts.actAs permission on this service account. If unspecified, it defaults to the compute engine default service account.

Import

Repository can be imported using any of these accepted formats

 $ pulumi import gcp:sourcerepo/repository:Repository default projects/{{project}}/repos/{{name}}
 $ pulumi import gcp:sourcerepo/repository:Repository default {{name}}

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.