deploy a cloud-init server on SoftLayer through the API - api

I'm trying to create a server on SoftLayer through the API and specify a cloud-init script to run after install. Initially I thought that would be easy, through userData (http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/createObject) but seems that's not the case as to what SoftLayer regards as userData.
I'm also having a hard time to find any examples of this working, so would highly appreciate any working example if anyone has achieved a cloud-init deployment on SoftLayer.
Thanks and regards,
Markos

“postInstallScriptUri” may help you to execute an script after provisioning.
This is a REST example:
https://[username]:[apikey]#api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/createObject
Method: POST
{
"parameters": [
{
"hostname": "myInstanceName",
"domain": "example.com",
"maxMemory": 4096,
"startCpus": 1,
"hourlyBillingFlag": true,
"localDiskFlag": false,
"operatingSystemReferenceCode": "UBUNTU_LATEST",
"datacenter": {
"name": "dal05"
},
"postInstallScriptUri": "https://www.softlayer.com"
}
]
}
References:
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/createObject section: postInstallScriptUri
https://sldn.softlayer.com/blog/jarteche/Getting-Started-User-Data-and-Post-Provisioning-Scripts
I hope it help you.

See documentation all the anwers are there https://sldn.softlayer.com/blog/jarteche/Getting-Started-User-Data-and-Post-Provisioning-Scripts
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/createObject
"postInstallScriptUri
Specifies the uri location of the script to be downloaded and run after installation is complete.
Optional
Type - string"
http://bodenr.blogspot.com/2014/04/giving-your-softlayer-servers.html

Related

Invalid variant ID while creating checkout for Shopify

I am trying to create checkout url using Admin API with following params.
URL: https://shopy-test11.myshopify.com/admin/api/2020-10/checkouts.json
{
"checkout": {
"line_items": [
{
"variant_id": 37033347711169,"quantity": 2
}
]
}
}
Unfortunately its returning below error which is not properly documented anywhere that I could find.
{
"errors": {
"line_items": {
"0": {
"variant_id": [
{
"code": "invalid",
"message": "is invalid",
"options": {}
}
]
}
}
}
}
I also tried Shopify-api ruby gem and got same error. There are some similar issue online, but none answers why that issue is occurring and how to fix it. This is new app under development which will create custom checkout. There's only one sales channel which is "Online Store" and is enabled for all products. Any ideas how to fix this issue? Any help is appreciated.
You seem to be mixing up concepts here. The checkout API is only associated with the Storefront API, and has nothing to do with the Admin API.
So this URL: /admin/api/2020-10/checkouts.json seems to be impossible. There is no endpoint in the admin API for checkouts, whereas, Storefront API which does have checkouts, might be your proper URL. So try that:
/api/2020-10/checkouts.json
And if you have the correct token in your header, it will likely work.

MessageBird SDK: Template Messages/HSMs

I am trying to build a custom connector for the Rasa chatbot framework and MessageBird messaging service, specifically for Whatsapp Business channel. I have taken a look into Python SDK for MessageBird, and I don't see WhatsApp template messages (or Highly Structured Messages in MessageBird's definition) supported anywhere in it.
Am I mistaken? Or the current version of the MessageBird's SDK really supports only non-structured messages, regular SMS-es?
Thanks in advance for your help.
There is a MESSAGE_TYPE_HSM = "hsm" as a selectable type for a conversation message (defined here) and you will have to adapt the content to refer the appropriate HSM template id (see documentation):
"content":{
"hsm": {
"namespace": "5ba2d0b7_f2c6_433b_a66e_57b009ceb6ff",
"templateName": "order_update",
"language": {
"policy": "deterministic",
"code": "en"
},
"params": [
{"default": "Bob"},
{"default": "tomorrow!"}
]
}
Putting it all together, based on the example, it should look something like this:
msg = client.conversation_create_message(args['conversationId'],
{'channelId': args['channelId'], 'type': MESSAGE_TYPE_HSM,
"content":{"hsm": { "namespace": "5ba2d0b7_f2c6_433b_a66e_57b009ceb6ff","templateName": "order_update","language": {"policy": "deterministic","code": "en"},"params": [{"default": "Bob"},{"default": "tomorrow!"}]}}})
Where of course you will have to customize the content to your exact setup.

How to tune flasgger in order to use basic authentication in sending requests

I try to use flasgger for my simple RESTful API. The API requireds the authentication/authorization and uses the basic authentication to perform any query.
There is really good documentation about Basic Authentication in swagger.io
But how can those settings be implemented in flassger? I've tried to used template to set securityDefinitions into swaggler, but the attempt hasn't been successful yet.
UPD. Probably the issue hasn't been resolved yet. Flasgger doesnt support basic auth #103
I've resolved the issue of authentication adding the next code:
swagger_template = {
# Other settings
'securityDefinitions': {
'basicAuth': {
'type': 'basic'
}
},
# Other settings
}
app = Flask(__name__)
Swagger(app, swagger_config, template=swagger_template)
Thanks for Dimaf's answer, helped me a lot. Just want to update the new version, in case someone else run into the same problem.
For Swagger 3.0, the config has been updated to the following (this example is for bearer authorization):
swagger_template = {
"components": {
"securitySchemes": {
"BearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT",
"in": "header",
}
}
}
}

WSO2 EMM 2.1.1 : Device not present in the dashboard analytics

I am currently installing with WSO2 EMM
I managed to set it correctly for my domain name.
I managed to put several tablets and smartphones under Android in the management console EMM.
https://i.stack.imgur.com/0Wlq0.png
In the emm-analytics-dashboard console, I do not see any devices
https://i.stack.imgur.com/MZiU4.png
I'm use the WSO2 2.1.1 version
Can you help me please.
Sorry for my english because i'm french... I use Google Translator
Thank for your reply.
You need to setup authorization configuration in portal/configs/designer.json
"authorization": {
"activeMethod": "oauth",
"methods": {
"oauth": {
"attributes": {
"idPServer": "https://localhost:9443/oauth2/token", (or https://<your_ip>:9443/oauth2/token)
"dynamicClientProperties": {
"callbackUrl": "https://localhost:9443/portal", (or https://<your_ip>:9443/portal)
"clientName": "portal",
"owner": "admin",
"applicationType": "JaggeryApp",
"grantType": "password refresh_token urn:ietf:params:oauth:grant-type:saml2-bearer",
"saasApp": false,
"dynamicClientRegistrationEndPoint": "https://localhost:9443/dynamic-client-web/register/", (or https://<your_ip>:9443/dynamic-client-web/register/)
"tokenScope": "Production"
}
}
}
}
}
Surely, This will help you.

Worklight Adapter to connect to Advantage Database

I need to connect to the Advantage Database through worklight Adapter.
I added the adsjdbc.jar(8.1), and added the datasource definition in *SQLadapter.xml file
<dataSourceDefinition>
<driverClass>com.extendedsystems.jdbc.advantage.ADSDriver</driverClass>
<url>jdbc:extendedsystems:advantage://ipaddress:port/wxzy$/TP8/COMPANY/ABCDMAIN/ABCDMAIN.add;</url>
<user>xyz</user>
<password>12345</password>
</dataSourceDefinition>
When I try to Invoke the procedure, It throws
{
"errors": [
"Runtime: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory ([Extended Systems][Advantage JDBC]Connection reset)"
],
"info": [
],
"isSuccessful": false,
"warnings": [
]
}
Kindly advice.
Thanks
Thanks #Idan,
I tried with a Java Program to connect, before trying with the adapter as below,
Class.forName("com.extendedsystems.jdbc.advantage.ADSDriver");
connection = DriverManager.getConnection("jdbc:extendedsystems:" +
"advantage://port:host//abcd$//TP8//COMPANY//XYZMAIN//XYZMAIN.add;user=xxxx;password=123456");
statement = connection.createStatement();
resultSet = statement.executeQuery("select * from USERS");
while (resultSet.next()) {
System.out.println("PS USER NAME :"+ resultSet.getInt("PS_USERNAME"));
}
But I get a com.extendedsystems.jdbc.advantage.ADSException: [Extended Systems][Advantage JDBC]Connection reset
Please Advice.
Thanks
I suspect that problem is in the JDBC URL value.
You have set the following:
<url>jdbc:extendedsystems:advantage://ipaddress:port/wxzy$/TP8/COMPANY/ABCDMAIN/ABCDMAIN.add;</url>
But in the documentation it gives this example:
("jdbc:extendedsystems:advantage://server1:6262/test/data;user=user1;password=up1");
So if I were you I'd check why you used the JBDC URL that you've used there, which does not seem to be inline with the product doucmentation of Advantage Database.