Skip to content

Commit

Permalink
[SQL] az sql instance-pool: Add instance pools command group (#11721)
Browse files Browse the repository at this point in the history
* Added CLI functions with tests

* Resolved comments, added vnet-name to create

* Fixed no_Wait call in create command

* Changed active/passive voice issues and added enum to license type

* Deleted existing recording file

* Added test recording file

* upgrade azure-mgmt-version to 0.16.0

* preview enabled for flexibility

* init colorama in az --version to fix issue on windows (#11609)

* [Storage] Remove Preview for -enable-hierarchical-namespace (#11639)

* remove preview

* update history

* Adding new license type for az sql vm (#11570)

* Adding DR license examples

Adding DR license examples

* Update test_sqlvm_update_license_and_sku.yaml

Adding test for DR

* Update test_vm_vmss_update_ultra_ssd_enabled.yaml

Undone changes for recording of vm_vmss

* Update test_vm_vmss_update_ultra_ssd_enabled.yaml

* Update HISTORY.rst

* Added CLI functions with tests

* Resolved comments, added vnet-name to create

* Fixed no_Wait call in create command

* Changed active/passive voice issues and added enum to license type

* Deleted existing recording file

* Added test recording file

* [Storage] Bump azure-mgmt-storage version to use api version 2019-06-01 (#11702)

* update version for auzre-mgmt-storage in setup.py

* pass test for storage module

* last 14 failures

* pass test_apim_core_service

* revert test_linux_webapp_ssh

* pass test_batchai_manual_scale_scenario

* pass test_create_event_subscriptions_to_resource

* pass test_hdinsight_cluster_kafka_with_rest_proxy

* pass test_adla_account_mgmt

* pass test_batchai_job_level_mounting_scenario

* pass test_hdinsight_monitor

* pass test_keyvault_storage_account

* pass test_monitor_create_log_profile

* pass test_sql_db_security_mgmt

* pass test_sql_db_import_export_mgmt

* pass test_create_for_rbac_with_existing_kv_cert

* update version in requirements.txt

* update history.rst

* pass test_afs_commands

* pass test_backup_restore.yaml

* pass test_dls_file_mgmt

* pass test_dls_file_mgmt

* ACR: deprecate os parameter (#11699)

* [App Service] On webapp up set httpsonly true (#11539)

* https_only = true when using webapp up

* update and validate testing

* supress entire file and rerun test

* update history

* rerun tests

* resetup dev and rerun test

* Fix typo in `KeyVaultMgmtScenarioTest` (#11722)

* Fix typo

* Fix type in history.rst

* Revert history

* [General][Minor]Update Code Onwers (#11705)

* Update Code Onwers

remove @zikalino from code owner

* Update CODEOWNERS

* Update codeowner for scripts

* Update CODEOWNERS

Co-authored-by: Feng Zhou <55177366+fengzhou-msft@users.noreply.github.com>

* [Compute][Feature]az vm create: Support default data source settings for vm workspace (#11704)

* [RecoveryServices Backup]Added disk exclusion Feature for IAASVM (#11717)

* Added disk exclusion tests

* resolving comments

* updated history.rst

* removed redundant parameter

* fix typo in authoring_commands.md (#11730)

* update codeowner for resource (#11739)

* Fix the test of test_managedapp (#11727)

* Fix the test of test_resource_policyset (#11723)

* add libc6-compat in dockerfile (#11742)

* Update Cosmos DB python package (#11551)

* migrating to cersion 0.10.0 of cosmos db management sdk

* updating cosmosdb sdk version to allow patch support

* update history to indicate changes

* update os requirements

* style improvements

* updating all network-rule commands to comply with guidelines

* update history to include network-rule changes

* [AppConfig] Adding new command 'set-keyvault' to kv subgroup (#11571)

* Adding new command set-keyvault and realted tests

* Update string escaping for python 2

* Resolve comments

* Remove default kwargs when validating vault id

* Improve exception and help message

* Update history file

* Update test recordings

* [AppConfig] Support Import/Export of features in yaml files (#11637)

* feature flag import/export for yaml files

* Remove naming-convention from import and add tests

* Change all test files to json for passing CI tests

* Using yaml.safe_dump and resolving comments

* Updating histoy and separating tests

* Adding new test recording file to credscansuppressions

* [App Service] Add az webapp up flag for HTML static sites (#11719)

* add html flag

* run tests

* rerun tests

* update help message, add error for html flag

* fix error

* remove trailing whitespace

* also look for htm and shtml files

* [Compute] Feature issue #11203 Add new reapply command action for az vm (#11733)

* [Compute] Feature issue #11203 Add new reapply command action for az vm

* update HISTORY.rst, add examples in help.py

* Added new parameters for account blob service properties to manage delete retention policy (#11660)

* [misc] Add 'az version'  (#11680)

* Removing ReceiveDisabled status from EventHub and ServiceBus CLI doc as it's an invalid status (#11566)

* Update _params.py

Remove ReceiveDisabled because it is not a valid state for an EventHub.

* Update _params.py

* Update HISTORY.rst

* Update _params.py

* Update _params.py

Co-authored-by: Zunli Hu <zuh@microsoft.com>

* [RBAC] Return exit code 3 if app or sp doesn't exist (#11725)

* update azure-cli version to 2.0.79 (#11762)

* add codeonwer for sql (#11777)

* fix: az monitor metric alert create. Fix test failure. (#11776)

* updating BYOS commands to mark them as preview (#11755)

This feature is in preview and this should be indicated

* Fix: tox can use ADO default Python 2.7 (#11802)

* python3.8 migration for homebrew (#11803)

* [Storage] Support Table and Queue Encryption Service for storage account (#11706)

* initialize encryption key feature

* enable key type for queue

* add test

* uodate history

* fix style

* update package version

* add test

* add examples

* refine examples

* remove Preview

* refine help

* fix style

* refine history

* update CODEOWNERS (#11814)

* [Webapp] Adding E2E tests for az webapp up (#11774)

* Adding E2E tests for az webapp up

Adding test  for az webapp up for Node app

Adding test for Python App for az webapp up

Adding test for dotnercore for az webapp up

Adding tests for static html

Rerecording test

Removing ResourceGroup preparer

Testing with plan & resourcegroup

Re-recording once more minus the -live flag

* Making az webapp up tests live only

* [Doc] Try new features before release (#11784)

* [Doc] Try new features without releasing

* use case-sensitive file name

* Refine

* Add highlighted rectangle in screenshot

* Add entrance in main readme

* Chore: move CredScansuppressions.json to codeownder guarded folder (#11815)

* [Compute] disk update: Add --disk-encryption-set and --encryption-type;  snapshot create/update: Add --disk-encryption-set and --encryption-type  (#11805)

* [Compute] disk update: Add --disk-encryption-set and --encryption-type

* snapshot create/update: Add --disk-encryption-set and --encryption-type

* Remove preview label

* Fix style problem

* Add parameter validation

* Fix yaml

* Fix test

Co-authored-by: Xiaojian Xu <arrownj@126.com>

* [AKS] Update example help text to reflect change of defaults to Standard LB and VMSS (#11791)

* Upgrade to Azure CLI 2.0.80 (#11826)

* Add table output to backup commands (#11764)

* Fix typo in History.rst (#11835)

* [IoT Central] Add new sku name to iotcentral (#11810)

* [Core] Expose example_provider hook to include AI examples (#10987)

* fix: enabling monitoring for OpenShift managed cluster (#11778)

* Update fedora install troubleshooting doc (#11827)

* Fix: 'az redis update' operation for RDB/AOF enabled redis caches (#11502)

* Fixing "az redis update" to work on caches with RDB/AOF enabled.

* Chore: disable CredScan job temporary for ADO security concern (#11844)

* [KeyVault] Add example for container sas-definition (#11846)

* Add example for container sas-definition

* Add `--account-key` param

* refact: update global --tags help content (#11847)

* [Rest] Make --method -m optional (#11843)

* [Core] Support filename and environment variable completion (#11817)

* Chore: add code owner for command module appconfig (#11860)

* Update code owner (#11875)

* [AppService] Fix #10476: Support appservice in 2019-03-01-hybrid profile (#11056)

* appservice: surface commands under the profile of 2019-03-01-hybrid

* upgrade azure-mgmt-web to support multiapi

* upgrade azure-mgmt-web in requirements

* update release note

* Update history in azure cli 2.0.75

* delete spaces

* fix typo

* use new package and make client multiapi

* Re-record test for app service

* pass test_acr_integration_function_app

* pass test_acr_create_function_app

* pass test_acr_integration

* pass test_webapp_hyperv_e2e

* replace api version because record_only() to pass test_webapp_continuousWebjob_e2e

* pass test_webapp_create_linux_free

* replace api version because record only to pass test_webapp_triggeredWebjob_list

* pass test_webapp_e2e

* replace api version to make test_linux_webapp_ssh pass because only supporting linux and mac

* fix test_webapp_config

* change api version  to 20181101

* change api version to 2019-08-01

* live test

* pass test_functionapp_reserved_instance for v2019-08-01

* pass test_set_domain_name

* pass test_set_source_control_token

* pass appservice except config

* pass more test

* pass test_metric_alert_v2_scenario

* pass test_functionapp_access_restriction_set_complex

* pass test_functionapp_access_restriction_add_service_endpoint

* pass more test

* pass mock

* pass other tests in live mode azdev test --lf --live

* revert aks test

* pass test_keyvault_secret_sofy_delete

*  pass test_keyvault_storage_account

* pass keyvault_softdelet

* pass test_create_for_rbac_with_existing_kv_cert

* pass test_version

* revert test_node_type

* pass test_webapp_config and deployment user show

* add cmd_mock in unitest

* update requirements

* fix style

* fix linter

* add help for deployment user show

* revert test_dls_file_mgmt

* pass webapp_continuousWebjob

* revert reversation_id

* fix typo

* pass test_linux_webapp_ssh

Co-authored-by: Yugang Wang <yugangw@microsoft.com>

* Bump argcomplete version (#11866)

* [AppConfig] Support import/export of keyvault ref from appservice (#11773)

* Support import/export of keyvault from appservice

* Centralize reserved keywords and constants

* Add connection string to all test commands

* Remove shell_safe_json_parse

* Making appservice test LiveScenarioTest

* Updating history

* Resolving comments

* Reuse appsvc_value_dict variable

* Remove test file from credscansuppression

Co-authored-by: Zunli Hu <zuh@microsoft.com>

* fix test_get_clouds_concurrent on python 3.8 windows (#11864)

* Documented sql db restore time format (#11838)

* Documented sql db restore time format

Fixes #9273

* Style

* [ARM] Fix az group export command does not support --query and --output parameters (#11885)

* acr: add notary version compatibility checks (#11792)

* {Storage} Update help for pattern (#11782)

* update help for pattern

* fix style

* fix help

* fix comments

* [ARM] Fix the exit code of az group deployment validate when the verification fails (#11842)

* [Storage]: Add a new command group `az storage share-rm` to use the Microsoft.Storage resource provider for Azure file share management operations. (#11649)

[Storage]: Add a new command group `az storage share-rm` to use the Microsoft.Storage resource provider for Azure file share management operations.

* delete cli_license_terms.md (#11902)

* [Network]az  network dns record-set add/remove: show warning when a new record-set is created automatically (#11900)

* [ACR]: Add a prompt for command "az acr delete" to avoid accidental operation (#11899)

* [Storage] Fix errors for storage blob update (#11907)

* fix validator

* update history.rst

* [AppConfig] Support import/export of all labels between 2 config stores (#11756)

* Import/export with label filters b/w config stores

* Add unit tests

* Updating arguments in help file

* Update history and test recording

* resolving comments

* Modify error message text

* fix failing test

* {Storage} Refine help for storage data plane commands and log warning (#11903)

* add long summary for data plane operations

* refine examples

* add warning

* fix linter

* fix typo

* fix style

* [AppConfig] Validate key and feature names before setting and importing (#11753)

* Adding input validation for key and feature name

* Adding unit tests

* Add key validation for keyvault ref

* Add missing comma in credscansiuppressions file

* Fix styling issue

* Make reserved keyword validations case insensitive

* Update history file

* Fix styling issue

* Fix style issues

Co-authored-by: Zunli Hu <zuh@microsoft.com>

* [IoT] Deprecated command group 'iot hub job' (#11794)

* Add deprecation message

* removed empty line

Co-authored-by: Feiyue Yu <iamyfy@163.com>

* [AppConfig] Expose sku and managed identity for GA (#11795)

* expose sku and managed identity feature

* Expose features for GA

1. Remove preview tag for most commands
2. Expose sku modification for configuration store
3. Add command group for managed identity

* fix styling issues

* update user agent version

* dedup input identities

* add test cases for user assgined identity

* remove duplicate code

* revise identity validator

* add default for identities

* remove unnecessary import

* hard code default value for identity

* make identity argument take empty list

* resolve conflict

* merge conflict

* update tests

* fix styling issue

* revise help message for --identities

* remove multiple spaces

* [Storage] Upgrade Azcopy for storage copy/remove and blob sync (#11874)

[Storage] Integrate Azcopy 10.3.3 and support Win32.
[Storage] `az storage copy`: Add `--include-path`, `--include-pattern`, `--exclude-path` and`--exclude-pattern` parameters
[Storage] `az storage remove`: Change `--inlcude` and `--exclude` parameters to `--include-path`, `--include-pattern`, `--exclude-path` and`--exclude-pattern` parameters
[Storage] `az storage sync`: Add `--include-pattern`, `--exclude-path` and`--exclude-pattern` parameters

* remove pydocumentdb (#11918)

* [ACR] Add new commands `az acr taskrun show/list/delete` for show list and remove (#11858)

* [Azure Red Hat OpenShift] Add `monitor` subgroup to manage Log Analytics monitoring in Azure Red Hat OpensShift cluster (#11904)

* [CDN] Add support for Rules engine feature (#11854)

[CDN] Add support for rulesEngine feature
[CDN] Add new commands group 'cdn endpoint rule' to manage rules
[CDN] Update azure-mgmt-cdn version to 4.0.0 to use api version 2019-04-15

* [Security] Add new commands `az atp show` and `az atp update` to view and manage advanced threat protection settings for storage accounts

* {Network} az network application-gateway create: set https when key_vault_secret_id provided (#11974)

* [SQL] BREAKING CHANGE: az sql db create: Remove WideWorldImportersStd and WideWorldImportersFull as allowed values for --sample-name values (#11976)

* Remove WideWorldImporters as allowed values for sql db sample name

The WideWorldImportersStd and WideWorldImportersFull sql db samples were never supported in production and were only documented here by mistake. Removing them from allowed values so that users do not attempt to create them. Note that this is not a breaking change because these options already caused db creation to fail.

* format history

Co-authored-by: Zunli Hu <zuh@microsoft.com>

* [RBAC] BREAKING CHANGE: Fix #11883: `az role assignment create`: empty scope will prompt error (#11983)

* [RBAC] BREAKING CHANGE: Fix #11883: `az role assignment create`: empty scope will prompt error

* add test for role assignment with empty scope case

* udpate HISTORY.rst according to alphabetic order

* {Packaging} Generate Homebrew formula by updating existing one by default (#11964)

* [ARM] Fix az resource list cannot use tag when there is a default location (#11787)

* Improve the error message of the conflict between tag and other filter conditions for az resource list

* [ARM] Fix az resource tag crashed when the parameter --ids passed in is resource group ID (#11859)

* Fix az resource tag crashed when the parameter --ids passed in is resource group ID

* [Key Vault] Add a new command `az keyvault key download` for downloading keys (#11912)

* Add support for downloading key

* Fix bug & Support EC key

* Add tests

* Update the test

* Modify history.rst

* Fix linter error

* Add some comments and fix some bugs

* Add comments

* Fix linter error

* Fix linter error

* Fix linter error and some code formats

* Fix linter error

* Refine string format

* Remove `pylint: disable=line-too-long`

* [Core][Profile] Add `tenant` parameter to `get_raw_token` (#11798)

* Improve the error message of the conflict between tag and other filter conditions for az resource list command (#11796)

* [Deployment Manager] Add `az deploymentmanager rollout/service/service-topology/service-unit/step list` commands (#11757)

* DeploymentManager 2019-11-preview update

* Modify tests, update history.rst

* Fix pylint and style errors

* Styling fixes

* Fixing fileInput close for test automation pass

* Incorporate feedback

* Incorporated feedback + Re-record tests after merge

* Fix styling errors

* Incorporated feedback

* Incorporated feedback

* Fix cli styling errors

* rearrange history

Co-authored-by: Zunli Hu <zuh@microsoft.com>

* [SQL] Add new commands `sql db classification show/list/update/delete` and `sql db classification recommendation list/enable/disable` to manage sensitivity classifications for SQL databases. (#11597)

* New commands `sql db sensitivity-labels show/list/list-recommended/update/delete/enable-recommendation/disable-recommendation` to manage sensitivity labels for SQL databases.

* Fix history file

* Fix failing style checks

* Fix help

* Use g.command() for list, list-recommended, delete, enable-recommendation and disable-recommendation

* rename sensitivity-labels to sensitivity-classification and add another group for recommendation

* Fix sensitivity classifications test after sync

* Rename command from `sensitivity-classification` to `classification`

* information_type and label_name should not be required

* SQl classification - fix comments

* SQL classification Additional fixes

* Update help

* SQL classification - show command should be seperated for current/recommended

Co-authored-by: Zunli Hu <zuh@microsoft.com>

* Improve intercluster isolation (#11848)

* Improve inter-cluster isolation

`az aks create` creates a service principal when invoked the first time,
and re-uses that service principal for all clusters it creates.
This leads to all clusters being able to access each other's Azure
resources, such as disks and load-balancers. This is undesirable since
it means that a compromised cluster would allow an attacked to steal
data from another cluster.

This patch disabled service principal re-usage to ensure better isolation
between clusters.

* Update HISTORY.rst

* Address comment from @Juliehzl

* Also improve inter-cluster isolation via _ensure_aks_service_principal

* Fix CI error

* Re-trigger pipeline

See pypa/pip#7217

* {Document} Modify PR template and document (#11913)

* Service Fabric Application commands (#10666)

[Service Fabric] Add new commands to manage appliaction and services.
    - sf application-type
        - list
        - delete
        - show
        - create
    - sf application-type version
        - list
        - delete
        - show
        - create
    - sf application
        - list
        - delete
        - show
        - create
        - update
    - sf service
        - list
        - delete
        - show
        - create

* [ACS] add support for the aks 1.16/1.17 in "aks browse" command. (#11804)

* switch to use the kube proxy to open the dashboard.

* [Policy] Update policyinsights to 0.4.0 package (#11820)

[Policy] Update policyinsights to 0.4.0 package
[Policy] Add new command `az policy metadata` to retrieve rich policy metadata resources
[Policy] `az policy remediation create`: Specify whether compliance should be re-evaluated prior to remediation with the `--resource-discovery-mode` parameter

* [SQL] BREAKING CHANGE: `az sql dw create`: Deprecate `--zone-redundant` & `--read-replica-count` parameters (#11837)

* Restructure db/dw create/update params

Just adding new structure, not moving any code yet

* Dedupe compute_model, auto_pause_delay, min_capacity

* Dedupe read_scale and read_replica_count

* Dedupe elastic_pool_id

* Dedupe max_size_bytes

* Indentation

* Function naming

* Formatting

* More refactoring

* Hide --read-replica-count from sql dw

* Deprecate sql dw create --read-replicas

* Deprecate sql dw create --zone-redundant

* Add history and hide the parameters

* Tweak comments

* Style

* Fixed style

Co-authored-by: Zunli Hu <zuh@microsoft.com>

* [BotService] Refactor tests, make bot create idempotent (#11935)

* [SQL] az sql db audit-policy: Fix for empty audit actions and groups (#11800)

* In case the policy is enabled and there are no audit actions and groups (Was overriden when disabling the policy), set the default value

* update history

Co-authored-by: Zunli Hu <zuh@microsoft.com>

* {CI} Add PR title check (#11982)

* [ACS] aks create/update: add --load-balancer-outbound-ports and --load-balancer-idle-timeout (#11960)

* fix merge conflicts, update containerservice version

* enable allocated ports and idletimeouts

* add validation, help doc, fix linting

* move lb to file

* refactor for patch, update naming

* update history

* update setup file to latest acs version

* feedback: update history, help docs and port validator

* feedback:int not string, typo

* int not string

* add blank line

* use logger instead of print

* Update _loadbalancer.py

* Update _loadbalancer.py

Co-authored-by: Feiyue Yu <iamyfy@163.com>

* [functionapp]: add ability to create java apps on Linux (#11811)

* update azure-cli version to 2.0.81 (#12005)

* Re-run functionapp tests (#12006)

* {CI} Enable CredScan task of Microsoft Security Code Analysis (Preview) (#12019)

* {Monitor} az monitor diagnostic-settings category list: fix bug(#12020)

* [AMS] az ams is GA now (#12004)

* {Compute} Fix typo in error message when attaching unmanaged disk (#12029)

* [KeyVault] az keyvault key create: add a new value `import` for parameter `--ops` (#12030)

* {Network} Clean up zone*.txt_export.txt files after tests (#12032)

* [ACS] aks create/update: add validation for --vnet-subnet-id argument (#12038)

* [AppConfig] Revise help message to exclude unsupported key/label filter (#12040)

* {Resource} Bump to azure-mgmt-resource~=8.0.1 (#12050)

* [Compute] vm/vmss/availability-set update: add --ppg to allowing updating ProximityPlacementGroup (#12002)

* [Compute] vm/vmss/availability-set update: add --ppg to allowing updating ProximityPlacementGroup

* stage

* add test

* Add help; Support translataion from name to ID

* [Compute] vmss create: add --data-disk-iops and --data-disk-mbps (#11797)

--data-disk-iops
Specify the Read-Write IOPS (space delimited) for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on diskSizeGB.

--data-disk-mbps
Specify the bandwidth in MB per second (space delimited) for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on diskSizeGB.

* upgrade azure-mgmt-version to 0.16.0

* preview enabled for flexibility

* Added --no-wait and list command to the tests

* Fixing lint issues

* Resolving PR comments

* Added transformer to create command

* Updated network by syncing with upstream/dev

* Removed description from HISTORY

* Adding new test for list

Co-authored-by: Rohan Doddaiah Shylaja <roshylaj@microsoft.com>
Co-authored-by: Zunli Hu <zuh@microsoft.com>
Co-authored-by: Feng Zhou <55177366+fengzhou-msft@users.noreply.github.com>
Co-authored-by: Yadi Reyes <36422356+yareyes@users.noreply.github.com>
Co-authored-by: Sam <samarthmshah@gmail.com>
Co-authored-by: Allison Manifold <allisonm@microsoft.com>
Co-authored-by: Bin Ma <bim@microsoft.com>
Co-authored-by: MyronFanQiu <49134743+MyronFanQiu@users.noreply.github.com>
Co-authored-by: Sambit Rath <es15btech11015@iith.ac.in>
Co-authored-by: Azure CLI Bot <azclibot@microsoft.com>
Co-authored-by: Xing Zhou <Zhou.Xing@microsoft.com>
Co-authored-by: shurd <shurd@users.noreply.github.com>
Co-authored-by: Avani Gupta <avanigupta@users.noreply.github.com>
Co-authored-by: Xiaojian Xu <arrownj@126.com>
Co-authored-by: Jiashuo Li <jiasli@microsoft.com>
Co-authored-by: Basil Hariri <8660137+basilhariri@users.noreply.github.com>
Co-authored-by: Byron Tardif <byvinyal@microsoft.com>
Co-authored-by: Jianhui Harold <haroldrandom@gmail.com>
Co-authored-by: Sisira Panchagnula <panchagnula@users.noreply.github.com>
Co-authored-by: Feiyue Yu <fey@microsoft.com>
Co-authored-by: Sean McKenna <seanmck@users.noreply.github.com>
Co-authored-by: Ankit Kumar <kumar.ankit55@gmail.com>
Co-authored-by: PoAn (Baron) Chen <chen.baron@hotmail.com>
Co-authored-by: Matthew Booe <mirdaki@users.noreply.github.com>
Co-authored-by: ganga1980 <gangams@microsoft.com>
Co-authored-by: MECHANDR <30642185+MECHANDR@users.noreply.github.com>
Co-authored-by: Yugang Wang <yugangw@microsoft.com>
Co-authored-by: Jared Moore <jaredmoo@microsoft.com>
Co-authored-by: Isaac Lee <58575754+Isaac-Lee-msft@users.noreply.github.com>
Co-authored-by: Yu Chen <ychenu@microsoft.com>
Co-authored-by: W <lixia_lei@outlook.com>
Co-authored-by: Sapan Saxena <31940305+anusapan@users.noreply.github.com>
Co-authored-by: Feiyue Yu <iamyfy@163.com>
Co-authored-by: Shuai Wang <shuawan@microsoft.com>
Co-authored-by: Huangli Wu <huanwu@microsoft.com>
Co-authored-by: Olga Mirensky <omirensk@redhat.com>
Co-authored-by: hytao <hytao@umich.edu>
Co-authored-by: libronsh <58980373+libronsh@users.noreply.github.com>
Co-authored-by: Min Pae <447317+sputnik13@users.noreply.github.com>
Co-authored-by: Devesh Guha Oleti Muni <devesh.oleti@microsoft.com>
Co-authored-by: ranisha2 <ranisha@microsoft.com>
Co-authored-by: Cristian Klein <cristian@kleinlabs.eu>
Co-authored-by: Alfredo Santamaria <chino.sebastian@gmail.com>
Co-authored-by: Liming Liu <andyliuliming@outlook.com>
Co-authored-by: Chris Eggert <pilor@users.noreply.github.com>
Co-authored-by: Steven Gum <14935595+stevengum@users.noreply.github.com>
Co-authored-by: Ganesha <ganesha.ashoka@gmail.com>
Co-authored-by: giakas <giakas@microsoft.com>
Co-authored-by: Gao Ruifeng <gaoruifeng@users.noreply.github.com>
Co-authored-by: CHENYI ZHANG <czhang0727@gmail.com>
  • Loading branch information
Show file tree
Hide file tree
Showing 9 changed files with 21,901 additions and 5 deletions.
26 changes: 26 additions & 0 deletions src/azure-cli/azure/cli/command_modules/sql/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,32 @@ def _apply_format(result, format_group):
# Apply format function to list
return [format_group(item) for item in obj_list]

###############################################
# sql instance-pool #
###############################################


def instance_pool_table_format(result):
'''
Formats an instance pool or list of instance pools as summary results for display with "-o table".
'''
def _instance_pool_table_format(result):
'''
Formats an instance pool or list of instance pools as summary results for display with "-o table".
'''
from collections import OrderedDict
sku = result['sku']
return OrderedDict([
('name', result['name']),
('resourceGroup', result['resourceGroup']),
('location', result['location']),
('Capacity', result['vCores']),
('SKU Family', sku['family']),
('SKU Tier', sku['tier']),
('Tags', str(result['tags']) if result['tags'] else '')
])

return _apply_format(result, _instance_pool_table_format)

###############################################
# sql server #
Expand Down
59 changes: 59 additions & 0 deletions src/azure-cli/azure/cli/command_modules/sql/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,65 @@
short-summary: Updates the instance failover group.
"""

helps['sql instance-pool'] = """
type: group
short-summary: Manage instance pools.
"""

helps['sql instance-pool create'] = """
type: command
short-summary: Create an instance pool.
examples:
- name: Example to create an instance pool (include --no-wait in the end to get an asynchronous experience)
text: az sql instance-pool create -g resource_group_name -n instance_pool_name -l location --subnet /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Network/virtualNetworks/{VNETName}/subnets/{SubnetName} --license-type LicenseIncluded --capacity 8 -e GeneralPurpose -f Gen5 --no-wait
- name: Example to create an instance pool with subnet name and vnet-name
text: az sql instance-pool create --license-type LicenseIncluded -l northcentralus -n myinstancepool -c 8 -e GeneralPurpose -f Gen5 -g billingPools --subnet mysubnetname --vnet-name myvnetname
"""

helps['sql instance-pool delete'] = """
type: command
short-summary: Delete an instance pool.
examples:
- name: Delete an instance pool
text: az sql instance-pool delete -g mygroup -n myinstancepool --yes
"""

helps['sql instance-pool list'] = """
type: command
short-summary: List available instance pools.
examples:
- name: List all instance pools in the current subscription.
text: az sql instance-pool list
- name: List all instance pools in a resource group.
text: az sql instance-pool list -g mygroup
"""

helps['sql instance-pool show'] = """
type: command
short-summary: Get the details for an instance pool.
examples:
- name: Get the details for an instance pool
text: az sql instance-pool show -g mygroup -n myinstancepool
"""

helps['sql instance-pool update'] = """
type: command
short-summary: Update an instance pool.
examples:
- name: Update an instance pool with new tags (make sure they are space separated if there are multiple tags)
text: az sql instance-pool update -n myinstancepool -g mygroup --tags mykey1=myvalue1 mykey2=myvalue2
- name: Clear the tags assigned to an instance pool
text: az sql instance-pool update -n myinstancepool -g mygroup --tags ""
"""

helps['sql instance-pool wait'] = """
type: command
short-summary: Wait for an instance pool to reach a desired state.
examples:
- name: Wait until an instance pool gets created.
text: az sql instance-pool wait -n myinstancepool -g mygroup --created
"""

helps['sql mi'] = """
type: group
short-summary: Manage SQL managed instances.
Expand Down
64 changes: 64 additions & 0 deletions src/azure-cli/azure/cli/command_modules/sql/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
ElasticPoolPerDatabaseSettings,
ImportExtensionRequest,
ExportRequest,
InstancePool,
ManagedDatabase,
ManagedInstance,
ManagedInstanceAdministrator,
Expand Down Expand Up @@ -1043,6 +1044,69 @@ def _configure_security_policy_storage_params(arg_ctx):
c.argument('allow_data_loss',
arg_type=allow_data_loss_param_type)

###############################################
# sql instance pool #
###############################################

with self.argument_context('sql instance-pool') as c:
c.argument('instance_pool_name',
options_list=['--name', '-n'],
help="Instance Pool Name")

c.argument(
'tier',
arg_type=tier_param_type,
required=True,
help='The edition component of the sku. Allowed value: GeneralPurpose.')

c.argument('family',
arg_type=family_param_type,
required=True,
help='The compute generation component of the sku. '
'Allowed value: Gen5')

c.argument('license_type',
arg_type=get_enum_type(DatabaseLicenseType),
help='The license type to apply for this instance pool.')

with self.argument_context('sql instance-pool create') as c:
# Create args that will be used to build up the InstancePool object
create_args_for_complex_type(
c, 'parameters', InstancePool, [
'location',
'license_type',
'subnet_id',
'vcores',
'tags'
])

c.argument('vcores',
required=True,
arg_type=capacity_param_type,
help='Capacity of the instance pool in vcores.')

c.argument(
'subnet_id',
options_list=['--subnet'],
required=True,
help='Name or ID of the subnet that allows access to an Instance Pool. '
'If subnet name is provided, --vnet-name must be provided.')

# Create args that will be used to build up the Instance Pool's Sku object
create_args_for_complex_type(
c, 'sku', Sku, [
'family',
'name',
'tier',
])

c.ignore('name') # Hide sku name

c.extra('vnet_name',
options_list=['--vnet-name'],
help='The virtual network name',
validator=validate_subnet)

###############################################
# sql server #
###############################################
Expand Down
4 changes: 4 additions & 0 deletions src/azure-cli/azure/cli/command_modules/sql/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ def get_sql_firewall_rules_operations(cli_ctx, _):
return get_sql_management_client(cli_ctx).firewall_rules


def get_sql_instance_pools_operations(cli_ctx, _):
return get_sql_management_client(cli_ctx).instance_pools


def get_sql_recommended_elastic_pools_operations(cli_ctx, _):
return get_sql_management_client(cli_ctx).recommended_elastic_pools

Expand Down
15 changes: 13 additions & 2 deletions src/azure-cli/azure/cli/command_modules/sql/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,32 @@ def validate_subnet(cmd, namespace):
from msrestazure.tools import resource_id, is_valid_resource_id
from azure.cli.core.commands.client_factory import get_subscription_id

subnet = namespace.virtual_network_subnet_id
# Different custom function arg names, instance pool has subnet_id
is_instance_pool = False
if hasattr(namespace, "subnet_id"):
is_instance_pool = True
subnet = namespace.subnet_id
else:
subnet = namespace.virtual_network_subnet_id

subnet_is_id = is_valid_resource_id(subnet)
vnet = namespace.vnet_name

if (subnet_is_id and not vnet) or (not subnet and not vnet):
pass
elif subnet and not subnet_is_id and vnet:
namespace.virtual_network_subnet_id = resource_id(
virtual_network_subnet_id = resource_id(
subscription=get_subscription_id(cmd.cli_ctx),
resource_group=namespace.resource_group_name,
namespace='Microsoft.Network',
type='virtualNetworks',
name=vnet,
child_type_1='subnets',
child_name_1=subnet)
if is_instance_pool:
namespace.subnet_id = virtual_network_subnet_id
else:
namespace.virtual_network_subnet_id = virtual_network_subnet_id
else:
raise CLIError('incorrect usage: [--subnet ID | --subnet NAME --vnet-name NAME]')
delattr(namespace, 'vnet_name')
Expand Down
20 changes: 20 additions & 0 deletions src/azure-cli/azure/cli/command_modules/sql/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
elastic_pool_table_format,
elastic_pool_edition_table_format,
firewall_rule_table_format,
instance_pool_table_format,
server_table_format,
usage_table_format,
LongRunningOperationResultTransform,
Expand All @@ -36,6 +37,7 @@
get_sql_encryption_protectors_operations,
get_sql_failover_groups_operations,
get_sql_firewall_rules_operations,
get_sql_instance_pools_operations,
get_sql_managed_databases_operations,
get_sql_managed_backup_short_term_retention_policies_operations,
get_sql_managed_database_long_term_retention_policies_operations,
Expand Down Expand Up @@ -360,6 +362,24 @@ def load_command_table(self, _):
g.command('delete', 'delete')
g.custom_command('set-primary', 'failover_group_failover')

###############################################
# sql instance-pool #
###############################################

instance_pools_operations = CliCommandType(
operations_tmpl='azure.mgmt.sql.operations#InstancePoolsOperations.{}',
client_factory=get_sql_instance_pools_operations)
with self.command_group('sql instance-pool', instance_pools_operations, client_factory=get_sql_instance_pools_operations, is_preview=True) as g:
g.show_command('show', 'get',
table_transformer=instance_pool_table_format)
g.custom_command('list', 'instance_pool_list',
table_transformer=instance_pool_table_format)
g.command('update', 'update')
g.command('delete', 'delete', supports_no_wait=True, confirmation=True)
g.custom_command('create', 'instance_pool_create',
supports_no_wait=True, table_transformer=instance_pool_table_format)
g.wait_command('wait')

###############################################
# sql server #
###############################################
Expand Down
76 changes: 76 additions & 0 deletions src/azure-cli/azure/cli/command_modules/sql/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1977,6 +1977,82 @@ def elastic_pool_list_capabilities(

return editions

###############################################
# sql instance-pool #
###############################################


def instance_pool_list(
client,
resource_group_name=None):
'''
Lists servers in a resource group or subscription
'''

if resource_group_name:
# List all instance pools in the resource group
return client.list_by_resource_group(
resource_group_name=resource_group_name)

# List all instance pools in the subscription
return client.list()


def instance_pool_create(
cmd,
client,
instance_pool_name,
resource_group_name,
no_wait=False,
sku=None,
**kwargs):
'''
Creates a new instance pool
'''

kwargs['sku'] = _find_instance_pool_sku_from_capabilities(
cmd.cli_ctx, kwargs['location'], sku)

return sdk_no_wait(no_wait, client.create_or_update,
instance_pool_name=instance_pool_name,
resource_group_name=resource_group_name,
parameters=kwargs)


def _find_instance_pool_sku_from_capabilities(cli_ctx, location, sku):
'''
Validate if the sku family and edition input by user are permissible in the region using
capabilities API and get the SKU name
'''

logger.debug('_find_instance_pool_sku_from_capabilities input: %s', sku)

# Get location capability
loc_capability = _get_location_capability(
cli_ctx, location, CapabilityGroup.supported_managed_instance_versions)

# Get default server version capability
managed_instance_version_capability = _get_default_capability(
loc_capability.supported_managed_instance_versions)

# Find edition capability, based on requested sku properties
edition_capability = _find_edition_capability(
sku, managed_instance_version_capability.supported_instance_pool_editions)

# Find family level capability, based on requested sku properties
_find_family_capability(
sku, edition_capability.supported_families)

result = Sku(
name="instance-pool",
tier=sku.tier,
family=sku.family)

logger.debug(
'_find_instance_pool_sku_from_capabilities return: %s',
result)
return result


###############################################
# sql server #
Expand Down
Loading

0 comments on commit 015be59

Please sign in to comment.