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

Open
wants to merge 1 commit 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

  • 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, Backup details, and Mount.

Copy link
Contributor

coderabbitai bot commented Dec 17, 2024

📝 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 and locations to backup endpoint responses
- Updated location to accept list of strings
- Allowed ALL for addons in partial backup creation
- Clarified payload requirements for backups
docs/api/supervisor/models.md - Extended Backup model with size_bytes, locations
- Added compressed and supervisor_version to Backup details
- Introduced user_path in Mount model

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.


📜 Recent review details

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

📥 Commits

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

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

879-879: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


885-885: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


997-997: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


1003-1003: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

🔇 Additional comments (11)
docs/api/supervisor/models.md (3)

171-183: LGTM! Well-documented backup model changes.

The additions to the Backup model are clear and comprehensive:

  • Added size_bytes for precise size tracking
  • Added locations array to support multiple backup locations
  • Clear descriptions that help API consumers understand the fields

203-215: LGTM! Backup details model is consistent with backup model.

The changes to the Backup details model align well with the Backup model changes:

  • Added size_bytes for precise size tracking
  • Added compressed and supervisor_version fields
  • Clear descriptions that help API consumers understand version compatibility

283-296: LGTM! Mount model changes improve clarity.

The Mount model updates are well structured:

  • Added request/response column to clearly indicate field availability
  • Added read_only and user_path fields with clear descriptions
  • Helpful note about request/response field behavior
docs/api/supervisor/endpoints.md (8)

784-790: LGTM! Backup response fields are well documented.

The backup response fields are clearly documented with examples showing:

  • Added size_bytes for precise size tracking
  • Added locations array for multiple backup locations
  • Consistent with the model definitions

Also applies to: 823-827


852-855: LGTM! Backup creation parameters and responses are clear.

The backup creation endpoint documentation:

  • Clearly documents the location parameter for multiple backup locations
  • Added job_id response field for async operations
  • Added helpful note about error handling

Also applies to: 861-862, 866-872


879-890: LGTM! Upload endpoint query parameters are well explained.

The backup upload endpoint documentation:

  • Clear explanation of the location parameter
  • Good examples showing single and multiple location usage
🧰 Tools
🪛 Markdownlint (0.37.0)

879-879: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


885-885: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


919-926: LGTM! Partial backup parameters are well documented.

The partial backup endpoint documentation:

  • Clear explanation of content parameters
  • Added support for ALL in addons parameter
  • Consistent with full backup endpoint

997-1007: LGTM! Download endpoint query parameters are clear.

The backup download endpoint documentation:

  • Clear explanation of the location parameter
  • Good examples showing different location options
🧰 Tools
🪛 Markdownlint (0.37.0)

997-997: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


1003-1003: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


1020-1025: LGTM! Delete endpoint parameters are well documented.

The backup delete endpoint documentation:

  • Clear explanation of the location parameter
  • References the backup model for consistency

1034-1038: LGTM! Restore parameters are well documented.

The backup restore endpoint documentation:

  • Added background parameter for async operations
  • Added location parameter for restore source
  • Clear descriptions of all parameters

1063-1072: LGTM! Partial restore parameters match full restore.

The partial restore endpoint documentation:

  • Consistent with full restore endpoint
  • Clear content parameters
  • Added background and location parameters

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.

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.

1 participant