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}

Updates an existing Workers VPC connectivity service by its ID.

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

DirectoryServiceUpdateParamsInfraHTTPServiceConfigHostInfraIPv4Host
IPV4 string
Network DirectoryServiceUpdateParamsInfraHTTPServiceConfigHostInfraIPv4HostNetwork
TunnelID string
formatuuid
DirectoryServiceUpdateParamsInfraHTTPServiceConfigHostInfraIPv6Host
IPV6 string
Network DirectoryServiceUpdateParamsInfraHTTPServiceConfigHostInfraIPv6HostNetwork
TunnelID string
formatuuid
DirectoryServiceUpdateParamsInfraHTTPServiceConfigHostInfraDualStackHost
IPV4 string
IPV6 string
Network DirectoryServiceUpdateParamsInfraHTTPServiceConfigHostInfraDualStackHostNetwork
TunnelID string
formatuuid
DirectoryServiceUpdateParamsInfraHTTPServiceConfigHostInfraHostnameHost
Hostname string
ResolverNetwork DirectoryServiceUpdateParamsInfraHTTPServiceConfigHostInfraHostnameHostResolverNetwork
TunnelID string
formatuuid
ResolverIPs []stringOptional
Name param.Field[string]

Body param

const DirectoryServiceUpdateParamsInfraHTTPServiceConfigTypeTCP DirectoryServiceUpdateParamsInfraHTTPServiceConfigType = "tcp"
const DirectoryServiceUpdateParamsInfraHTTPServiceConfigTypeHTTP DirectoryServiceUpdateParamsInfraHTTPServiceConfigType = "http"
HTTPPort param.Field[int64]Optional

Body param

formatint32
minimum1
HTTPSPort param.Field[int64]Optional

Body param

formatint32
minimum1

Body param: TLS settings for a connectivity service.

CERTVerificationMode string

TLS certificate verification mode for the connection to the origin.

  • "verify_full" — verify certificate chain and hostname (default)
  • "verify_ca" — verify certificate chain only, skip hostname check
  • "disabled" — do not verify the server certificate at all

disabled cannot be combined with certificate_authority: a custom CA is only used to verify the server certificate.

CertificateAuthority stringOptional

UUID of the custom CA certificate or chain.

ClientCertificate stringOptional

UUID of the mTLS client certificate and private key.

ReturnsExpand Collapse
type DirectoryServiceUpdateResponse interface{…}
One of the following:
type DirectoryServiceUpdateResponseInfraHTTPServiceConfig struct{…}
Host DirectoryServiceUpdateResponseInfraHTTPServiceConfigHost
One of the following:
type DirectoryServiceUpdateResponseInfraHTTPServiceConfigHostInfraIPv4Host struct{…}
IPV4 string
Network DirectoryServiceUpdateResponseInfraHTTPServiceConfigHostInfraIPv4HostNetwork
TunnelID string
formatuuid
type DirectoryServiceUpdateResponseInfraHTTPServiceConfigHostInfraIPv6Host struct{…}
IPV6 string
Network DirectoryServiceUpdateResponseInfraHTTPServiceConfigHostInfraIPv6HostNetwork
TunnelID string
formatuuid
type DirectoryServiceUpdateResponseInfraHTTPServiceConfigHostInfraDualStackHost struct{…}
IPV4 string
IPV6 string
Network DirectoryServiceUpdateResponseInfraHTTPServiceConfigHostInfraDualStackHostNetwork
TunnelID string
formatuuid
type DirectoryServiceUpdateResponseInfraHTTPServiceConfigHostInfraHostnameHost struct{…}
Hostname string
ResolverNetwork DirectoryServiceUpdateResponseInfraHTTPServiceConfigHostInfraHostnameHostResolverNetwork
TunnelID string
formatuuid
ResolverIPs []stringOptional
Name string
Type DirectoryServiceUpdateResponseInfraHTTPServiceConfigType
One of the following:
const DirectoryServiceUpdateResponseInfraHTTPServiceConfigTypeTCP DirectoryServiceUpdateResponseInfraHTTPServiceConfigType = "tcp"
const DirectoryServiceUpdateResponseInfraHTTPServiceConfigTypeHTTP DirectoryServiceUpdateResponseInfraHTTPServiceConfigType = "http"
CreatedAt TimeOptional
formatdate-time
HTTPPort int64Optional
formatint32
minimum1
HTTPSPort int64Optional
formatint32
minimum1
ServiceID stringOptional
formatuuid
TLSSettings DirectoryServiceUpdateResponseInfraHTTPServiceConfigTLSSettingsOptional

TLS settings for a connectivity service.

CERTVerificationMode string

TLS certificate verification mode for the connection to the origin.

  • "verify_full" — verify certificate chain and hostname (default)
  • "verify_ca" — verify certificate chain only, skip hostname check
  • "disabled" — do not verify the server certificate at all

disabled cannot be combined with certificate_authority: a custom CA is only used to verify the server certificate.

CertificateAuthority stringOptional

UUID of the custom CA certificate or chain.

ClientCertificate stringOptional

UUID of the mTLS client certificate and private key.

UpdatedAt TimeOptional
formatdate-time
type DirectoryServiceUpdateResponseInfraTCPServiceConfig struct{…}
Host DirectoryServiceUpdateResponseInfraTCPServiceConfigHost
One of the following:
type DirectoryServiceUpdateResponseInfraTCPServiceConfigHostInfraIPv4Host struct{…}
IPV4 string
Network DirectoryServiceUpdateResponseInfraTCPServiceConfigHostInfraIPv4HostNetwork
TunnelID string
formatuuid
type DirectoryServiceUpdateResponseInfraTCPServiceConfigHostInfraIPv6Host struct{…}
IPV6 string
Network DirectoryServiceUpdateResponseInfraTCPServiceConfigHostInfraIPv6HostNetwork
TunnelID string
formatuuid
type DirectoryServiceUpdateResponseInfraTCPServiceConfigHostInfraDualStackHost struct{…}
IPV4 string
IPV6 string
Network DirectoryServiceUpdateResponseInfraTCPServiceConfigHostInfraDualStackHostNetwork
TunnelID string
formatuuid
type DirectoryServiceUpdateResponseInfraTCPServiceConfigHostInfraHostnameHost struct{…}
Hostname string
ResolverNetwork DirectoryServiceUpdateResponseInfraTCPServiceConfigHostInfraHostnameHostResolverNetwork
TunnelID string
formatuuid
ResolverIPs []stringOptional
Name string
Type DirectoryServiceUpdateResponseInfraTCPServiceConfigType
One of the following:
const DirectoryServiceUpdateResponseInfraTCPServiceConfigTypeTCP DirectoryServiceUpdateResponseInfraTCPServiceConfigType = "tcp"
const DirectoryServiceUpdateResponseInfraTCPServiceConfigTypeHTTP DirectoryServiceUpdateResponseInfraTCPServiceConfigType = "http"
AppProtocol DirectoryServiceUpdateResponseInfraTCPServiceConfigAppProtocolOptional
One of the following:
const DirectoryServiceUpdateResponseInfraTCPServiceConfigAppProtocolPostgresql DirectoryServiceUpdateResponseInfraTCPServiceConfigAppProtocol = "postgresql"
const DirectoryServiceUpdateResponseInfraTCPServiceConfigAppProtocolMysql DirectoryServiceUpdateResponseInfraTCPServiceConfigAppProtocol = "mysql"
CreatedAt TimeOptional
formatdate-time
ServiceID stringOptional
formatuuid
TCPPort int64Optional
formatint32
minimum1
TLSSettings DirectoryServiceUpdateResponseInfraTCPServiceConfigTLSSettingsOptional

TLS settings for a connectivity service.

CERTVerificationMode string

TLS certificate verification mode for the connection to the origin.

  • "verify_full" — verify certificate chain and hostname (default)
  • "verify_ca" — verify certificate chain only, skip hostname check
  • "disabled" — do not verify the server certificate at all

disabled cannot be combined with certificate_authority: a custom CA is only used to verify the server certificate.

CertificateAuthority stringOptional

UUID of the custom CA certificate or chain.

ClientCertificate stringOptional

UUID of the mTLS client certificate and private key.

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"),
      Body: connectivity.DirectoryServiceUpdateParamsBodyInfraHTTPServiceConfig{
        Host: cloudflare.F[connectivity.DirectoryServiceUpdateParamsBodyInfraHTTPServiceConfigHostUnion](connectivity.DirectoryServiceUpdateParamsBodyInfraHTTPServiceConfigHostInfraIPv4Host{
          IPV4: cloudflare.F("10.0.0.1"),
          Network: cloudflare.F(connectivity.DirectoryServiceUpdateParamsBodyInfraHTTPServiceConfigHostInfraIPv4HostNetwork{
            TunnelID: cloudflare.F("0191dce4-9ab4-7fce-b660-8e5dec5172da"),
          }),
        }),
        Name: cloudflare.F("postgres-db"),
        Type: cloudflare.F(connectivity.DirectoryServiceUpdateParamsBodyInfraHTTPServiceConfigTypeTCP),
      },
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", service)
}
{
  "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",
    "tls_settings": {
      "cert_verification_mode": "verify_full",
      "certificate_authority": "705db030-8247-489b-80dd-0d6256e5950d",
      "client_certificate": "a493fbb4-34bc-4218-a63c-61a9323ac725"
    },
    "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",
    "tls_settings": {
      "cert_verification_mode": "verify_full",
      "certificate_authority": "705db030-8247-489b-80dd-0d6256e5950d",
      "client_certificate": "a493fbb4-34bc-4218-a63c-61a9323ac725"
    },
    "updated_at": "2024-01-15T10:45:00Z"
  }
}