Class: Google::Apis::FirebaserulesV1::FirebaseRulesService

Inherits:
Core::BaseService show all
Defined in:
generated/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.

Examples:

require 'google/apis/firebaserules_v1'

Firebaserules = Google::Apis::FirebaserulesV1 # Alias the module
service = Firebaserules::FirebaseRulesService.new

See Also:

Instance Attribute Summary collapse

Attributes inherited from Core::BaseService

#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path

Instance Method Summary collapse

Methods inherited from Core::BaseService

#batch, #batch_upload, #fetch_all, #http

Methods included from Core::Logging

#logger

Constructor Details

#initializeFirebaseRulesService

Returns a new instance of FirebaseRulesService



46
47
48
49
# File 'generated/google/apis/firebaserules_v1/service.rb', line 46

def initialize
  super('https://firebaserules.googleapis.com/', '')
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString

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.

Returns:

  • (String)

    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.



39
40
41
# File 'generated/google/apis/firebaserules_v1/service.rb', line 39

def key
  @key
end

#quota_userString

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.

Returns:

  • (String)

    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.



44
45
46
# File 'generated/google/apis/firebaserules_v1/service.rb', line 44

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 table reflects the 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.

Parameters:

  • name (String)

    Resource name for the project which owns this Release. Format: projects/project_id``

  • release_object (Google::Apis::FirebaserulesV1::Release) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



144
145
146
147
148
149
150
151
152
153
154
# File 'generated/google/apis/firebaserules_v1/service.rb', line 144

def create_project_release(name, release_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1/{+name}/releases', options)
  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.

Parameters:

  • name (String)

    Resource name for Project which owns this Ruleset. Format: projects/project_id``

  • ruleset_object (Google::Apis::FirebaserulesV1::Ruleset) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



380
381
382
383
384
385
386
387
388
389
390
# File 'generated/google/apis/firebaserules_v1/service.rb', line 380

def create_project_ruleset(name, ruleset_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1/{+name}/rulesets', options)
  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.

Parameters:

  • name (String)

    Resource name for the Release to delete. Format: projects/project_id/releases/release_id``

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



177
178
179
180
181
182
183
184
185
# File 'generated/google/apis/firebaserules_v1/service.rb', line 177

def delete_project_release(name, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:delete, 'v1/{+name}', options)
  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.

Parameters:

  • name (String)

    Resource name for the ruleset to delete. Format: projects/project_id/rulesets/ruleset_id``

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



414
415
416
417
418
419
420
421
422
# File 'generated/google/apis/firebaserules_v1/service.rb', line 414

def delete_project_ruleset(name, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:delete, 'v1/{+name}', options)
  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.

Parameters:

  • name (String)

    Resource name of the Release. Format: projects/project_id/releases/release_id``

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



208
209
210
211
212
213
214
215
216
# File 'generated/google/apis/firebaserules_v1/service.rb', line 208

def get_project_release(name, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:get, 'v1/{+name}', options)
  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.

Parameters:

  • name (String)

    Resource name of the Release. Format: projects/project_id/releases/release_id``

  • executable_version (String)

    The requested runtime executable version. Defaults to FIREBASE_RULES_EXECUTABLE_V1

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



242
243
244
245
246
247
248
249
250
251
# File 'generated/google/apis/firebaserules_v1/service.rb', line 242

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', options)
  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.

Parameters:

  • name (String)

    Resource name for the ruleset to get. Format: projects/project_id/rulesets/ruleset_id``

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



445
446
447
448
449
450
451
452
453
# File 'generated/google/apis/firebaserules_v1/service.rb', line 445

def get_project_ruleset(name, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:get, 'v1/{+name}', options)
  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.

Parameters:

  • name (String)

    Resource name for the project. Format: projects/project_id``

  • filter (String)

    Release filter. The list method supports filters with restrictions on the Release.name, Release.ruleset_name, and Release.test_suite_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* ruleset_name=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. e.g. test_suite_name=projects/foo/testsuites/uuid1

  • page_size (Fixnum)

    Page size to load. Maximum of 100. Defaults to 10. Note: page_size is just a hint and the service may choose to load fewer than page_size results due to the size of the output. To traverse all of the releases, the caller should iterate until the page_token on the response is empty.

  • page_token (String)

    Next page token for the next batch of Release instances.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



304
305
306
307
308
309
310
311
312
313
314
315
# File 'generated/google/apis/firebaserules_v1/service.rb', line 304

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', options)
  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.

Parameters:

  • name (String)

    Resource name for the project. Format: projects/project_id``

  • filter (String)

    Ruleset filter. 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-01") AND name=UUID-*

  • page_size (Fixnum)

    Page size to load. Maximum of 100. Defaults to 10. Note: page_size is just a hint and the service may choose to load less than page_size due to the size of the output. To traverse all of the releases, caller should iterate until the page_token is empty.

  • page_token (String)

    Next page token for loading the next batch of Ruleset instances.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



492
493
494
495
496
497
498
499
500
501
502
503
# File 'generated/google/apis/firebaserules_v1/service.rb', line 492

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', options)
  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 the ruleset_name and test_suite_name fields will be honored. Release rename is not supported. To create a Release use the CreateRelease method.

Parameters:

  • name (String)

    Resource name for the project which owns this Release. Format: projects/project_id``

  • update_release_request_object (Google::Apis::FirebaserulesV1::UpdateReleaseRequest) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



342
343
344
345
346
347
348
349
350
351
352
# File 'generated/google/apis/firebaserules_v1/service.rb', line 342

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}', options)
  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/')

Parameters:

  • name (String)

    Tests may either provide source or a Ruleset resource name. For tests against source, the resource name must refer to the project: Format: projects/project_id For tests against a `Ruleset`, this must be the `Ruleset` resource name: Format: `projects/`project_id`/rulesets/`ruleset_id

  • test_ruleset_request_object (Google::Apis::FirebaserulesV1::TestRulesetRequest) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



93
94
95
96
97
98
99
100
101
102
103
# File 'generated/google/apis/firebaserules_v1/service.rb', line 93

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', options)
  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