tayganr / purviewcli

Microsoft Purview CLI
https://aka.ms/purviewcli
MIT License
48 stars 27 forks source link

`pv scan createSource` resourceName become only the first character of the specified parameter #2

Closed nakazax closed 3 years ago

nakazax commented 3 years ago

I've tried pv scan createSource command like the following, the command has succeeded and the source has been created. But the resourceName has became c instead of cosdb-example.

Command

!pv scan createSource \
    --datasource "cosdb-example" \
    --kind "AzureCosmosDb" \
    --accountUri "https://cosdb-example.documents.azure.com:443/" \
    --subscriptionId "xxx" \
    --resourceGroup "rg-hinakaza-private" \
    --location "westus2" \
    --resourceName "cosdb-example" \
    --parentCollection "ServiceEndpoint"

Response

{
    "id": "datasources/cosdb-example",
    "kind": "AzureCosmosDb",
    "name": "cosdb-example",
    "properties": {
        "accountUri": "https://cosdb-example.documents.azure.com:443/",
        "createdAt": "2021-05-06T15:11:47.903815Z",
        "lastModifiedAt": "2021-05-06T15:13:51.304859Z",
        "location": "westus2",
        "parentCollection": {
            "referenceName": "ServiceEndpoint",
            "type": "DataSourceReference"
        },
        "resourceGroup": "rg-hinakaza-private",
        "resourceName": "c",
        "subscriptionId": "xxx"
    }
}

Idea of solution

I'm wondering if [0] of "resourceName": args['--resourceName'][0] in the follwoing function is the reason. How about removing the [0]? https://github.com/tayganr/purviewcli/blob/711fa8cbf5533adc4bcf529af6948cf1d35c0396/purviewcli/client/_scan.py#L108-L132

tayganr commented 3 years ago

@nakazax - Thanks for picking up the issue. Just pushed through a new version (0.1.10) which should fix it.

nakazax commented 3 years ago

@tayganr Thanks for your quick response.