diff --git a/src/devcenter/HISTORY.rst b/src/devcenter/HISTORY.rst index ee7d15e759a..9c9a62817ef 100644 --- a/src/devcenter/HISTORY.rst +++ b/src/devcenter/HISTORY.rst @@ -2,6 +2,10 @@ Release History =============== +5.0.0 +++++++ +* Require roles and identity type parameters in "az decenter admin project-environment-type create" + 4.0.1 ++++++ * Update due to bug in API swagger causing missing API version diff --git a/src/devcenter/azext_devcenter/_help.py b/src/devcenter/azext_devcenter/_help.py index 6228245ebc2..c26f9b7bd3d 100644 --- a/src/devcenter/azext_devcenter/_help.py +++ b/src/devcenter/azext_devcenter/_help.py @@ -623,7 +623,7 @@ --project-name "DevProject" - name: List using endpoint text: |- - az devcenter dev environment-definition list --dev-center-name "ContosoDevCenter" \ + az devcenter dev environment-definition list --endpoint "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com/" \ --project-name "DevProject" - name: List by catalog using dev center text: |- diff --git a/src/devcenter/azext_devcenter/_params.py b/src/devcenter/azext_devcenter/_params.py index b77c64bef9e..65b0304b498 100644 --- a/src/devcenter/azext_devcenter/_params.py +++ b/src/devcenter/azext_devcenter/_params.py @@ -5,6 +5,7 @@ # pylint: disable=line-too-long # pylint: disable=unused-import # pylint: disable=too-many-statements +# pylint: disable=too-many-lines from knack.arguments import CLIArgumentType from azure.cli.core.commands.parameters import ( diff --git a/src/devcenter/azext_devcenter/action.py b/src/devcenter/azext_devcenter/action.py index ef43a7a2f5e..51d04779e0e 100644 --- a/src/devcenter/azext_devcenter/action.py +++ b/src/devcenter/azext_devcenter/action.py @@ -7,12 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- - - # pylint: disable=protected-access -# pylint: disable=no-self-use - import argparse from collections import defaultdict diff --git a/src/devcenter/azext_devcenter/custom.py b/src/devcenter/azext_devcenter/custom.py index e46a9bf8273..33c3e9465c4 100644 --- a/src/devcenter/azext_devcenter/custom.py +++ b/src/devcenter/azext_devcenter/custom.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- # pylint: disable=protected-access +# pylint: disable=too-many-lines from datetime import datetime import json @@ -459,6 +460,8 @@ def _build_arguments_schema(cls, *args, **kwargs): args_schema = super()._build_arguments_schema(*args, **kwargs) args_schema.deployment_target_id._required = True args_schema.status._required = True + args_schema.roles._required = True + args_schema.identity_type._required = True return args_schema def _cli_arguments_loader(self): diff --git a/src/devcenter/azext_devcenter/tests/latest/test_devcenter_scenario.py b/src/devcenter/azext_devcenter/tests/latest/test_devcenter_scenario.py index bc771404ca5..9e27cdb2d13 100644 --- a/src/devcenter/azext_devcenter/tests/latest/test_devcenter_scenario.py +++ b/src/devcenter/azext_devcenter/tests/latest/test_devcenter_scenario.py @@ -8,7 +8,6 @@ # regenerated. # -------------------------------------------------------------------------- -import os from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer, record_only from azure.cli.testsdk.scenario_tests import AllowLargeResponse from .. import ( @@ -35,7 +34,7 @@ create_dev_box_dependencies, get_endpoint, login_account, - get_aad_id + get_aad_id, ) @@ -927,7 +926,6 @@ def test_pool_scenario(self): self.check("location", "{location}"), self.check("virtualNetworkType", "Unmanaged"), self.check("singleSignOnStatus", "Enabled"), - ], ) @@ -959,7 +957,7 @@ def test_pool_scenario(self): self.check("virtualNetworkType", "Managed"), self.check("singleSignOnStatus", "Disabled"), self.check("managedVirtualNetworkRegions[0]", "canadacentral"), - self.check("healthStatus", "Warning") + self.check("healthStatus", "Warning"), ], ) @@ -975,7 +973,7 @@ def test_pool_scenario(self): self.check("localAdministrator", "Enabled"), self.check("networkConnectionName", "{attachedNetworkName}"), self.check("location", "{location}"), - self.check("devBoxCount", 0) + self.check("devBoxCount", 0), ], ) @@ -987,7 +985,6 @@ def test_pool_scenario(self): checks=[], ) - self.cmd( "az devcenter admin schedule create " '--pool-name "{poolName}" ' @@ -1261,7 +1258,6 @@ def test_env_definition_scenario(self): ], ) - @ResourceGroupPreparer( name_prefix="clitestdevcenter_rg1"[:7], key="rg", parameter_name="rg" ) @@ -1494,26 +1490,22 @@ def __init__(self, *args, **kwargs): { "subscriptionId": self.get_subscription_id(), "location": "canadacentral", - "userName": "amlim@fidalgosh010.onmicrosoft.com" #update to your guest account + "userName": "amlim@fidalgosh010.onmicrosoft.com", # update to your guest account } ) login_account(self) get_aad_id(self) - + def test_project_dataplane_scenario(self): - self.kwargs.update( { "devcenterName": self.create_random_name(prefix="cli", length=24), "location": "canadacentral", - "rg": self.create_random_name(prefix="cli", length=24) + "rg": self.create_random_name(prefix="cli", length=24), } ) - self.cmd( - "az group create " - '--location "{location}" ' - '--name "{rg}" ') + self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ') create_dev_center(self) create_project_with_dev_box_limit(self) @@ -1566,14 +1558,11 @@ def test_pool_dataplane_scenario(self): { "location": "canadacentral", "devcenterName": self.create_random_name(prefix="cli", length=24), - "rg": self.create_random_name(prefix="cli", length=24) + "rg": self.create_random_name(prefix="cli", length=24), } ) - self.cmd( - "az group create " - '--location "{location}" ' - '--name "{rg}" ') + self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ') create_dev_center(self) create_project(self) @@ -1581,7 +1570,7 @@ def test_pool_dataplane_scenario(self): add_dev_box_user_role_to_project(self) create_pool(self) login_account(self) - + self.cmd( "az devcenter dev pool list " '--dev-center "{devcenterName}" ' @@ -1695,14 +1684,11 @@ def test_catalog_dataplane_scenario(self): self.kwargs.update( { "location": "canadacentral", - "rg": self.create_random_name(prefix="cli", length=24) + "rg": self.create_random_name(prefix="cli", length=24), } ) - self.cmd( - "az group create " - '--location "{location}" ' - '--name "{rg}" ') + self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ') create_catalog(self) login_account(self) @@ -1752,14 +1738,11 @@ def test_env_definition_dataplane_scenario(self): self.kwargs.update( { "location": "canadacentral", - "rg": self.create_random_name(prefix="cli", length=24) + "rg": self.create_random_name(prefix="cli", length=24), } ) - self.cmd( - "az group create " - '--location "{location}" ' - '--name "{rg}" ') + self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ') create_catalog(self) login_account(self) function_app_id = f"/projects/{self.kwargs.get('projectName', '')}/catalogs/{self.kwargs.get('catalogName', '')}/environmentDefinitions/functionapp" @@ -1849,14 +1832,11 @@ def test_env_type_dataplane_scenario(self): self.kwargs.update( { "location": "canadacentral", - "rg": self.create_random_name(prefix="cli", length=24) + "rg": self.create_random_name(prefix="cli", length=24), } ) - self.cmd( - "az group create " - '--location "{location}" ' - '--name "{rg}" ') + self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ') create_proj_env_type(self) login_account(self) @@ -1871,20 +1851,15 @@ def test_env_type_dataplane_scenario(self): ], ) - def test_dev_box_dataplane_scenario(self): self.kwargs.update( { "location": "canadacentral", "devBoxName": self.create_random_name(prefix="cli", length=24), - "rg": self.create_random_name(prefix="cli", length=24) - + "rg": self.create_random_name(prefix="cli", length=24), } ) - self.cmd( - "az group create " - '--location "{location}" ' - '--name "{rg}" ') + self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ') create_dev_box_dependencies(self) login_account(self) @@ -2093,8 +2068,7 @@ def test_dev_box_dataplane_scenario(self): checks=[ self.check("[0].action.name", "{actionName}"), self.check("[0].action.actionType", "Stop"), - self.exists( - "[0].action.next.scheduledTime"), + self.exists("[0].action.next.scheduledTime"), self.exists("[0].action.suspendedUntil"), self.check( "[0].action.sourceId", @@ -2143,21 +2117,16 @@ def test_dev_box_dataplane_scenario(self): ], ) - @AllowLargeResponse() def test_environment_dataplane_scenario(self): self.kwargs.update( { "envName": self.create_random_name(prefix="cli", length=12), "location": "centraluseuap", - "rg": self.create_random_name(prefix="cli", length=24) - + "rg": self.create_random_name(prefix="cli", length=24), } ) - self.cmd( - "az group create " - '--location "{location}" ' - '--name "{rg}" ') + self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ') create_environment_dependencies(self) login_account(self) @@ -2266,14 +2235,10 @@ def test_environment_operations_dataplane_scenario(self): "envName": self.create_random_name(prefix="cli", length=12), "location": "centraluseuap", "rg": self.create_random_name(prefix="cli", length=24), - "environmentDefinitionName": "Sandbox" - + "environmentDefinitionName": "Sandbox", } ) - self.cmd( - "az group create " - '--location "{location}" ' - '--name "{rg}" ') + self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ') create_environment_dependencies(self) login_account(self) @@ -2301,7 +2266,7 @@ def test_environment_operations_dataplane_scenario(self): self.check("environmentType", "{envTypeName}"), self.check("name", "{envName}"), self.check("provisioningState", "Succeeded"), - self.check("expirationDate", "2025-11-30T22:35:00+00:00") + self.check("expirationDate", "2025-11-30T22:35:00+00:00"), ], ) @@ -2317,7 +2282,7 @@ def test_environment_operations_dataplane_scenario(self): self.check("environmentType", "{envTypeName}"), self.check("name", "{envName}"), self.check("provisioningState", "Succeeded"), - self.check("expirationDate", "2025-12-30T22:35:00+00:00") + self.check("expirationDate", "2025-12-30T22:35:00+00:00"), ], ) @@ -2340,12 +2305,12 @@ def test_environment_operations_dataplane_scenario(self): "az devcenter dev environment list-operation " '--name "{envName}" ' '--project "{projectName}" ' - '--dev-center "{devcenterName}" ').get_output_in_json()[0]["operationId"] - + '--dev-center "{devcenterName}" ' + ).get_output_in_json()[0]["operationId"] + self.kwargs.update( { "operationId": operationId, - } ) @@ -2409,7 +2374,7 @@ def test_environment_operations_dataplane_scenario(self): checks=[ self.check("name", "{actionName}"), self.check("actionType", "Delete"), - self.check("next.scheduledTime", "{scheduledTime}") + self.check("next.scheduledTime", "{scheduledTime}"), ], ) @@ -2426,7 +2391,6 @@ def test_environment_operations_dataplane_scenario(self): ], ) - self.cmd( "az devcenter dev environment skip-action " '--name "{envName}" ' @@ -2434,21 +2398,16 @@ def test_environment_operations_dataplane_scenario(self): '--dev-center "{devcenterName}" ' '--action-name "{actionName}"' ) - def test_dev_box_repair_dataplane_scenario(self): self.kwargs.update( { "location": "centraluseuap", "devBoxName": self.create_random_name(prefix="cli", length=24), - "rg": self.create_random_name(prefix="cli", length=24) - + "rg": self.create_random_name(prefix="cli", length=24), } ) - self.cmd( - "az group create " - '--location "{location}" ' - '--name "{rg}" ') + self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ') create_dev_box_dependencies(self) login_account(self) @@ -2460,8 +2419,6 @@ def test_dev_box_repair_dataplane_scenario(self): '--dev-center "{devcenterName}" ', ) - - self.cmd( "az devcenter dev dev-box repair " '--name "{devBoxName}" ' @@ -2497,12 +2454,12 @@ def test_dev_box_repair_dataplane_scenario(self): "az devcenter dev dev-box list-operation " '--name "{devBoxName}" ' '--project "{projectName}" ' - '--dev-center "{devcenterName}" ').get_output_in_json()[0]["operationId"] - + '--dev-center "{devcenterName}" ' + ).get_output_in_json()[0]["operationId"] + self.kwargs.update( { "operationId": operationId, - } ) @@ -2522,4 +2479,3 @@ def test_dev_box_repair_dataplane_scenario(self): self.check("status", "Succeeded"), ], ) - \ No newline at end of file diff --git a/src/devcenter/setup.py b/src/devcenter/setup.py index 80428aa21d8..bee3d7f8602 100644 --- a/src/devcenter/setup.py +++ b/src/devcenter/setup.py @@ -10,7 +10,7 @@ from setuptools import setup, find_packages # HISTORY.rst entry. -VERSION = '4.0.1' +VERSION = '5.0.0' try: from azext_devcenter.manual.version import VERSION except ImportError: