github.RepositoryTagProtection
Explore with Pulumi AI
This resource allows you to create and manage a repository tag protection for repositories within your GitHub organization or personal account.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const example = new github.RepositoryTagProtection("example", {
repository: "example-repository",
pattern: "v*",
});
import pulumi
import pulumi_github as github
example = github.RepositoryTagProtection("example",
repository="example-repository",
pattern="v*")
package main
import (
"github.com/pulumi/pulumi-github/sdk/v6/go/github"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := github.NewRepositoryTagProtection(ctx, "example", &github.RepositoryTagProtectionArgs{
Repository: pulumi.String("example-repository"),
Pattern: pulumi.String("v*"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var example = new Github.RepositoryTagProtection("example", new()
{
Repository = "example-repository",
Pattern = "v*",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.RepositoryTagProtection;
import com.pulumi.github.RepositoryTagProtectionArgs;
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 example = new RepositoryTagProtection("example", RepositoryTagProtectionArgs.builder()
.repository("example-repository")
.pattern("v*")
.build());
}
}
resources:
example:
type: github:RepositoryTagProtection
properties:
repository: example-repository
pattern: v*
Create RepositoryTagProtection Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RepositoryTagProtection(name: string, args: RepositoryTagProtectionArgs, opts?: CustomResourceOptions);
@overload
def RepositoryTagProtection(resource_name: str,
args: RepositoryTagProtectionArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RepositoryTagProtection(resource_name: str,
opts: Optional[ResourceOptions] = None,
pattern: Optional[str] = None,
repository: Optional[str] = None)
func NewRepositoryTagProtection(ctx *Context, name string, args RepositoryTagProtectionArgs, opts ...ResourceOption) (*RepositoryTagProtection, error)
public RepositoryTagProtection(string name, RepositoryTagProtectionArgs args, CustomResourceOptions? opts = null)
public RepositoryTagProtection(String name, RepositoryTagProtectionArgs args)
public RepositoryTagProtection(String name, RepositoryTagProtectionArgs args, CustomResourceOptions options)
type: github:RepositoryTagProtection
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 RepositoryTagProtectionArgs
- 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 RepositoryTagProtectionArgs
- 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 RepositoryTagProtectionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RepositoryTagProtectionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RepositoryTagProtectionArgs
- 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 repositoryTagProtectionResource = new Github.RepositoryTagProtection("repositoryTagProtectionResource", new()
{
Pattern = "string",
Repository = "string",
});
example, err := github.NewRepositoryTagProtection(ctx, "repositoryTagProtectionResource", &github.RepositoryTagProtectionArgs{
Pattern: pulumi.String("string"),
Repository: pulumi.String("string"),
})
var repositoryTagProtectionResource = new RepositoryTagProtection("repositoryTagProtectionResource", RepositoryTagProtectionArgs.builder()
.pattern("string")
.repository("string")
.build());
repository_tag_protection_resource = github.RepositoryTagProtection("repositoryTagProtectionResource",
pattern="string",
repository="string")
const repositoryTagProtectionResource = new github.RepositoryTagProtection("repositoryTagProtectionResource", {
pattern: "string",
repository: "string",
});
type: github:RepositoryTagProtection
properties:
pattern: string
repository: string
RepositoryTagProtection Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The RepositoryTagProtection resource accepts the following input properties:
- Pattern string
- The pattern of the tag to protect.
- Repository string
- Name of the repository to add the tag protection to.
- Pattern string
- The pattern of the tag to protect.
- Repository string
- Name of the repository to add the tag protection to.
- pattern String
- The pattern of the tag to protect.
- repository String
- Name of the repository to add the tag protection to.
- pattern string
- The pattern of the tag to protect.
- repository string
- Name of the repository to add the tag protection to.
- pattern str
- The pattern of the tag to protect.
- repository str
- Name of the repository to add the tag protection to.
- pattern String
- The pattern of the tag to protect.
- repository String
- Name of the repository to add the tag protection to.
Outputs
All input properties are implicitly available as output properties. Additionally, the RepositoryTagProtection resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Tag
Protection intId - The ID of the tag protection.
- Id string
- The provider-assigned unique ID for this managed resource.
- Tag
Protection intId - The ID of the tag protection.
- id String
- The provider-assigned unique ID for this managed resource.
- tag
Protection IntegerId - The ID of the tag protection.
- id string
- The provider-assigned unique ID for this managed resource.
- tag
Protection numberId - The ID of the tag protection.
- id str
- The provider-assigned unique ID for this managed resource.
- tag_
protection_ intid - The ID of the tag protection.
- id String
- The provider-assigned unique ID for this managed resource.
- tag
Protection NumberId - The ID of the tag protection.
Look up Existing RepositoryTagProtection Resource
Get an existing RepositoryTagProtection 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?: RepositoryTagProtectionState, opts?: CustomResourceOptions): RepositoryTagProtection
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
pattern: Optional[str] = None,
repository: Optional[str] = None,
tag_protection_id: Optional[int] = None) -> RepositoryTagProtection
func GetRepositoryTagProtection(ctx *Context, name string, id IDInput, state *RepositoryTagProtectionState, opts ...ResourceOption) (*RepositoryTagProtection, error)
public static RepositoryTagProtection Get(string name, Input<string> id, RepositoryTagProtectionState? state, CustomResourceOptions? opts = null)
public static RepositoryTagProtection get(String name, Output<String> id, RepositoryTagProtectionState 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.
- Pattern string
- The pattern of the tag to protect.
- Repository string
- Name of the repository to add the tag protection to.
- Tag
Protection intId - The ID of the tag protection.
- Pattern string
- The pattern of the tag to protect.
- Repository string
- Name of the repository to add the tag protection to.
- Tag
Protection intId - The ID of the tag protection.
- pattern String
- The pattern of the tag to protect.
- repository String
- Name of the repository to add the tag protection to.
- tag
Protection IntegerId - The ID of the tag protection.
- pattern string
- The pattern of the tag to protect.
- repository string
- Name of the repository to add the tag protection to.
- tag
Protection numberId - The ID of the tag protection.
- pattern str
- The pattern of the tag to protect.
- repository str
- Name of the repository to add the tag protection to.
- tag_
protection_ intid - The ID of the tag protection.
- pattern String
- The pattern of the tag to protect.
- repository String
- Name of the repository to add the tag protection to.
- tag
Protection NumberId - The ID of the tag protection.
Import
Repository tag protections can be imported using the name
of the repository, combined with the id
of the tag protection, separated by a /
character.
The id
of the tag protection can be found using the GitHub API.
Importing uses the name of the repository, as well as the ID of the tag protection, e.g.
$ pulumi import github:index/repositoryTagProtection:RepositoryTagProtection terraform my-repo/31077
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- GitHub pulumi/pulumi-github
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
github
Terraform Provider.