How to Get Session Object in Loopback 3 Route using Express-Session - loopback

I found this link that shows how to add express-session as middleware however I don't know how to access the session based on the loopback model.
https://strongloop.com/strongblog/part-1-ionic-loopback-node-js-mobile/
Sorry, don't have copy/paste access to the code currently.
Example model.json file:
model.json
Example model.js file:
model.js

Was able to add it as an arg {arg: 'req', type: 'object', 'http': {source: 'req'}} and then use the normal req.session to get the session.
Documentation:
https://loopback.io/doc/en/lb3/Remote-methods.html

Related

how to create object of minioAdmin using minio-py, I want to call admin functionality

I am using minio and want to call admin functions from my client.
we can mc admin CLI for doing admin operation but I want to do the same from my python client.
I have installed minio-py and I found there is minioAdmin class for the same.
Ref: https://github.com/minio/minio-py/blob/master/minio/minioadmin.py
But don't find any example of How one can create an object of minioAdmin class and call its functionality.
please help.

vSphere Build Version via API

Is there a way do get the vsphere build versing using any API/SDK/REST?
I know it's possible using powershell on vcenter for that, but it'd be great if there was another option.
Like described here: https://www.virtuallyghetto.com/2017/08/powercli-script-to-help-correlate-vcenter-esxi-vsan-buildversions-wo-manual-vmware-kb-lookup.html
It looks like you should be able to using the VMware vSphere API Python Bindings, as you can just simulate going through the Managed Object Browser.
Parent Managed Object ID: ServiceInstance
Property Path: content.about
And then there is a build string which is what you are looking for.
I figure out how to do this, my need is having as much information about vsphere as possible, so get datacenter, cluster and host details is mantaroy.
For that I used the official ruby api, rbvmomi, but I believe it's exactly the same thing for python one and golang.
It's needed to interact through host folder under root/children object, which is not that clear on wmware api docs, to get it easier follow a piece of code:
vim = RbVmomi::VIM.connect host: host, user: 'user', password: 'pass', insecure: true, debug: false
vim.root.children.each do |root_child|
root_child.hostFolder.children.each do |child|
child.host.each do |host|
prod = host.config.product
puts host.name,
prod.apiType,
prod.apiVersion,
prod.build,
prod.fullName,
prod.instanceUuid,
prod.licenseProductName,
prod.localeBuild,
prod.localeVersion,
prod.name,
prod.osType,
prod.productLineId,
prod.vendor,
prod.version
end
end
end

i cannot create a domain in openstack

i am trying to create a domain in openstack
i tried this code
export OS_TOKEN=admintoken
export OS_URL=http://20.20.20.119:35357/v3
export OS_IDENTITY_API_VERSION=3
openstack domain create --description "Default Domain" default
the result should be like this
please see the first table on this link
https://www.server-world.info/en/note?os=CentOS_7&p=openstack_mitaka&f=4
but i am facing an error
the error is
"the request you have made requires authentication. (HTTP 401) (Request-ID: req-af227c0b-5db2-8e32-a391b133b466)"
kindly help so that i can create a domain
thank you very much
The OS_TOKEN value should be same as in your environment keystone.conf (/etc/keystone/keystone.conf) admin_token label.

RAML API baseUriParameters unused template parameter error

I want to create a different base URI for each of the dozen customers of my API so the endpoints are the same but I can filter on customer. I think adding a template parameter to the base URI is the solution but how do I use the baseUriParameter?
I've imported a RAML spec into APIMATIC that has a baseUriParameter.
baseUri: http://{fi}.api.mycompany.com
baseUriParameters:
fi:
type: string
This template parameter gets added to each endpoint as a parameter. Here's an example endpoint.
/users:
get:
This gives an error message.
"Endpoint Users has an unused template parameter named fi."
APIMATIC has a parameter added to the endpoint.
It also means no test cases have been auto-generated.
How do I use the baseUriParameter?
Try importing your RAML API description file again. APIMATIC will use your baseUri and create template parameters now. You can checkout the Server Configuration page to see what parameters in the baseUri were recognized and set the default values for them as well.
Reference documentation for Server Configuration and template parameters in baseUri: https://docs.apimatic.io/api-editor/server-configuration/
Hope this helps!

Function app binding issue - Value cannot be null. Parameter name: hostAccount

When I try to upload the zip file to an azure function app using kudu REST API, it throws an error while I try to view the c# code in Function App editor in the browser. The error is:
"Error:
Function ($Source) Error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.Source'. Microsoft.Azure.WebJobs.Host: Value cannot be null.
Parameter name: hostAccount.
Session Id: xxxxxxxxxxx
Timestamp: 2016-12-02T18:35:00.083Z"
Please note that I have automated end to end of Application Insights starting from creation of a resource group till exporting the multi-setep web test results to our Splunk - All using Powershell.
In this process of automation, I am forming a storage connection string and setting it to the app settings of the function app and then providing that key in my function.json binding.
But still I get this error.
Here is the issue I created in the Azure Function App - Git: https://github.com/Azure/azure-webjobs-sdk-script/issues/1020
The error points to missing host configuration (e.g. the host storage account).
If you're automating the creation process, you need to make sure the required environment variables are properly set. The recommended way would be to use an ARM template manage that for you.
I have some details on how you can get the ARM template for a resource (which you could use to look at the required settings for your Function App) here.
We also have some sample templates you can use linked here
I hope this helps!