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
(DataFlex) Azure List Storage AccountsDemonstrates how to list Azure storage accounts.
Use ChilkatAx-win32.pkg Procedure Test Handle hoHttp Token Handle hoJsonToken Boolean iSuccess String sUrl String sJsonResp Handle hoJson Integer i Integer iCount_i String sSkuName String sSkuTier String sKind String sId String sName String sV_type String sLocation String sPropertiesNetworkAclsBypass String sPropertiesNetworkAclsDefaultAction Boolean iPropertiesSupportsHttpsTrafficOnly Boolean iPropertiesEncryptionServicesFileEnabled String sPropertiesEncryptionServicesFileLastEnabledTime Boolean iPropertiesEncryptionServicesBlobEnabled String sPropertiesEncryptionServicesBlobLastEnabledTime String sPropertiesEncryptionKeySource String sPropertiesProvisioningState String sPropertiesCreationTime String sPropertiesPrimaryEndpointsBlob String sPropertiesPrimaryEndpointsQueue String sPropertiesPrimaryEndpointsTable String sPropertiesPrimaryEndpointsFile String sPropertiesPrimaryLocation String sPropertiesStatusOfPrimary String sTemp1 Integer iTemp1 Boolean bTemp1 // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End // Load an OAuth2 access token previously fetched by this example: Get Azure OAuth2 Access Token Get Create (RefClass(cComChilkatJsonObject)) To hoJsonToken If (Not(IsComObjectCreated(hoJsonToken))) Begin Send CreateComObject of hoJsonToken End Get ComLoadFile Of hoJsonToken "qa_data/tokens/azureToken.json" To iSuccess // Assuming success.. Get ComStringOf Of hoJsonToken "access_token" To sTemp1 Set ComAuthToken Of hoHttp To sTemp1 Get ComAuthToken Of hoHttp To sTemp1 Showln "AuthToken: " sTemp1 Set ComAccept Of hoHttp To "application/json" Move "https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts?api-version=2018-11-01" To sUrl Get ComQuickGetStr Of hoHttp sUrl To sJsonResp Get ComLastMethodSuccess Of hoHttp To bTemp1 If (bTemp1 <> True) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get ComLastStatus Of hoHttp To iTemp1 Showln "Response Status Code: " iTemp1 Get Create (RefClass(cComChilkatJsonObject)) To hoJson If (Not(IsComObjectCreated(hoJson))) Begin Send CreateComObject of hoJson End Get ComLoad Of hoJson sJsonResp To iSuccess Set ComEmitCompact Of hoJson To False Get ComEmit Of hoJson To sTemp1 Showln sTemp1 Get ComLastStatus Of hoHttp To iTemp1 If (iTemp1 <> 200) Begin Showln "Failed." Procedure_Return End // 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" // } // } // ] // } // Move 0 To i Get ComSizeOfArray Of hoJson "value" To iCount_i While (i < iCount_i) Set ComI Of hoJson To i Get ComStringOf Of hoJson "value[i].sku.name" To sSkuName Get ComStringOf Of hoJson "value[i].sku.tier" To sSkuTier Get ComStringOf Of hoJson "value[i].kind" To sKind Get ComStringOf Of hoJson "value[i].id" To sId Get ComStringOf Of hoJson "value[i].name" To sName Get ComStringOf Of hoJson "value[i].type" To sV_type Get ComStringOf Of hoJson "value[i].location" To sLocation Get ComStringOf Of hoJson "value[i].properties.networkAcls.bypass" To sPropertiesNetworkAclsBypass Get ComStringOf Of hoJson "value[i].properties.networkAcls.defaultAction" To sPropertiesNetworkAclsDefaultAction Get ComBoolOf Of hoJson "value[i].properties.supportsHttpsTrafficOnly" To iPropertiesSupportsHttpsTrafficOnly Get ComBoolOf Of hoJson "value[i].properties.encryption.services.file.enabled" To iPropertiesEncryptionServicesFileEnabled Get ComStringOf Of hoJson "value[i].properties.encryption.services.file.lastEnabledTime" To sPropertiesEncryptionServicesFileLastEnabledTime Get ComBoolOf Of hoJson "value[i].properties.encryption.services.blob.enabled" To iPropertiesEncryptionServicesBlobEnabled Get ComStringOf Of hoJson "value[i].properties.encryption.services.blob.lastEnabledTime" To sPropertiesEncryptionServicesBlobLastEnabledTime Get ComStringOf Of hoJson "value[i].properties.encryption.keySource" To sPropertiesEncryptionKeySource Get ComStringOf Of hoJson "value[i].properties.provisioningState" To sPropertiesProvisioningState Get ComStringOf Of hoJson "value[i].properties.creationTime" To sPropertiesCreationTime Get ComStringOf Of hoJson "value[i].properties.primaryEndpoints.blob" To sPropertiesPrimaryEndpointsBlob Get ComStringOf Of hoJson "value[i].properties.primaryEndpoints.queue" To sPropertiesPrimaryEndpointsQueue Get ComStringOf Of hoJson "value[i].properties.primaryEndpoints.table" To sPropertiesPrimaryEndpointsTable Get ComStringOf Of hoJson "value[i].properties.primaryEndpoints.file" To sPropertiesPrimaryEndpointsFile Get ComStringOf Of hoJson "value[i].properties.primaryLocation" To sPropertiesPrimaryLocation Get ComStringOf Of hoJson "value[i].properties.statusOfPrimary" To sPropertiesStatusOfPrimary Move (i + 1) To i Loop End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.