"Update a volume. Valid only for Swarm cluster volumes" Run in API Explorer

PUT /volumes/{name}

Path parameters

  • name string Required

    The name or ID of the volume

Query parameters

  • version integer(int64) Required

    The version number of the volume being updated. This is required to avoid conflicting writes. Found in the volume's ClusterVolume field.

application/json

Body

The spec of the volume to update. Currently, only Availability may change. All other fields must remain unchanged.

  • Spec object

    Cluster-specific options used to create the volume.

    Hide Spec attributes Show Spec attributes object
    • Group string

      Group defines the volume group of this volume. Volumes belonging to the same group can be referred to by group name when creating Services. Referring to a volume by group instructs Swarm to treat volumes in that group interchangeably for the purpose of scheduling. Volumes with an empty string for a group technically all belong to the same, emptystring group.

    • AccessMode object

      Defines how the volume is used by tasks.

      Hide AccessMode attributes Show AccessMode attributes object
      • Scope string

        The set of nodes this volume can be used on at one time.

        • single The volume may only be scheduled to one node at a time.
        • multi the volume may be scheduled to any supported number of nodes at a time.

        Values are single or multi. Default value is single.

      • Sharing string

        The number and way that different tasks can use this volume at one time.

        • none The volume may only be used by one task at a time.
        • readonly The volume may be used by any number of tasks, but they all must mount the volume as readonly
        • onewriter The volume may be used by any number of tasks, but only one may mount it as read/write.
        • all The volume may have any number of readers and writers.

        Values are none, readonly, onewriter, or all. Default value is none.

      • MountVolume object

        Options for using this volume as a Mount-type volume.

        Either MountVolume or BlockVolume, but not both, must be present. properties: FsType: type: "string" description: | Specifies the filesystem type for the mount volume. Optional. MountFlags: type: "array" description: | Flags to pass when mounting the volume. Optional. items: type: "string" BlockVolume: type: "object" description: | Options for using this volume as a Block-type volume. Intentionally empty.

      • Secrets array[object]

        Swarm Secrets that are passed to the CSI storage plugin when operating on this volume.

        One cluster volume secret entry. Defines a key-value pair that is passed to the plugin.

        Hide Secrets attributes Show Secrets attributes object
        • Key string

          Key is the name of the key of the key-value pair passed to the plugin.

        • Secret string

          Secret is the swarm Secret object from which to read data. This can be a Secret name or ID. The Secret data is retrieved by swarm and used as the value of the key-value pair passed to the plugin.

      • AccessibilityRequirements object

        Requirements for the accessible topology of the volume. These fields are optional. For an in-depth description of what these fields mean, see the CSI specification.

        Hide AccessibilityRequirements attributes Show AccessibilityRequirements attributes object
        • Requisite array[object]

          A list of required topologies, at least one of which the volume must be accessible from.

          A map of topological domains to topological segments. For in depth details, see documentation for the Topology object in the CSI specification.

          Hide Requisite attribute Show Requisite attribute object
          • * string Additional properties
        • Preferred array[object]

          A list of topologies that the volume should attempt to be provisioned in.

          A map of topological domains to topological segments. For in depth details, see documentation for the Topology object in the CSI specification.

          Hide Preferred attribute Show Preferred attribute object
          • * string Additional properties
      • CapacityRange object

        The desired capacity that the volume should be created with. If empty, the plugin will decide the capacity.

        Hide CapacityRange attributes Show CapacityRange attributes object
        • RequiredBytes integer(int64)

          The volume must be at least this big. The value of 0 indicates an unspecified minimum

        • LimitBytes integer(int64)

          The volume must not be bigger than this. The value of 0 indicates an unspecified maximum.

      • Availability string

        The availability of the volume for use in tasks.

        • active The volume is fully available for scheduling on the cluster
        • pause No new workloads should use the volume, but existing workloads are not stopped.
        • drain All workloads using this volume should be stopped and rescheduled, and no new ones should be started.

        Values are active, pause, or drain. Default value is active.

Responses

  • 200

    no error

  • 400 application/json

    bad parameter

    Hide response attribute Show response attribute object
    • message string Required

      The error message.

  • 404 application/json

    no such volume

    Hide response attribute Show response attribute object
    • message string Required

      The error message.

  • 500 application/json

    server error

    Hide response attribute Show response attribute object
    • message string Required

      The error message.

  • 503 application/json

    node is not part of a swarm

    Hide response attribute Show response attribute object
    • message string Required

      The error message.

PUT /volumes/{name}
curl \
 --request PUT 'http://api.example.com/v1.44/volumes/{name}?version=42' \
 --header "Content-Type: application/json" \
 --data '{"Spec":{"Group":"string","AccessMode":{"Scope":"single","Sharing":"none","MountVolume":{},"Secrets":[{"Key":"string","Secret":"string"}],"AccessibilityRequirements":{"Requisite":[{"additionalProperty1":"string","additionalProperty2":"string"}],"Preferred":[{"additionalProperty1":"string","additionalProperty2":"string"}]},"CapacityRange":{"RequiredBytes":42,"LimitBytes":42},"Availability":"active"}}}'
Request examples
{
  "Spec": {
    "Group": "string",
    "AccessMode": {
      "Scope": "single",
      "Sharing": "none",
      "MountVolume": {},
      "Secrets": [
        {
          "Key": "string",
          "Secret": "string"
        }
      ],
      "AccessibilityRequirements": {
        "Requisite": [
          {
            "additionalProperty1": "string",
            "additionalProperty2": "string"
          }
        ],
        "Preferred": [
          {
            "additionalProperty1": "string",
            "additionalProperty2": "string"
          }
        ]
      },
      "CapacityRange": {
        "RequiredBytes": 42,
        "LimitBytes": 42
      },
      "Availability": "active"
    }
  }
}
Response examples (400)
{
  "message": "Something went wrong."
}
Response examples (400)
{
  "message": "Something went wrong."
}
Response examples (404)
{
  "message": "Something went wrong."
}
Response examples (404)
{
  "message": "Something went wrong."
}
Response examples (500)
{
  "message": "Something went wrong."
}
Response examples (500)
{
  "message": "Something went wrong."
}
Response examples (503)
{
  "message": "Something went wrong."
}
Response examples (503)
{
  "message": "Something went wrong."
}