{
"name": "string",
"type": "Microsoft.StorageSync/storageSyncServices/syncGroups/serverEndpoints",
"apiVersion": "2019-06-01",
"properties": {
"serverLocalPath": "string",
"cloudTiering": "string",
"volumeFreeSpacePercent": "integer",
"tierFilesOlderThanDays": "integer",
"friendlyName": "string",
"serverResourceId": "string",
"offlineDataTransfer": "string",
"offlineDataTransferShareName": "string"
}
}
What needs to be passed as a server resource id in the above template format for storage sync. How do we get the server id ?
Yes. Use the Get-AzStorageSyncServerEndpoint cmdlet from the Az.StorageSync module to list all server endpoints within a given sync group.
Get-AzStorageSyncServerEndpoint -ResourceGroupName "myResourceGroup" -StorageSyncServiceName "mysyncservice" -SyncGroupName "testsyncgroup"
Sample Response:
SyncGroupName : testsyncgroup
StorageSyncServiceName : mysyncservice
ServerLocalPath : C:\Users\onpremwindows\Desktop\myfolder
ServerResourceId : /subscriptions/***/resourceGroups/myResourceGroup/providers/microsoft.stor
agesync/storageSyncServices/mysyncservice/registeredServers/8ec8b78c-0739-195r-856e-2e7r5ta2c13w
ServerEndpointName : 94e9fd59-23d6-9854-99c1-3e9a8ab73760
ProvisioningState : Succeeded
LastWorkflowId : storageSyncServices/mysyncservice/workflows/bd3o8c77-7183-4a46-8830-9b156dd2f011
LastOperationName : ICreateServerEndpointWorkflow
FriendlyName : onpremwindows
SyncStatus : Microsoft.Azure.Commands.StorageSync.Models.PSServerEndpointHealth
CloudTiering : Off
VolumeFreeSpacePercent : 20
TierFilesOlderThanDays :
OfflineDataTransfer : Off
OfflineDataTransferShareName :
OfflineDataTransferStorageAccountResourceId :
OfflineDataTransferStorageAccountTenantId :
InitialDownloadPolicy : NamespaceThenModifiedFiles
LocalCacheMode : UpdateLocallyCachedFiles
ResourceId : /subscriptions/***/resourceGroups/myResourceGroup/providers/microsoft.stor
agesync/storageSyncServices/mysyncservice/syncGroups/testsyncgroup/serverEndpoints/94e9fd59-23d6-9854-99c1-3e9a8ab73760
ResourceGroupName : myResourceGroup
Type : microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints
8ec8b78c-0739-195r-856e-2e7r5ta2c13w would be the ServerId you can pass.
You can obtain the ServerId using the Get-AzStorageSyncService cmdlet as well:
Get-AzStorageSyncService -ResourceGroupName "myResourceGroup" -StorageSyncServiceName "mysyncservice"
Sample response:
StorageSyncServiceName : mysyncservice
ServerName : 8ec8b78c-0739-195r-856e-2e7r5ta2c13w
ServerCertificate :
AgentVersion : 8.0.0.0
ServerOSVersion : 10.0.14393.0
ServerManagementErrorCode : 0
LastHeartBeat : 12/10/2019 12:55:01
ProvisioningState : Succeeded
ServerRole : Standalone
ClusterId : 00000000-0000-0000-0000-000000000000
ClusterName :
ServerId : 8ec8b78c-0739-195r-856e-2e7r5ta2c13w
StorageSyncServiceUid : 76104503-6cd8-4812-7884-c4288e87a8cd
LastWorkflowId : storageSyncServices/finalsync/workflows/0e3bc737-7619-4b42-81a9-aec36e3fbf53
LastOperationName : ICreateRegisteredServerWorkflow
DiscoveryEndpointUri : https://tm-server.xxx.com:443
ResourceLocation : eastasia
ServiceLocation : eastasia
FriendlyName : onpremwindows
ManagementEndpointUri : https://tm-server.xxx.com:443
MonitoringEndpointUri : https://tm-server.xxx.com:443
ResourceId : /subscriptions/***/resourceGroups/myResourceGroup/providers/microsoft.storagesync/storageSyncServices/mysyncservice/registeredServers/8ec8b78c-0739-195r-856e-2e7r5ta2c13w
ResourceGroupName : myResourceGroup
Type : microsoft.storagesync/storageSyncServices/registeredServers
I am completely new to Gatling/Scala.
I have a scenario to execute. Here it goes:
-->Change the shift timings of the employees.
For the above, I am able to script/code the flow. However, I have a challenge:
-> I need to extract the "new" time values from the response and check if that matches with the "new" time values being passed through the parameter (csv) file.
Approach/logic: Extract the date values from the response body and compare that with the date value that has been provided in the csv file.
Sample Response:
{
"employeeId":"xxxxxx",
"schedules":
[
{
"date":"2019-11-25",
: : : "schedules":
: : : [
: : : : {
: : : : : "employeeId":"xxxxxx",
: : : : : "laborWeekStartDate":"2019-11-25", //New edited time
: : : : : "laborWeekEndDate":"2019-12-01", //New edited time
: : : : : "schedules":
: : : : : {
: : : : : : "startTime":"2019-11-25T18:15:00.000Z",
: : : : : : "endTime":"2019-11-25T23:45:00.000Z",
: : : : : : "departmentId":xxxxx,
: : : : : : "departmentName":"abc",
: : : : : : "lastModifiedTimestamp":"2019-12-11T09:22:44.000Z",
: : : : : : "breakDetails":
: : : : : : [
: : : : : : : {
: : : : : : : : "startTime":"2019-11-25T21:00:00.000Z",
: : : : : : : : "endTime":"2019-11-25T21:15:00.000Z",
: : : : : : : : "type":"break"
: : : : : : : }
: : : : : : ]
: : : : : }
: : : : }
: : : ]
: : }
Here, in the below, the right-handside values need to be extracted and compared with the values provided in the csv file.
"startTime":"2019-11-25T18:15:00.000Z",
"endTime":"2019-11-25T23:45:00.000Z",
Please help in performing the above. A step-wise detailed explanation would be much appreciated considering I am totally new to this.
Thanks!
Disclaimer: I will provide some useful links that should help you in achieving the task. If you will encounter any problems doing it, just post a new question
In order to get a value from a JSON response, you could use a jsonPath HTTP response body. There is an example here, how value can be extracted and saved using this method :JSON Path Usage for Gatling Tests
Reading values from CSV file is possible using a built-in feeder functionality: CSV feeders .Once you have the feeder added, you can reference a value using ${columnName} There is an example here: Step 03: Use dynamic data with Feeders and Checks.
After this step you have both values in session. Then using scala language, you should be able to compare those values. Getting a value from session happens using session("variableName").as[String]
For example, you could do a String comparision, if you first substring the value from csv. Scala String comparision Another option is like described here, which is really close to your requirement : How to compare responses from http calls in gatling?
Good luck! :)
When I used slcli(softlayer-python command) to create a dedicated host, the command return the order id. And I check the order's status was 'APPROVED'. But I can not get the host in the result of 'SoftLayer_Account/getDedicatedHosts'.
So I check the billing item and it is 'dedicated_virtual_hosts' rightly. Did SoftLayer API support another approach to inspect the dedicated host provisioned? Or did I do something wrong?
Yes, the dedicated host should be listed when calling to SoftLayer_Account::getDedicatedHosts method, or when using the "slcli dedicatedhost list" command. I suggest to check your permissions and device access, verify that "View Virtual Dedicated Host Details" is checked.
Below are some slcli commands I executed to order and list dedicated hosts.
To order a dedicated host:
slcli dedicatedhost create -H slahostname -D example.com -d mex01 -f 56_CORES_X_242_RAM_X_1_4_TB
To list dedicated hosts:
slcli dedicatedhost list
:.......:...................:..........:..............:................:............:............:
: id : name : cpuCount : diskCapacity : memoryCapacity : datacenter : guestCount :
:.......:...................:..........:..............:................:............:............:
: 11111 : slahostname : 56 : 1200 : 242 : mex01 : - :
:.......:...................:..........:..............:................:............:............:
Below an example about how to see the details:
slcli dedicatedhost detail 11111
:.................:...........................:
: name : value :
:.................:...........................:
: id : 11111 :
: name : slahostname :
: cpu count : 56 :
: memory capacity : 242 :
: disk capacity : 1200 :
: create date : 2018-02-01T09:53:46-04:00 :
: modify date : :
: router id : 333333 :
: router hostname : bcr01a.mex01 :
: owner : owner001 :
: guest count : 0 :
: datacenter : mex01 :
:.................:...........................:
Using RestFul the response when calling to SoftLayer_Account::getDedicatedHosts should be something like below:
GET:
https://[userName]:[apiKey]#api.softlayer.com/rest/v3/SoftLayer_Account/getDedicatedHosts
RESPONSE:
{
"cpuCount": 56,
"createDate": "2018-02-01T09:53:46-04:00",
"diskCapacity": 1200,
"id": 11111,
"memoryCapacity": 242,
"modifyDate": null,
"name": "slahostname"
}
Also you can use SoftLayer_Virtual_DedicatedHost::getObject method:
GET:
https://[userName]:[apiKey]#api.softlayer.com/rest/v3/SoftLayer_Virtual_DedicatedHost/11111/getObject
I have a JSON and I need to write the values into different tables. I could get the data from json, but I need to insert the data accordingly. It's like I have a form, the form has n number of sections, each section have n number of steps and each step can have n number of questions. How I can loop this and write into different tables? Basically I need to know how we can find how many sections, steps and questions we have in the JSON. I tried array_length, but not working.
Here is a small sample of my JSON.
{ "functionId" : "2","subFunctionId" : "6","groupId" : "11","formId" : "","formName":"BladeInseption","submittedBy" : "200021669","createdDate" : "2015-08-06",
"updatedBy" : "","updatedDate" : "","comments" : "","formStatusId" :"11","formStatus" :"Draft","formLanguage" : "English","isFormConfigured" : "N","formChange":"Yes",
"sectionLevelChange":"Yes","isActive" : "Y","formVersionNo" : "1.0","formFooterDetails" : "","formHeaderDetails" : "","images" : [
{"imageId" : "","imageTempId" : "","imageTempUrl" : "","imageName" : "","imageUrl" : "","isDeleted" : "","imagesDesc" : ""} ],
"imagesDescLevel" : "","sectionElements" : [{"sectionElement":[{"sectionId" : "","sectionTempId":"sectionId+DDMMHHSSSS","sectionName":"section1",
"sectionChange":"Yes","stepLevelChange":"Yes","sectionLabel" : "","sectionOrder" : "1","outOfScopeSection" : "false",
"punchListSection" : "false","images" : [{"imageId" : "","imageTempId" : "","imageTempUrl" : "","imageName" : "","imageUrl" : "","isDeleted" : "",
"imagesDesc" : ""}],"imagesDescLevel" : "","isDeleted" : "","stepElements" : [{"stepElement":[{"stepId" : "","stepTempId":"stepId+DDMMHHSSSS",
"stepName":"section1step1","stepLabel" : "","stepOrder" : "1","stepChange":"Yes","questionLevelChange":"Yes","images" : [{"imageId" : "",
"imageTempId" : "","imageTempUrl" : "","imageName" : "","imageUrl" : "","isDeleted" : "","imagesDesc" : ""}],"imagesDescLevel" : "","isDeleted" : "",
"questionAnswerElements" : [{"questionAnswerElement":[{"questionId" : "","questionClientUid" : "","questionDescription" : "step1question1",
"questionAccessibility" : "","isPunchListQuestion" : "","questionChange":"Yes","questionOrder" : "1","isDeleted" : "","images" : [{
"imageId" : "","imageTempId" : "","imageTempUrl" : "","imageName" : "","imageUrl" : "","isDeleted" : "","imagesDesc" : ""}],"imagesDescLevel" : "",
"answerId" : "","answerClientUid" : "","elements" :[{"element" :[{"elementId": "2","elementMapId" : "12","clientUid" : "","clientClass" : "","imageTempId" : "",
"imageTempUrl" : "","elementType":"Question","elementOrder" : "1","elementArributuesProp": [{"attributeId" : "1","attributeName" : "","defaultValue" : ""}],
"elementArributuesVal":[{"value1" : "item1"}],"rule" : [{"ruleId" : "1","ruleName" : "Mandatory","formula" : "i>a","formulaData" : "i>50","isDeleted" : "",
...
}
If you know all paths to JSON arrays in your code, can use some special functions appearing in 9.4 such as
SELECT json_array_length('{"array":[{"a":1},{"b":2},{"c":3}]}'::json->'array')
If you need to iterate through JSON array, there is another useful function:
SELECT json_array_elements('{"array":[{"a":1},{"b":2},{"c":3}]}'::json->'array')
SELECT json_array_elements('[{"a":1},{"b":2},{"c":3}]'::json)
or if json is stored in table, lets call
SELECT json_array_elements(tbl.json_value->'array') FROM jsontable AS tbl
It returns a set of json values unwrapped from array ready to processing.
http://www.postgresql.org/docs/9.4/static/functions-json.html
More information about JSON parsing can be found here
How do I query using fields inside the new PostgreSQL JSON datatype?
I am trying to query the USB Device for the USB Descriptor which will store information regarding the USB Version, Device ID, PID, VID etc. I only need the USB Version.
Here is the PowerShell Code so far:
[System.Reflection.Assembly]::Load("System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$Man = New-Object System.Management.ManagementClass("Win32_USBHub")
[System.Management.ManagementObjectCollection]$Devs = $Man.GetInstances()
echo $Devs
The output I am getting is:
__GENUS : 2
__CLASS : Win32_USBHub
__SUPERCLASS : CIM_USBHub
__DYNASTY : CIM_ManagedSystemElement
__RELPATH : Win32_USBHub.DeviceID="USB\\VID_0781&PID_5567\\4C530000120619102080"
__PROPERTY_COUNT : 28
__DERIVATION : {CIM_USBHub, CIM_USBDevice, CIM_LogicalDevice, CIM_LogicalElement...}
__SERVER : APPS-SD-AUTO-PC
__NAMESPACE : root\cimv2
__PATH : \\APPS-SD-AUTO- PC\root\cimv2:Win32_USBHub.DeviceID="USB\\VID_0781&PID_5567\\4C530000120619102080"
Availability :
Caption : USB Mass Storage Device
ClassCode :
ConfigManagerErrorCode : 0
ConfigManagerUserConfig : False
CreationClassName : Win32_USBHub
CurrentAlternateSettings :
CurrentConfigValue :
Description : USB Mass Storage Device
DeviceID : USB\VID_0781&PID_5567\4C530000120619102080
ErrorCleared :
ErrorDescription :
GangSwitched :
InstallDate :
LastErrorCode :
Name : USB Mass Storage Device
NumberOfConfigs :
NumberOfPorts :
PNPDeviceID : USB\VID_0781&PID_5567\4C530000120619102080
PowerManagementCapabilities :
PowerManagementSupported :
ProtocolCode :
Status : OK
StatusInfo :
SubclassCode :
SystemCreationClassName : Win32_ComputerSystem
SystemName : APPS-SD-AUTO-PC
USBVersion :
Here USBVersion is coming as an empty field. Can anyone suggest a solution?
I have tried with Win32_usbDeviceController but that is also returning an empty field.