Skip to content

Initiate an NFS action

client.Nfs.InitiateAction(ctx, nfsID, body) (*NfInitiateActionResponse, error)
post/v2/nfs/{nfs_id}/actions

To execute an action (such as resize) on a specified NFS share, send a POST request to /v2/nfs/{nfs_id}/actions. In the JSON body to the request, set the type attribute to on of the supported action types:

Action Details
resize Resizes an NFS share. Set the size_gib attribute to a desired value in GiB
snapshot Takes a snapshot of an NFS share
attach Attaches an NFS share to a VPC. Set the vpc_id attribute to the desired VPC ID
detach Detaches an NFS share from a VPC. Set the vpc_id attribute to the desired VPC ID
switch_performance_tier Switches the performance tier of an NFS share. Set the performance_tier attribute to the desired tier (e.g., standard, high)
ParametersExpand Collapse
nfsID string
body NfInitiateActionParams

The type of action to initiate for the NFS share (such as resize or snapshot).

const NfInitiateActionParamsNfsActionResizeTypeResize NfInitiateActionParamsNfsActionResizeType = "resize"
const NfInitiateActionParamsNfsActionResizeTypeSnapshot NfInitiateActionParamsNfsActionResizeType = "snapshot"
SizeGib int64

The new size for the NFS share.

Region param.Field[string]optional

The DigitalOcean region slug (e.g. atl1, nyc2) where the NFS snapshot resides.

ReturnsExpand Collapse
type NfInitiateActionResponse struct{…}

Action response of an NFS share.

Action NfInitiateActionResponseAction

The action that was submitted.

RegionSlug string

The DigitalOcean region slug where the resource is located.

ResourceID string

The unique identifier of the resource on which the action is being performed.

formatuuid
ResourceType NfInitiateActionResponseActionResourceType

The type of resource on which the action is being performed.

Accepts one of the following:
const NfInitiateActionResponseActionResourceTypeNetworkFileShare NfInitiateActionResponseActionResourceType = "network_file_share"
const NfInitiateActionResponseActionResourceTypeNetworkFileShareSnapshot NfInitiateActionResponseActionResourceType = "network_file_share_snapshot"
StartedAt Time

The timestamp when the action was started.

formatdate-time
Status NfInitiateActionResponseActionStatus

The current status of the action.

Accepts one of the following:
const NfInitiateActionResponseActionStatusInProgress NfInitiateActionResponseActionStatus = "in-progress"
const NfInitiateActionResponseActionStatusCompleted NfInitiateActionResponseActionStatus = "completed"
const NfInitiateActionResponseActionStatusErrored NfInitiateActionResponseActionStatus = "errored"
Type string

The type of action being performed.

Initiate an NFS action
package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/-go"
  "github.com/stainless-sdks/-go/option"
)

func main() {
  client := gradient.NewClient(
    option.WithAccessToken("My Access Token"),
  )
  response, err := client.Nfs.InitiateAction(
    context.TODO(),
    "0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d",
    gradient.NfInitiateActionParams{
      Body: gradient.NfInitiateActionParamsBodyNfsActionResize{
        Type: gradient.F(gradient.NfInitiateActionParamsBodyNfsActionResizeTypeResize),
      },
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Action)
}
{
  "action": {
    "region_slug": "atl1",
    "resource_id": "b5eb9e60-6750-4f3f-90b6-8296966eaf35",
    "resource_type": "network_file_share",
    "started_at": "2025-10-14T11:55:31.615157397Z",
    "status": "in-progress",
    "type": "resize"
  }
}
Returns Examples
{
  "action": {
    "region_slug": "atl1",
    "resource_id": "b5eb9e60-6750-4f3f-90b6-8296966eaf35",
    "resource_type": "network_file_share",
    "started_at": "2025-10-14T11:55:31.615157397Z",
    "status": "in-progress",
    "type": "resize"
  }
}