Skip to content

Commit

Permalink
docs: add api docs to should_auto_attach endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
orndorffgrant committed Jun 20, 2024
1 parent 39488b3 commit e4aa252
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion uaclient/api/u/pro/attach/auto/should_auto_attach/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@

class ShouldAutoAttachResult(DataObject, AdditionalInfo):
fields = [
Field("should_auto_attach", BoolDataValue),
Field(
"should_auto_attach",
BoolDataValue,
doc="True if the system should run auto-attach on boot",
),
]

def __init__(self, should_auto_attach: bool):
Expand All @@ -21,6 +25,9 @@ def should_auto_attach() -> ShouldAutoAttachResult:


def _should_auto_attach(cfg: UAConfig) -> ShouldAutoAttachResult:
"""
This endpoint checks if a given system should run auto-attach on boot.
"""
try:
cloud_instance_factory()
except exceptions.CloudFactoryError:
Expand All @@ -40,3 +47,20 @@ def _should_auto_attach(cfg: UAConfig) -> ShouldAutoAttachResult:
fn=_should_auto_attach,
options_cls=None,
)

_doc = {
"introduced_in": "27.11",
"example_python": """
from uaclient.api.u.pro.attach.auto.should_auto_attach.v1 import should_auto_attach
result = should_auto_attach()
""", # noqa: E501
"result_cls": ShouldAutoAttachResult,
"exceptions": [],
"example_cli": "pro api u.pro.attach.auto.should_auto_attach.v1",
"example_json": """
{
"should_auto_attach": false
}
""",
}

0 comments on commit e4aa252

Please sign in to comment.