Manually Creating and Renaming Domains
New domains can be created in a storage cluster in three ways:
Swarm Content UI (preferred); see Configuring Domains.
Programmatically, using Swarm SDK
Manually, using cURL
Best 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 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 https://perifery.atlassian.net/wiki/spaces/DOCS/pages/2443822872.
Class | Location |
---|---|
C++ |
|
C# |
|
Java |
|
Python |
|
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
$ 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 Domain and Bucket Creation). 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 Replication, Erasure Coding EC, and Object Versioning requirements. See Configuring Cluster Policies.
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.