com.pulumi.gcp.firebaserules.kotlin.ReleaseArgs.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.ReleaseArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName
/**
* For more information, see:
* * [Get started with Firebase Security Rules](https://firebase.google.com/docs/rules/get-started)
* ## Example Usage
* ### Firestore_release
* Creates a Firebase Rules Release to Cloud Firestore
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const firestore = new gcp.firebaserules.Ruleset("firestore", {
* source: {
* files: [{
* content: "service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }",
* name: "firestore.rules",
* }],
* },
* project: "my-project-name",
* });
* const primary = new gcp.firebaserules.Release("primary", {
* name: "cloud.firestore/database",
* rulesetName: pulumi.interpolate`projects/my-project-name/rulesets/${firestore.name}`,
* project: "my-project-name",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* firestore = gcp.firebaserules.Ruleset("firestore",
* 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")
* primary = gcp.firebaserules.Release("primary",
* name="cloud.firestore/database",
* ruleset_name=firestore.name.apply(lambda name: f"projects/my-project-name/rulesets/{name}"),
* project="my-project-name")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var firestore = new Gcp.Firebaserules.Ruleset("firestore", 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",
* });
* var primary = new Gcp.Firebaserules.Release("primary", new()
* {
* Name = "cloud.firestore/database",
* RulesetName = firestore.Name.Apply(name => $"projects/my-project-name/rulesets/{name}"),
* Project = "my-project-name",
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "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 {
* firestore, err := firebaserules.NewRuleset(ctx, "firestore", &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
* }
* _, err = firebaserules.NewRelease(ctx, "primary", &firebaserules.ReleaseArgs{
* Name: pulumi.String("cloud.firestore/database"),
* RulesetName: firestore.Name.ApplyT(func(name string) (string, error) {
* return fmt.Sprintf("projects/my-project-name/rulesets/%v", name), nil
* }).(pulumi.StringOutput),
* 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 com.pulumi.gcp.firebaserules.Release;
* import com.pulumi.gcp.firebaserules.ReleaseArgs;
* 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 firestore = new Ruleset("firestore", 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());
* var primary = new Release("primary", ReleaseArgs.builder()
* .name("cloud.firestore/database")
* .rulesetName(firestore.name().applyValue(name -> String.format("projects/my-project-name/rulesets/%s", name)))
* .project("my-project-name")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:firebaserules:Release
* properties:
* name: cloud.firestore/database
* rulesetName: projects/my-project-name/rulesets/${firestore.name}
* project: my-project-name
* firestore:
* 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
* ```
*
* ### Storage_release
* Creates a Firebase Rules Release for a Storage bucket
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* // Provision a non-default Cloud Storage bucket.
* const bucket = new gcp.storage.Bucket("bucket", {
* project: "my-project-name",
* name: "bucket",
* location: "us-west1",
* });
* // Create a ruleset of Firebase Security Rules from a local file.
* const storage = new gcp.firebaserules.Ruleset("storage", {
* project: "my-project-name",
* source: {
* files: [{
* name: "storage.rules",
* content: "service firebase.storage {match /b/{bucket}/o {match /{allPaths=**} {allow read, write: if request.auth != null;}}}",
* }],
* },
* });
* const primary = new gcp.firebaserules.Release("primary", {
* name: pulumi.interpolate`firebase.storage/${bucket.name}`,
* rulesetName: pulumi.interpolate`projects/my-project-name/rulesets/${storage.name}`,
* project: "my-project-name",
* });
* // Make the Storage bucket accessible for Firebase SDKs, authentication, and Firebase Security Rules.
* const bucketStorageBucket = new gcp.firebase.StorageBucket("bucket", {
* project: "my-project-name",
* bucketId: bucket.name,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* # Provision a non-default Cloud Storage bucket.
* bucket = gcp.storage.Bucket("bucket",
* project="my-project-name",
* name="bucket",
* location="us-west1")
* # Create a ruleset of Firebase Security Rules from a local file.
* storage = gcp.firebaserules.Ruleset("storage",
* project="my-project-name",
* source=gcp.firebaserules.RulesetSourceArgs(
* files=[gcp.firebaserules.RulesetSourceFileArgs(
* name="storage.rules",
* content="service firebase.storage {match /b/{bucket}/o {match /{allPaths=**} {allow read, write: if request.auth != null;}}}",
* )],
* ))
* primary = gcp.firebaserules.Release("primary",
* name=bucket.name.apply(lambda name: f"firebase.storage/{name}"),
* ruleset_name=storage.name.apply(lambda name: f"projects/my-project-name/rulesets/{name}"),
* project="my-project-name")
* # Make the Storage bucket accessible for Firebase SDKs, authentication, and Firebase Security Rules.
* bucket_storage_bucket = gcp.firebase.StorageBucket("bucket",
* project="my-project-name",
* bucket_id=bucket.name)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* // Provision a non-default Cloud Storage bucket.
* var bucket = new Gcp.Storage.Bucket("bucket", new()
* {
* Project = "my-project-name",
* Name = "bucket",
* Location = "us-west1",
* });
* // Create a ruleset of Firebase Security Rules from a local file.
* var storage = new Gcp.Firebaserules.Ruleset("storage", new()
* {
* Project = "my-project-name",
* Source = new Gcp.Firebaserules.Inputs.RulesetSourceArgs
* {
* Files = new[]
* {
* new Gcp.Firebaserules.Inputs.RulesetSourceFileArgs
* {
* Name = "storage.rules",
* Content = "service firebase.storage {match /b/{bucket}/o {match /{allPaths=**} {allow read, write: if request.auth != null;}}}",
* },
* },
* },
* });
* var primary = new Gcp.Firebaserules.Release("primary", new()
* {
* Name = bucket.Name.Apply(name => $"firebase.storage/{name}"),
* RulesetName = storage.Name.Apply(name => $"projects/my-project-name/rulesets/{name}"),
* Project = "my-project-name",
* });
* // Make the Storage bucket accessible for Firebase SDKs, authentication, and Firebase Security Rules.
* var bucketStorageBucket = new Gcp.Firebase.StorageBucket("bucket", new()
* {
* Project = "my-project-name",
* BucketId = bucket.Name,
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firebase"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firebaserules"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* // Provision a non-default Cloud Storage bucket.
* bucket, err := storage.NewBucket(ctx, "bucket", &storage.BucketArgs{
* Project: pulumi.String("my-project-name"),
* Name: pulumi.String("bucket"),
* Location: pulumi.String("us-west1"),
* })
* if err != nil {
* return err
* }
* // Create a ruleset of Firebase Security Rules from a local file.
* storage, err := firebaserules.NewRuleset(ctx, "storage", &firebaserules.RulesetArgs{
* Project: pulumi.String("my-project-name"),
* Source: &firebaserules.RulesetSourceArgs{
* Files: firebaserules.RulesetSourceFileArray{
* &firebaserules.RulesetSourceFileArgs{
* Name: pulumi.String("storage.rules"),
* Content: pulumi.String("service firebase.storage {match /b/{bucket}/o {match /{allPaths=**} {allow read, write: if request.auth != null;}}}"),
* },
* },
* },
* })
* if err != nil {
* return err
* }
* _, err = firebaserules.NewRelease(ctx, "primary", &firebaserules.ReleaseArgs{
* Name: bucket.Name.ApplyT(func(name string) (string, error) {
* return fmt.Sprintf("firebase.storage/%v", name), nil
* }).(pulumi.StringOutput),
* RulesetName: storage.Name.ApplyT(func(name string) (string, error) {
* return fmt.Sprintf("projects/my-project-name/rulesets/%v", name), nil
* }).(pulumi.StringOutput),
* Project: pulumi.String("my-project-name"),
* })
* if err != nil {
* return err
* }
* // Make the Storage bucket accessible for Firebase SDKs, authentication, and Firebase Security Rules.
* _, err = firebase.NewStorageBucket(ctx, "bucket", &firebase.StorageBucketArgs{
* Project: pulumi.String("my-project-name"),
* BucketId: bucket.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.storage.Bucket;
* import com.pulumi.gcp.storage.BucketArgs;
* import com.pulumi.gcp.firebaserules.Ruleset;
* import com.pulumi.gcp.firebaserules.RulesetArgs;
* import com.pulumi.gcp.firebaserules.inputs.RulesetSourceArgs;
* import com.pulumi.gcp.firebaserules.Release;
* import com.pulumi.gcp.firebaserules.ReleaseArgs;
* import com.pulumi.gcp.firebase.StorageBucket;
* import com.pulumi.gcp.firebase.StorageBucketArgs;
* 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) {
* // Provision a non-default Cloud Storage bucket.
* var bucket = new Bucket("bucket", BucketArgs.builder()
* .project("my-project-name")
* .name("bucket")
* .location("us-west1")
* .build());
* // Create a ruleset of Firebase Security Rules from a local file.
* var storage = new Ruleset("storage", RulesetArgs.builder()
* .project("my-project-name")
* .source(RulesetSourceArgs.builder()
* .files(RulesetSourceFileArgs.builder()
* .name("storage.rules")
* .content("service firebase.storage {match /b/{bucket}/o {match /{allPaths=**} {allow read, write: if request.auth != null;}}}")
* .build())
* .build())
* .build());
* var primary = new Release("primary", ReleaseArgs.builder()
* .name(bucket.name().applyValue(name -> String.format("firebase.storage/%s", name)))
* .rulesetName(storage.name().applyValue(name -> String.format("projects/my-project-name/rulesets/%s", name)))
* .project("my-project-name")
* .build());
* // Make the Storage bucket accessible for Firebase SDKs, authentication, and Firebase Security Rules.
* var bucketStorageBucket = new StorageBucket("bucketStorageBucket", StorageBucketArgs.builder()
* .project("my-project-name")
* .bucketId(bucket.name())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:firebaserules:Release
* properties:
* name: firebase.storage/${bucket.name}
* rulesetName: projects/my-project-name/rulesets/${storage.name}
* project: my-project-name
* # Provision a non-default Cloud Storage bucket.
* bucket:
* type: gcp:storage:Bucket
* properties:
* project: my-project-name
* name: bucket
* location: us-west1
* # Make the Storage bucket accessible for Firebase SDKs, authentication, and Firebase Security Rules.
* bucketStorageBucket:
* type: gcp:firebase:StorageBucket
* name: bucket
* properties:
* project: my-project-name
* bucketId: ${bucket.name}
* # Create a ruleset of Firebase Security Rules from a local file.
* storage:
* type: gcp:firebaserules:Ruleset
* properties:
* project: my-project-name
* source:
* files:
* - name: storage.rules
* content: 'service firebase.storage {match /b/{bucket}/o {match /{allPaths=**} {allow read, write: if request.auth != null;}}}'
* ```
*
* ## Import
* Release can be imported using any of these accepted formats:
* * `projects/{{project}}/releases/{{name}}`
* When using the `pulumi import` command, Release can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:firebaserules/release:Release default projects/{{project}}/releases/{{name}}
* ```
* @property name Format: `projects/{project_id}/releases/{release_id}`\Firestore Rules Releases will **always** have the name 'cloud.firestore'
* @property project The project for the resource
* @property rulesetName Name of the `Ruleset` referred to by this `Release`. The `Ruleset` must exist for the `Release` to be created.
* - - -
*/
public data class ReleaseArgs(
public val name: Output? = null,
public val project: Output? = null,
public val rulesetName: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gcp.firebaserules.ReleaseArgs =
com.pulumi.gcp.firebaserules.ReleaseArgs.builder()
.name(name?.applyValue({ args0 -> args0 }))
.project(project?.applyValue({ args0 -> args0 }))
.rulesetName(rulesetName?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [ReleaseArgs].
*/
@PulumiTagMarker
public class ReleaseArgsBuilder internal constructor() {
private var name: Output? = null
private var project: Output? = null
private var rulesetName: Output? = null
/**
* @param value Format: `projects/{project_id}/releases/{release_id}`\Firestore Rules Releases will **always** have the name 'cloud.firestore'
*/
@JvmName("rtjwqcsdtkpwlhri")
public suspend fun name(`value`: Output) {
this.name = value
}
/**
* @param value The project for the resource
*/
@JvmName("ysyvoolffdotpuke")
public suspend fun project(`value`: Output) {
this.project = value
}
/**
* @param value Name of the `Ruleset` referred to by this `Release`. The `Ruleset` must exist for the `Release` to be created.
* - - -
*/
@JvmName("frjjxguoinxxyise")
public suspend fun rulesetName(`value`: Output) {
this.rulesetName = value
}
/**
* @param value Format: `projects/{project_id}/releases/{release_id}`\Firestore Rules Releases will **always** have the name 'cloud.firestore'
*/
@JvmName("rpeshasvuwpsxyvt")
public suspend fun name(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.name = mapped
}
/**
* @param value The project for the resource
*/
@JvmName("gbmbqxvxkjdaisoo")
public suspend fun project(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.project = mapped
}
/**
* @param value Name of the `Ruleset` referred to by this `Release`. The `Ruleset` must exist for the `Release` to be created.
* - - -
*/
@JvmName("gvusidobdptejimm")
public suspend fun rulesetName(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.rulesetName = mapped
}
internal fun build(): ReleaseArgs = ReleaseArgs(
name = name,
project = project,
rulesetName = rulesetName,
)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy