Function Repository Resource:

CloudObjectBase

Source Notebook

Get the cloud base for a cloud object

Contributed by: Bob Sandheinrich

ResourceFunction["CloudObjectBase"][CloudObject[]]

gives the CloudBase associated with a CloudObject.

Details and Options

ResourceFunction["CloudObjectBase"] simply extracts the protocol and domain from the object's URL.

Examples

Basic Examples (1) 

Get the cloud base of a new CloudObject:

In[1]:=
ResourceFunction["CloudObjectBase"][CloudPut[1]]
Out[1]=

Scope (1) 

Use a cloud object from a private cloud:

In[2]:=
ResourceFunction["CloudObjectBase"][
 CloudObject["https://www.bobscloud.com/obj/superuser/superapi"]]
Out[2]=

Applications (2) 

Create a function that authenticates with a cloud object's base before importing it:

In[3]:=
AnyCloudBaseImport[co_] := If[ResourceFunction["CloudObjectBase"][co] === $CloudBase,
  Import[co],
  If[MatchQ[
    CloudConnect[
     CloudBase -> ResourceFunction["CloudObjectBase"][co]], _String | _List],
   Import[co],
   $Failed]
  ]

Connect to the appropriate base and import the object:

In[4]:=
AnyCloudBaseImport[
 CloudObject["https://www.bobscloud.com/obj/superuser/superdata"]]
Out[4]=

Properties and Relations (1) 

New cloud objects have $CloudBase as their base:

In[5]:=
ResourceFunction["CloudObjectBase"][CloudPut[1]] === $CloudBase
Out[5]=

Version History

  • 1.0.0 – 19 December 2019

License Information