Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Visual FoxPro) Azure List Storage AccountsDemonstrates how to list Azure storage accounts.
LOCAL loHttp LOCAL loJsonToken LOCAL lnSuccess LOCAL lcUrl LOCAL lcJsonResp LOCAL loJson LOCAL i LOCAL lnCount_i LOCAL lcSkuName LOCAL lcSkuTier LOCAL lcKind LOCAL lcId LOCAL lcName LOCAL lcV_type LOCAL lcLocation LOCAL lcPropertiesNetworkAclsBypass LOCAL lcPropertiesNetworkAclsDefaultAction LOCAL lnPropertiesSupportsHttpsTrafficOnly LOCAL lnPropertiesEncryptionServicesFileEnabled LOCAL lcPropertiesEncryptionServicesFileLastEnabledTime LOCAL lnPropertiesEncryptionServicesBlobEnabled LOCAL lcPropertiesEncryptionServicesBlobLastEnabledTime LOCAL lcPropertiesEncryptionKeySource LOCAL lcPropertiesProvisioningState LOCAL lcPropertiesCreationTime LOCAL lcPropertiesPrimaryEndpointsBlob LOCAL lcPropertiesPrimaryEndpointsQueue LOCAL lcPropertiesPrimaryEndpointsTable LOCAL lcPropertiesPrimaryEndpointsFile LOCAL lcPropertiesPrimaryLocation LOCAL lcPropertiesStatusOfPrimary * This example requires the Chilkat API to have been previously unlocked. * See Global Unlock Sample for sample code. * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http') loHttp = CreateObject('Chilkat.Http') * Load an OAuth2 access token previously fetched by this example: Get Azure OAuth2 Access Token * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJsonToken = CreateObject('Chilkat.JsonObject') lnSuccess = loJsonToken.LoadFile("qa_data/tokens/azureToken.json") * Assuming success.. loHttp.AuthToken = loJsonToken.StringOf("access_token") ? "AuthToken: " + loHttp.AuthToken loHttp.Accept = "application/json" lcUrl = "https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts?api-version=2018-11-01" lcJsonResp = loHttp.QuickGetStr(lcUrl) IF (loHttp.LastMethodSuccess <> 1) THEN ? loHttp.LastErrorText RELEASE loHttp RELEASE loJsonToken CANCEL ENDIF ? "Response Status Code: " + STR(loHttp.LastStatus) * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJson = CreateObject('Chilkat.JsonObject') loJson.Load(lcJsonResp) loJson.EmitCompact = 0 ? loJson.Emit() IF (loHttp.LastStatus <> 200) THEN ? "Failed." RELEASE loHttp RELEASE loJsonToken RELEASE loJson CANCEL ENDIF * Sample output... * (See the parsing code below..) * * Use this online tool to generate parsing code from sample JSON: * Generate Parsing Code from JSON * { * "value": [ * { * "sku": { * "name": "Standard_LRS", * "tier": "Standard" * }, * "kind": "Storage", * "id": "/subscriptions/6c42643b-ebef-45e0-b917-b3583b84a57f/resourceGroups/gchilkat/providers/Microsoft.Storage/storageAccounts/chilkat", * "name": "chilkat", * "type": "Microsoft.Storage/storageAccounts", * "location": "eastus", * "tags": {}, * "properties": { * "networkAcls": { * "bypass": "AzureServices", * "virtualNetworkRules": [ * ], * "ipRules": [ * ], * "defaultAction": "Allow" * }, * "supportsHttpsTrafficOnly": true, * "encryption": { * "services": { * "file": { * "enabled": true, * "lastEnabledTime": "2017-12-28T11:02:10.6840887Z" * }, * "blob": { * "enabled": true, * "lastEnabledTime": "2017-12-28T11:02:10.6840887Z" * } * }, * "keySource": "Microsoft.Storage" * }, * "provisioningState": "Succeeded", * "creationTime": "2016-04-18T22:57:36.5377065Z", * "primaryEndpoints": { * "blob": "https://chilkat.blob.core.windows.net/", * "queue": "https://chilkat.queue.core.windows.net/", * "table": "https://chilkat.table.core.windows.net/", * "file": "https://chilkat.file.core.windows.net/" * }, * "primaryLocation": "eastus", * "statusOfPrimary": "available" * } * } * ] * } * i = 0 lnCount_i = loJson.SizeOfArray("value") DO WHILE i < lnCount_i loJson.I = i lcSkuName = loJson.StringOf("value[i].sku.name") lcSkuTier = loJson.StringOf("value[i].sku.tier") lcKind = loJson.StringOf("value[i].kind") lcId = loJson.StringOf("value[i].id") lcName = loJson.StringOf("value[i].name") lcV_type = loJson.StringOf("value[i].type") lcLocation = loJson.StringOf("value[i].location") lcPropertiesNetworkAclsBypass = loJson.StringOf("value[i].properties.networkAcls.bypass") lcPropertiesNetworkAclsDefaultAction = loJson.StringOf("value[i].properties.networkAcls.defaultAction") lnPropertiesSupportsHttpsTrafficOnly = loJson.BoolOf("value[i].properties.supportsHttpsTrafficOnly") lnPropertiesEncryptionServicesFileEnabled = loJson.BoolOf("value[i].properties.encryption.services.file.enabled") lcPropertiesEncryptionServicesFileLastEnabledTime = loJson.StringOf("value[i].properties.encryption.services.file.lastEnabledTime") lnPropertiesEncryptionServicesBlobEnabled = loJson.BoolOf("value[i].properties.encryption.services.blob.enabled") lcPropertiesEncryptionServicesBlobLastEnabledTime = loJson.StringOf("value[i].properties.encryption.services.blob.lastEnabledTime") lcPropertiesEncryptionKeySource = loJson.StringOf("value[i].properties.encryption.keySource") lcPropertiesProvisioningState = loJson.StringOf("value[i].properties.provisioningState") lcPropertiesCreationTime = loJson.StringOf("value[i].properties.creationTime") lcPropertiesPrimaryEndpointsBlob = loJson.StringOf("value[i].properties.primaryEndpoints.blob") lcPropertiesPrimaryEndpointsQueue = loJson.StringOf("value[i].properties.primaryEndpoints.queue") lcPropertiesPrimaryEndpointsTable = loJson.StringOf("value[i].properties.primaryEndpoints.table") lcPropertiesPrimaryEndpointsFile = loJson.StringOf("value[i].properties.primaryEndpoints.file") lcPropertiesPrimaryLocation = loJson.StringOf("value[i].properties.primaryLocation") lcPropertiesStatusOfPrimary = loJson.StringOf("value[i].properties.statusOfPrimary") i = i + 1 ENDDO RELEASE loHttp RELEASE loJsonToken RELEASE loJson |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.