Skip to content

Create a new NFS share

client.Nfs.New(ctx, body) (*NfNewResponse, error)
post/v2/nfs

To create a new NFS share, send a POST request to /v2/nfs.

ParametersExpand Collapse
body NfNewParams
Name param.Field[string]

The human-readable name of the share.

Region param.Field[string]

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

SizeGib param.Field[int64]

The desired/provisioned size of the share in GiB (Gibibytes). Must be >= 50.

VpcIDs param.Field[[]string]

List of VPC IDs that should be able to access the share.

PerformanceTier param.Field[string]optional

The performance tier of the share.

ReturnsExpand Collapse
type NfNewResponse struct{…}
Share NfNewResponseShareoptional
ID string

The unique identifier of the NFS share.

CreatedAt Time

Timestamp for when the NFS share was created.

formatdate-time
Name string

The human-readable name of the share.

Region string

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

SizeGib int64

The desired/provisioned size of the share in GiB (Gibibytes). Must be >= 50.

Status NfNewResponseShareStatus

The current status of the share.

Accepts one of the following:
const NfNewResponseShareStatusCreating NfNewResponseShareStatus = "CREATING"
const NfNewResponseShareStatusActive NfNewResponseShareStatus = "ACTIVE"
const NfNewResponseShareStatusFailed NfNewResponseShareStatus = "FAILED"
const NfNewResponseShareStatusDeleted NfNewResponseShareStatus = "DELETED"
Host stringoptional

The host IP of the NFS server that will be accessible from the associated VPC

MountPath stringoptional

Path at which the share will be available, to be mounted at a target of the user's choice within the client

VpcIDs []stringoptional

List of VPC IDs that should be able to access the share.

Create a new NFS share
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"),
  )
  nf, err := client.Nfs.New(context.TODO(), gradient.NfNewParams{
    Name: gradient.F("sammy-share-drive"),
    Region: gradient.F("atl1"),
    SizeGib: gradient.F(int64(1024)),
    VpcIDs: gradient.F([]string{"796c6fe3-2a1d-4da2-9f3e-38239827dc91"}),
    PerformanceTier: gradient.F("standard"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", nf.Share)
}
{
  "share": {
    "id": "0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d",
    "created_at": "2023-01-01T00:00:00Z",
    "name": "sammy-share-drive",
    "region": "atl1",
    "size_gib": 1024,
    "status": "ACTIVE",
    "host": "10.128.32.2",
    "mount_path": "/123456/your-nfs-share-uuid",
    "vpc_ids": [
      "796c6fe3-2a1d-4da2-9f3e-38239827dc91"
    ]
  }
}
Returns Examples
{
  "share": {
    "id": "0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d",
    "created_at": "2023-01-01T00:00:00Z",
    "name": "sammy-share-drive",
    "region": "atl1",
    "size_gib": 1024,
    "status": "ACTIVE",
    "host": "10.128.32.2",
    "mount_path": "/123456/your-nfs-share-uuid",
    "vpc_ids": [
      "796c6fe3-2a1d-4da2-9f3e-38239827dc91"
    ]
  }
}