Skip to content

Commit 12e415b

Browse files
authored
feat(baremetal): support overriding default SSH keys on rescue (#1205)
1 parent 53e625c commit 12e415b

File tree

6 files changed

+44
-0
lines changed

6 files changed

+44
-0
lines changed

scaleway-async/scaleway_async/baremetal/v1/api.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,13 +529,15 @@ async def reboot_server(
529529
server_id: str,
530530
zone: Optional[ScwZone] = None,
531531
boot_type: Optional[ServerBootType] = None,
532+
ssh_key_ids: Optional[List[str]] = None,
532533
) -> Server:
533534
"""
534535
Reboot an Elastic Metal server.
535536
Reboot the Elastic Metal server associated with the ID, use the `boot_type` `rescue` to reboot the server in rescue mode.
536537
:param server_id: ID of the server to reboot.
537538
:param zone: Zone to target. If none is passed will use default zone from the config.
538539
:param boot_type: The type of boot.
540+
:param ssh_key_ids: Additional SSH public key IDs to configure on rescue image.
539541
:return: :class:`Server <Server>`
540542
541543
Usage:
@@ -557,6 +559,7 @@ async def reboot_server(
557559
server_id=server_id,
558560
zone=zone,
559561
boot_type=boot_type,
562+
ssh_key_ids=ssh_key_ids,
560563
),
561564
self.client,
562565
),
@@ -571,13 +574,15 @@ async def start_server(
571574
server_id: str,
572575
zone: Optional[ScwZone] = None,
573576
boot_type: Optional[ServerBootType] = None,
577+
ssh_key_ids: Optional[List[str]] = None,
574578
) -> Server:
575579
"""
576580
Start an Elastic Metal server.
577581
Start the server associated with the ID.
578582
:param server_id: ID of the server to start.
579583
:param zone: Zone to target. If none is passed will use default zone from the config.
580584
:param boot_type: The type of boot.
585+
:param ssh_key_ids: Additional SSH public key IDs to configure on rescue image.
581586
:return: :class:`Server <Server>`
582587
583588
Usage:
@@ -599,6 +604,7 @@ async def start_server(
599604
server_id=server_id,
600605
zone=zone,
601606
boot_type=boot_type,
607+
ssh_key_ids=ssh_key_ids,
602608
),
603609
self.client,
604610
),

scaleway-async/scaleway_async/baremetal/v1/marshalling.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,6 +2001,9 @@ def marshal_RebootServerRequest(
20012001
if request.boot_type is not None:
20022002
output["boot_type"] = request.boot_type
20032003

2004+
if request.ssh_key_ids is not None:
2005+
output["ssh_key_ids"] = request.ssh_key_ids
2006+
20042007
return output
20052008

20062009

@@ -2025,6 +2028,9 @@ def marshal_StartServerRequest(
20252028
if request.boot_type is not None:
20262029
output["boot_type"] = request.boot_type
20272030

2031+
if request.ssh_key_ids is not None:
2032+
output["ssh_key_ids"] = request.ssh_key_ids
2033+
20282034
return output
20292035

20302036

scaleway-async/scaleway_async/baremetal/v1/types.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,6 +1725,11 @@ class RebootServerRequest:
17251725
The type of boot.
17261726
"""
17271727

1728+
ssh_key_ids: Optional[List[str]] = field(default_factory=list)
1729+
"""
1730+
Additional SSH public key IDs to configure on rescue image.
1731+
"""
1732+
17281733

17291734
@dataclass
17301735
class SetServerPrivateNetworksResponse:
@@ -1766,6 +1771,11 @@ class StartServerRequest:
17661771
The type of boot.
17671772
"""
17681773

1774+
ssh_key_ids: Optional[List[str]] = field(default_factory=list)
1775+
"""
1776+
Additional SSH public key IDs to configure on rescue image.
1777+
"""
1778+
17691779

17701780
@dataclass
17711781
class StopBMCAccessRequest:

scaleway/scaleway/baremetal/v1/api.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,13 +529,15 @@ def reboot_server(
529529
server_id: str,
530530
zone: Optional[ScwZone] = None,
531531
boot_type: Optional[ServerBootType] = None,
532+
ssh_key_ids: Optional[List[str]] = None,
532533
) -> Server:
533534
"""
534535
Reboot an Elastic Metal server.
535536
Reboot the Elastic Metal server associated with the ID, use the `boot_type` `rescue` to reboot the server in rescue mode.
536537
:param server_id: ID of the server to reboot.
537538
:param zone: Zone to target. If none is passed will use default zone from the config.
538539
:param boot_type: The type of boot.
540+
:param ssh_key_ids: Additional SSH public key IDs to configure on rescue image.
539541
:return: :class:`Server <Server>`
540542
541543
Usage:
@@ -557,6 +559,7 @@ def reboot_server(
557559
server_id=server_id,
558560
zone=zone,
559561
boot_type=boot_type,
562+
ssh_key_ids=ssh_key_ids,
560563
),
561564
self.client,
562565
),
@@ -571,13 +574,15 @@ def start_server(
571574
server_id: str,
572575
zone: Optional[ScwZone] = None,
573576
boot_type: Optional[ServerBootType] = None,
577+
ssh_key_ids: Optional[List[str]] = None,
574578
) -> Server:
575579
"""
576580
Start an Elastic Metal server.
577581
Start the server associated with the ID.
578582
:param server_id: ID of the server to start.
579583
:param zone: Zone to target. If none is passed will use default zone from the config.
580584
:param boot_type: The type of boot.
585+
:param ssh_key_ids: Additional SSH public key IDs to configure on rescue image.
581586
:return: :class:`Server <Server>`
582587
583588
Usage:
@@ -599,6 +604,7 @@ def start_server(
599604
server_id=server_id,
600605
zone=zone,
601606
boot_type=boot_type,
607+
ssh_key_ids=ssh_key_ids,
602608
),
603609
self.client,
604610
),

scaleway/scaleway/baremetal/v1/marshalling.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,6 +2001,9 @@ def marshal_RebootServerRequest(
20012001
if request.boot_type is not None:
20022002
output["boot_type"] = request.boot_type
20032003

2004+
if request.ssh_key_ids is not None:
2005+
output["ssh_key_ids"] = request.ssh_key_ids
2006+
20042007
return output
20052008

20062009

@@ -2025,6 +2028,9 @@ def marshal_StartServerRequest(
20252028
if request.boot_type is not None:
20262029
output["boot_type"] = request.boot_type
20272030

2031+
if request.ssh_key_ids is not None:
2032+
output["ssh_key_ids"] = request.ssh_key_ids
2033+
20282034
return output
20292035

20302036

scaleway/scaleway/baremetal/v1/types.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,6 +1725,11 @@ class RebootServerRequest:
17251725
The type of boot.
17261726
"""
17271727

1728+
ssh_key_ids: Optional[List[str]] = field(default_factory=list)
1729+
"""
1730+
Additional SSH public key IDs to configure on rescue image.
1731+
"""
1732+
17281733

17291734
@dataclass
17301735
class SetServerPrivateNetworksResponse:
@@ -1766,6 +1771,11 @@ class StartServerRequest:
17661771
The type of boot.
17671772
"""
17681773

1774+
ssh_key_ids: Optional[List[str]] = field(default_factory=list)
1775+
"""
1776+
Additional SSH public key IDs to configure on rescue image.
1777+
"""
1778+
17691779

17701780
@dataclass
17711781
class StopBMCAccessRequest:

0 commit comments

Comments
 (0)