Esri / hub-py

Python interface to ArcGIS Hub
https://github.com/esri/hub-py/wiki
Apache License 2.0
41 stars 13 forks source link

v1 functionality for Site class #51

Closed ManushiM closed 5 years ago

ManushiM commented 5 years ago

Functionality supported:


>>> hub.sites.add(title=title, group_id, domain=None, initiative=None)
>>> site.update()
>>> site.delete()
>>> hub.sites.get(siteId)
>>> hub.sites.search(initiative=None, creator/owner=None)
ManushiM commented 5 years ago

Refer - https://github.com/ArcGIS/Hub/blob/master/site.md

ManushiM commented 5 years ago

Checkpoints for site creation (not necessarily in this order)

ManushiM commented 5 years ago

@dbouwman am I missing anything in these ^ checkpoints?

dbouwman commented 5 years ago

Ok... so - what you are trying to replicate is the "core" of the site-service

Specifically the create(...) fn, and parts of fromTemplate(...) and ensureUniqueDomainName(...)

https://github.com/ArcGIS/opendata-ui/blob/master/packages/ember-arcgis-layout-services/addon/services/site-service.js#L636

https://github.com/ArcGIS/opendata-ui/blob/master/packages/ember-arcgis-layout-services/addon/services/site-service.js#L878

Along with the registerSiteAsApplication(...) function in the domain-service

https://github.com/ArcGIS/opendata-ui/blob/master/packages/ember-arcgis-layout-services/addon/services/domain-service.js#L309


You need to verify that the domain is not currently used... we do that by issuing a GET to the domain service like https://opendataqa.arcgis.com/utilities/domains/dave-private-1-dc.hubqa.arcgis.com - if we get a 404 in response, we know the domain is available. There is different portal logic.

For automated site creation, we have logic that increments the requested subdomain... so if myfancysite is the requested subdomain, that becomes myfancysite-{{orgUrlKey}}.hub{{ENV}}.arcgis.com. If that is in use, we then check myfancysite-1-{{orgUrlKey}}.hub{{ENV}}.arcgis.com etc

For the javascript API's we use, the item.data is set when we create the item... not sure if that's an option w/ the python api.

Looking at the code, the process is more like this:

At this point we'd have the json structure of the item... the hash is structured like {item:{...}, data: {...}} and we have helpers that know how to serialize that into the mess that the AGO API wants anyhow... steps are...