com.pulumi.github.RepositoryEnvironmentDeploymentPolicy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of github Show documentation
Show all versions of github Show documentation
A Pulumi package for creating and managing github cloud resources.
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.github;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import com.pulumi.github.RepositoryEnvironmentDeploymentPolicyArgs;
import com.pulumi.github.Utilities;
import com.pulumi.github.inputs.RepositoryEnvironmentDeploymentPolicyState;
import java.lang.String;
import javax.annotation.Nullable;
/**
* This resource allows you to create and manage environment deployment branch policies for a GitHub repository.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.github.GithubFunctions;
* import com.pulumi.github.inputs.GetUserArgs;
* import com.pulumi.github.Repository;
* import com.pulumi.github.RepositoryArgs;
* import com.pulumi.github.RepositoryEnvironment;
* import com.pulumi.github.RepositoryEnvironmentArgs;
* import com.pulumi.github.inputs.RepositoryEnvironmentReviewerArgs;
* import com.pulumi.github.inputs.RepositoryEnvironmentDeploymentBranchPolicyArgs;
* import com.pulumi.github.RepositoryEnvironmentDeploymentPolicy;
* import com.pulumi.github.RepositoryEnvironmentDeploymentPolicyArgs;
* 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 current = GithubFunctions.getUser(GetUserArgs.builder()
* .username("")
* .build());
*
* var test = new Repository("test", RepositoryArgs.builder()
* .name("tf-acc-test-%s")
* .build());
*
* var testRepositoryEnvironment = new RepositoryEnvironment("testRepositoryEnvironment", RepositoryEnvironmentArgs.builder()
* .repository(test.name())
* .environment("environment/test")
* .waitTimer(10000)
* .reviewers(RepositoryEnvironmentReviewerArgs.builder()
* .users(current.applyValue(getUserResult -> getUserResult.id()))
* .build())
* .deploymentBranchPolicy(RepositoryEnvironmentDeploymentBranchPolicyArgs.builder()
* .protectedBranches(false)
* .customBranchPolicies(true)
* .build())
* .build());
*
* var testRepositoryEnvironmentDeploymentPolicy = new RepositoryEnvironmentDeploymentPolicy("testRepositoryEnvironmentDeploymentPolicy", RepositoryEnvironmentDeploymentPolicyArgs.builder()
* .repository(test.name())
* .environment(testRepositoryEnvironment.environment())
* .branchPattern("releases/*")
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* GitHub Repository Environment Deployment Policy can be imported using an ID made up of `name` of the repository combined with the `environment` name of the environment with the `Id` of the deployment policy, separated by a `:` character, e.g.
*
* ```sh
* $ pulumi import github:index/repositoryEnvironmentDeploymentPolicy:RepositoryEnvironmentDeploymentPolicy daily terraform:daily:123456
* ```
*
*/
@ResourceType(type="github:index/repositoryEnvironmentDeploymentPolicy:RepositoryEnvironmentDeploymentPolicy")
public class RepositoryEnvironmentDeploymentPolicy extends com.pulumi.resources.CustomResource {
/**
* The name pattern that branches must match in order to deploy to the environment.
*
*/
@Export(name="branchPattern", refs={String.class}, tree="[0]")
private Output branchPattern;
/**
* @return The name pattern that branches must match in order to deploy to the environment.
*
*/
public Output branchPattern() {
return this.branchPattern;
}
/**
* The name of the environment.
*
*/
@Export(name="environment", refs={String.class}, tree="[0]")
private Output environment;
/**
* @return The name of the environment.
*
*/
public Output environment() {
return this.environment;
}
/**
* The repository of the environment.
*
*/
@Export(name="repository", refs={String.class}, tree="[0]")
private Output repository;
/**
* @return The repository of the environment.
*
*/
public Output repository() {
return this.repository;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public RepositoryEnvironmentDeploymentPolicy(java.lang.String name) {
this(name, RepositoryEnvironmentDeploymentPolicyArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public RepositoryEnvironmentDeploymentPolicy(java.lang.String name, RepositoryEnvironmentDeploymentPolicyArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public RepositoryEnvironmentDeploymentPolicy(java.lang.String name, RepositoryEnvironmentDeploymentPolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("github:index/repositoryEnvironmentDeploymentPolicy:RepositoryEnvironmentDeploymentPolicy", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private RepositoryEnvironmentDeploymentPolicy(java.lang.String name, Output id, @Nullable RepositoryEnvironmentDeploymentPolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("github:index/repositoryEnvironmentDeploymentPolicy:RepositoryEnvironmentDeploymentPolicy", name, state, makeResourceOptions(options, id), false);
}
private static RepositoryEnvironmentDeploymentPolicyArgs makeArgs(RepositoryEnvironmentDeploymentPolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? RepositoryEnvironmentDeploymentPolicyArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static RepositoryEnvironmentDeploymentPolicy get(java.lang.String name, Output id, @Nullable RepositoryEnvironmentDeploymentPolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new RepositoryEnvironmentDeploymentPolicy(name, id, state, options);
}
}