Firebase Rules API . projects

Instance Methods

releases()

Returns the releases Resource.

rulesets()

Returns the rulesets Resource.

test(name=None, body, x__xgafv=None)

Test `Source` for syntactic and semantic correctness. Issues present in the

Method Details

test(name=None, body, x__xgafv=None)
Test `Source` for syntactic and semantic correctness. Issues present in the
rules, if any, will be returned to the caller with a description, severity,
and source location.

The test method will typically be executed with a developer provided
`Source`, but if regression testing is desired, this method may be
executed against a `Ruleset` resource name and the `Source` will be
retrieved from the persisted `Ruleset`.

The following is an example of `Source` that permits users to upload images
to a bucket bearing their user id and matching the correct metadata:

_*Example*_

    // Users are allowed to subscribe and unsubscribe to the blog.
    service firebase.storage {
      match /users/{userId}/images/{imageName} {
          allow write: if userId == request.userId
              && (imageName.endsWith('.png') || imageName.endsWith('.jpg'))
              && resource.mimeType.startsWith('image/')
      }
    }

Args:
  name: string, Name of the project.

Format: `projects/{project_id}` (required)
  body: object, The request body. (required)
    The object takes the form of:

{ # The request for FirebaseRulesService.TestRuleset.
    "source": { # `Source` is one or more `File` messages comprising a logical set of rules. # `Source` to be checked for correctness.
      "files": [ # `File` set constituting the `Source` bundle.
        { # `File` containing source content.
          "content": "A String", # Textual Content.
          "name": "A String", # File name.
          "fingerprint": "A String", # Fingerprint (e.g. github sha) associated with the `File`.
        },
      ],
    },
  }

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # The response for FirebaseRulesService.TestRuleset.
    "issues": [ # Syntactic and semantic `Source` issues of varying severity. Issues of
        # `ERROR` severity will prevent tests from executing.
      { # Issues include warnings, errors, and deprecation notices.
        "sourcePosition": { # Position in the `Source` content including its line, column number, and an # Position of the issue in the `Source`.
            # index of the `File` in the `Source` message. Used for debug purposes.
          "column": 42, # First column on the source line associated with the source fragment.
          "line": 42, # Line number of the source fragment. 1-based.
          "fileName": "A String", # Name of the `File`.
        },
        "description": "A String", # Short error description.
        "severity": "A String", # The severity of the issue.
      },
    ],
  }