1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. firebaserules
  5. Ruleset
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

gcp.firebaserules.Ruleset

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

    For more information, see:

    Example Usage

    Basic_ruleset

    Creates a basic Firestore ruleset

    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",
    });
    
    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")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/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
    	})
    }
    
    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",
        });
    
    });
    
    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());
    
        }
    }
    
    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

    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",
    });
    
    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")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/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
    	})
    }
    
    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",
        });
    
    });
    
    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());
    
        }
    }
    
    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
    

    Create Ruleset Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Ruleset(name: string, args: RulesetArgs, opts?: CustomResourceOptions);
    @overload
    def Ruleset(resource_name: str,
                args: RulesetArgs,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Ruleset(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                source: Optional[RulesetSourceArgs] = None,
                project: Optional[str] = None)
    func NewRuleset(ctx *Context, name string, args RulesetArgs, opts ...ResourceOption) (*Ruleset, error)
    public Ruleset(string name, RulesetArgs args, CustomResourceOptions? opts = null)
    public Ruleset(String name, RulesetArgs args)
    public Ruleset(String name, RulesetArgs args, CustomResourceOptions options)
    
    type: gcp:firebaserules:Ruleset
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args RulesetArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args RulesetArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args RulesetArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RulesetArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RulesetArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var rulesetResource = new Gcp.Firebaserules.Ruleset("rulesetResource", new()
    {
        Source = new Gcp.Firebaserules.Inputs.RulesetSourceArgs
        {
            Files = new[]
            {
                new Gcp.Firebaserules.Inputs.RulesetSourceFileArgs
                {
                    Content = "string",
                    Name = "string",
                    Fingerprint = "string",
                },
            },
            Language = "string",
        },
        Project = "string",
    });
    
    example, err := firebaserules.NewRuleset(ctx, "rulesetResource", &firebaserules.RulesetArgs{
    	Source: &firebaserules.RulesetSourceArgs{
    		Files: firebaserules.RulesetSourceFileArray{
    			&firebaserules.RulesetSourceFileArgs{
    				Content:     pulumi.String("string"),
    				Name:        pulumi.String("string"),
    				Fingerprint: pulumi.String("string"),
    			},
    		},
    		Language: pulumi.String("string"),
    	},
    	Project: pulumi.String("string"),
    })
    
    var rulesetResource = new Ruleset("rulesetResource", RulesetArgs.builder()
        .source(RulesetSourceArgs.builder()
            .files(RulesetSourceFileArgs.builder()
                .content("string")
                .name("string")
                .fingerprint("string")
                .build())
            .language("string")
            .build())
        .project("string")
        .build());
    
    ruleset_resource = gcp.firebaserules.Ruleset("rulesetResource",
        source={
            "files": [{
                "content": "string",
                "name": "string",
                "fingerprint": "string",
            }],
            "language": "string",
        },
        project="string")
    
    const rulesetResource = new gcp.firebaserules.Ruleset("rulesetResource", {
        source: {
            files: [{
                content: "string",
                name: "string",
                fingerprint: "string",
            }],
            language: "string",
        },
        project: "string",
    });
    
    type: gcp:firebaserules:Ruleset
    properties:
        project: string
        source:
            files:
                - content: string
                  fingerprint: string
                  name: string
            language: string
    

    Ruleset Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Ruleset resource accepts the following input properties:

    Source RulesetSource
    Source for the Ruleset.
    Project string
    The project for the resource
    Source RulesetSourceArgs
    Source for the Ruleset.
    Project string
    The project for the resource
    source RulesetSource
    Source for the Ruleset.
    project String
    The project for the resource
    source RulesetSource
    Source for the Ruleset.
    project string
    The project for the resource
    source RulesetSourceArgs
    Source for the Ruleset.
    project str
    The project for the resource
    source Property Map
    Source for the Ruleset.
    project String
    The project for the resource

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Ruleset resource produces the following output properties:

    CreateTime string
    Output only. Time the Ruleset was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    Metadatas List<RulesetMetadata>
    Output only. The metadata for this ruleset.
    Name string
    Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format: projects/{project_id}/rulesets/{ruleset_id}
    CreateTime string
    Output only. Time the Ruleset was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    Metadatas []RulesetMetadata
    Output only. The metadata for this ruleset.
    Name string
    Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format: projects/{project_id}/rulesets/{ruleset_id}
    createTime String
    Output only. Time the Ruleset was created.
    id String
    The provider-assigned unique ID for this managed resource.
    metadatas List<RulesetMetadata>
    Output only. The metadata for this ruleset.
    name String
    Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format: projects/{project_id}/rulesets/{ruleset_id}
    createTime string
    Output only. Time the Ruleset was created.
    id string
    The provider-assigned unique ID for this managed resource.
    metadatas RulesetMetadata[]
    Output only. The metadata for this ruleset.
    name string
    Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format: projects/{project_id}/rulesets/{ruleset_id}
    create_time str
    Output only. Time the Ruleset was created.
    id str
    The provider-assigned unique ID for this managed resource.
    metadatas Sequence[RulesetMetadata]
    Output only. The metadata for this ruleset.
    name str
    Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format: projects/{project_id}/rulesets/{ruleset_id}
    createTime String
    Output only. Time the Ruleset was created.
    id String
    The provider-assigned unique ID for this managed resource.
    metadatas List<Property Map>
    Output only. The metadata for this ruleset.
    name String
    Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format: projects/{project_id}/rulesets/{ruleset_id}

    Look up Existing Ruleset Resource

    Get an existing Ruleset resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: RulesetState, opts?: CustomResourceOptions): Ruleset
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            create_time: Optional[str] = None,
            metadatas: Optional[Sequence[RulesetMetadataArgs]] = None,
            name: Optional[str] = None,
            project: Optional[str] = None,
            source: Optional[RulesetSourceArgs] = None) -> Ruleset
    func GetRuleset(ctx *Context, name string, id IDInput, state *RulesetState, opts ...ResourceOption) (*Ruleset, error)
    public static Ruleset Get(string name, Input<string> id, RulesetState? state, CustomResourceOptions? opts = null)
    public static Ruleset get(String name, Output<String> id, RulesetState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CreateTime string
    Output only. Time the Ruleset was created.
    Metadatas List<RulesetMetadata>
    Output only. The metadata for this ruleset.
    Name string
    Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format: projects/{project_id}/rulesets/{ruleset_id}
    Project string
    The project for the resource
    Source RulesetSource
    Source for the Ruleset.
    CreateTime string
    Output only. Time the Ruleset was created.
    Metadatas []RulesetMetadataArgs
    Output only. The metadata for this ruleset.
    Name string
    Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format: projects/{project_id}/rulesets/{ruleset_id}
    Project string
    The project for the resource
    Source RulesetSourceArgs
    Source for the Ruleset.
    createTime String
    Output only. Time the Ruleset was created.
    metadatas List<RulesetMetadata>
    Output only. The metadata for this ruleset.
    name String
    Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format: projects/{project_id}/rulesets/{ruleset_id}
    project String
    The project for the resource
    source RulesetSource
    Source for the Ruleset.
    createTime string
    Output only. Time the Ruleset was created.
    metadatas RulesetMetadata[]
    Output only. The metadata for this ruleset.
    name string
    Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format: projects/{project_id}/rulesets/{ruleset_id}
    project string
    The project for the resource
    source RulesetSource
    Source for the Ruleset.
    create_time str
    Output only. Time the Ruleset was created.
    metadatas Sequence[RulesetMetadataArgs]
    Output only. The metadata for this ruleset.
    name str
    Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format: projects/{project_id}/rulesets/{ruleset_id}
    project str
    The project for the resource
    source RulesetSourceArgs
    Source for the Ruleset.
    createTime String
    Output only. Time the Ruleset was created.
    metadatas List<Property Map>
    Output only. The metadata for this ruleset.
    name String
    Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format: projects/{project_id}/rulesets/{ruleset_id}
    project String
    The project for the resource
    source Property Map
    Source for the Ruleset.

    Supporting Types

    RulesetMetadata, RulesetMetadataArgs

    Services List<string>
    Services that this ruleset has declarations for (e.g., "cloud.firestore"). There may be 0+ of these.
    Services []string
    Services that this ruleset has declarations for (e.g., "cloud.firestore"). There may be 0+ of these.
    services List<String>
    Services that this ruleset has declarations for (e.g., "cloud.firestore"). There may be 0+ of these.
    services string[]
    Services that this ruleset has declarations for (e.g., "cloud.firestore"). There may be 0+ of these.
    services Sequence[str]
    Services that this ruleset has declarations for (e.g., "cloud.firestore"). There may be 0+ of these.
    services List<String>
    Services that this ruleset has declarations for (e.g., "cloud.firestore"). There may be 0+ of these.

    RulesetSource, RulesetSourceArgs

    Files List<RulesetSourceFile>
    File set constituting the Source bundle.
    Language string
    Language of the Source bundle. If unspecified, the language will default to FIREBASE_RULES. Possible values: LANGUAGE_UNSPECIFIED, FIREBASE_RULES, EVENT_FLOW_TRIGGERS
    Files []RulesetSourceFile
    File set constituting the Source bundle.
    Language string
    Language of the Source bundle. If unspecified, the language will default to FIREBASE_RULES. Possible values: LANGUAGE_UNSPECIFIED, FIREBASE_RULES, EVENT_FLOW_TRIGGERS
    files List<RulesetSourceFile>
    File set constituting the Source bundle.
    language String
    Language of the Source bundle. If unspecified, the language will default to FIREBASE_RULES. Possible values: LANGUAGE_UNSPECIFIED, FIREBASE_RULES, EVENT_FLOW_TRIGGERS
    files RulesetSourceFile[]
    File set constituting the Source bundle.
    language string
    Language of the Source bundle. If unspecified, the language will default to FIREBASE_RULES. Possible values: LANGUAGE_UNSPECIFIED, FIREBASE_RULES, EVENT_FLOW_TRIGGERS
    files Sequence[RulesetSourceFile]
    File set constituting the Source bundle.
    language str
    Language of the Source bundle. If unspecified, the language will default to FIREBASE_RULES. Possible values: LANGUAGE_UNSPECIFIED, FIREBASE_RULES, EVENT_FLOW_TRIGGERS
    files List<Property Map>
    File set constituting the Source bundle.
    language String
    Language of the Source bundle. If unspecified, the language will default to FIREBASE_RULES. Possible values: LANGUAGE_UNSPECIFIED, FIREBASE_RULES, EVENT_FLOW_TRIGGERS

    RulesetSourceFile, RulesetSourceFileArgs

    Content string
    Textual Content.
    Name string
    File name.


    Fingerprint string
    Fingerprint (e.g. github sha) associated with the File.
    Content string
    Textual Content.
    Name string
    File name.


    Fingerprint string
    Fingerprint (e.g. github sha) associated with the File.
    content String
    Textual Content.
    name String
    File name.


    fingerprint String
    Fingerprint (e.g. github sha) associated with the File.
    content string
    Textual Content.
    name string
    File name.


    fingerprint string
    Fingerprint (e.g. github sha) associated with the File.
    content str
    Textual Content.
    name str
    File name.


    fingerprint str
    Fingerprint (e.g. github sha) associated with the File.
    content String
    Textual Content.
    name String
    File name.


    fingerprint String
    Fingerprint (e.g. github sha) associated with the File.

    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:

    $ pulumi import gcp:firebaserules/ruleset:Ruleset default projects/{{project}}/rulesets/{{name}}
    
    $ pulumi import gcp:firebaserules/ruleset:Ruleset default {{project}}/{{name}}
    
    $ pulumi import gcp:firebaserules/ruleset:Ruleset default {{name}}
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi