Skip to content
Start here

Update Workers VPC connectivity service

client.Connectivity.Directory.Services.Update(ctx, serviceID, params) (*DirectoryServiceUpdateResponse, error)
PUT/accounts/{account_id}/connectivity/directory/services/{service_id}

Update Workers VPC connectivity service

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
ParametersExpand Collapse
serviceID string
formatuuid
params DirectoryServiceUpdateParams
AccountID param.Field[string]

Path param

Body param

type DirectoryServiceUpdateParamsHostInfraIPv4Host struct{…}
IPV4 string
Network DirectoryServiceUpdateParamsHostInfraIPv4HostNetwork
TunnelID string
formatuuid
type DirectoryServiceUpdateParamsHostInfraIPv6Host struct{…}
IPV6 string
Network DirectoryServiceUpdateParamsHostInfraIPv6HostNetwork
TunnelID string
formatuuid
type DirectoryServiceUpdateParamsHostInfraDualStackHost struct{…}
IPV4 string
IPV6 string
Network DirectoryServiceUpdateParamsHostInfraDualStackHostNetwork
TunnelID string
formatuuid
type DirectoryServiceUpdateParamsHostInfraHostnameHost struct{…}
Hostname string
ResolverNetwork DirectoryServiceUpdateParamsHostInfraHostnameHostResolverNetwork
TunnelID string
formatuuid
ResolverIPs []stringoptional
Name param.Field[string]

Body param

Body param

const DirectoryServiceUpdateParamsTypeHTTP DirectoryServiceUpdateParamsType = "http"
HTTPPort param.Field[int64]optional

Body param

formatint32
minimum1
HTTPSPort param.Field[int64]optional

Body param

formatint32
minimum1
ReturnsExpand Collapse
type DirectoryServiceUpdateResponse struct{…}
Host DirectoryServiceUpdateResponseHost
One of the following:
type DirectoryServiceUpdateResponseHostInfraIPv4Host struct{…}
IPV4 string
Network DirectoryServiceUpdateResponseHostInfraIPv4HostNetwork
TunnelID string
formatuuid
type DirectoryServiceUpdateResponseHostInfraIPv6Host struct{…}
IPV6 string
Network DirectoryServiceUpdateResponseHostInfraIPv6HostNetwork
TunnelID string
formatuuid
type DirectoryServiceUpdateResponseHostInfraDualStackHost struct{…}
IPV4 string
IPV6 string
Network DirectoryServiceUpdateResponseHostInfraDualStackHostNetwork
TunnelID string
formatuuid
type DirectoryServiceUpdateResponseHostInfraHostnameHost struct{…}
Hostname string
ResolverNetwork DirectoryServiceUpdateResponseHostInfraHostnameHostResolverNetwork
TunnelID string
formatuuid
ResolverIPs []stringoptional
Name string
Type DirectoryServiceUpdateResponseType
CreatedAt Timeoptional
formatdate-time
HTTPPort int64optional
formatint32
minimum1
HTTPSPort int64optional
formatint32
minimum1
ServiceID stringoptional
formatuuid
UpdatedAt Timeoptional
formatdate-time

Update Workers VPC connectivity service

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/connectivity"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  service, err := client.Connectivity.Directory.Services.Update(
    context.TODO(),
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    connectivity.DirectoryServiceUpdateParams{
      AccountID: cloudflare.F("account_id"),
      Host: cloudflare.F[connectivity.DirectoryServiceUpdateParamsHostUnion](connectivity.DirectoryServiceUpdateParamsHostInfraIPv4Host{
        IPV4: cloudflare.F("10.0.0.1"),
        Network: cloudflare.F(connectivity.DirectoryServiceUpdateParamsHostInfraIPv4HostNetwork{
          TunnelID: cloudflare.F("0191dce4-9ab4-7fce-b660-8e5dec5172da"),
        }),
      }),
      Name: cloudflare.F("web-app"),
      Type: cloudflare.F(connectivity.DirectoryServiceUpdateParamsTypeHTTP),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", service.ServiceID)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "host": {
      "ipv4": "10.0.0.1",
      "network": {
        "tunnel_id": "0191dce4-9ab4-7fce-b660-8e5dec5172da"
      }
    },
    "name": "web-app",
    "type": "http",
    "created_at": "2024-01-15T09:30:00Z",
    "http_port": 8080,
    "https_port": 8443,
    "service_id": "550e8400-e29b-41d4-a716-446655440000",
    "updated_at": "2024-01-15T10:45:00Z"
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "host": {
      "ipv4": "10.0.0.1",
      "network": {
        "tunnel_id": "0191dce4-9ab4-7fce-b660-8e5dec5172da"
      }
    },
    "name": "web-app",
    "type": "http",
    "created_at": "2024-01-15T09:30:00Z",
    "http_port": 8080,
    "https_port": 8443,
    "service_id": "550e8400-e29b-41d4-a716-446655440000",
    "updated_at": "2024-01-15T10:45:00Z"
  }
}