Is there a way to retrieve this:
.
.
.
"authType": "sasl",
"autoCompactionSettings": {
"allowedTimePeriod": {
"abortOutside": true,
"fromHour": 1,
"fromMinute": 0,
"toHour": 2,
"toMinute": 0
},
"databaseFragmentationThreshold": {
"percentage": 30,
"size": "undefined"
},
"parallelDBAndViewCompaction": true,
"viewFragmentationThreshold": {
"percentage": 30,
"size": "undefined"
}
},
.
.
.
see: http://docs.couchbase.com/admin/admin/REST/rest-bucket-info.html
using the java api?
Yes, the BucketManager can be used to get information on the bucket's configuration through its info() method.
You can obtain the manager from the Bucket instance by calling bucket.bucketManager().
It also can be used to create views for instance...
Related
I use the GCP metadata API (http://metadata.google.internal/computeMetadata/v1/) to get information about the instance that a process is running on, including machine type (e.g. "projects/818238156224/machineTypes/n1-standard-4" -- presumably the important part is the "n1-standard-4"), region, zone, and whether the instance is preemptible.
I would like to be able to retrieve information programmatically about how much GCP is charging (e.g. per hour) for usage of the instance.
I can query the GCP billing API (https://cloudbilling.googleapis.com/v1/services/6F81-5844-456A/skus), but that returns JSON like
{
"name": "services/6F81-5844-456A/skus/0048-21CE-74C3",
"skuId": "0048-21CE-74C3",
"description": "Preemptible N2 Custom Instance Core running in Sao Paulo",
"category": {
"serviceDisplayName": "Compute Engine",
"resourceFamily": "Compute",
"resourceGroup": "CPU",
"usageType": "Preemptible"
},
"serviceRegions": [
"southamerica-east1"
],
"pricingInfo": [
{
"summary": "",
"pricingExpression": {
"usageUnit": "h",
"usageUnitDescription": "hour",
"baseUnit": "s",
"baseUnitDescription": "second",
"baseUnitConversionFactor": 3600,
"displayQuantity": 1,
"tieredRates": [
{
"startUsageAmount": 0,
"unitPrice": {
"currencyCode": "USD",
"units": "0",
"nanos": 11538000
}
}
]
},
"currencyConversionRate": 1,
"effectiveTime": "2021-05-26T08:47:05.220Z"
}
],
"serviceProviderName": "Google",
"geoTaxonomy": {
"type": "REGIONAL",
"regions": [
"southamerica-east1"
]
}
}
And it's very unclear how to retrieve an objects in one API given an object in the other.
Do I need to parse the description somehow? Does that even work? Is there a better way?
I want to create new alerts(High CPU,RAM) for all AppServicePlans in a given subscription. I could not find Powershell commands to create new alerts. Is there a way we can create these alerts for all appserviceplans with a single script? May be using ARM template?
Sorry for pasting a direct answer, but I cannot yet comment. You get the error because in the documentation for Add-AzMetricAlertruleV2 it states: "$act is the output of New-AzActionGroup cmdlet". Meaning you need to use for example:
$act = New-AzActionGroup -ActionGroupId "testActionGroup"
After that you need to add it in the parameter -ActionGroup $act for it to work.
If you look at Resource Explorer and navigate to a manually created (near-realtime) alert, you should see the "critera" object defined like below. Here is a full example of a resource that seems to be working. Create some variables for each of your values:
{
"type": "Microsoft.Insights/metricAlerts",
"apiVersion": "2018-03-01",
"name": "[variables('alertName')]",
"location": "global",
"dependsOn": [],
"tags": {
"[concat('hidden-link:', variables('applicationInsightsResourceId'))]": "Resource",
"[concat('hidden-link:', variables('webtestResourceId'))]": "Resource"
},
"properties": {
"description": "[concat('Alert for ', parameters('availibilityTestName'))]",
"severity": 4,
"enabled": true,
"scopes": [
"[variables('webtestResourceId')]",
"[variables('applicationInsightsResourceId')]"
],
"evaluationFrequency": "PT5M",
"windowSize": "PT15M",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria",
"webTestId": "[variables('webtestResourceId')]",
"componentId": "[variables('applicationInsightsResourceId')]",
"failedLocationCount": 3
},
"actions": [
{
"actionGroupId": "[resourceId('microsoft.insights/actiongroups', 'webhook')]",
"webHookProperties": {
// Some properties to send to webhook
}
}
]
}
}
currently I am extracting data from the Facebook Marketing API.
I am Using an XPATH query in Talend Studio for the JSON i get via the API.
Since this is my first Job with JSON and XPATH I need some help with the following extraction:
At first a part of my JSON:
{
"data": [
{
.
.
.
"adsets": {
"data": [
{
.
.
.
"targeting": {
"age_max": 60,
"age_min": 18,
"geo_locations": {
"countries": [
"DE"
]
},
"facebook_positions": [
"feed",
"right_hand_column"
],
.
.
.
Now i want to extract from "facebook_positions" with XPATH:
"/data/adsets/data/targeting/facebook_positions"
with that XPATH query I only get "feed" as my result but I need "feed,right_hand_column" since there are no keys to the values like ' "age_max": 60' I am not able to extract the correct path.
Thanks in advance for your help!
Best Regards
CoGe
Have you tried :-
//facebook_positions
OR
//facebook_positions[1] -> feed
//facebook_positions[2] -> right_hand_column
Example :-
Open below URL:
http://www.jsonquerytool.com/
{
"data": [{
"adsets": {
"data": [{
"targeting": {
"age_max": 60,
"age_min": 18,
"geo_locations": {
"countries": [
"DE"
]
},
"facebook_positions": [
"feed",
"right_hand_column"
]
}
}]
}
}]
}
Select Query for JSON as :-
Xpath for JSon
put the query as :-
//facebook_positions
Click on Run
I have a bucket name 0001 when I use the following N1QL statement I get a "5000" syntax error:
cbq> Select * from 0001;
{
"requestID": "f2b70856-f80c-4c89-ab37-740e82d119b5",
"errors": [
{
"code": 5000,
"msg": "syntax error"
}
],
"status": "fatal",
"metrics": {
"elapsedTime": "349.733us",
"executionTime": "204.442us",
"resultCount": 0,
"resultSize": 0,
"errorCount": 1
}
}
I think it takes 0001 as a number and not as a bucket name, is there an easy way to rename it?
In this case you can use back ticks in N1QL to escape the bucket name:
cbq> Select * from `0001`;
{
"requestID": "f48527e6-6035-47e7-a34f-90efe9f90d4f",
"signature": {
"*": "*"
},
"results": [
{
"0001": {
"Hello": "World"
}
}
],
"status": "success",
"metrics": {
"elapsedTime": "2.410929ms",
"executionTime": "2.363788ms",
"resultCount": 1,
"resultSize": 80
}
}
Currently there is noway to rename a bucket instead you could do one of the following:
Backup the bucket using cbbackup. Then recreate it and restore it using cbrestore.
Create a second cluster and use XDCR to transfer the data to the new cluster with the correctly named bucket.
There is no way I am seeing to rename. I checked the CLI as well and nothing. Your best bet, if you can, is to create a new bucket with the settings you want and then use cbtransfer to move the data over from the old to the new bucket. This is an online operation.
Please help me in parsing this Json sample as I'm not able to parse it because of the complexity of it as well as different objects inside it. I'm able to parse Json when a list of same objects & same structure but not like the one below.
[
{
"notificationBrowserHead":
{
"notificationId": 4,
"notificationType": "NEW_PRODUCT",
"creationTime": 1421933381000,
"notificationNormalUserId": 4,
"notificationViewed": false
},
"brandIdAndNameHolder":
{
"brandId": 1,
"name": "B1"
},
"brandLogo": null,
"productIdAndNameHolder":
{
"productId": 1,
"name": "JK product1"
}
},
{
"notificationBrowserHead":
{
"notificationId": 2,
"notificationType": "USER_INT_COMMENT",
"creationTime": 1421924403000,
"notificationNormalUserId": 2,
"notificationViewed": false
},
"uploadId": 22,
"uploadThumbnail": "/mediaUrl/location/thumbNail",
"uploadDescription": "upload 1 location desc",
"notificationCreator":
{
"normalUserId": 90,
"displayName": "amit"
},
"uploadRemoved": false
},
{
"notificationBrowserHead":
{
"notificationId": 1,
"notificationType": "NEW_LOCATION_VOTE",
"creationTime": 1421924403000,
"notificationNormalUserId": 1,
"notificationViewed": false
},
"locationIdAndNameHolder":
{
"locationId": 11,
"name": "Current King JK"
},
"locationLogo": null
}
]
Any help would be truly appreciated.
I presume that you receive different set of json properties when your NotificationType varies.
Solution 1:
Define all your members(the collection of all your properties that you receive for different types of notification) in a Class and use it for DeSerialization, so that the unwanted properties for your particular notification type will be null.
Solution 2:
Parser manually. Newtonsoft json documentation here
Make class "Notifications (or something)" and put inside everything you got back from json2csharp.com site, then use this framework http://www.newtonsoft.com/json to deserialize data as you download it from server and you should be able to get notificationType by Object.Notificationbrowserhead[x].notificationType or similar.