I am using this request to get the credentials to the iSCSI disk 000001 for the virtual guest 000002:
GET /rest/v3.1/SoftLayer_Network_Storage_Iscsi/000001/getObject.json?objectMask=filteredMask[allowedVirtualGuests[allowedHost[credential]]]&objectFilter={"allowedVirtualGuests":{"id":000002}}
However, the result is the same as if I wouldn't apply the objectFilter part at all, resulting in the credentials for all virtual guests being returned, instead of the single one that I need.
What am I missing?
Try the following REST call:
GET /rest/v3.1/SoftLayer_Network_Storage_Iscsi/000001/getAllowedVirtualGuests?objectMask=mask[allowedHost[credential]]&objectFilter={"allowedVirtualGuests":{"id":{"operation":000002}}}
You can use object-filters when the method returns a list of objects, getObject returns only one which is the SoftLayer_Network_Storage_Iscsi itself, on the other hand the method getAllowedVirtualGuests returns a list of virtual guests.
I recommend to review the following links to know more about this:
http://sldn.softlayer.com/reference/services/softlayer_network_storage_iscsi/getallowedvirtualguests
https://sldn.softlayer.com/article/object-filters
How to use object filter with softlayer rest api?
Related
A customer has implemented an OPC-UA server and has provided some documentation for us to access it. The only information we have is the endpoint to contact the server at and the tags that the data points are linked to.
I have to implement a client without having access to the server to test it with. Is this enough information to go by? I imagine we would at least need some namespace uri. From what I understand, in order to use a function such as translateBrowsePathsToNodeIds I would also need to know some namespace ID's.
For instance, in python-opcua it would be something like:
mynode = client.uaclient.translate_browsepaths_to_nodeids(ua.QualifiedName("StaticData", 3)) (which somehow is not working but that's another question)
It doesn't help that the client examples I find somehow all use hardcoded namespace ID's.
TranslateBrowsePathToNodeIds is generally used when programming against type definitions where you know what the path of BrowseNames will be because they are defined by the type definition of each node in the path.
If this doesn't sound like your situation then you should push back for the documentation to include the NodeIds of all the Nodes you need to access.
I am using this call https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments?api-version=2015-07-01 to get role assignment of subscription. The output is of this gives principalId and other values
Question is How can I differentiate the principalId is user principal or serviceprincipal?
This is needed to for me to query graph api to get appid (if service principle) or display name , upn ( if user principle).
Graph APi has 2 different call for this hence while automating I need to know which one to be called based on object type.
User: https://graph.windows.net/microsoft.com/users/principalid?api-version=1.6
Service Pricipal: https://graph.windows.net/microsoft.com/servicePrincipals/principalid?api-version=1.6
Graph APi has 2 different call for this hence while automating I need to know which one to be called based on object type.
Based on my understanding, you could use the Objects - Get Objects By Object Ids Rest API to get the objects by principleid, no need to call 2 different calls. You also could get the object type from the response.
POST https://graph.windows.net/{tenantID}/getObjectsByObjectIds?api-version=1.6
I test with 2 principalids, one is the service principal and another is user.
Test Result:
Where do I retrieve the NextToken from when using the AWS Powershell CmdLets?
For example when I call Get-CDDeploymentList I need to supply the NextToken to retrieve the next set of deployment IDs. However the Get-CDDeploymentList command only returns an array of deployment IDs and not a NextToken.
The NextToken is contained in the $AWSHistory.LastServiceResponse variable.
In the case of the Get-CDDeploymentList command the LastServiceResponse will contain the properties Deployments and the NextToken, so the NextToken can be retrieved using:
$AWSHistory.LastServiceResponse.NextToken
For more information on the $AWSHistory object see http://docs.aws.amazon.com/powershell/latest/userguide/pstools-pipelines.html.
Actually you don't need to use NextToken unless you want or need to take manual control of pagination. By default, if NextToken isn't supplied to the vast majority of the cmdlets, they will automatically handle pagination for you internally and make multiple calls to the underlying service api to emit the full data set to the pipeline.
There are a couple of service apis where the response data from the api call contains more than one field that we would emit to the pipeline (imagine a call that returned a list of 'success' elements as well as a list of 'failed' elements). In these scenarios the cmdlets will emit the entire response object to the pipeline and it will contain the next token element -- for these you (the user) have to manually paginate.
I'm sure we used to note when cmdlets auto-paginate (and when they don't) in the cmdlet documentation but in looking at the linked cmdlet documentation it seems we've dropped this somewhere along the way - I'll investigate and get this fixed.
I am a beginner in Softlayer and we need to implement block storage functionality provided by softlayer in an Application. We just need to make REST call to fetch the locations on the basis of storage type selected. I need to know relationship between Storage Type and locations. What method I need to call in REST API and object mask required for same.. Thanks in Advance.
If you want to order a new “Network storage” and know what “locations” are available for this item, see these steps:
1. The first that we need to know is the “package id” to use for this order.
The “package id” is very important to valid and verifies what kind of items, what locations are available at the moment to order network storage.
For example:
Storage Type: Endurance, the package to use is “240”
Storage Type: Performance, the package to use is “222”
To get all active packages, please review:
http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getAllObjects
2. Once we know what package to use, we need to get the valid “item price ids” according to LOCATION. The following request can help us:
https://[username]:[apikey]#api.softlayer.com/rest/v3/SoftLayer_Product_Package/[package_id]/getItemPrices?objectMask=mask[id,item[keyName,description],pricingLocationGroup[locations[id, name, longName]]]
Method: GET
Where:
A price id with a locationGroupId = null is considered "A standard price" and the API will internally switch the prices for the customer. But we recommend to execute first the verifyOrder in order to see if the wanted order is ok (the fee can vary).
Reference: http://sldn.softlayer.com/blog/cmporter/Location-based-Pricing-and-You
Also, this method can help you to get available locations for a specific package:
http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getRegions
3. Then you will able to order a new Network storage, please see:
API for Performance and Endurance storage(Block storage)
Now, if you want to list the network storage of your account, please see:
http://sldn.softlayer.com/reference/services/SoftLayer_Account/getNetworkStorage
This is an example, where the result displays properties like: “location” and “network storage type”.
https://[username]:[apikey]#api.softlayer.com/rest/v3/SoftLayer_Account/getNetworkStorage?objectMask=mask[storageType, billingItem[description,location[id,longName]]]
Using filters:
Filtering by network Storage Type: “Endurance Storage” or “Block Storage (Performance)”
https://[username]:[apikey]#api.softlayer.com/rest/v3/SoftLayer_Account/getNetworkStorage?objectMask=mask[id,username,nasType,storageType, billingItem[description,location[id,longName]]]&objectFilter={"networkStorage":{"nasType":{"operation":"ISCSI"},"billingItem":{"description":{"operation":"Endurance Storage"}}}}
Regards.
You need to use the http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getRegions method
It returns the valid locations for a package, each storage type belongs to an specific package (that is the relation you are looking for) to get the packages use http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getAllObjects method
see this post for more information
Filter parameters to POST verify and place order request for Performance storage
I am following this tutorial:
http://msdn.microsoft.com/en-us/library/windowsazure/dn376546.aspx
At this point:
Step 4: Create the availability group listener
We are told to enter the public VIP of the cloud service.
I want to get this programatically using Powershell.
I've seen this answer:
azure-powershell-get-public-virtual-ip-of-service
However, my service has multiple IPs and so a list is returned.
Is it possible to use Get-AzureService to get the IP address rather than the workaround of asking a VM for the EndPoint?
Alternatively, is it possible to get the first IP address in the list returned by the answer to the above StackOverflow answer?
This is exactly what I wanted. It's just the answer did not come up in my endless searching:
Powershell select a specific value