GridGain Web Console user creation automated - ignite

Is there a way to automate user creation on GridGain Web Console's docker container deployment?
Our test stand deployment is fully automated, and we'd like to deploy Web Agent automatically as well, copying token and starting Agent's container manually every time is not very convenient in our case.

There are several options:
Create a Web Console user with HTTP REST API, grab their token and pass it to the Agent.
Generate your own token (a UUID), pass it to Agent, create a Web Console user with API calls and set their token.
Please keep in mind that the Web Console HTTP API is considered private. It has been stable for a while, especially the user-related parts, so I wouldn't expect any changes soon. Use it at your own discretion.
Before sending any requests, make sure you use a cookie jar. Send a "/api/v1/user" GET to initialize a session. The host is the same as WC, but you can also send requests to backend directly. CORS might be an issue.
In general, you can open browser network inspector, perform actions manually, note what requests are made and perform same requests with a tool of your choice, like curl. Some communications are handled by a Web Socket connection, but not for user management.
Endpoints you are interested in:
POST "/api/v1/user". Creates a user. Example payload:
{
"email": "user#example",
"password": "1",
"firstName": "User",
"lastName": "Name",
"phone": "+790000000",
"country": "Russia",
"company": "GridGain",
"industry": "Software"
}
POST "/api/v1/profile/save". Edits user. Example payload:
{
"firstName": "User",
"lastName": "Name",
"email": "test#example",
"phone": null,
"country": "Russia",
"company": "GridGain",
"industry": "Other",
"permitEmailContact": false,
"permitPhoneContact": false,
"token": "fcf99d68-5a4c-4a43-8abc-1f93e19af26a"
}
GET "/api/v1/user". Gets a user. Example payload:
{
"email": "test#example",
"firstName": "User",
"lastName": "name",
"phone": null,
"company": "GridGain",
"country": "Russia",
"admin": false,
"becomeUsed": false,
"industry": "Other",
"permitEmailContact": false,
"permitPhoneContact": false,
"token": "fcf99d68-5a4c-4a43-8abc-1f93e19af26a",
"lastEvent": 0
}

Related

Pact - contract testing - verify consumer and producer against contract

I have made demo application for Pact-Contract testing. Following is the link, I referred. I have change few things out of that like patternmatcher and bodytype.
https://www.javacodegeeks.com/2017/03/consumer-driven-testing-pact-spring-boot.html
I am able to publish pact from consumer and verify it from provider side.
I have been asked to verify pact from consumer end as well.
E.g. consumer posts following json to provider for creating new user.
{
"address": {
"city": "string",
"houseNumber": 0,
"postalCode": "string",
"street": "string"
},
"name": "string",
"registrationId": 0,
"surname": "string"
}
But now consumer changes the model classes. (as it is also provider for some other service. it might be possible to get request to change change contract). Following is the new request json that will be generated.
{
"address": {
"city": "string",
"houseNumber": 0,
"postalCode": "string",
"street": "string"
},
"firstname": "string",
"registrationId": 0,
"surname": "string"
}
As the request object is changed. If I verify consumer against pact. It should fail.
Problem: When I run mvn:verify from consumer, it is always OK. I want it to fail.
P.S. Let me know if it is not correct way of doing it.
The consumer test is analogous to a unit test. It will always pass if your code does what you expect it to in the test. It isn't dependent on prior state (such as a previous generated contract).
The part of the process where you would check for a breaking change is in CI with the can I deploy tool (https://docs.pact.io/pact_broker/can_i_deploy).

Netcore server respond to slack interactive message

I am trying to build Slack application with asp net core server. Currently, I have added Slash command which makes a request to my local server through ngrok. Once my server receives that request, it makes a post request to configured slack webhook to display interactive message which looks like pic from attachment.
I want user to be able to select yes or no and receive the result in my controller, but I can't realize how to tell Slack where should it make a post request. I attach the code of this message which is posted through weebhook into Slack:
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "This is a section block with a button."
}
},
{
"type": "actions",
"block_id": "actionblock789",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Yes"
},
"style": "primary",
"value": "yes"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": "No"
},
"value": "no"
}
]
}
]
}
What I have in netcore is TestController with route /api/test which I suppose should receive from Slack a payload where information about selected button is set, but I couldn't find a way where specify a url in this json code.
You can not configure a URL in the JSON code. That is not how it works with the Slack API.
Slack will send all responses to interactive message - like when someone clicks on a button - to the configured request URL of your Slack app. Check out this link how to find that parameter: documentation

Is there any way to access private datasets through API call

I'm running Mirth 3.6.1 with CKAN 2.8 and being a newbie to this I've run into an issue: Is there a way to access resources in private datasets in CKAN through API requests? I can't seem to do it.
I have an organization with a public dataset and I can can go through Mirth via the API router to the correct Mirth channel and get the data from CKAN, like normal, with an API request. But if I make the dataset private, it all falls apart. Even though I use the correct API-key. Although, that doesn't seem to make a difference. I get success true regardless of whether I use the API-key or not (or if it's even the correct key)
The API-key included in the request is that of the sysadmin.
When I directly access the CKAN resource through a CKAN-endpoint and the dataset is public, I get this response:
{
"help": "https://URL/api/3/action/help_show?name=resource_search", (URL instead of real url)
"success": true,
"result": {
"count": 1,
"results": [
{
"mimetype": null,
"cache_url": null,
"state": "active",
"hash": "REDACTED__", (sensitive data)
"description": "",
"format": "",
"url": "https://URL/datastore/dump/0696c0a1-b249-4fd5-ba80-caf7046a650b", (URL instead of real url)
"datastore_active": true,
"created": "2019-03-19T00:30:04.313593",
"cache_last_updated": null,
"package_id": "11211598-34f8-4d67-ab34-b7fd590ae08d",
"mimetype_inner": null,
"last_modified": null,
"position": 1,
"revision_id": "17b85d36-4ec1-4645-b9b1-dcfe310a54e6",
"size": null,
"url_type": "datastore",
"id": "0696c0a1-b249-4fd5-ba80-caf7046a650b",
"resource_type": null,
"name": "REDACTED" (sensitive data)
}
]
}
}
When the dataset is private, regardless of whether I include the API-key or not (or if it's even the real api-key), I get this response:
{
"help": "https://URL/api/3/action/help_show?name=resource_search",
"success": true,
"result": {
"count": 0,
"results": []
}
}
So, how can I do a resource_search for a resource in a private dataset?
Thanks in advance.
Yes you can do that by using include_private:True in the dataset
Please see the below link
https://docs.ckan.org/en/2.8/api/index.html#ckan.logic.action.get.package_search

How do I automate adding a custom Iot Hub Endpoint (and route to it)?

In order to receive Azure IotHub Device Twin change notifications, it appears that it's necessary to create a custom endpoint and create a route to send notifications to that endpoint. This seems straightforward enough on the Azure Portal, but as one might expect we want to automate it.
I haven't been able to find any documentation for the the az cli or even the REST API, though I might have missed something. I didn't find anything promising looking in the SDKs either.
How do I automate adding a custom endpoint and then setting up the route for device twin notifications?
You can check IotHubs template to see if it helps.
Route:
"routing": {
"endpoints": {
"serviceBusQueues": [
{
"connectionString": "string",
"name": "string",
"subscriptionId": "string",
"resourceGroup": "string"
}
]
},
"routes": [
{
"name": "string",
"source": "string",
"condition": "string",
"endpointNames": [
"string"
],
"isEnabled": boolean
}
],
Consumer group:
{
"apiVersion": "2016-02-03",
"type": "Microsoft.Devices/IotHubs/eventhubEndpoints/ConsumerGroups",
"name": "[concat(parameters('hubName'), '/events/cg1')]",
"dependsOn": [
"[concat('Microsoft.Devices/Iothubs/', parameters('hubName'))]"
]
},
For more detailed information you can reference:
Microsoft.Devices/IotHubs template reference
Create an IoT hub using Azure Resource Manager template (PowerShell)

Xirsys iceConnectionStatus is failed

I am developing one video calling application. Currently using Xirsys's stun and turn server. I am using the result of https://service.xirsys.com/ice as my configurations. Is it the right username and credential to use in the Javascript page or anything else. If it is wrong then please guide me where will I get the correct iceServers values.
iceServers = [
{ "url": "stun:turn01.uswest.xirsys.com" },
{ "username": "0xxxxxx8-fxxc-1xx6-bxxb-bxxxxxxxxxx8", "url": "turn:turn01.uswest.xirsys.com:80?transport=udp", "credential": "0xxxxxxe-fxxc-1xx6-axx0-axxxxxxxxxx9" },
{ "username": "0xxxxxx8-fxxc-1xx6-bxxb-bxxxxxxxxxx8", "url": "turn:turn01.uswest.xirsys.com:3478?transport=udp", "credential": "0xxxxxxe-fxxc-1xx6-axx0-axxxxxxxxxx9" },
{ "username": "0xxxxxx8-fxxc-1xx6-bxxb-bxxxxxxxxxx8", "url": "turn:turn01.uswest.xirsys.com:80?transport=tcp", "credential": "0xxxxxxe-fxxc-1xx6-axx0-axxxxxxxxxx9" },
{ "username": "0xxxxxx8-fxxc-1xx6-bxxb-bxxxxxxxxxx8", "url": "turn:turn01.uswest.xirsys.com:3478?transport=tcp", "credential": "0xxxxxxe-fxxc-1xx6-axx0-axxxxxxxxxx9" },
{ "username": "0xxxxxx8-fxxc-1xx6-bxxb-bxxxxxxxxxx8", "url": "turns:turn01.uswest.xirsys.com:443?transport=tcp", "credential": "0xxxxxxe-fxxc-1xx6-axx0-axxxxxxxxxx9" },
{ "username": "0xxxxxx8-fxxc-1xx6-bxxb-bxxxxxxxxxx8", "url": "turns:turn01.uswest.xirsys.com:5349?transport=tcp", "credential": "0xxxxxxe-fxxc-1xx6-axx0-axxxxxxxxxx9" }
];
Note: Its working in the same network but not in different network. Even in different network I can get the incomming call but after receiving the call iceConnectionState gets failed.
I have also raised similar question here where I was using numb as stun and turn server.
Thanks in advance.
The ICE string should be used 'as-is' in the ice configuration for your WebRTC application. Note, however, that the ICE credentials are only valid for 30 seconds. You need to request a fresh ICE string immediately before each connection.
Local network connections will work WITHOUT a valid ICE string, because your NAT translation will NOT use TURN / STUN. This is because your NAT translates your local IP's itself. Therefore, local network connections will always work (unless you have a non-common NAT situation). If you were using the ICE credentials without refreshing them before each call, that will certainly be why your external connections were failing (or certainly will contribute to the problem).
Lee