com.pulumi.gcp.firebaserules.kotlin.RulesetArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.firebaserules.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.firebaserules.RulesetArgs.builder
import com.pulumi.gcp.firebaserules.kotlin.inputs.RulesetSourceArgs
import com.pulumi.gcp.firebaserules.kotlin.inputs.RulesetSourceArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmName
/**
* For more information, see:
* * [Get started with Firebase Security Rules](https://firebase.google.com/docs/rules/get-started)
* ## Example Usage
* ### Basic_ruleset
* Creates a basic Firestore ruleset
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const primary = new gcp.firebaserules.Ruleset("primary", {
* source: {
* files: [{
* content: "service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }",
* name: "firestore.rules",
* fingerprint: "",
* }],
* language: "",
* },
* project: "my-project-name",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* primary = gcp.firebaserules.Ruleset("primary",
* source=gcp.firebaserules.RulesetSourceArgs(
* files=[gcp.firebaserules.RulesetSourceFileArgs(
* content="service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }",
* name="firestore.rules",
* fingerprint="",
* )],
* language="",
* ),
* project="my-project-name")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var primary = new Gcp.Firebaserules.Ruleset("primary", new()
* {
* Source = new Gcp.Firebaserules.Inputs.RulesetSourceArgs
* {
* Files = new[]
* {
* new Gcp.Firebaserules.Inputs.RulesetSourceFileArgs
* {
* Content = "service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }",
* Name = "firestore.rules",
* Fingerprint = "",
* },
* },
* Language = "",
* },
* Project = "my-project-name",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firebaserules"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := firebaserules.NewRuleset(ctx, "primary", &firebaserules.RulesetArgs{
* Source: &firebaserules.RulesetSourceArgs{
* Files: firebaserules.RulesetSourceFileArray{
* &firebaserules.RulesetSourceFileArgs{
* Content: pulumi.String("service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }"),
* Name: pulumi.String("firestore.rules"),
* Fingerprint: pulumi.String(""),
* },
* },
* Language: pulumi.String(""),
* },
* Project: pulumi.String("my-project-name"),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.firebaserules.Ruleset;
* import com.pulumi.gcp.firebaserules.RulesetArgs;
* import com.pulumi.gcp.firebaserules.inputs.RulesetSourceArgs;
* 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 primary = new Ruleset("primary", RulesetArgs.builder()
* .source(RulesetSourceArgs.builder()
* .files(RulesetSourceFileArgs.builder()
* .content("service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }")
* .name("firestore.rules")
* .fingerprint("")
* .build())
* .language("")
* .build())
* .project("my-project-name")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:firebaserules:Ruleset
* properties:
* source:
* files:
* - content: 'service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }'
* name: firestore.rules
* fingerprint:
* language:
* project: my-project-name
* ```
*
* ### Minimal_ruleset
* Creates a minimal Firestore ruleset
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const primary = new gcp.firebaserules.Ruleset("primary", {
* source: {
* files: [{
* content: "service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }",
* name: "firestore.rules",
* }],
* },
* project: "my-project-name",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* primary = gcp.firebaserules.Ruleset("primary",
* source=gcp.firebaserules.RulesetSourceArgs(
* files=[gcp.firebaserules.RulesetSourceFileArgs(
* content="service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }",
* name="firestore.rules",
* )],
* ),
* project="my-project-name")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var primary = new Gcp.Firebaserules.Ruleset("primary", new()
* {
* Source = new Gcp.Firebaserules.Inputs.RulesetSourceArgs
* {
* Files = new[]
* {
* new Gcp.Firebaserules.Inputs.RulesetSourceFileArgs
* {
* Content = "service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }",
* Name = "firestore.rules",
* },
* },
* },
* Project = "my-project-name",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firebaserules"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := firebaserules.NewRuleset(ctx, "primary", &firebaserules.RulesetArgs{
* Source: &firebaserules.RulesetSourceArgs{
* Files: firebaserules.RulesetSourceFileArray{
* &firebaserules.RulesetSourceFileArgs{
* Content: pulumi.String("service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }"),
* Name: pulumi.String("firestore.rules"),
* },
* },
* },
* Project: pulumi.String("my-project-name"),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.firebaserules.Ruleset;
* import com.pulumi.gcp.firebaserules.RulesetArgs;
* import com.pulumi.gcp.firebaserules.inputs.RulesetSourceArgs;
* 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 primary = new Ruleset("primary", RulesetArgs.builder()
* .source(RulesetSourceArgs.builder()
* .files(RulesetSourceFileArgs.builder()
* .content("service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }")
* .name("firestore.rules")
* .build())
* .build())
* .project("my-project-name")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:firebaserules:Ruleset
* properties:
* source:
* files:
* - content: 'service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }'
* name: firestore.rules
* project: my-project-name
* ```
*
* ## Import
* Ruleset can be imported using any of these accepted formats:
* * `projects/{{project}}/rulesets/{{name}}`
* * `{{project}}/{{name}}`
* * `{{name}}`
* When using the `pulumi import` command, Ruleset can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:firebaserules/ruleset:Ruleset default projects/{{project}}/rulesets/{{name}}
* ```
* ```sh
* $ pulumi import gcp:firebaserules/ruleset:Ruleset default {{project}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:firebaserules/ruleset:Ruleset default {{name}}
* ```
* @property project The project for the resource
* @property source `Source` for the `Ruleset`.
*/
public data class RulesetArgs(
public val project: Output? = null,
public val source: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gcp.firebaserules.RulesetArgs =
com.pulumi.gcp.firebaserules.RulesetArgs.builder()
.project(project?.applyValue({ args0 -> args0 }))
.source(source?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) })).build()
}
/**
* Builder for [RulesetArgs].
*/
@PulumiTagMarker
public class RulesetArgsBuilder internal constructor() {
private var project: Output? = null
private var source: Output? = null
/**
* @param value The project for the resource
*/
@JvmName("iawolxdwobehiomt")
public suspend fun project(`value`: Output) {
this.project = value
}
/**
* @param value `Source` for the `Ruleset`.
*/
@JvmName("eikebycyixavysph")
public suspend fun source(`value`: Output) {
this.source = value
}
/**
* @param value The project for the resource
*/
@JvmName("biyojfcbgbnqkwda")
public suspend fun project(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.project = mapped
}
/**
* @param value `Source` for the `Ruleset`.
*/
@JvmName("nbnddpvbhhsjbqtj")
public suspend fun source(`value`: RulesetSourceArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.source = mapped
}
/**
* @param argument `Source` for the `Ruleset`.
*/
@JvmName("bqidypdnpfjlpauy")
public suspend fun source(argument: suspend RulesetSourceArgsBuilder.() -> Unit) {
val toBeMapped = RulesetSourceArgsBuilder().applySuspend { argument() }.build()
val mapped = of(toBeMapped)
this.source = mapped
}
internal fun build(): RulesetArgs = RulesetArgs(
project = project,
source = source,
)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy