Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document fields and parameters added to support cloud backup #2506

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mdegat01
Copy link
Contributor

@mdegat01 mdegat01 commented Dec 17, 2024

Proposed change

Document the fields and parameters added to Supervisor's API in support of the cloud backup work. Additionally fixes some small gaps in the backup response model documentation I noticed.

This is catch-up after a number of PRs to Supervisor. I'm actually going to link the Supervisor client library PRs rather then Supervisor ones as they are easier to review since they match the API changes and almost nothing else. Whereas the Supervisor PRs include a lot more then the API changes. They also link back to the corresponding Supervisor PRs for reviewing there as well:

Type of change

  • Document existing features within Home Assistant
  • Document new or changing features which there is an existing pull request elsewhere
  • Spelling or grammatical corrections, or rewording for improved clarity
  • Changes to the backend of this documentation
  • Removed stale or deprecated documentation

Additional information

  • This PR fixes or closes issue: fixes #
  • Link to relevant existing code or pull request:

Summary by CodeRabbit

Summary by CodeRabbit

  • Documentation
    • Enhanced API documentation for Supervisor endpoints, adding new fields for backup-related endpoints.
    • Updated payload requirements for creating backups to allow for more flexible options.
    • Clarified descriptions and examples throughout the documentation for better usability.
    • Expanded the Supervisor API models with additional fields for Backup and Backup details, improving data representation.

Copy link
Contributor

coderabbitai bot commented Dec 17, 2024

Warning

Rate limit exceeded

@mdegat01 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 34 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d905151 and a9d4e0f.

📒 Files selected for processing (1)
  • docs/api/supervisor/endpoints.md (9 hunks)
📝 Walkthrough

Walkthrough

The pull request introduces enhancements to the Supervisor API documentation, focusing on backup-related endpoints and models. The changes expand the backup information by adding new fields like size_bytes and locations, providing more detailed backup metadata. The documentation now allows for more flexible backup creation, including the ability to specify ALL for add-ons and supporting multiple backup destinations. The modifications aim to improve the clarity and functionality of backup-related API interactions.

Changes

File Changes
docs/api/supervisor/endpoints.md - Added size_bytes, locations, and location_attributes to backup endpoint responses
- Updated location to accept a list of strings or a string
- Allowed ALL for addons in partial backup creation
- Clarified payload requirements for backups, requiring at least one "Content" key
docs/api/supervisor/models.md - Extended Backup model with location_attributes, size, size_bytes, location, and locations
- Updated Backup details model with location_attributes, supervisor_version, and extra

Sequence Diagram

sequenceDiagram
    participant Client
    participant SupervisorAPI
    participant BackupSystem

    Client->>SupervisorAPI: Request Backup Creation
    alt Full Backup
        Client->>SupervisorAPI: POST /backups/new/full
    else Partial Backup
        Client->>SupervisorAPI: POST /backups/new/partial
    end
    SupervisorAPI->>BackupSystem: Initiate Backup
    BackupSystem-->>SupervisorAPI: Generate Backup
    SupervisorAPI-->>Client: Return Backup Details (size, locations)
Loading

This sequence diagram illustrates the high-level flow of backup creation through the Supervisor API, showing how a client can request either a full or partial backup, and receive detailed information about the created backup.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
docs/api/supervisor/endpoints.md (1)

934-944: Consider clarifying the 'ALL' behavior for addons.

While the documentation correctly shows that addons can accept ALL, it would be helpful to explicitly state that this includes all currently installed add-ons.

-| addons                         | list or `ALL`  | Content  | A list of strings representing add-on slugs. Provide the string `ALL` instead of a list to include all currently installed add-ons |
+| addons                         | list or `ALL`  | Content  | A list of strings representing add-on slugs. Provide the string `ALL` instead of a list to automatically include all add-ons that are currently installed in the system |
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7b7bd4 and d905151.

📒 Files selected for processing (2)
  • docs/api/supervisor/endpoints.md (9 hunks)
  • docs/api/supervisor/models.md (3 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
docs/api/supervisor/endpoints.md

892-892: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


899-899: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


1013-1013: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


1019-1019: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Redirect rules - developers-home-assistant
  • GitHub Check: Header rules - developers-home-assistant
  • GitHub Check: Pages changed - developers-home-assistant
🔇 Additional comments (7)
docs/api/supervisor/models.md (4)

171-185: Well-documented backup model changes!

The changes clearly document the new cloud backup capabilities while properly marking deprecated fields. The new location_attributes field provides a flexible way to track backup metadata across multiple locations.


186-191: Clear and consistent location attributes documentation!

The location attributes structure is well-defined and aligns perfectly with its usage in the Backup model.


205-224: Comprehensive backup details model documentation!

The changes thoroughly document:

  • New fields for cloud backup support
  • Version tracking capabilities
  • Optional Home Assistant inclusion
  • Consistent deprecation notices

292-305: Helpful mount model enhancements!

The changes improve the documentation by:

  • Clarifying which fields are available in requests vs responses
  • Adding support for read-only mounts
  • Including user-facing path information
docs/api/supervisor/endpoints.md (3)

784-793: Clear and consistent backup response example!

The example accurately demonstrates the structure of the new backup fields, aligning perfectly with the model documentation.


892-905: Excellent query parameter documentation!

The documentation clearly explains:

  • Available query parameters
  • Multiple location support
  • Common usage examples
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

892-892: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


899-899: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


879-885: Valuable error handling documentation!

The note provides important guidance for API consumers about:

  • Additional job_id field in error responses
  • How to handle complex error scenarios
  • Where to find detailed error information

| compressed | boolean | True | `false` to create uncompressed backups |
| location | string or null | True | Name of a backup mount or `null` for /backup |
| location | list or string | True | Name of a backup mount or `.local` for /backup. Use a list to the make backup in multiple places |
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
| location | list or string | True | Name of a backup mount or `.local` for /backup. Use a list to the make backup in multiple places |
| location | list or string | True | Name of a backup mount or `.local` for /backup. Use a list to the store the backup in multiple places |

Comment on lines +180 to +184
| size | float | yes | Size of the backup in MB (rounded) |
| size_bytes | int | yes | Size of the backup in bytes |
| location | string or null | yes | The name of the backup mount it's stored on. `null` if it's stored locally |
| locations | list | yes | List of names of all backup mounts it's stored on and/or `null` if it's stored locally |
| protected | boolean | yes | `true` if the backup is password protected |
Copy link
Member

Choose a reason for hiding this comment

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

I'd mark the fields we don't have in the client library as deprecated here too (related to home-assistant-libs/python-supervisor-client#47

Suggested change
| size | float | yes | Size of the backup in MB (rounded) |
| size_bytes | int | yes | Size of the backup in bytes |
| location | string or null | yes | The name of the backup mount it's stored on. `null` if it's stored locally |
| locations | list | yes | List of names of all backup mounts it's stored on and/or `null` if it's stored locally |
| protected | boolean | yes | `true` if the backup is password protected |
| size | float | yes | Size of the backup in MB (rounded) (deprecated) |
| size_bytes | int | yes | Size of the backup in bytes (deprecated) |
| location | string or null | yes | The name of the backup mount it's stored on. `null` if it's stored locally |
| locations | list | yes | List of names of all backup mounts it's stored on and/or `null` if it's stored locally (deprecated) |
| protected | boolean | yes | `true` if the backup is password protected |

@home-assistant home-assistant bot marked this pull request as draft January 31, 2025 15:38
@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

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.

2 participants