Manually Creating and Renaming Domains

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

  1. https://perifery.atlassian.net/wiki/spaces/public/pages/2443817402 (preferred); see https://perifery.atlassian.net/wiki/spaces/public/pages/2443818040.

  2. Programmatically, using Swarm SDK

  3. Manually, using cURL

Best Practice

  • Use the https://perifery.atlassian.net/wiki/spaces/public/pages/2443817402 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  (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 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 .

Class

Location

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 .

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 ) because SCSP methods on a domain are executing.

Create a Domain

$ 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

$ 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

  • Content-type: application/castorcontext - specifies creating a domain or bucket, and is required when sending requests to the Gateway (see ). It replaces the createdomain query argument, which is deprecated. The Swarm setting scsp.requireExplicitContextCreate protects objects from being created erroneously as contexts (buckets or domains); with this setting enabled, Swarm does not create a context object unless it includes this header. (v9.1)

  • Policy-* headers - add for any domain-specific , , and requirements. See .

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

Best 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:

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





© DataCore Software Corporation. · https://www.datacore.com · All rights reserved.