Skip to content

Conversation

@hiranya911
Copy link
Contributor

@hiranya911 hiranya911 commented Aug 1, 2019

Implemented the releaseFirestoreRuleset() API. This attempts to PATCH the existing release.

@ryanpbrewster
Copy link
Contributor

Under what circumstances would we expect to get a not-found error? In general the partner services themselves are responsible for creating the release.

@hiranya911
Copy link
Contributor Author

I'm not really sure -- just going by intuition here. If these releases are guaranteed to always exist, we can certainly get rid of the createRelease logic and further simplify the implementation. There is also a deleteRelease operation supported on the REST API, which I haven't played with. What happens if somebody deletes a release (perhaps accidentally)?

@ryanpbrewster
Copy link
Contributor

My mental model is that creating a release is basically "enabling" the service (e.g., linking a GCS bucket up to work with Firebase Storage), and deleting the release is the inverse (e.g., removing the bucket, disabling client access).

@hiranya911
Copy link
Contributor Author

Fair enough. I've removed the createRelease functionality from the PR.

@ryanpbrewster ryanpbrewster removed their assignment Aug 2, 2019
readonly createTime: string;
readonly updateTime: string;
readonly createTime?: string;
readonly updateTime?: string;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to expect that we won't get the create and updateTimes back, or you're just signaling that we don't rely on them for anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use the same interface as an input argument when updating/patching a release. In this case I wanted the flexibility to not specify these 2 attributes. And you're right -- we also don't rely on them for anything else.


/**
* Releases the specified ruleset as the current Cloud Firestore ruleset. This makes the specified ruleset
* the currently applied ruleset for Cloud Firestore.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Total nit; seems like the second sentence is more complete and could stand on its own here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


private releaseRuleset(ruleset: string | RulesetMetadata, releaseName: string): Promise<void> {
if (!validator.isNonEmptyString(ruleset) &&
(!validator.isNonNullObject(ruleset) || !validator.isNonEmptyString(ruleset.name))) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's interesting that the name could come in either as a String or as part of the RulesetMetadata Object. Why did you opt for this and not the simpler signature of only passing in the name as a String, making it the caller's job to pluck out the name if it had an Object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use the same private method for releasing storage rulesets. By doing it here we save a few lines from being duplicated.

@hiranya911 hiranya911 assigned hiranya911 and unassigned rachelmyers Aug 7, 2019
@hiranya911 hiranya911 merged commit d6c7af9 into rules Aug 7, 2019
@hiranya911 hiranya911 deleted the hkj-release-ruleset branch August 7, 2019 17:41
hiranya911 added a commit that referenced this pull request Sep 18, 2019
* Implementing the Firebase Security Rules API (#604)

* Implementing the Firebase Security Rules API

* More argument validation and assertions

* Cleaning up the rules impl

* Internal API renamed

* Fixing a typo in a comment

* Implemented createRulesFileFromSource() and createRuleset() APIs (#607)

* Implementing the Firebase Security Rules API

* More argument validation and assertions

* Adding the rest of the CRUD operations for rulesets

* Cleaning up the rules impl

* Cleaned up tests

* Adding some missing comments

* Removing support for multiple rules files in create()

* Implemented the deleteRuleset() API (#609)

* Added deleteRuleset API

* Merged with source

* Implemented the API for releasing rulesets (#610)

* Implemented the API for releasing rulesets

* Removed createRelease logic

* Updated comment

* Added the getStorageRuleset() API (#613)

* Implemented the API for releasing rulesets

* Removed createRelease logic

* Added getStorageRules() API

* Removed some redundant tests

* Implementing the remaining releaseRuleset APIs (#616)

* Implemented the listRulesetMetadata() API (#622)

* Adding the rules API to the public API surface (#625)

* Added rules API to the public admin namespace

* Updated docs

* Addressing comments regarding the d.ts file

* Updated App typings

* Rules integration tests (#633)

* Rules integration tests

* Refactored by adding some helper methods

* Cleaned up some conditionals

* Added verification for deleteRuleset test

* Renamed tempRulesets

* Handling ruleset limit exceeded error (#636)

* Fixing alignment of an annotation

* Updated comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants