com.pulumi.cloudflare.PagesProject Maven / Gradle / Ivy
// *** 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.cloudflare;
import com.pulumi.cloudflare.PagesProjectArgs;
import com.pulumi.cloudflare.Utilities;
import com.pulumi.cloudflare.inputs.PagesProjectState;
import com.pulumi.cloudflare.outputs.PagesProjectBuildConfig;
import com.pulumi.cloudflare.outputs.PagesProjectDeploymentConfigs;
import com.pulumi.cloudflare.outputs.PagesProjectSource;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Provides a resource which manages Cloudflare Pages projects.
*
* > If you are using a `source` block configuration, you must first have a
* connected GitHub or GitLab account connected to Cloudflare. See the
* [Getting Started with Pages] documentation on how to link your accounts.
*
* ## Example Usage
* ```java
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.cloudflare.PagesProject;
* import com.pulumi.cloudflare.PagesProjectArgs;
* import com.pulumi.cloudflare.inputs.PagesProjectBuildConfigArgs;
* import com.pulumi.cloudflare.inputs.PagesProjectSourceArgs;
* import com.pulumi.cloudflare.inputs.PagesProjectSourceConfigArgs;
* import com.pulumi.cloudflare.inputs.PagesProjectDeploymentConfigsArgs;
* import com.pulumi.cloudflare.inputs.PagesProjectDeploymentConfigsPreviewArgs;
* import com.pulumi.cloudflare.inputs.PagesProjectDeploymentConfigsProductionArgs;
* 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 basicProject = new PagesProject("basicProject", PagesProjectArgs.builder()
* .accountId("f037e56e89293a057740de681ac9abbe")
* .name("this-is-my-project-01")
* .productionBranch("main")
* .build());
*
* var buildConfig = new PagesProject("buildConfig", PagesProjectArgs.builder()
* .accountId("f037e56e89293a057740de681ac9abbe")
* .buildConfig(PagesProjectBuildConfigArgs.builder()
* .buildCommand("npm run build")
* .destinationDir("build")
* .rootDir("/")
* .webAnalyticsTag("cee1c73f6e4743d0b5e6bb1a0bcaabcc")
* .webAnalyticsToken("021e1057c18547eca7b79f2516f06o7x")
* .build())
* .name("this-is-my-project-01")
* .productionBranch("main")
* .build());
*
* var sourceConfig = new PagesProject("sourceConfig", PagesProjectArgs.builder()
* .accountId("f037e56e89293a057740de681ac9abbe")
* .name("this-is-my-project-01")
* .productionBranch("main")
* .source(PagesProjectSourceArgs.builder()
* .config(PagesProjectSourceConfigArgs.builder()
* .deploymentsEnabled(true)
* .owner("cloudflare")
* .prCommentsEnabled(true)
* .previewBranchExcludes(
* "main",
* "prod")
* .previewBranchIncludes(
* "dev",
* "preview")
* .previewDeploymentSetting("custom")
* .productionBranch("main")
* .productionDeploymentEnabled(true)
* .repoName("ninjakittens")
* .build())
* .type("github")
* .build())
* .build());
*
* var deploymentConfigs = new PagesProject("deploymentConfigs", PagesProjectArgs.builder()
* .accountId("f037e56e89293a057740de681ac9abbe")
* .deploymentConfigs(PagesProjectDeploymentConfigsArgs.builder()
* .preview(PagesProjectDeploymentConfigsPreviewArgs.builder()
* .compatibilityDate("2022-08-15")
* .compatibilityFlags("preview_flag")
* .d1Databases(Map.of("D1BINDING", "445e2955-951a-4358-a35b-a4d0c813f63"))
* .durableObjectNamespaces(Map.of("DOBINDING", "5eb63bbbe01eeed093cb22bb8f5acdc3"))
* .environmentVariables(Map.of("ENVIRONMENT", "preview"))
* .kvNamespaces(Map.of("KVBINDING", "5eb63bbbe01eeed093cb22bb8f5acdc3"))
* .r2Buckets(Map.of("R2BINDING", "some-bucket"))
* .build())
* .production(PagesProjectDeploymentConfigsProductionArgs.builder()
* .compatibilityDate("2022-08-16")
* .compatibilityFlags(
* "production_flag",
* "second flag")
* .d1Databases(Map.ofEntries(
* Map.entry("D1BINDING1", "445e2955-951a-4358-a35b-a4d0c813f63"),
* Map.entry("D1BINDING2", "a399414b-c697-409a-a688-377db6433cd9")
* ))
* .durableObjectNamespaces(Map.ofEntries(
* Map.entry("DOBINDING1", "5eb63bbbe01eeed093cb22bb8f5acdc3"),
* Map.entry("DOBINDING2", "3cdca5f8bb22bc390deee10ebbb36be5")
* ))
* .environmentVariables(Map.ofEntries(
* Map.entry("ENVIRONMENT", "production"),
* Map.entry("OTHERVALUE", "other value")
* ))
* .kvNamespaces(Map.ofEntries(
* Map.entry("KVBINDING1", "5eb63bbbe01eeed093cb22bb8f5acdc3"),
* Map.entry("KVBINDING2", "3cdca5f8bb22bc390deee10ebbb36be5")
* ))
* .r2Buckets(Map.ofEntries(
* Map.entry("R2BINDING1", "some-bucket"),
* Map.entry("R2BINDING2", "other-bucket")
* ))
* .build())
* .build())
* .name("this-is-my-project-01")
* .productionBranch("main")
* .build());
*
* }
* }
* ```
*
* ## Import
*
* ```sh
* $ pulumi import cloudflare:index/pagesProject:PagesProject example <account_id>/<project_name>
* ```
*
* [Getting Started with Pages]https://developers.cloudflare.com/pages/get-started/#connect-your-git-provider-to-pages
*
*/
@ResourceType(type="cloudflare:index/pagesProject:PagesProject")
public class PagesProject extends com.pulumi.resources.CustomResource {
/**
* The account identifier to target for the resource.
*
*/
@Export(name="accountId", type=String.class, parameters={})
private Output accountId;
/**
* @return The account identifier to target for the resource.
*
*/
public Output accountId() {
return this.accountId;
}
/**
* Configuration for the project build process.
*
*/
@Export(name="buildConfig", type=PagesProjectBuildConfig.class, parameters={})
private Output* @Nullable */ PagesProjectBuildConfig> buildConfig;
/**
* @return Configuration for the project build process.
*
*/
public Output> buildConfig() {
return Codegen.optional(this.buildConfig);
}
/**
* When the project was created.
*
*/
@Export(name="createdOn", type=String.class, parameters={})
private Output createdOn;
/**
* @return When the project was created.
*
*/
public Output createdOn() {
return this.createdOn;
}
/**
* Configuration for deployments in a project.
*
*/
@Export(name="deploymentConfigs", type=PagesProjectDeploymentConfigs.class, parameters={})
private Output* @Nullable */ PagesProjectDeploymentConfigs> deploymentConfigs;
/**
* @return Configuration for deployments in a project.
*
*/
public Output> deploymentConfigs() {
return Codegen.optional(this.deploymentConfigs);
}
/**
* A list of associated custom domains for the project.
*
*/
@Export(name="domains", type=List.class, parameters={String.class})
private Output> domains;
/**
* @return A list of associated custom domains for the project.
*
*/
public Output> domains() {
return this.domains;
}
/**
* Name of the project. **Modifying this attribute will force creation of a new resource.**
*
*/
@Export(name="name", type=String.class, parameters={})
private Output name;
/**
* @return Name of the project. **Modifying this attribute will force creation of a new resource.**
*
*/
public Output name() {
return this.name;
}
/**
* The name of the branch that is used for the production environment.
*
*/
@Export(name="productionBranch", type=String.class, parameters={})
private Output productionBranch;
/**
* @return The name of the branch that is used for the production environment.
*
*/
public Output productionBranch() {
return this.productionBranch;
}
/**
* Configuration for the project source.
*
*/
@Export(name="source", type=PagesProjectSource.class, parameters={})
private Output* @Nullable */ PagesProjectSource> source;
/**
* @return Configuration for the project source.
*
*/
public Output> source() {
return Codegen.optional(this.source);
}
/**
* The Cloudflare subdomain associated with the project.
*
*/
@Export(name="subdomain", type=String.class, parameters={})
private Output subdomain;
/**
* @return The Cloudflare subdomain associated with the project.
*
*/
public Output subdomain() {
return this.subdomain;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public PagesProject(String name) {
this(name, PagesProjectArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public PagesProject(String name, PagesProjectArgs 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 PagesProject(String name, PagesProjectArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("cloudflare:index/pagesProject:PagesProject", name, args == null ? PagesProjectArgs.Empty : args, makeResourceOptions(options, Codegen.empty()));
}
private PagesProject(String name, Output id, @Nullable PagesProjectState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("cloudflare:index/pagesProject:PagesProject", name, state, makeResourceOptions(options, id));
}
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 PagesProject get(String name, Output id, @Nullable PagesProjectState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new PagesProject(name, id, state, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy