Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/devcenter/azext_devcenter/manual/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,31 @@
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from .helper import get_project_data

def cf_devcenter_dataplane(cli_ctx, endpoint, project_name=None, *_):
def cf_devcenter_dataplane(cli_ctx, dev_center, project_name=None, *_):

from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_devcenter.vendored_sdks.devcenter_dataplane import (
DevCenterDataplaneClient,
)

project = get_project_data(cli_ctx, dev_center, project_name)
endpoint = project.endpoint
# We need to set the project name even if we don't need this information
# since initializing DevCenterDataplaneClient requires this param
if project_name is None:
project_name = project.name

cli_ctx.cloud.endpoints.active_directory_resource_id = "https://devcenter.azure.com"

return get_mgmt_service_client(
cli_ctx,
DevCenterDataplaneClient,
subscription_bound=False,
base_url_bound=False,
endpoint=endpoint,
project_name=project_name,
project_name=project_name
)

def cf_project_dp(cli_ctx, dev_center, *_):
Expand Down
14 changes: 1 addition & 13 deletions src/devcenter/azext_devcenter/manual/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ def load_arguments(self, _):
required=True,
help="The DevCenter to operate on.",
)
c.argument('filter_', options_list=['--filter'], type=str, help='An OData filter clause to apply to the '
'operation.')

with self.argument_context("devcenter dev project show") as c:
c.argument(
Expand Down Expand Up @@ -70,8 +68,6 @@ def load_arguments(self, _):
type=str,
help="The DevCenter Project upon which to execute operations.",
)
c.argument('filter_', options_list=['--filter'], type=str, help='An OData filter clause to apply to the '
'operation.')

with self.argument_context("devcenter dev pool show") as c:
c.argument(
Expand Down Expand Up @@ -119,9 +115,7 @@ def load_arguments(self, _):
options_list=["--pool-name", "--pool"],
type=str,
help="The name of a pool of Dev Boxes.",
)
c.argument('filter_', options_list=['--filter'], type=str, help='An OData filter clause to apply to the '
'operation.')
)

with self.argument_context("devcenter dev schedule show") as c:
c.argument(
Expand Down Expand Up @@ -163,12 +157,6 @@ def load_arguments(self, _):
type=str,
help="The DevCenter to operate on.",
)
c.argument(
"filter_",
options_list=["--filter"],
type=str,
help="An OData $filter clause to apply to the " "operation.",
)
c.argument(
"project_name",
options_list=[
Expand Down
24 changes: 10 additions & 14 deletions src/devcenter/azext_devcenter/manual/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,19 +220,19 @@ def load_command_table(self, _):

# data plane
with self.command_group(
"devcenter dev project", devcenter_project_dp, client_factory=cf_project_dp
"devcenter dev project", devcenter_project_dp
) as g:
g.custom_command("list", "devcenter_project_list_dp")
g.custom_show_command("show", "devcenter_project_show_dp")

with self.command_group(
"devcenter dev pool", devcenter_pool_dp, client_factory=cf_pool_dp
"devcenter dev pool", devcenter_pool_dp
) as g:
g.custom_command("list", "devcenter_pool_list_dp")
g.custom_show_command("show", "devcenter_pool_show_dp")

with self.command_group(
"devcenter dev dev-box", devcenter_dev_box_dp, client_factory=cf_dev_box_dp
"devcenter dev dev-box", devcenter_dev_box_dp
) as g:
g.custom_command("list", "devcenter_dev_box_list")
g.custom_show_command("show", "devcenter_dev_box_show")
Expand All @@ -254,30 +254,27 @@ def load_command_table(self, _):
g.custom_command('skip-upcoming-action', 'devcenter_dev_box_skip_upcoming_action')

with self.command_group(
"devcenter dev artifact", devcenter_artifact_dp, client_factory=cf_artifact_dp
"devcenter dev artifact", devcenter_artifact_dp
) as g:
g.custom_command("list", "devcenter_artifact_list")

with self.command_group(
"devcenter dev catalog-item",
devcenter_catalog_item_dp,
client_factory=cf_catalog_item_dp,
devcenter_catalog_item_dp
) as g:
g.custom_command("list", "devcenter_catalog_item_list")
g.custom_show_command("show", "devcenter_catalog_item_show")

with self.command_group(
"devcenter dev catalog-item-version",
devcenter_catalog_item_version_dp,
client_factory=cf_catalog_item_version_dp,
devcenter_catalog_item_version_dp
) as g:
g.custom_command("list", "devcenter_catalog_item_version_list")
g.custom_show_command("show", "devcenter_catalog_item_version_show")

with self.command_group(
"devcenter dev environment",
devcenter_environment_dp,
client_factory=cf_environment_dp,
devcenter_environment_dp
) as g:
g.custom_command("list", "devcenter_environment_list")
g.custom_show_command("show", "devcenter_environment_show")
Expand Down Expand Up @@ -307,19 +304,18 @@ def load_command_table(self, _):

with self.command_group(
"devcenter dev environment-type",
devcenter_environment_type_dp,
client_factory=cf_environment_type_dp,
devcenter_environment_type_dp
) as g:
g.custom_command("list", "devcenter_environment_type_list_dp")

with self.command_group(
"devcenter dev schedule", devcenter_schedule_dp, client_factory=cf_schedule_dp
"devcenter dev schedule", devcenter_schedule_dp
) as g:
g.custom_command("list", "devcenter_schedule_list_dp")
g.custom_show_command("show", "devcenter_schedule_show_dp")

with self.command_group(
"devcenter dev notification setting", devcenter_notification_setting_dp, client_factory=cf_notification_setting_dp
"devcenter dev notification setting", devcenter_notification_setting_dp
) as g:
g.custom_command("list-allowed-culture", "devcenter_notification_setting_list_allowed_culture_dp")
g.custom_show_command("show", "devcenter_notification_setting_show_dp")
Expand Down
Loading