gcp.sourcerepo.Repository
Explore with Pulumi AI
A repository (or repo) is a Git repository storing versioned source content.
To get more information about Repository, see:
- API documentation
- How-to Guides
Example Usage
Sourcerepo Repository Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const my_repo = new gcp.sourcerepo.Repository("my-repo", {name: "my/repository"});
import pulumi
import pulumi_gcp as gcp
my_repo = gcp.sourcerepo.Repository("my-repo", name="my/repository")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/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
})
}
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",
});
});
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());
}
}
resources:
my-repo:
type: gcp:sourcerepo:Repository
properties:
name: my/repository
Sourcerepo Repository Full
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,
}],
});
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=[{
"topic": topic.id,
"message_format": "JSON",
"service_account_email": test_account.email,
}])
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/pubsub"
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/serviceaccount"
"github.com/pulumi/pulumi-gcp/sdk/v8/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
})
}
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,
},
},
});
});
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());
}
}
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}
Create Repository Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Repository(name: string, args?: RepositoryArgs, opts?: CustomResourceOptions);
@overload
def Repository(resource_name: str,
args: Optional[RepositoryArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Repository(resource_name: str,
opts: Optional[ResourceOptions] = None,
name: Optional[str] = None,
project: Optional[str] = None,
pubsub_configs: Optional[Sequence[RepositoryPubsubConfigArgs]] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var examplerepositoryResourceResourceFromSourcereporepository = new Gcp.SourceRepo.Repository("examplerepositoryResourceResourceFromSourcereporepository", new()
{
Name = "string",
Project = "string",
PubsubConfigs = new[]
{
new Gcp.SourceRepo.Inputs.RepositoryPubsubConfigArgs
{
MessageFormat = "string",
Topic = "string",
ServiceAccountEmail = "string",
},
},
});
example, err := sourcerepo.NewRepository(ctx, "examplerepositoryResourceResourceFromSourcereporepository", &sourcerepo.RepositoryArgs{
Name: pulumi.String("string"),
Project: pulumi.String("string"),
PubsubConfigs: sourcerepo.RepositoryPubsubConfigArray{
&sourcerepo.RepositoryPubsubConfigArgs{
MessageFormat: pulumi.String("string"),
Topic: pulumi.String("string"),
ServiceAccountEmail: pulumi.String("string"),
},
},
})
var examplerepositoryResourceResourceFromSourcereporepository = new Repository("examplerepositoryResourceResourceFromSourcereporepository", RepositoryArgs.builder()
.name("string")
.project("string")
.pubsubConfigs(RepositoryPubsubConfigArgs.builder()
.messageFormat("string")
.topic("string")
.serviceAccountEmail("string")
.build())
.build());
examplerepository_resource_resource_from_sourcereporepository = gcp.sourcerepo.Repository("examplerepositoryResourceResourceFromSourcereporepository",
name="string",
project="string",
pubsub_configs=[{
"messageFormat": "string",
"topic": "string",
"serviceAccountEmail": "string",
}])
const examplerepositoryResourceResourceFromSourcereporepository = new gcp.sourcerepo.Repository("examplerepositoryResourceResourceFromSourcereporepository", {
name: "string",
project: "string",
pubsubConfigs: [{
messageFormat: "string",
topic: "string",
serviceAccountEmail: "string",
}],
});
type: gcp:sourcerepo:Repository
properties:
name: string
project: string
pubsubConfigs:
- messageFormat: string
serviceAccountEmail: string
topic: string
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.
- Pubsub
Configs List<RepositoryPubsub Config> - 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.
- Pubsub
Configs []RepositoryPubsub Config Args - 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.
- pubsub
Configs List<RepositoryPubsub Config> - 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.
- pubsub
Configs RepositoryPubsub Config[] - 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[RepositoryPubsub Config Args] - 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.
- pubsub
Configs 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:
Look up 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.
- 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.
- Pubsub
Configs List<RepositoryPubsub Config> - 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.
- Pubsub
Configs []RepositoryPubsub Config Args - 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.
- pubsub
Configs List<RepositoryPubsub Config> - 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.
- pubsub
Configs RepositoryPubsub Config[] - 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[RepositoryPubsub Config Args] - 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.
- pubsub
Configs 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, RepositoryPubsubConfigArgs
- Message
Format 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
,JSON
.
- Topic string
- The identifier for this object. Format specified above.
- Service
Account stringEmail - 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 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
,JSON
.
- Topic string
- The identifier for this object. Format specified above.
- Service
Account stringEmail - 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 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
,JSON
.
- topic String
- The identifier for this object. Format specified above.
- service
Account StringEmail - 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 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
,JSON
.
- topic string
- The identifier for this object. Format specified above.
- service
Account stringEmail - 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
,JSON
.
- topic str
- The identifier for this object. Format specified above.
- service_
account_ stremail - 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 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
,JSON
.
- topic String
- The identifier for this object. Format specified above.
- service
Account StringEmail - 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:
projects/{{project}}/repos/{{name}}
{{name}}
When using the pulumi import
command, Repository can be imported using one of the formats above. For example:
$ pulumi import gcp:sourcerepo/repository:Repository default projects/{{project}}/repos/{{name}}
$ pulumi import gcp:sourcerepo/repository:Repository default {{name}}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-beta
Terraform Provider.