Closed bzuidgeest closed 8 months ago
Thank you for reaching out. I believe you are looking for help with the Azure.ResourceManager.RecoveryServicesBackup management plane SDK. @ArthurMa1978 could you help route this to the right team members?
Hi @bzuidgeest , Thank you for using Azure SDK for .NET. Found one possible sample for you, please check: https://github.com/Azure/azure-sdk-for-net/blob/84c0361d53cc0cfa4c71f8267e28d5af34c6b889/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs#L166
Hi @bzuidgeest. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.
Hi @bzuidgeest, since you haven’t asked that we /unresolve
the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve
to reopen the issue.
/unresolve
sorry for the late reply, but I have been enjoying a holiday. The answer from @HarveyLink does the opposite of answering the question. (though the example might be usefull).
The question is about the lack of documentation for these string based filters and the fact that there are mananged classes that seem to pertain to these filters like BackupManagementType and WorkloadTypeEnum. But they are not used anywhere. Is there tooling to use these classes directly to specify things, instead of magic strings?
Also the filter parameter is undocumented. How do you filter by name or other properties?
/unresolve
sorry for the late reply, but I have been enjoying a holiday. The answer from @HarveyLink Minghao Chen (WICRESOFT NORTH AMERICA LTD) Vendor does the opposite of answering the question. (though the example might be usefull).
The question is about the lack of documentation for these string based filters and the fact that there are mananged classes that seem to pertain to these filters like BackupManagementType and WorkloadTypeEnum. But they are not used anywhere. Is there tooling to use these classes directly to specify things, instead of magic strings?
Also the filter parameter is undocumented. How do you filter by name or other properties?
BackupManagementType
is used as properties in BackupGenericProtectionContainer
and it's subclasses, BackupWorkloadType
is used in setup BackupProtectionPolicyData
and other classes.
Our current SDK is auto generated from the service RESTAPI, the filter string and no detailed comments are designed by service team. Currently there is no convenience layer supported to bypass those properties in our SDK.
If you need the detailed filter usage comments, you could file an issue at https://github.com/Azure/azure-rest-api-specs
"An OData filter expression that filters elements in the collection." Is hardly detailed documentation
take the example (generated) on this page https://learn.microsoft.com/en-us/rest/api/backup/backup-protected-items/list?view=rest-backup-2023-02-01&tabs=HTTP
There is an URL with this filter: $filter=backupManagementType eq 'AzureIaasVM' and itemType eq 'VM'
In the response there is a backupManagementType property, but its hidden in a subproperties named properties. There is not property named "itemType" at all, but its value seems to match up with workloadtype. Am I to guess as to what the actual propertyname is to filter the list on "name"?
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupProtectedItems?api-version=2023-02-01&$filter=backupManagementType eq 'AzureIaasVM' and itemType eq 'VM'
{
"value": [
{
"id": "/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/protectionContainers/IaasVMContainer;iaasvmcontainer;iaasvm-rg;iaasvm-1/protectedItems/VM;iaasvmcontainer;iaasvm-rg;iaasvm-1",
"name": "VM;iaasvmcontainer;iaasvm-rg;iaasvm-1",
"type": "Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems",
"properties": {
"friendlyName": "iaasvm-1",
"virtualMachineId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/providers/Microsoft.ClassicCompute/virtualMachines/iaasvm-1",
"protectionStatus": "Healthy",
"protectionState": "Protected",
"healthStatus": "Passed",
"lastBackupStatus": "Completed",
"lastBackupTime": "2018-01-22T12:25:32.048723Z",
"protectedItemDataId": "636482643132986882",
"protectedItemType": "Microsoft.ClassicCompute/virtualMachines",
**"backupManagementType": "AzureIaasVM",**
**"workloadType": "VM",**
"containerName": "iaasvmcontainer;iaasvm-rg;iaasvm-1",
"sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/providers/Microsoft.ClassicCompute/virtualMachines/iaasvm-1",
"policyId": "/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/testPolicy1",
"lastRecoveryPoint": "2017-11-22T12:25:32.048723Z"
}
}
]
}
Hi @bzuidgeest , thank you for reaching out to us about the Azure SDK for .NET. Unfortunately, this issue is related to the service side and not the SDK side, so we are not able to help you with it. Therefore, we are closing this issue for now. If you need more assistance, please open an Azure support request. We apologize for any inconvenience this may cause you.
We value your feedback and we want to make sure that your problem is solved. If you think that we have misunderstood your issue or closed it incorrectly, please feel free to comment on this thread and reopen the issue. We will be happy to assist you further. Thank you for your understanding and cooperation.
Library name and version
1.9.0?
Query/Question
Hello,
I'm trying to translate some powershell for restoring a sql database backup to an azure hosted cluster. The azure Az powershell module doesn't seem to translate 1:1 to the c# libraries.
I'm trying for example to translate this line in equivalent c# code using the Azure.ResourceManager.* library
I think I need to use the function GetBackupProtectableItems, but this requires me to create a filter. Something I can find little documetation on.
searching through this code repo I found that there is a BackupManagementType enum and a WorkloadTypeEnum. But I don't see any functions using these classes.
I'm getting kind of lost. Do I need to create the filter myself based on these classes? Where is filter parameter of GetBackupProtectableItems documented? I would expect for a library wrapping a rest service to support these things in a strongly type way. Not with parsing filter strings. Is this incorrect?
Environment
No response