Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ProviderHub CLI Support for Comma Separated Values #8461

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,9 @@ def _execute_operations(self):

@register_callback
def pre_operations(self):
pass
from azure.cli.core.aaz import AAZArgEnum
args = str(self.ctx.args).split(",")
return AAZArgEnum(args)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this used for?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow this doc for customization https://azure.github.io/aaz-dev-tools/pages/usage/customization/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for parsing comma separated input for the following commands:
az providerhub provider-registration create --provider-type
az providerhub resource-type-registration create --routing-type

So that the user could enter something like:
az providerhub provider-registration create --provider-type "Hidden, Internal"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from azure.cli.core.aaz import AAZArgEnum
args = str(self.ctx.args).split(",")
return AAZArgEnum(args)
pass


@register_callback
def post_operations(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,9 @@ def _execute_operations(self):

@register_callback
def pre_operations(self):
pass
from azure.cli.core.aaz import AAZArgEnum
args = str(self.ctx.args).split(",")
return AAZArgEnum(args)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from azure.cli.core.aaz import AAZArgEnum
args = str(self.ctx.args).split(",")
return AAZArgEnum(args)
pass


@register_callback
def post_operations(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ interactions:
"Resource Provider Service as a Service", "incidentRoutingTeam": "RPaaS", "manifestOwners":
["SPARTA-PlatformServiceAdministrator"], "serviceTreeInfos": [{"componentId":
"d1b7d8ba-05e2-48e6-90d6-d781b99c6e69", "serviceId": "d1b7d8ba-05e2-48e6-90d6-d781b99c6e69"}]},
"metadata": {"BypassManifestValidation": true}, "providerVersion": "2.0", "tokenAuthConfiguration":
{"authenticationScheme": "PoP", "signedRequestScope": "ResourceUri"}}}'
"metadata": {"BypassManifestValidation": true}, "providerType": "Hidden, Internal",
"providerVersion": "2.0", "tokenAuthConfiguration": {"authenticationScheme":
"PoP", "signedRequestScope": "ResourceUri"}}}'
headers:
Accept:
- application/json
Expand All @@ -18,31 +19,31 @@ interactions:
Connection:
- keep-alive
Content-Length:
- '684'
- '720'
Content-Type:
- application/json
ParameterSetName:
- --token-auth-configuration --service-tree-infos --capabilities --capabilities
--manifest-owners --incident-contact-email --incident-routing-service --incident-routing-team
--provider-version --provider-namespace --metadata
--provider-version --provider-type --provider-namespace --metadata
User-Agent:
- AZURECLI/2.61.0 azsdk-python-core/1.28.0 Python/3.11.0 (Windows-10-10.0.22631-SP0)
- AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.0 (Windows-11-10.0.26100-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ProviderHub/providerRegistrations/Private.VPTest?api-version=2024-04-01-preview
response:
body:
string: '{"properties":{"privateResourceProviderConfiguration":{"allowedSubscriptions":["81ddc363-4b54-4223-833d-16b2a424d8a0"]},"provisioningState":"Succeeded","namespace":"Private.VPTest","providerVersion":"2.0","providerType":"Internal,
Hidden","management":{"manifestOwners":["SPARTA-PlatformServiceAdministrator"],"incidentRoutingService":"Resource
Provider Service as a Service","incidentRoutingTeam":"RPaaS","incidentContactEmail":"[email protected]","serviceTreeInfos":[{"serviceId":"d1b7d8ba-05e2-48e6-90d6-d781b99c6e69","componentId":"d1b7d8ba-05e2-48e6-90d6-d781b99c6e69"}]},"capabilities":[{"quotaId":"CSP_2015-05-01","effect":"Allow"},{"quotaId":"CSP_MG_2017-12-01","effect":"Allow"}],"metadata":{"BypassManifestValidation":true},"tokenAuthConfiguration":{"authenticationScheme":"PoP","signedRequestScope":"ResourceUri","disableCertificateAuthenticationFallback":false}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ProviderHub/providerRegistrations/Private.VPTest","type":"Microsoft.ProviderHub/providerRegistrations","name":"Private.VPTest","kind":"Managed","systemData":{"createdBy":"[email protected]","createdByType":"User","createdAt":"2022-11-16T00:05:06.5154703Z","lastModifiedBy":"gaurimadhok@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2024-06-17T03:49:36.6182293Z"}}'
Provider Service as a Service","incidentRoutingTeam":"RPaaS","incidentContactEmail":"[email protected]","serviceTreeInfos":[{"serviceId":"d1b7d8ba-05e2-48e6-90d6-d781b99c6e69","componentId":"d1b7d8ba-05e2-48e6-90d6-d781b99c6e69"}]},"capabilities":[{"quotaId":"CSP_2015-05-01","effect":"Allow"},{"quotaId":"CSP_MG_2017-12-01","effect":"Allow"}],"metadata":{"BypassManifestValidation":true},"tokenAuthConfiguration":{"authenticationScheme":"PoP","signedRequestScope":"ResourceUri","disableCertificateAuthenticationFallback":false}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ProviderHub/providerRegistrations/Private.VPTest","type":"Microsoft.ProviderHub/providerRegistrations","name":"Private.VPTest","kind":"Managed","systemData":{"createdBy":"[email protected]","createdByType":"User","createdAt":"2022-11-16T00:05:06.5154703Z","lastModifiedBy":"nataliezoz@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2025-02-07T22:45:57.4420139Z"}}'
headers:
cache-control:
- no-cache
content-length:
- '1345'
- '1344'
content-type:
- application/json; charset=utf-8
date:
- Mon, 17 Jun 2024 03:49:46 GMT
- Fri, 07 Feb 2025 22:45:57 GMT
expires:
- '-1'
pragma:
Expand All @@ -53,12 +54,12 @@ interactions:
- CONFIG_NOCACHE
x-content-type-options:
- nosniff
x-ms-operation-identifier:
- tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47,objectId=9506e7c0-c569-479f-9940-1f63cb8ce817/centraluseuap/295f3079-311a-4576-9769-bd2118a4720c
x-ms-ratelimit-remaining-subscription-global-writes:
- '11999'
x-ms-ratelimit-remaining-subscription-writes:
- '1197'
- '799'
x-msedge-ref:
- 'Ref A: 6F6726D26FE84B3AB8B77DA8FE0CBD56 Ref B: CO6AA3150218035 Ref C: 2024-06-17T03:49:36Z'
- 'Ref A: D03FDA3C0F81495192B17B735EB0F8C1 Ref B: CO6AA3150218019 Ref C: 2025-02-07T22:45:57Z'
status:
code: 200
message: OK
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
interactions:
- request:
body: '{"kind": "Managed", "properties": {"endpoints": [{"apiVersions": ["2019-01-01"],
"locations": ["WestUS"]}], "regionality": "Regional"}}'
"locations": ["WestUS"]}], "regionality": "Regional", "routingType": "ProxyOnly,
Extension"}}'
headers:
Accept:
- application/json
Expand All @@ -12,27 +13,28 @@ interactions:
Connection:
- keep-alive
Content-Length:
- '135'
- '174'
Content-Type:
- application/json
ParameterSetName:
- --endpoints --regionality --provider-namespace --resource-type
- --endpoints --regionality --provider-namespace --resource-type --routing-type
User-Agent:
- AZURECLI/2.59.0 azsdk-python-core/1.28.0 Python/3.11.0 (Windows-10-10.0.22631-SP0)
- AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.0 (Windows-11-10.0.26100-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ProviderHub/providerRegistrations/Private.VPTest/resourcetypeRegistrations/extensionresourcetype?api-version=2024-04-01-preview
response:
body:
string: '{"properties":{"name":"extensionresourcetype","routingType":"Default","regionality":"Regional","endpoints":[{"kind":"Managed","apiVersions":["2019-01-01"],"locations":["WestUS"]}],"defaultApiVersion":"2019-01-01","enableAsyncOperation":false,"provisioningState":"Succeeded","enableThirdPartyS2S":false,"templateDeploymentOptions":{"preflightSupported":true,"preflightOptions":["DefaultValidationOnly"]}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ProviderHub/providerRegistrations/Private.VPTest/resourceTypeRegistrations/extensionresourcetype","type":"Microsoft.ProviderHub/providerRegistrations/resourceTypeRegistrations","name":"extensionresourcetype","kind":"Managed","systemData":{"createdBy":"[email protected]","createdByType":"User","createdAt":"2024-05-31T03:23:33.5645757Z","lastModifiedBy":"[email protected]","lastModifiedByType":"User","lastModifiedAt":"2024-06-04T23:30:16.4751488Z"}}'
string: '{"properties":{"name":"extensionresourcetype","routingType":"ProxyOnly,
Extension","regionality":"Regional","endpoints":[{"kind":"Managed","apiVersions":["2019-01-01"],"locations":["WestUS"]}],"defaultApiVersion":"2019-01-01","throttlingRules":[{"action":"Private.VPTest/extensionresourcetype/write","metrics":[{"type":"NumberOfRequests","limit":400,"interval":"PT1H"}]},{"action":"Private.VPTest/extensionresourcetype/read","metrics":[{"type":"NumberOfRequests","limit":4000,"interval":"PT1H"}]},{"action":"Private.VPTest/extensionresourcetype/delete","metrics":[{"type":"NumberOfRequests","limit":5000,"interval":"PT1H"}]}],"enableAsyncOperation":false,"provisioningState":"Succeeded","enableThirdPartyS2S":false,"templateDeploymentOptions":{"preflightSupported":true,"preflightOptions":["DefaultValidationOnly"]}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ProviderHub/providerRegistrations/Private.VPTest/resourceTypeRegistrations/extensionresourcetype","type":"Microsoft.ProviderHub/providerRegistrations/resourceTypeRegistrations","name":"extensionresourcetype","kind":"Managed","systemData":{"createdBy":"[email protected]","createdByType":"User","createdAt":"2025-02-07T22:56:55.0029838Z","lastModifiedBy":"[email protected]","lastModifiedByType":"User","lastModifiedAt":"2025-02-07T22:56:55.0029838Z"}}'
headers:
cache-control:
- no-cache
content-length:
- '949'
- '1360'
content-type:
- application/json; charset=utf-8
date:
- Tue, 04 Jun 2024 23:30:21 GMT
- Fri, 07 Feb 2025 22:56:56 GMT
expires:
- '-1'
pragma:
Expand All @@ -43,12 +45,12 @@ interactions:
- CONFIG_NOCACHE
x-content-type-options:
- nosniff
x-ms-operation-identifier:
- tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47,objectId=9506e7c0-c569-479f-9940-1f63cb8ce817/centraluseuap/c2af90b9-43e4-42e1-89aa-e6284ab27de0
x-ms-ratelimit-remaining-subscription-global-writes:
- '11999'
x-ms-ratelimit-remaining-subscription-writes:
- '1197'
- '799'
x-msedge-ref:
- 'Ref A: 8C557624C4F54E8380FDDB445379C9FA Ref B: DM2AA1091214017 Ref C: 2024-06-04T23:30:16Z'
- 'Ref A: 91D0426F1AC74686B7893DD629D80460 Ref B: CO6AA3150219009 Ref C: 2025-02-07T22:56:54Z'
status:
code: 200
message: OK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def test_step_provider_registration_create(self, resource_group):
'--incident-routing-service "Resource Provider Service as a Service" '
'--incident-routing-team "RPaaS" '
'--provider-version "2.0" '
'--provider-type "Hidden, Internal" '
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'--provider-type "Hidden, Internal" '
'--provider-type "Hidden,Internal" '

'--provider-namespace "{providerNamespace}" '
'--metadata {{\\"BypassManifestValidation\\":true}}')

Expand Down Expand Up @@ -213,7 +214,8 @@ def test_step_resource_type_registration_create(self, resource_group):
'--endpoints "[{{api-versions:[2019-01-01],locations:[WestUS]}}]" '
'--regionality "Regional" '
'--provider-namespace "{providerNamespace}" '
'--resource-type "extensionresourcetype"')
'--resource-type "extensionresourcetype" '
'--routing-type "ProxyOnly, Extension" ')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'--routing-type "ProxyOnly, Extension" ')
'--routing-type "ProxyOnly,Extension" ')


# EXAMPLE: /ResourceTypeRegistrations/get/ResourceTypeRegistrations_ListByProviderRegistration
@AllowLargeResponse()
Expand Down Expand Up @@ -514,4 +516,4 @@ def test_step_sku_delete4(self, resource_group):
'--nested-resource-type-third "nestedResourceTypeThird" '
'--provider-namespace "{providerNamespace}" '
'--resource-type "{resourceType}" '
'--sku "{skuName}"')
'--sku "{skuName}"')
Loading