Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.gcp.firebaserules.kotlin.Ruleset.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.firebaserules.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.firebaserules.kotlin.outputs.RulesetMetadata
import com.pulumi.gcp.firebaserules.kotlin.outputs.RulesetSource
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.gcp.firebaserules.kotlin.outputs.RulesetMetadata.Companion.toKotlin as rulesetMetadataToKotlin
import com.pulumi.gcp.firebaserules.kotlin.outputs.RulesetSource.Companion.toKotlin as rulesetSourceToKotlin
/**
* Builder for [Ruleset].
*/
@PulumiTagMarker
public class RulesetResourceBuilder internal constructor() {
public var name: String? = null
public var args: RulesetArgs = RulesetArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend RulesetArgsBuilder.() -> Unit) {
val builder = RulesetArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): Ruleset {
val builtJavaResource = com.pulumi.gcp.firebaserules.Ruleset(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Ruleset(builtJavaResource)
}
}
/**
* 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={
* "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")
* ```
* ```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={
* "files": [{
* "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}}
* ```
*/
public class Ruleset internal constructor(
override val javaResource: com.pulumi.gcp.firebaserules.Ruleset,
) : KotlinCustomResource(javaResource, RulesetMapper) {
/**
* Output only. Time the `Ruleset` was created.
*/
public val createTime: Output
get() = javaResource.createTime().applyValue({ args0 -> args0 })
/**
* Output only. The metadata for this ruleset.
*/
public val metadatas: Output>
get() = javaResource.metadatas().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
rulesetMetadataToKotlin(args0)
})
})
})
/**
* Output only. Name of the `Ruleset`. The ruleset_id is auto generated by the service. Format: `projects/{project_id}/rulesets/{ruleset_id}`
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The project for the resource
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* `Source` for the `Ruleset`.
*/
public val source: Output
get() = javaResource.source().applyValue({ args0 ->
args0.let({ args0 ->
rulesetSourceToKotlin(args0)
})
})
}
public object RulesetMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.firebaserules.Ruleset::class == javaResource::class
override fun map(javaResource: Resource): Ruleset = Ruleset(
javaResource as
com.pulumi.gcp.firebaserules.Ruleset,
)
}
/**
* @see [Ruleset].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Ruleset].
*/
public suspend fun ruleset(name: String, block: suspend RulesetResourceBuilder.() -> Unit): Ruleset {
val builder = RulesetResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Ruleset].
* @param name The _unique_ name of the resulting resource.
*/
public fun ruleset(name: String): Ruleset {
val builder = RulesetResourceBuilder()
builder.name(name)
return builder.build()
}