Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
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
Infotip |
---|
BestpracticesPractice
|
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++ |
|
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
Code Block | ||
---|---|---|
| ||
$ 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 | ||
---|---|---|
| ||
$ 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 - 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, ec-encoding Replication, Erasure Coding EC, and versioning Object Versioning requirements. See See Configuring Cluster Policies.
Swarm returns a 201 Created response with the result on success: New stream created.
Infotip | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
BestpracticePracticeAdd conditional headers to verify updates are being made to the intended domain or bucket. Use
Use
|
...