Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel2
outlinefalse
typelist
printablefalse

New domains can be created in a storage cluster in three ways:

  1. Swarm Content UI (preferred); see Configuring Domains.

  2. Programmatically, using Swarm SDK

  3. Manually, using cURL

Infotip

Best

practices

Practice

  • Use the Swarm Content UI to create each new context (domain or bucket), because the UI automatically creates the corresponding domain managers and adds the correct protection settings to a cluster. Contact the cluster administrator to access the Content UI and create a new context if a new domain is needed.

  • Do not attempt to create domains and buckets manually unless the administrator is unavailable, Content UI access is unavailable, and have advanced user with experience in creating domains and buckets.

  • Create Content Configuring Cluster Policies (protection settings) for domains and buckets matching the settings normally created by the Content UI. Contact DataCore Support for help manually enabling the protection settings.

  • Check the Naming Rules before creating any context objects. Unlike cluster names, domain and bucket names cannot include spaces.

SDK for Creating a Domain

The Swarm SDK version 1.4 and later includes classes assisting in creating a domain. The following table lists the classes and corresponding source code location in the SDK distribution.

See the/wiki/spaces/DOCS/pages/2443822872.

Class

Location

C++

sdk-extract-dir/cpp/src/realm

C#

sdk-extract-dir\csharp\ScspCSExamples\ScspRealmExamples.cs

Java

CAStorSDK-src-extract-dir/com/caringo/realm

Python

castorsdk-python-egg-extract-dir/castorsdk/realm

cURL for Creating a Domain or Bucket

The example below shows how to create a domain with no domain protection setting, allowing any user to POST to the domain. For guidance on authentication, see Content Gateway Authentication.

To create the domain manually, use the following syntax. Either the domain query argument or a Host header is required, even if the domain being created is the default cluster domain (see Types of Container Objects) because SCSP methods on a domain are executing.

Create a

...

Domain

Code Block
languagebash
$ curl -i -X POST --location-trusted --post301 --anyauth --user 'admin:password' --data-binary '' \
  -H 'Content-type: application/castorcontext' \
  -H "Policy-*: {if needed}" \
 'http://{host}/?domain=newdomain.example.com'

Create a

...

Bucket

Code Block
languagebash
$ curl -i -X POST --location-trusted --post301 --anyauth --user 'admin:password' --data-binary '' \
  -H 'Content-type: application/castorcontext' \
  -H "Policy-*: {if needed}" \
 'http://{host}/newbucket?domain=mydomain.example.com'

Headers

Swarm returns a 201 Created response with the result on success: New stream created.

Infotip

Best

practice

Practice

Add conditional headers to verify updates are being made to the intended domain or bucket. 

Use if-none-match to prevent creating a domain or bucket that already exists:

Code Block
languagebash
$ curl -X PUT http://{host}/_admin/manage/tenants/_system/domains/mydomain 
    -H "if-none-match: *"

Use if-match on the ETag to prevent updating the wrong domain or bucket:

Code Block
languagebash
$ curl -X PUT http://{host}/_admin/manage/tenants/_system/domains/mydomain 
    -H "if-match: \"ETAG\""

...