how to make vmware API for tags and ip address link? - api

is there any api for the vmware virtual machine tags and ip addresses fetching and joining them... for example vm1 would have an ip of 1.1.1.1 and user defined tags like app=db...
I can query the tags but doesn't map to virtual machine nor iP address...
i used cis tags api but none provide the useful output....
vsession = self.vCenterSession()
#print(vsession)
all_tags =
vsession.get('https://10.156.0.10/rest/com/vmware/cis/tagging/tag')
all_tags_py = json.loads(all_tags.text)['value']

You'll have to combine several calls together to pull all that information.
Retrieve the VM ID with: List VM
Retrieve the VM's IP by referencing the VM ID with: List Guest Network Interfaces
Retrieve the Tag ID with: List Tag
Update the tag with: Update Tag

Related

How do you get all roads (including private and service roads) in osmnx?

I am using the follwing command in osmnx to downlaod roads from the OSM server:
osmnx.graph.graph_from_polygon(polygon, network_type='all_private', simplify=True, retain_all=False, truncate_by_edge=False, clean_periphery=True, custom_filter=None)
I was looking at the documentation for the network_type parameter and you can specify which subset of the road network you want to download using one of the following key terms:
'drive' - get drivable public streets (but not service roads)
'drive_service' - get drivable streets, including service roads
'walk' - get all streets and paths that pedestrians can use (this network type ignores one-way directionality)
'bike' - get all streets and paths that cyclists can use
'all' - download all non-private OSM streets and paths (this is the default network type unless you specify a different one)
'all_private' - download all OSM streets and paths, including private-access ones
I want to get all drivable roads, including both service AND private access roads but there is no option for that. Is there an easy way to do this? Or do I have to use the "all_private" value and then filter out the nodes/edges I don't want to include?

Currency conversion based on location and Paypal payments

In a Prestashop 1.6 based store I want to accept payments via Paypal in only one currency (Euros). However, I want to show prices in other currencies based on the location of the customer (probably using it's IP address?). How can I do that?
In Modules and services > payment you have a tab CURRENCY RESTRICTIONS, you can check in which currency you would like Paypal to be available
For currecy selection by IP:
First, you should get the user IP after, you should set the curency of the Prestashop context
$this->context->currency->id = $id_currency
To get $id_currency, follow this steps
You should get the country of the the user IP with this script
Then get the currency code by country code (you can get if from a csv file or you you should use an API or database)
The free IP Find service provides currency information in the response for any given IP Address.
Eg. http://ipfind.co?ip=8.8.8.8
Will return (among other things)
currency: USD

Woocommerce select email address destination only for new order notification(admin) through form checkout it's possible?

Scenery: 1 store and 2 locations. I already have select field form (checkout) where the customer select which store is closest to your location, eg: city A or city B.
Now I need that the new order notification (admin) sent ONLY to e-mail the city shop chosen in form.
Seems to me that all this operations occurs near: class-wc-order, class-wc-checkout.php
But I belive that exist that do it only using filters
Any ideas?
Thanks advance.
$_SESSION Vars on WooCommerce work's fine.
Well not the fine way, but also not worst too!
Create a jquery ($.ajax) function to call one php script external file and register the session variable ($_SESSION).
In my case this php is in (eg: public_html/loadvar.php), this file receive $_POST variables through ajax (in my case: when the user select your office location prefered, this value eg: emailA or emailB according office selected (onChange event) )
I used this session variable to store the alternative email addresses. (not admin_email default)
In (class-wc-checkout.php) , retrieve these values (session variable) eg: email1 or email2... previously selected on form checkout, and overriding the "get_option( 'admin_email' )" by the $_SESSION value
Now, users can choice the office that prefer, and only the selected office will receive the quote request
Note: I only can use this session vars on woocommerce configuring wp_unregister_GLOBALS() on wp-includes/load.php or disable it commenting this function.
This worked (not is state-of-art code) maybe dirty code but can't need deep coding, obviously not "strict patch" this will not survive an update
Thats all folks

Get Country code from VBA and LDAP

I have email id of the members and I am executing following quesy
The command text is
UserDomain = VBA.Environ("UserDomain")
cmd.CommandText = "SELECT cn, mail, c FROM 'LDAP://" & UserDomain & "' WHERE mail = 'r.khenat#abc.com'"
Above code works well on my machine for me and my teammates, however if I use the same code to get the details of the team mates who are in different domain, I get no information.
Instead of UserDomain, what root value I need to put so that I can get the required information.
Any idea?
I managed to get it done by hard coding the domain names and adding it in an Array. I iterated through array to fetch the required details.
You can only ask a domain for users that belong to that domain, so the current domain you are querying will know nothing about e.g. my email, just as my domain will know nothing about your email.
You can try asking my domain about my email if you want, but you won't have any access to it. In the same way I can try asking your domain about its members but if I have access them your domain has been set up very very badly. Only a properly authorised member of a domain should be able to ask that domain such questions, and them only when logged onto a machine which is also a member of that same domain, and is also connected to it.
So no, the query you want to run will not work, by design.

How to know a domain name server in vb.net?

I want a vb.net function. We give domain name, it gives the name servers and the IP.
What would the code be?
I know I can use webclient to scrap various whois sites. They don't like that and put password. I want the "good" way to do it.
Say google.com's name server is ns1.google.com I want to know what's the name server of google.com.
For example:
If we go to http://who.is/whois/google.com/
We will see that google.com has ns1.google.com ns2.google.com ns3.google.com and ns4.google.com
I want a function say FindNS("Google.com") to yield "ns1.google.com"
System.Net.Dns.GetHostEntry("ns1.google.com").AddressList;
This will return an array of all IPs linked to the hostname you provide.