Class: Google::Apis::FirebaserulesV1::FirebaseRulesService
- Inherits:
-
Core::BaseService
- Object
- Core::BaseService
- Google::Apis::FirebaserulesV1::FirebaseRulesService
- Defined in:
- lib/google/apis/firebaserules_v1/service.rb
Overview
Firebase Rules API
Creates and manages rules that determine when a Firebase Rules-enabled service should permit a request.
Constant Summary collapse
- DEFAULT_ENDPOINT_TEMPLATE =
"https://firebaserules.$UNIVERSE_DOMAIN$/"
Instance Attribute Summary collapse
-
#key ⇒ String
API key.
-
#quota_user ⇒ String
Available to use for quota purposes for server-side applications.
Instance Method Summary collapse
-
#create_project_release(name, release_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::Release
Create a
Release
. -
#create_project_ruleset(name, ruleset_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::Ruleset
Create a
Ruleset
fromSource
. -
#delete_project_release(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::Empty
Delete a
Release
by resource name. -
#delete_project_ruleset(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::Empty
Delete a
Ruleset
by resource name. -
#get_project_release(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::Release
Get a
Release
by name. -
#get_project_release_executable(name, executable_version: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::GetReleaseExecutableResponse
Get the
Release
executable to use when enforcing rules. -
#get_project_ruleset(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::Ruleset
Get a
Ruleset
by name including the fullSource
contents. -
#initialize ⇒ FirebaseRulesService
constructor
A new instance of FirebaseRulesService.
-
#list_project_releases(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::ListReleasesResponse
List the
Release
values for a project. -
#list_project_rulesets(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::ListRulesetsResponse
List
Ruleset
metadata only and optionally filter the results byRuleset
name. -
#patch_project_release(name, update_release_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::Release
Update a
Release
via PATCH. -
#test_project_ruleset(name, test_ruleset_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::TestRulesetResponse
Test
Source
for syntactic and semantic correctness.
Constructor Details
#initialize ⇒ FirebaseRulesService
Returns a new instance of FirebaseRulesService.
48 49 50 51 52 53 |
# File 'lib/google/apis/firebaserules_v1/service.rb', line 48 def initialize super(DEFAULT_ENDPOINT_TEMPLATE, '', client_name: 'google-apis-firebaserules_v1', client_version: Google::Apis::FirebaserulesV1::GEM_VERSION) @batch_path = 'batch' end |
Instance Attribute Details
#key ⇒ String
Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
41 42 43 |
# File 'lib/google/apis/firebaserules_v1/service.rb', line 41 def key @key end |
#quota_user ⇒ String
Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
46 47 48 |
# File 'lib/google/apis/firebaserules_v1/service.rb', line 46 def quota_user @quota_user end |
Instance Method Details
#create_project_release(name, release_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::Release
Create a Release
. Release names should reflect the developer's deployment
practices. For example, the release name 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 UpdateRelease method.
135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/google/apis/firebaserules_v1/service.rb', line 135 def create_project_release(name, release_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/{+name}/releases', ) command.request_representation = Google::Apis::FirebaserulesV1::Release::Representation command.request_object = release_object command.response_representation = Google::Apis::FirebaserulesV1::Release::Representation command.response_class = Google::Apis::FirebaserulesV1::Release command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#create_project_ruleset(name, ruleset_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::Ruleset
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. For a detailed view of Source
issues, use TestRuleset.
361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/google/apis/firebaserules_v1/service.rb', line 361 def create_project_ruleset(name, ruleset_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/{+name}/rulesets', ) command.request_representation = Google::Apis::FirebaserulesV1::Ruleset::Representation command.request_object = ruleset_object command.response_representation = Google::Apis::FirebaserulesV1::Ruleset::Representation command.response_class = Google::Apis::FirebaserulesV1::Ruleset command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#delete_project_release(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::Empty
Delete a Release
by resource name.
168 169 170 171 172 173 174 175 176 |
# File 'lib/google/apis/firebaserules_v1/service.rb', line 168 def delete_project_release(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:delete, 'v1/{+name}', ) command.response_representation = Google::Apis::FirebaserulesV1::Empty::Representation command.response_class = Google::Apis::FirebaserulesV1::Empty command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#delete_project_ruleset(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::Empty
Delete a Ruleset
by resource name. If the Ruleset
is referenced by a
Release
the operation will fail.
395 396 397 398 399 400 401 402 403 |
# File 'lib/google/apis/firebaserules_v1/service.rb', line 395 def delete_project_ruleset(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:delete, 'v1/{+name}', ) command.response_representation = Google::Apis::FirebaserulesV1::Empty::Representation command.response_class = Google::Apis::FirebaserulesV1::Empty command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#get_project_release(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::Release
Get a Release
by name.
199 200 201 202 203 204 205 206 207 |
# File 'lib/google/apis/firebaserules_v1/service.rb', line 199 def get_project_release(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}', ) command.response_representation = Google::Apis::FirebaserulesV1::Release::Representation command.response_class = Google::Apis::FirebaserulesV1::Release command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#get_project_release_executable(name, executable_version: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::GetReleaseExecutableResponse
Get the Release
executable to use when enforcing rules.
233 234 235 236 237 238 239 240 241 242 |
# File 'lib/google/apis/firebaserules_v1/service.rb', line 233 def get_project_release_executable(name, executable_version: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}:getExecutable', ) command.response_representation = Google::Apis::FirebaserulesV1::GetReleaseExecutableResponse::Representation command.response_class = Google::Apis::FirebaserulesV1::GetReleaseExecutableResponse command.params['name'] = name unless name.nil? command.query['executableVersion'] = executable_version unless executable_version.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#get_project_ruleset(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::Ruleset
Get a Ruleset
by name including the full Source
contents.
426 427 428 429 430 431 432 433 434 |
# File 'lib/google/apis/firebaserules_v1/service.rb', line 426 def get_project_ruleset(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}', ) command.response_representation = Google::Apis::FirebaserulesV1::Ruleset::Representation command.response_class = Google::Apis::FirebaserulesV1::Ruleset command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#list_project_releases(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::ListReleasesResponse
List the Release
values for a project. This list may optionally be filtered
by Release
name, Ruleset
name, TestSuite
name, or any combination
thereof.
287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/google/apis/firebaserules_v1/service.rb', line 287 def list_project_releases(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}/releases', ) command.response_representation = Google::Apis::FirebaserulesV1::ListReleasesResponse::Representation command.response_class = Google::Apis::FirebaserulesV1::ListReleasesResponse command.params['name'] = name unless name.nil? command.query['filter'] = filter unless filter.nil? command.query['pageSize'] = page_size unless page_size.nil? command.query['pageToken'] = page_token unless page_token.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#list_project_rulesets(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::ListRulesetsResponse
List Ruleset
metadata only and optionally filter the results by Ruleset
name. The full Source
contents of a Ruleset
may be retrieved with
GetRuleset.
470 471 472 473 474 475 476 477 478 479 480 481 |
# File 'lib/google/apis/firebaserules_v1/service.rb', line 470 def list_project_rulesets(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}/rulesets', ) command.response_representation = Google::Apis::FirebaserulesV1::ListRulesetsResponse::Representation command.response_class = Google::Apis::FirebaserulesV1::ListRulesetsResponse command.params['name'] = name unless name.nil? command.query['filter'] = filter unless filter.nil? command.query['pageSize'] = page_size unless page_size.nil? command.query['pageToken'] = page_token unless page_token.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#patch_project_release(name, update_release_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::Release
Update a Release
via PATCH. Only updates to ruleset_name
will be honored.
Release
rename is not supported. To create a Release
use the CreateRelease
method.
324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/google/apis/firebaserules_v1/service.rb', line 324 def patch_project_release(name, update_release_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:patch, 'v1/{+name}', ) command.request_representation = Google::Apis::FirebaserulesV1::UpdateReleaseRequest::Representation command.request_object = update_release_request_object command.response_representation = Google::Apis::FirebaserulesV1::Release::Representation command.response_class = Google::Apis::FirebaserulesV1::Release command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#test_project_ruleset(name, test_ruleset_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FirebaserulesV1::TestRulesetResponse
Test Source
for syntactic and semantic correctness. Issues present, if any,
will be returned to the caller with a description, severity, and source
location. The test method may be executed with Source
or a Ruleset
name.
Passing Source
is useful for unit testing new rules. Passing a Ruleset
name is useful for regression testing an existing rule. 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.
auth.uid && (imageName.matches('.png$') || imageName.matches('.jpg$')) &&
resource.mimeType.matches('^image/')
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/google/apis/firebaserules_v1/service.rb', line 89 def test_project_ruleset(name, test_ruleset_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/{+name}:test', ) command.request_representation = Google::Apis::FirebaserulesV1::TestRulesetRequest::Representation command.request_object = test_ruleset_request_object command.response_representation = Google::Apis::FirebaserulesV1::TestRulesetResponse::Representation command.response_class = Google::Apis::FirebaserulesV1::TestRulesetResponse command.params['name'] = name unless name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |