Skip to content

Commit

Permalink
[fleet] upgrade sdk (#6175)
Browse files Browse the repository at this point in the history
* match swagger summary

* upgrade sdk version to 2022-07-02-preview

* use snake style

* update tests

* new release version

* fix location help text

* fix test

* upgrade fleet sdk

* upgrade fleet sdk

* revert

* revert

* revert

* update test

* revert change

* remove deprecated api

---------

Co-authored-by: Pankil Daru <daru.pankil05@gmail.com>
  • Loading branch information
pdaru and Pankil Daru authored Apr 13, 2023
1 parent 769a552 commit b37737f
Show file tree
Hide file tree
Showing 71 changed files with 6,936 additions and 29,065 deletions.
6 changes: 5 additions & 1 deletion src/fleet/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ Release History
0.1.1
++++++
* Upgrade SDK version to 2022-07-02-preview
* Bug fixes
* Bug fixes

0.2.0
++++++
* Use new SDK
6 changes: 4 additions & 2 deletions src/fleet/azext_fleet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def register_fleet_resource_type():
register_resource_type(
"latest",
CUSTOM_MGMT_FLEET,
SDKProfile("2022-07-02-preview", {"container_services": "2017-07-01"}),
SDKProfile("2023-03-15-preview"),
)


Expand All @@ -26,7 +26,9 @@ def __init__(self, cli_ctx=None):
register_fleet_resource_type()

fleet_custom = CliCommandType(operations_tmpl='azext_fleet.custom#{}')
super().__init__(cli_ctx=cli_ctx, resource_type=CUSTOM_MGMT_FLEET, custom_command_type=fleet_custom)
super(FleetCommandsLoader, self).__init__(cli_ctx=cli_ctx,
resource_type=CUSTOM_MGMT_FLEET,
custom_command_type=fleet_custom)

def load_command_table(self, args):
from azext_fleet.commands import load_command_table
Expand Down
2 changes: 1 addition & 1 deletion src/fleet/azext_fleet/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ResourceType
)

CUSTOM_MGMT_FLEET = CustomResourceType('azext_fleet.vendored_sdks', 'ContainerServiceClient')
CUSTOM_MGMT_FLEET = CustomResourceType('azext_fleet.vendored_sdks', 'ContainerServiceFleetMgmtClient')


# container service clients
Expand Down
1 change: 0 additions & 1 deletion src/fleet/azext_fleet/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=line-too-long
import os
from argcomplete.completers import FilesCompleter
Expand Down
6 changes: 3 additions & 3 deletions src/fleet/azext_fleet/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def update_fleet(cmd,
operation_group="fleets"
)
fleet_patch = fleet_patch_model(tags=tags)
return client.update(resource_group_name, name, None, fleet_patch)
return client.update(resource_group_name, name, fleet_patch, None)


def show_fleet(cmd, # pylint: disable=unused-argument
Expand All @@ -78,7 +78,7 @@ def list_fleet(cmd, # pylint: disable=unused-argument
resource_group_name=None):
if resource_group_name:
return client.list_by_resource_group(resource_group_name)
return client.list()
return client.list_by_subscription()


def delete_fleet(cmd, # pylint: disable=unused-argument
Expand Down Expand Up @@ -123,7 +123,7 @@ def create_fleet_member(cmd,
operation_group="fleet_members"
)
fleet_member = fleet_member_model(cluster_resource_id=member_cluster_id)
return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name, fleet_name, name, fleet_member)
return sdk_no_wait(no_wait, client.begin_create, resource_group_name, fleet_name, name, fleet_member)


def list_fleet_member(cmd, # pylint: disable=unused-argument
Expand Down
1,133 changes: 579 additions & 554 deletions src/fleet/azext_fleet/tests/latest/recordings/test_fleet.yaml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/fleet/azext_fleet/tests/latest/test_fleet_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def test_fleet(self):
self.cmd('fleet member show -g {rg} --fleet-name {fleet_name} -n {member_name}', checks=[
self.check('name', '{member_name}')
])

self.cmd('aks wait -g {rg} -n {member_name} --created', checks=[self.is_empty()])

self.cmd('fleet member delete -g {rg} --fleet-name {fleet_name} -n {member_name}')

Expand Down
4 changes: 2 additions & 2 deletions src/fleet/azext_fleet/vendored_sdks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._container_service_client import ContainerServiceClient
__all__ = ['ContainerServiceClient']
from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient
__all__ = ['ContainerServiceFleetMgmtClient']

try:
from ._patch import patch_sdk # type: ignore
Expand Down
14 changes: 6 additions & 8 deletions src/fleet/azext_fleet/vendored_sdks/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential

class ContainerServiceClientConfiguration(Configuration):
"""Configuration for ContainerServiceClient.
class ContainerServiceFleetMgmtClientConfiguration(Configuration):
"""Configuration for ContainerServiceFleetMgmtClient.
Note that all parameters used to create this instance are saved as instance
attributes.
Expand All @@ -36,26 +36,24 @@ def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
**kwargs # type: Any
**kwargs: Any
):
# type: (...) -> None
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(ContainerServiceClientConfiguration, self).__init__(**kwargs)
super(ContainerServiceFleetMgmtClientConfiguration, self).__init__(**kwargs)

self.credential = credential
self.subscription_id = subscription_id
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'azure-mgmt-containerservice/{}'.format(VERSION))
kwargs.setdefault('sdk_moniker', 'azure-mgmt-containerservicefleet/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs # type: Any
**kwargs: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
Expand Down
Loading

0 comments on commit b37737f

Please sign in to comment.