Questions re Flowgear Formatter and Variable bar - flowgear

Following the answer from this question, I have my Flowgear Email Alert sending an email on Any Error.
Using this formatter Expression:
Message: {error}
siteId: {siteId}
workflowId: {workflowId}
workflowInstanceId: {workflowInstanceId}
username: {username}
profile: {profile}
and this variable bar mapping:
I get this result in the email body of the email:
Message: [Full email error message here]
siteId: [Site id GUID here]
workflowId: {workflowId}
workflowInstanceId: {workflowInstanceId}
username: cloudmonitoring#flowgear.net
profile: Production
Note that while Message, siteId, username and profile are there, the workflowId and workflowInstanceId are not being populated. What could I have missed?
Also, I see from the documentation that the workflowInstanceId refers to the ID of the task that was executing. How can I get this translated into a meaningful task name for the email recipient?

Related

Vue.js short and clean syntax for data

I started using vue.js and i would like to know if there is any best way (clean) to declare my data variables:
for example i have :
profileInfos: {
name:null,
email: null,
mobile: null
},
when i do :
profileInfos: {name, email, mobile},
i get an error message : email not defined
can i declare profileInfos without the keys name, email, mobile and use v-text in my html tags ?
You can simply do:
declare
profileInfos: {}
then you can straightforwardly set undeclared property up to 1 level of the object like:
this.profileInfos.name = 'my Name'

The provided key element does not match the schema. GraphQL Mutation error

I am trying to test/run a mutation that creates groupChat in my DynamoDB by id,groupChatName, messages, createdTime, createdUser, users. I have 2 seperate tables, UserTable and GroupChatTable.The problem is I keep getting data is null and an error that says "the provided key element does not match the schema. ErrorCode: Validation Exception, request ID." Resolvers are attached to my tables so I am not sure why I am getting this error.
The weird thing is when I check the groupChatTable, my mutation is saved incorrectly as an input.This is what it looks like,
Ex: {"createdTime":{"S":"12:00"},"createdUser":{"S":"Me"},........
Below is the Mutation,Schema type,and Resolver.
createGroupChat(input:{
id: 4
groupChatName: "newgroup"
messages: "we love this group"
createdTime:"12:00"
createdUser: "Me"
users:"we, me"
}) {
id
groupChatName
messages
createdTime
createdUser
users
}
}```
```type GroupChat {
id: ID!
groupChatName: String!
messages: String
createdTime: String!
createdUser: String!
users: String
}```
```{
"version" : "2017-02-28",
"operation" : "PutItem",
"key" : {
"id": $util.dynamodb.toDynamoDBJson($util.autoId()),
},
"attributeValues" : $util.dynamodb.toMapValuesJson($ctx.args)
}```
It looks like the way data is being stored through resolver is incorrect and when it returns it doesn't match the schema
Instead of using $util.dynamodb.toMapValuesJson(($ctx.args))
use: $util.dynamodb.toMapValuesJson($util.parseJson($util.toJson($ctx.args.input)))

Karate contains and all key-values did not match error

I try to learn Karate but have some issue and I can't resolve it by myself.
So my Feature is looking rather simple:
Feature: Alerting get the list of all alerts
Background:
* url 'url'
Scenario: Retrieve all alerts
Given path '5c348c553a892c000bb1f2dd'
When method get
Then status 200
And match response contains {id: 5c348c553a892c000bb1f2dd}
The case here is to fetch a response and make sure that given ID is on the list. As far I understand this documentation keyword contains should lookup only for the given phrase but I get an error: reason: all key-values did not match
This is my console output:
allAlertsGet.feature:10 - path: $, actual: {data={name=Baelish of Harrenhal, user=griffin, id=5c348c553a892c000bb1f2dd, tags=["Gared"], triggers={prometheus=[{"js_id":"Qarth","labels":["Harry Potter and the Sorcerer's Stone"],"operator":"==","query":"up","value":"1"}]}, trigger_interval=398s, receivers={slack=[{"holdoffTime":"0s","id":"Stalls","message":"Dark and difficult times lie ahead. Soon we must all face the choice between what is right and what is easy.","revokeMessage":"Every flight begins with a fall.","token":"Buckbeak"}]}, hold_cap=4, max_cap=16, factor=2, createDate=1546947669, triggered_date=1546948867, mute_until=0, muted=false, status=3}}, expected: {id=5c348c553a892c000bb1f2dd}, reason: all key-values did not match
What I have missed? I use karate 0.9.0.
Pay attention to the nested structure of your JSON. You can paste this snippet into a Scenario and try it, this is a tip - you can experiment quickly without making HTTP requests like this:
* def response = { data: { name: 'Baelish of Harrenhal', user: 'griffin', id: '5c348c553a892c000bb1f2dd' } }
* match response.data contains { id: '5c348c553a892c000bb1f2dd' }
EDIT: just to show off a few other ways to do assertions:
* match response.data.id == '5c348c553a892c000bb1f2dd'
* match response..id contains '5c348c553a892c000bb1f2dd'
* def id = { id: '5c348c553a892c000bb1f2dd' }
* match response == { data: '#(^id)' }
* match response contains { data: '#(^id)' }

API_Defining an array

How can I define array below in Intellij? I am sending this API request and getting error:
sharedAccountDetails [
Account details.
SharedAccountItem{
accountNumber string
Account number of the user.
accountName string
Account name of the user.
accountType string
Account type saving/current etc.
branchCode string
Branch Code.
}]
This is my request below:
And request { 'channel': 'email'}
And request { 'accountNumber': '000000000'}
And request { 'accountName': 'Mr Bytes C'}
And request { 'accountType': 'Current Account'}
And request { 'branchCode': '000'}
It is requesting for the arrays. how do I define them?
Thanks in advance.
Regards,
Tshilidzi
Not sure I understand but can you look at the demo examples of Karate carefully. Looks like you have to understand how to use JSON. See this example below:
And request
"""
{
sharedAccountDetails: [
{ accountNumber: '000000000', 'accountName': 'Mr Bytes C', 'accountType': 'Current Account' }
]
}
"""

Is there a specific scope that I can use WL.Server.SetActiveUser?

I am trying to create an adapter based authentication in Worklight. I have added my Realm, Security test, and Login Module to the authenticationConfig file. I have tried to follow along with the modules provided by IBM. I've copied the exact syntax and even hard coded values for the WL.Server.setActiveUser method. But I continue to get an error. Is there a certain scope I can use this method in? Does anyone see or know where my error is?
I continue to get the follow error:
LOG: Request [login]
LOG: Request [/apps/services/api/GPC2/android/query]
LOG: response [/apps/services/api/GPC2/android/query] success: /*-secure-
{"responseID":"1","isSuccessful":true,"resultSet REMOVED LINE THAT CONTAINED DB RESULTS FOR SECURITY
[/apps/services/api/GPC2/android/query] exception.
SCRIPT5007: Unable to get value of the property 'setActiveUser': object is null or undefined
var lname= responseData.invocationResult.resultSet[0].somelastname;
var gpcid = responseData.invocationResult.resultSet[0].someid;
var fname = responseData.invocationResult.resultSet[0].somefname;
WL.Logger.debug("Login :: SUCCESS" + lname + " " + gpcid + " " + fname); //this line does write the values to the log
//WL.Client.login("NotificationsRealm");
WL.Server.setActiveUser ("NotificationsRealm", {
userId: gpcid,
displayName: fname,
attributes: {
firstName: fname,
lastName : lname,
isUserAuthenticated: 1,
}
});
Looking at the API documentation for WL.Server.setActiveUser, it should be like this:
WL.Server.setActiveUser ("ACMERealm", {
userId: "38017840288",
displayName: "John Doe",
attributes: {
"firstName": "John",
"lastName": "Doe",
"lastLogin": "2010-07-13 19:25:08.0 GMT",
}
})
Looks like you are missing the double quotes for the attributes?