Skip to content

Commit aac7959

Browse files
frantranftran
andauthored
add Fleet API 2025-03-01 (#8589)
* add Fleet 2025-03-01 api * add api * add serialization * revert changes, remove old api version * add next api * add changes * fix linters * remove wait to remove get * add name parameter alias * redo test recordings * redo test with discover * redo recording * fix recording * add comment * remove comment * fix recording * remove unused parameter * add pylint disable * fix trailing whitespace --------- Co-authored-by: ftran <[email protected]>
1 parent f77c214 commit aac7959

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+6085
-4216
lines changed

src/fleet/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,7 @@ Release History
115115
1.4.0
116116
++++++
117117
* Set autoupgradeprofile commands to preview mode
118+
119+
1.5.0
120+
++++++
121+
* Upgrade SDK version to 2025-03-01

src/fleet/azext_fleet/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def register_fleet_resource_type():
1515
register_resource_type(
1616
"latest",
1717
CUSTOM_MGMT_FLEET,
18-
SDKProfile("2024-05-02-preview"),
18+
SDKProfile("2025-03-01"),
1919
)
2020

2121

src/fleet/azext_fleet/_client_factory.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,7 @@ def get_resource_groups_client(cli_ctx, subscription_id=None):
4040

4141
def cf_auto_upgrade_profiles(cli_ctx, *_):
4242
return get_container_service_client(cli_ctx).auto_upgrade_profiles
43+
44+
45+
def cf_auto_upgrade_profile_operations(cli_ctx, *_):
46+
return get_container_service_client(cli_ctx).auto_upgrade_profile_operations

src/fleet/azext_fleet/_help.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,14 @@
380380
text: az fleet autoupgradeprofile list -g MyFleetResourceGroup -f MyFleetName
381381
"""
382382

383+
helps['fleet autoupgradeprofile generate-update-run'] = """
384+
type: command
385+
short-summary: Generates an update run for a given auto upgrade profile.
386+
examples:
387+
- name: Generates an update run for a given auto upgrade profile.
388+
text: az fleet autoupgradeprofile generate-update-run -g MyFleetResourceGroup -f MyFleetName --auto-upgrade-profile-name MyAutoUpgradeProfileName
389+
"""
390+
383391
helps['fleet autoupgradeprofile wait'] = """
384392
type: command
385393
short-summary: Wait for an auto upgrade resource to reach a desired state.

src/fleet/azext_fleet/_params.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,8 @@ def load_arguments(self, _):
110110
with self.argument_context('fleet autoupgradeprofile wait') as c:
111111
c.argument('auto_upgrade_profile_name', options_list=['--auto-upgrade-profile-name', '--profile-name'],
112112
help='Specify name for the auto upgrade profile.')
113+
114+
with self.argument_context('fleet autoupgradeprofile generate-update-run') as c:
115+
c.argument('resource_group_name', options_list=['--resource-group', '-g'], help='Name of the resource group.')
116+
c.argument('fleet_name', options_list=['--fleet-name', '-f'], help='Name of the fleet.')
117+
c.argument('auto_upgrade_profile_name', options_list=['--auto-upgrade-profile-name', '--profile-name', '--name', '-n'], help='Name of the auto upgrade profile.')

src/fleet/azext_fleet/commands.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
cf_fleet_members,
1111
cf_update_runs,
1212
cf_fleet_update_strategies,
13-
cf_auto_upgrade_profiles
13+
cf_auto_upgrade_profiles,
14+
cf_auto_upgrade_profile_operations
15+
1416
)
1517

1618

@@ -46,6 +48,12 @@ def load_command_table(self, _):
4648
client_factory=cf_auto_upgrade_profiles
4749
)
4850

51+
auto_upgrade_profile_operations_sdk = CliCommandType(
52+
operations_tmpl="azext_fleet.vendored_sdks.operations._auto_upgrade_profile_operations_operations#AutoUpgradeProfileOperationsOperations.{}",
53+
operation_group="auto_upgrade_profile_operations",
54+
client_factory=cf_auto_upgrade_profile_operations
55+
)
56+
4957
# fleets command group
5058
with self.command_group("fleet", fleets_sdk, client_factory=cf_fleets) as g:
5159
g.custom_command("create", "create_fleet", supports_no_wait=True)
@@ -87,9 +95,13 @@ def load_command_table(self, _):
8795
g.wait_command("wait")
8896

8997
# auto upgrade profiles command group
90-
with self.command_group("fleet autoupgradeprofile", auto_upgrade_profiles_sdk, client_factory=cf_auto_upgrade_profiles, is_preview=True) as g:
98+
with self.command_group("fleet autoupgradeprofile", auto_upgrade_profiles_sdk, client_factory=cf_auto_upgrade_profiles) as g:
9199
g.custom_command("create", "create_auto_upgrade_profile", supports_no_wait=True)
92100
g.custom_show_command("show", "show_auto_upgrade_profile")
93101
g.custom_command("list", "list_auto_upgrade_profiles")
94102
g.custom_command("delete", "delete_auto_upgrade_profile", supports_no_wait=True, confirmation=True)
95103
g.wait_command("wait")
104+
105+
# auto upgrade profiles operation command group
106+
with self.command_group("fleet autoupgradeprofile", auto_upgrade_profile_operations_sdk, client_factory=cf_auto_upgrade_profile_operations) as g:
107+
g.custom_command("generate-update-run", "generate_update_run", supports_no_wait=True)

src/fleet/azext_fleet/custom.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,3 +603,18 @@ def delete_auto_upgrade_profile(cmd, # pylint: disable=unused-argument
603603
name,
604604
no_wait=False):
605605
return sdk_no_wait(no_wait, client.begin_delete, resource_group_name, fleet_name, name)
606+
607+
608+
def generate_update_run(cmd, # pylint: disable=unused-argument
609+
client,
610+
resource_group_name,
611+
fleet_name,
612+
auto_upgrade_profile_name,
613+
no_wait=False):
614+
return sdk_no_wait(
615+
no_wait,
616+
client.begin_generate_update_run,
617+
resource_group_name,
618+
fleet_name,
619+
auto_upgrade_profile_name
620+
)

src/fleet/azext_fleet/tests/latest/recordings/test_fleet_hubful.yaml

Lines changed: 1341 additions & 2114 deletions
Large diffs are not rendered by default.

src/fleet/azext_fleet/tests/latest/recordings/test_fleet_hubless.yaml

Lines changed: 909 additions & 900 deletions
Large diffs are not rendered by default.

src/fleet/azext_fleet/tests/latest/test_fleet_hubful_scenario.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def generate_ssh_keys(cls):
4141
@AllowLargeResponse(size_kb=9999)
4242
@ResourceGroupPreparer(name_prefix='cli-', random_name_length=8)
4343
def test_fleet_hubful(self):
44-
4544
self.kwargs.update({
4645
'fleet_name': self.create_random_name(prefix='fl-', length=7),
4746
'member_name': self.create_random_name(prefix='flmc-', length=9),

0 commit comments

Comments
 (0)