The class represent File which containing source content.
class File
A File class constructor in the Rules namespace.
explicit File(const String &content, const String &name, const String &fingerprint = "")
Params:
content
- Rules language statements. Use \n for line breaks.name
- File name.fingerprint
- Fingerprint (e.g. github sha) associated with the File. A base64-encoded string.
Rules language statements. Use \n for line breaks.
void content(const String &content)
Params:
content
- Rules language statements. Use \n for line breaks.
File name.
void name(const String &name)
Params:
name
- File name.
Fingerprint (e.g. github sha) associated with the File. A base64-encoded string.
void fingerprint(const String &fingerprint)
Params:
fingerprint
- Base64 encoded string of File fingerprint.
The class represent Source which is one or more File messages comprising a logical set of rules.
class Source
A File class constructor in the Rules namespace.
explicit Source(const File &file)
Params:
file
- File containing source content.
Append the File containing source content.
void files(const File &file)
Params:
file
- File containing source content.
Clear all Files in the Source object.
void clear()
The class represents Ruleset which is an immutable copy of Source with a globally unique identifier and a creation time.
class Ruleset
A Ruleset class constructor with source and attachment_point.
Ruleset(const Rules::Source &source, const String &attachment_point)
Params:
source
- Source for the Ruleset.attachment_point
- Intended resource to which this Ruleset should be released. May be left blank to signify the resource associated with the default release. Expected format: firestore.googleapis.com/projects//databases/
Source for the Ruleset.
void source(const Rules::Source &source)
Params:
source
- Source for the Ruleset.
Intended resource to which this Ruleset should be released. May be left blank to signify the resource associated with the default release. Expected format: firestore.googleapis.com/projects//databases/
void attachmentPoint(const String &attachment_point)
Params:
attachment_point
- Intended resource to which this Ruleset should be released.
The class represents the REST API request's query parameters.
class ListOptions
Page size to load. Maximum of 100. Defaults to 10. Note: pageSize is just a hint and the service may choose to load less than pageSize due to the size of the output. To traverse all of the releases, caller should iterate until the pageToken is empty.
ListOptions &pageSize(int value)
Params:
value
- Optional. The page size.
Next page token for loading the next batch of Ruleset instances.
ListOptions &pageToken(const String &value)
Params:
value
- The page token.
Ruleset/Release filter.
For Ruleset, the list method supports filters with restrictions on Ruleset.name. Filters on Ruleset.create_time should use the date function which parses strings that conform to the RFC 3339 date/time specifications. Example: create_time > date("2017-01-01T00:00:00Z") AND name=UUID-*
For Release, the list method supports filters with restrictions on the Release.name, and Release.ruleset_name. Example 1: A filter of 'name=prod*' might return Releases with names within 'projects/foo' prefixed with 'prod': Name -> Ruleset Name: projects/foo/releases/prod -> projects/foo/rulesets/uuid1234 projects/foo/releases/prod/v1 -> projects/foo/rulesets/uuid1234 projects/foo/releases/prod/v2 -> projects/foo/rulesets/uuid8888 Example 2: A filter of name=prod* rulesetName=uuid1234 would return only Release instances for 'projects/foo' with names prefixed with 'prod' referring to the same Ruleset name of 'uuid1234': Name -> Ruleset Name: projects/foo/releases/prod -> projects/foo/rulesets/1234 projects/foo/releases/prod/v1 -> projects/foo/rulesets/1234
In the examples, the filter parameters refer to the search filters are relative to the project. Fully qualified prefixed may also be used.
ListOptions &filter(const String value)
Params:
value
- Optional. The filter.
Release is a named reference to a Ruleset. Once a Release refers to a Ruleset, rules-enabled services will be able to enforce the Ruleset.
class Release
The Release class constructor with release ID and ruleset ID.
explicit Release(const String &releaseId, const String &rulesetId)
The release Id is the part of the release name i.e. the release name structure "projects/projectId/releaseId"
.
Release name/id should reflect the developer's deployment practices. For example, the release Id may include the environment name, application name, application version, or any other name meaningful to the developer.
Once a Release refers to a Ruleset, the rules can be enforced by Firebase Rules-enabled services.
More than one Release may be 'live' concurrently. Consider the following three Release names for projects/foo and the Ruleset to which they refer.
Release Name
-> Ruleset Name
:
projects/foo/releases/prod
-> projects/foo/rulesets/uuid123
projects/foo/releases/prod/beta
-> projects/foo/rulesets/uuid123
projects/foo/releases/prod/v23
-> projects/foo/rulesets/uuid456
The relationships reflect a Ruleset rollout in progress. The prod and prod/beta releases refer to the same Ruleset. However, prod/v23 refers to a new Ruleset. The Ruleset reference for a Release may be updated using the releases.patch method.
Params:
releaseId
- The release ID.rulesetId
- The ruleset ID.
The release Id is the part of the release name i.e. the release name structure "projects/projectId/releaseId"
.
Release name/id should reflect the developer's deployment practices. For example, the release Id may include the environment name, application name, application version, or any other name meaningful to the developer.
Once a Release refers to a Ruleset, the rules can be enforced by Firebase Rules-enabled services.
More than one Release may be 'live' concurrently. Consider the following three Release names for projects/foo and the Ruleset to which they refer.
Release Name
-> Ruleset Name
:
projects/foo/releases/prod
-> projects/foo/rulesets/uuid123
projects/foo/releases/prod/beta
-> projects/foo/rulesets/uuid123
projects/foo/releases/prod/v23
-> projects/foo/rulesets/uuid456
The relationships reflect a Ruleset rollout in progress. The prod and prod/beta releases refer to the same Ruleset. However, prod/v23 refers to a new Ruleset. The Ruleset reference for a Release may be updated using the releases.patch method.
void releaseId(const String &releaseId)
Params:
releaseId
- The release ID.
The ruleset ID.
void rulesetId(const String &rulesetId)
Params:
rulesetId
- The ruleset ID.
The class to hadle ruleset operations.
class RuleSets
Unbind or remove FirebaseApp.
void resetApp()
Perform the async task repeatedly (DEPRECATED).
void loop()
Create a Ruleset from Source.
The Ruleset is given a unique generated name which is returned to the caller. Source containing syntactic or semantics errors will result in an error response indicating the first error encountered.
void create(AsyncClientClass &aClient, const String &projectId, const Ruleset &ruleSet, AsyncResultCallback cb, const String &uid = "")
Params:
aClient
- The async client.projectId
- The project ID.ruleSet
- The ruleset object.cb
- The async result callback (AsyncResultCallback).uid
- The user specified UID of async result (optional).
Create a Ruleset from Source.
The Ruleset is given a unique generated name which is returned to the caller. Source containing syntactic or semantics errors will result in an error response indicating the first error encountered.
void create(AsyncClientClass &aClient, const String &projectId, const Ruleset &ruleSet, AsyncResult &aResult)
Params:
aClient
- The async client.projectId
- The project ID.ruleSet
- The ruleset object.aResult
- The async result (AsyncResult).
Create a Ruleset from Source.
The Ruleset is given a unique generated name which is returned to the caller. Source containing syntactic or semantics errors will result in an error response indicating the first error encountered.
String create(AsyncClientClass &aClient, const String &projectId, const Ruleset &ruleSet)
Params:
aClient
- The async client.projectId
- The project ID.ruleSet
- The ruleset object.
Returns:
String
- The response payload.
Create a Ruleset from Source.
The Ruleset is given a unique generated name which is returned to the caller. Source containing syntactic or semantics errors will result in an error response indicating the first error encountered.
void remove(AsyncClientClass &aClient, const String &projectId, const String &rulesetId, AsyncResultCallback cb, const String &uid = "")
Params:
aClient
- The async client.projectId
- The project ID.rulesetId
- The ruleset ID.cb
- The async result callback (AsyncResultCallback).uid
- The user specified UID of async result (optional).
Create a Ruleset from Source.
The Ruleset is given a unique generated name which is returned to the caller. Source containing syntactic or semantics errors will result in an error response indicating the first error encountered.
void remove(AsyncClientClass &aClient, const String &projectId, const String &rulesetId, AsyncResult &aResult)
Params:
aClient
- The async client.projectId
- The project ID.rulesetId
- The ruleset ID.aResult
- The async result (AsyncResult).
Create a Ruleset from Source.
The Ruleset is given a unique generated name which is returned to the caller. Source containing syntactic or semantics errors will result in an error response indicating the first error encountered.
String remove(AsyncClientClass &aClient, const String &projectId, const String &rulesetId)
Params:
aClient
- The async client.projectId
- The project ID.rulesetId
- The ruleset ID.
Returns:
String
- The response payload.
Get a Ruleset by name including the full Source contents.
void get(AsyncClientClass &aClient, const String &projectId, const String &rulesetId, AsyncResultCallback cb, const String &uid = "")
Params:
aClient
- The async client.projectId
- The project ID.rulesetId
- The ruleset ID.cb
- The async result callback (AsyncResultCallback).uid
- The user specified UID of async result (optional).
Get a Ruleset by name including the full Source contents.
void get(AsyncClientClass &aClient, const String &projectId, const String &rulesetId, AsyncResult &aResult)
Params:
aClient
- The async client.projectId
- The project ID.rulesetId
- The ruleset ID.aResult
- The async result (AsyncResult).
Get a Ruleset by name including the full Source contents.
String get(AsyncClientClass &aClient, const String &projectId, const String &rulesetId)
Params:
aClient
- The async client.projectId
- The project ID.rulesetId
- The ruleset ID.
Returns:
String
- The response payload.
List Ruleset metadata only and optionally filter the results by Ruleset name.
The full Source contents of a Ruleset may be retrieved with Rulesets::get.
void list(AsyncClientClass &aClient, const String &projectId, const ListOptions &listOptions, AsyncResultCallback cb, const String &uid = "")
Params:
aClient
- The async client.projectId
- The project ID.listOptions
- The ListOptions object that represents the request query parameters e.g.filter
,pageSize
andpageToken
.cb
- The async result callback (AsyncResultCallback).uid
- The user specified UID of async result (optional).
List Ruleset metadata only and optionally filter the results by Ruleset name.
The full Source contents of a Ruleset may be retrieved with Rulesets::get.
void list(AsyncClientClass &aClient, const String &projectId, const ListOptions &listOptions, AsyncResult &aResult)
Params:
aClient
- The async client.projectId
- The project ID.listOptions
- The ListOptions object that represents the request query parameters e.g.filter
,pageSize
andpageToken
.aResult
- The async result (AsyncResult).
List Ruleset metadata only and optionally filter the results by Ruleset name.
The full Source contents of a Ruleset may be retrieved with Rulesets::get.
String list(AsyncClientClass &aClient, const String &projectId, const ListOptions &listOptions)
Params:
aClient
- The async client.projectId
- The project ID.listOptions
- The ListOptions object that represents the request query parameters e.g.filter
,pageSize
andpageToken
.
Returns:
String
- The response payload.
Get SHA1 string
String getSha1(String payload)
Params:
payload
- The string to calculate SHA1.
Returns:
String
- The SHA1 string.
The class to perform a Release operations. Release is a named reference to a Ruleset. Once a Release refers to a Ruleset, rules-enabled services will be able to enforce the Ruleset.
The JSON representation of Release.
{
"name": string,
"rulesetName": string,
"createTime": string,
"updateTime": string
}
class Releases
Unbind or remove FirebaseApp.
void resetApp()
Perform the async task repeatedly (DEPRECATED).
void loop()
Create a Ruleset from Source.
The Ruleset is given a unique generated name which is returned to the caller. Source containing syntactic or semantics errors will result in an error response indicating the first error encountered.
void create(AsyncClientClass &aClient, const String &projectId, const Release &release, AsyncResultCallback cb, const String &uid = "")
Params:
aClient
- The async client.projectId
- The project ID.release
- The Release object.cb
- The async result callback (AsyncResultCallback).uid
- The user specified UID of async result (optional).
Create a Ruleset from Source.
The Ruleset is given a unique generated name which is returned to the caller. Source containing syntactic or semantics errors will result in an error response indicating the first error encountered.
void create(AsyncClientClass &aClient, const String &projectId, const Release &release, AsyncResult &aResult)
Params:
aClient
- The async client.projectId
- The project ID.release
- The Release object.aResult
- The async result (AsyncResult).
Create a Ruleset from Source.
The Ruleset is given a unique generated name which is returned to the caller. Source containing syntactic or semantics errors will result in an error response indicating the first error encountered.
String create(AsyncClientClass &aClient, const String &projectId, const Release &release)
Params:
aClient
- The async client.projectId
- The project ID.release
- The Release object.
Returns:
String
- The response payload.
Delete a Release by resource name.
void remove(AsyncClientClass &aClient, const String &projectId, const String &releaseId, AsyncResultCallback cb, const String &uid = "")
Params:
aClient
- The async client.projectId
- The project ID.releaseId
- The release ID.cb
- The async result callback (AsyncResultCallback).uid
- The user specified UID of async result (optional).
Delete a Release by resource name.
void remove(AsyncClientClass &aClient, const String &projectId, const String &releaseId, AsyncResult &aResult)
Params:
aClient
- The async client.projectId
- The project ID.releaseId
- The release ID.aResult
- The async result (AsyncResult).
Delete a Release by resource name.
String remove(AsyncClientClass &aClient, const String &projectId, const String &releaseId)
Params:
aClient
- The async client.projectId
- The project ID.releaseId
- The release ID.
Returns:
String
- The response payload.
Get a Release by name.
void get(AsyncClientClass &aClient, const String &projectId, const String &releaseId, AsyncResultCallback cb, const String &uid = "")
Params:
aClient
- The async client.projectId
- The project ID.releaseId
- The release ID.cb
- The async result callback (AsyncResultCallback).uid
- The user specified UID of async result (optional).
Get a Release by name.
void get(AsyncClientClass &aClient, const String &projectId, const String &releaseId, AsyncResult &aResult)
Params:
aClient
- The async client.projectId
- The project ID.releaseId
- The release ID.aResult
- The async result (AsyncResult).
Get a Release by name.
String get(AsyncClientClass &aClient, const String &projectId, const String &releaseId)
Params:
aClient
- The async client.projectId
- The project ID.releaseId
- The release ID.
Returns:
String
- The response payload.
Get the Release executable to use when enforcing rules.
void getExecutable(AsyncClientClass &aClient, const String &projectId, const String &releaseId, Rules::ReleaseExecutableVersion executableVersion, AsyncResultCallback cb, const String &uid = "")
Params:
-
aClient
- The async client. -
projectId
- The project ID. -
releaseId
- The release ID. -
executableVersion
- ReleaseExecutableVersion enum. -
RELEASE_EXECUTABLE_VERSION_UNSPECIFIED
Executable format unspecified. Defaults to FIREBASE_RULES_EXECUTABLE_V1 -
FIREBASE_RULES_EXECUTABLE_V1
Firebase Rules syntax 'rules2' executable versions: Custom AST for use with Java clients. -
FIREBASE_RULES_EXECUTABLE_V2
CEL-based executable for use with C++ clients.
The requested runtime executable version. Defaults to FIREBASE_RULES_EXECUTABLE_V1
.
cb
- The async result callback (AsyncResultCallback).uid
- The user specified UID of async result (optional).
Get the Release executable to use when enforcing rules.
void getExecutable(AsyncClientClass &aClient, const String &projectId, const String &releaseId, Rules::ReleaseExecutableVersion executableVersion, AsyncResult &aResult)
Params:
-
aClient
- The async client. -
projectId
- The project ID. -
releaseId
- The release ID. -
executableVersion
- ReleaseExecutableVersion enum. -
RELEASE_EXECUTABLE_VERSION_UNSPECIFIED
Executable format unspecified. Defaults to FIREBASE_RULES_EXECUTABLE_V1 -
FIREBASE_RULES_EXECUTABLE_V1
Firebase Rules syntax 'rules2' executable versions: Custom AST for use with Java clients. -
FIREBASE_RULES_EXECUTABLE_V2
CEL-based executable for use with C++ clients.
The requested runtime executable version. Defaults to FIREBASE_RULES_EXECUTABLE_V1
.
aResult
- The async result (AsyncResult).
Get the Release executable to use when enforcing rules.
String getExecutable(AsyncClientClass &aClient, const String &projectId, const String &releaseId, Rules::ReleaseExecutableVersion executableVersion)
Params:
-
aClient
- The async client. -
projectId
- The project ID. -
releaseId
- The release ID. -
executableVersion
- ReleaseExecutableVersion enum. -
RELEASE_EXECUTABLE_VERSION_UNSPECIFIED
Executable format unspecified. Defaults to FIREBASE_RULES_EXECUTABLE_V1 -
FIREBASE_RULES_EXECUTABLE_V1
Firebase Rules syntax 'rules2' executable versions: Custom AST for use with Java clients. -
FIREBASE_RULES_EXECUTABLE_V2
CEL-based executable for use with C++ clients.
The requested runtime executable version. Defaults to FIREBASE_RULES_EXECUTABLE_V1
.
Returns:
String
- The response payload.
List the Release values for a project. This list may optionally be filtered by Release name, Ruleset name, TestSuite name, or any combination thereof.
void list(AsyncClientClass &aClient, const String &projectId, const ListOptions &listOptions, AsyncResultCallback cb, const String &uid = "")
Params:
aClient
- The async client.projectId
- The project ID.listOptions
- The ListOptions object that represents the request query parameters e.g.filter
,pageSize
andpageToken
.cb
- The async result callback (AsyncResultCallback).uid
- The user specified UID of async result (optional).
List the Release values for a project. This list may optionally be filtered by Release name, Ruleset name, TestSuite name, or any combination thereof.
void list(AsyncClientClass &aClient, const String &projectId, const ListOptions &listOptions, AsyncResult &aResult)
Params:
aClient
- The async client.projectId
- The project ID.listOptions
- The ListOptions object that represents the request query parameters e.g.filter
,pageSize
andpageToken
.aResult
- The async result (AsyncResult).
List the Release values for a project. This list may optionally be filtered by Release name, Ruleset name, TestSuite name, or any combination thereof.
String list(AsyncClientClass &aClient, const String &projectId, const ListOptions &listOptions)
Params:
aClient
- The async client.projectId
- The project ID.listOptions
- The ListOptions object that represents the request query parameters e.g.filter
,pageSize
andpageToken
.
Returns:
String
- The response payload.
Update a Release via PATCH.
Only updates to rulesetName will be honored. Release rename is not supported. To create a Release use the releases.create method.
void patch(AsyncClientClass &aClient, const String &projectId, const Release &release, const String &updateMask, AsyncResultCallback cb, const String &uid = "")
Params:
aClient
- The async client.projectId
- The project ID.release
- The Release object to update.updateMask
- Specifies which fields to update. This is a comma-separated list of fully qualified names of fields. Example: "user.displayName,photo".cb
- The async result callback (AsyncResultCallback).uid
- The user specified UID of async result (optional).
Update a Release via PATCH.
Only updates to rulesetName will be honored. Release rename is not supported. To create a Release use the releases.create method.
void patch(AsyncClientClass &aClient, const String &projectId, const Release &release, const String &updateMask, AsyncResult &aResult)
Params:
aClient
- The async client.projectId
- The project ID.release
- The Release object to update.updateMask
- Specifies which fields to update. This is a comma-separated list of fully qualified names of fields. Example: "user.displayName,photo".aResult
- The async result (AsyncResult).
Update a Release via PATCH.
Only updates to rulesetName will be honored. Release rename is not supported. To create a Release use the releases.create method.
String patch(AsyncClientClass &aClient, const String &projectId, const Release &release, const String &updateMask)
Params:
aClient
- The async client.projectId
- The project ID.release
- The Release object to update.updateMask
- Specifies which fields to update. This is a comma-separated list of fully qualified names of fields. Example: "user.displayName,photo".
Returns:
String
- The response payload.