# Configs ## List Hyperdrives `client.Hyperdrive.Configs.List(ctx, query) (*SinglePage[Hyperdrive], error)` **get** `/accounts/{account_id}/hyperdrive/configs` Returns a list of Hyperdrives. ### Parameters - `query ConfigListParams` - `AccountID param.Field[string]` Define configurations using a unique string identifier. ### Returns - `type Hyperdrive struct{…}` - `ID string` Define configurations using a unique string identifier. - `Name string` The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. - `Origin HyperdriveOrigin` - `type HyperdriveOriginPublicDatabase struct{…}` - `Database string` Set the name of your origin database. - `Host string` Defines the host (hostname or IP) of your origin database. - `Password string` Set the password needed to access your origin database. The API never returns this write-only value. - `Port int64` Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified. - `Scheme HyperdriveOriginPublicDatabaseScheme` Specifies the URL scheme used to connect to your origin database. - `const HyperdriveOriginPublicDatabaseSchemePostgres HyperdriveOriginPublicDatabaseScheme = "postgres"` - `const HyperdriveOriginPublicDatabaseSchemePostgresql HyperdriveOriginPublicDatabaseScheme = "postgresql"` - `const HyperdriveOriginPublicDatabaseSchemeMysql HyperdriveOriginPublicDatabaseScheme = "mysql"` - `User string` Set the user of your origin database. - `type HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnel struct{…}` - `AccessClientID string` Defines the Client ID of the Access token to use when connecting to the origin database. - `AccessClientSecret string` Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value. - `Database string` Set the name of your origin database. - `Host string` Defines the host (hostname or IP) of your origin database. - `Password string` Set the password needed to access your origin database. The API never returns this write-only value. - `Scheme HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme` Specifies the URL scheme used to connect to your origin database. - `const HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelSchemePostgres HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = "postgres"` - `const HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelSchemePostgresql HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = "postgresql"` - `const HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelSchemeMysql HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = "mysql"` - `User string` Set the user of your origin database. - `Caching HyperdriveCaching` - `type HyperdriveCachingHyperdriveHyperdriveCachingCommon struct{…}` - `Disabled bool` Set to true to disable caching of SQL responses. Default is false. - `type HyperdriveCachingHyperdriveHyperdriveCachingEnabled struct{…}` - `Disabled bool` Set to true to disable caching of SQL responses. Default is false. - `MaxAge int64` Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. - `StaleWhileRevalidate int64` Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. - `CreatedOn Time` Defines the creation time of the Hyperdrive configuration. - `ModifiedOn Time` Defines the last modified time of the Hyperdrive configuration. - `MTLS HyperdriveMTLS` - `CACertificateID string` Define CA certificate ID obtained after uploading CA cert. - `MTLSCertificateID string` Define mTLS certificate ID obtained after uploading client cert. - `Sslmode string` Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. - `OriginConnectionLimit int64` The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database. Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts. If not specified, defaults to 20 for free tier and 60 for paid tier. Contact Cloudflare if you need a higher limit. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/hyperdrive" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.Hyperdrive.Configs.List(context.TODO(), hyperdrive.ConfigListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "name": "example-hyperdrive", "origin": { "database": "postgres", "host": "database.example.com", "port": 5432, "scheme": "postgres", "user": "postgres" }, "caching": { "disabled": true }, "created_on": "2017-01-01T00:00:00Z", "modified_on": "2017-01-01T00:00:00Z", "mtls": { "ca_certificate_id": "00000000-0000-0000-0000-0000000000", "mtls_certificate_id": "00000000-0000-0000-0000-0000000000", "sslmode": "verify-full" }, "origin_connection_limit": 60 } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get Hyperdrive `client.Hyperdrive.Configs.Get(ctx, hyperdriveID, query) (*Hyperdrive, error)` **get** `/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}` Returns the specified Hyperdrive configuration. ### Parameters - `hyperdriveID string` Define configurations using a unique string identifier. - `query ConfigGetParams` - `AccountID param.Field[string]` Define configurations using a unique string identifier. ### Returns - `type Hyperdrive struct{…}` - `ID string` Define configurations using a unique string identifier. - `Name string` The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. - `Origin HyperdriveOrigin` - `type HyperdriveOriginPublicDatabase struct{…}` - `Database string` Set the name of your origin database. - `Host string` Defines the host (hostname or IP) of your origin database. - `Password string` Set the password needed to access your origin database. The API never returns this write-only value. - `Port int64` Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified. - `Scheme HyperdriveOriginPublicDatabaseScheme` Specifies the URL scheme used to connect to your origin database. - `const HyperdriveOriginPublicDatabaseSchemePostgres HyperdriveOriginPublicDatabaseScheme = "postgres"` - `const HyperdriveOriginPublicDatabaseSchemePostgresql HyperdriveOriginPublicDatabaseScheme = "postgresql"` - `const HyperdriveOriginPublicDatabaseSchemeMysql HyperdriveOriginPublicDatabaseScheme = "mysql"` - `User string` Set the user of your origin database. - `type HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnel struct{…}` - `AccessClientID string` Defines the Client ID of the Access token to use when connecting to the origin database. - `AccessClientSecret string` Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value. - `Database string` Set the name of your origin database. - `Host string` Defines the host (hostname or IP) of your origin database. - `Password string` Set the password needed to access your origin database. The API never returns this write-only value. - `Scheme HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme` Specifies the URL scheme used to connect to your origin database. - `const HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelSchemePostgres HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = "postgres"` - `const HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelSchemePostgresql HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = "postgresql"` - `const HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelSchemeMysql HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = "mysql"` - `User string` Set the user of your origin database. - `Caching HyperdriveCaching` - `type HyperdriveCachingHyperdriveHyperdriveCachingCommon struct{…}` - `Disabled bool` Set to true to disable caching of SQL responses. Default is false. - `type HyperdriveCachingHyperdriveHyperdriveCachingEnabled struct{…}` - `Disabled bool` Set to true to disable caching of SQL responses. Default is false. - `MaxAge int64` Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. - `StaleWhileRevalidate int64` Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. - `CreatedOn Time` Defines the creation time of the Hyperdrive configuration. - `ModifiedOn Time` Defines the last modified time of the Hyperdrive configuration. - `MTLS HyperdriveMTLS` - `CACertificateID string` Define CA certificate ID obtained after uploading CA cert. - `MTLSCertificateID string` Define mTLS certificate ID obtained after uploading client cert. - `Sslmode string` Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. - `OriginConnectionLimit int64` The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database. Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts. If not specified, defaults to 20 for free tier and 60 for paid tier. Contact Cloudflare if you need a higher limit. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/hyperdrive" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) hyperdrive, err := client.Hyperdrive.Configs.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", hyperdrive.ConfigGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", hyperdrive.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "name": "example-hyperdrive", "origin": { "database": "postgres", "host": "database.example.com", "port": 5432, "scheme": "postgres", "user": "postgres" }, "caching": { "disabled": true }, "created_on": "2017-01-01T00:00:00Z", "modified_on": "2017-01-01T00:00:00Z", "mtls": { "ca_certificate_id": "00000000-0000-0000-0000-0000000000", "mtls_certificate_id": "00000000-0000-0000-0000-0000000000", "sslmode": "verify-full" }, "origin_connection_limit": 60 }, "success": true } ``` ## Create Hyperdrive `client.Hyperdrive.Configs.New(ctx, params) (*Hyperdrive, error)` **post** `/accounts/{account_id}/hyperdrive/configs` Creates and returns a new Hyperdrive configuration. ### Parameters - `params ConfigNewParams` - `AccountID param.Field[string]` Path param: Define configurations using a unique string identifier. - `Hyperdrive param.Field[Hyperdrive]` Body param ### Returns - `type Hyperdrive struct{…}` - `ID string` Define configurations using a unique string identifier. - `Name string` The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. - `Origin HyperdriveOrigin` - `type HyperdriveOriginPublicDatabase struct{…}` - `Database string` Set the name of your origin database. - `Host string` Defines the host (hostname or IP) of your origin database. - `Password string` Set the password needed to access your origin database. The API never returns this write-only value. - `Port int64` Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified. - `Scheme HyperdriveOriginPublicDatabaseScheme` Specifies the URL scheme used to connect to your origin database. - `const HyperdriveOriginPublicDatabaseSchemePostgres HyperdriveOriginPublicDatabaseScheme = "postgres"` - `const HyperdriveOriginPublicDatabaseSchemePostgresql HyperdriveOriginPublicDatabaseScheme = "postgresql"` - `const HyperdriveOriginPublicDatabaseSchemeMysql HyperdriveOriginPublicDatabaseScheme = "mysql"` - `User string` Set the user of your origin database. - `type HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnel struct{…}` - `AccessClientID string` Defines the Client ID of the Access token to use when connecting to the origin database. - `AccessClientSecret string` Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value. - `Database string` Set the name of your origin database. - `Host string` Defines the host (hostname or IP) of your origin database. - `Password string` Set the password needed to access your origin database. The API never returns this write-only value. - `Scheme HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme` Specifies the URL scheme used to connect to your origin database. - `const HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelSchemePostgres HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = "postgres"` - `const HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelSchemePostgresql HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = "postgresql"` - `const HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelSchemeMysql HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = "mysql"` - `User string` Set the user of your origin database. - `Caching HyperdriveCaching` - `type HyperdriveCachingHyperdriveHyperdriveCachingCommon struct{…}` - `Disabled bool` Set to true to disable caching of SQL responses. Default is false. - `type HyperdriveCachingHyperdriveHyperdriveCachingEnabled struct{…}` - `Disabled bool` Set to true to disable caching of SQL responses. Default is false. - `MaxAge int64` Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. - `StaleWhileRevalidate int64` Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. - `CreatedOn Time` Defines the creation time of the Hyperdrive configuration. - `ModifiedOn Time` Defines the last modified time of the Hyperdrive configuration. - `MTLS HyperdriveMTLS` - `CACertificateID string` Define CA certificate ID obtained after uploading CA cert. - `MTLSCertificateID string` Define mTLS certificate ID obtained after uploading client cert. - `Sslmode string` Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. - `OriginConnectionLimit int64` The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database. Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts. If not specified, defaults to 20 for free tier and 60 for paid tier. Contact Cloudflare if you need a higher limit. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/hyperdrive" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) hyperdrive, err := client.Hyperdrive.Configs.New(context.TODO(), hyperdrive.ConfigNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Hyperdrive: hyperdrive.HyperdriveParam{ Name: cloudflare.F("example-hyperdrive"), Origin: cloudflare.F[hyperdrive.HyperdriveOriginUnionParam](hyperdrive.HyperdriveOriginPublicDatabaseParam{ Database: cloudflare.F("postgres"), Host: cloudflare.F("database.example.com"), Password: cloudflare.F("password"), Port: cloudflare.F(int64(5432)), Scheme: cloudflare.F(hyperdrive.HyperdriveOriginPublicDatabaseSchemePostgres), User: cloudflare.F("postgres"), }), }, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", hyperdrive.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "name": "example-hyperdrive", "origin": { "database": "postgres", "host": "database.example.com", "port": 5432, "scheme": "postgres", "user": "postgres" }, "caching": { "disabled": true }, "created_on": "2017-01-01T00:00:00Z", "modified_on": "2017-01-01T00:00:00Z", "mtls": { "ca_certificate_id": "00000000-0000-0000-0000-0000000000", "mtls_certificate_id": "00000000-0000-0000-0000-0000000000", "sslmode": "verify-full" }, "origin_connection_limit": 60 }, "success": true } ``` ## Update Hyperdrive `client.Hyperdrive.Configs.Update(ctx, hyperdriveID, params) (*Hyperdrive, error)` **put** `/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}` Updates and returns the specified Hyperdrive configuration. ### Parameters - `hyperdriveID string` Define configurations using a unique string identifier. - `params ConfigUpdateParams` - `AccountID param.Field[string]` Path param: Define configurations using a unique string identifier. - `Hyperdrive param.Field[Hyperdrive]` Body param ### Returns - `type Hyperdrive struct{…}` - `ID string` Define configurations using a unique string identifier. - `Name string` The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. - `Origin HyperdriveOrigin` - `type HyperdriveOriginPublicDatabase struct{…}` - `Database string` Set the name of your origin database. - `Host string` Defines the host (hostname or IP) of your origin database. - `Password string` Set the password needed to access your origin database. The API never returns this write-only value. - `Port int64` Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified. - `Scheme HyperdriveOriginPublicDatabaseScheme` Specifies the URL scheme used to connect to your origin database. - `const HyperdriveOriginPublicDatabaseSchemePostgres HyperdriveOriginPublicDatabaseScheme = "postgres"` - `const HyperdriveOriginPublicDatabaseSchemePostgresql HyperdriveOriginPublicDatabaseScheme = "postgresql"` - `const HyperdriveOriginPublicDatabaseSchemeMysql HyperdriveOriginPublicDatabaseScheme = "mysql"` - `User string` Set the user of your origin database. - `type HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnel struct{…}` - `AccessClientID string` Defines the Client ID of the Access token to use when connecting to the origin database. - `AccessClientSecret string` Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value. - `Database string` Set the name of your origin database. - `Host string` Defines the host (hostname or IP) of your origin database. - `Password string` Set the password needed to access your origin database. The API never returns this write-only value. - `Scheme HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme` Specifies the URL scheme used to connect to your origin database. - `const HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelSchemePostgres HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = "postgres"` - `const HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelSchemePostgresql HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = "postgresql"` - `const HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelSchemeMysql HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = "mysql"` - `User string` Set the user of your origin database. - `Caching HyperdriveCaching` - `type HyperdriveCachingHyperdriveHyperdriveCachingCommon struct{…}` - `Disabled bool` Set to true to disable caching of SQL responses. Default is false. - `type HyperdriveCachingHyperdriveHyperdriveCachingEnabled struct{…}` - `Disabled bool` Set to true to disable caching of SQL responses. Default is false. - `MaxAge int64` Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. - `StaleWhileRevalidate int64` Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. - `CreatedOn Time` Defines the creation time of the Hyperdrive configuration. - `ModifiedOn Time` Defines the last modified time of the Hyperdrive configuration. - `MTLS HyperdriveMTLS` - `CACertificateID string` Define CA certificate ID obtained after uploading CA cert. - `MTLSCertificateID string` Define mTLS certificate ID obtained after uploading client cert. - `Sslmode string` Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. - `OriginConnectionLimit int64` The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database. Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts. If not specified, defaults to 20 for free tier and 60 for paid tier. Contact Cloudflare if you need a higher limit. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/hyperdrive" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) hyperdrive, err := client.Hyperdrive.Configs.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", hyperdrive.ConfigUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Hyperdrive: hyperdrive.HyperdriveParam{ Name: cloudflare.F("example-hyperdrive"), Origin: cloudflare.F[hyperdrive.HyperdriveOriginUnionParam](hyperdrive.HyperdriveOriginPublicDatabaseParam{ Database: cloudflare.F("postgres"), Host: cloudflare.F("database.example.com"), Password: cloudflare.F("password"), Port: cloudflare.F(int64(5432)), Scheme: cloudflare.F(hyperdrive.HyperdriveOriginPublicDatabaseSchemePostgres), User: cloudflare.F("postgres"), }), }, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", hyperdrive.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "name": "example-hyperdrive", "origin": { "database": "postgres", "host": "database.example.com", "port": 5432, "scheme": "postgres", "user": "postgres" }, "caching": { "disabled": true }, "created_on": "2017-01-01T00:00:00Z", "modified_on": "2017-01-01T00:00:00Z", "mtls": { "ca_certificate_id": "00000000-0000-0000-0000-0000000000", "mtls_certificate_id": "00000000-0000-0000-0000-0000000000", "sslmode": "verify-full" }, "origin_connection_limit": 60 }, "success": true } ``` ## Patch Hyperdrive `client.Hyperdrive.Configs.Edit(ctx, hyperdriveID, params) (*Hyperdrive, error)` **patch** `/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}` Patches and returns the specified Hyperdrive configuration. Custom caching settings are not kept if caching is disabled. ### Parameters - `hyperdriveID string` Define configurations using a unique string identifier. - `params ConfigEditParams` - `AccountID param.Field[string]` Path param: Define configurations using a unique string identifier. - `Caching param.Field[ConfigEditParamsCaching]` Body param - `type ConfigEditParamsCachingHyperdriveHyperdriveCachingCommon struct{…}` - `Disabled bool` Set to true to disable caching of SQL responses. Default is false. - `type ConfigEditParamsCachingHyperdriveHyperdriveCachingEnabled struct{…}` - `Disabled bool` Set to true to disable caching of SQL responses. Default is false. - `MaxAge int64` Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. - `StaleWhileRevalidate int64` Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. - `MTLS param.Field[ConfigEditParamsMTLS]` Body param - `CACertificateID string` Define CA certificate ID obtained after uploading CA cert. - `MTLSCertificateID string` Define mTLS certificate ID obtained after uploading client cert. - `Sslmode string` Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. - `Name param.Field[string]` Body param: The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. - `Origin param.Field[ConfigEditParamsOrigin]` Body param - `type ConfigEditParamsOriginHyperdriveHyperdriveDatabase struct{…}` - `Database string` Set the name of your origin database. - `Password string` Set the password needed to access your origin database. The API never returns this write-only value. - `Scheme ConfigEditParamsOriginHyperdriveHyperdriveDatabaseScheme` Specifies the URL scheme used to connect to your origin database. - `const ConfigEditParamsOriginHyperdriveHyperdriveDatabaseSchemePostgres ConfigEditParamsOriginHyperdriveHyperdriveDatabaseScheme = "postgres"` - `const ConfigEditParamsOriginHyperdriveHyperdriveDatabaseSchemePostgresql ConfigEditParamsOriginHyperdriveHyperdriveDatabaseScheme = "postgresql"` - `const ConfigEditParamsOriginHyperdriveHyperdriveDatabaseSchemeMysql ConfigEditParamsOriginHyperdriveHyperdriveDatabaseScheme = "mysql"` - `User string` Set the user of your origin database. - `type ConfigEditParamsOriginHyperdriveInternetOrigin struct{…}` - `Host string` Defines the host (hostname or IP) of your origin database. - `Port int64` Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified. - `type ConfigEditParamsOriginHyperdriveOverAccessOrigin struct{…}` - `AccessClientID string` Defines the Client ID of the Access token to use when connecting to the origin database. - `AccessClientSecret string` Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value. - `Host string` Defines the host (hostname or IP) of your origin database. - `OriginConnectionLimit param.Field[int64]` Body param: The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database. Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts. If not specified, defaults to 20 for free tier and 60 for paid tier. Contact Cloudflare if you need a higher limit. ### Returns - `type Hyperdrive struct{…}` - `ID string` Define configurations using a unique string identifier. - `Name string` The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. - `Origin HyperdriveOrigin` - `type HyperdriveOriginPublicDatabase struct{…}` - `Database string` Set the name of your origin database. - `Host string` Defines the host (hostname or IP) of your origin database. - `Password string` Set the password needed to access your origin database. The API never returns this write-only value. - `Port int64` Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified. - `Scheme HyperdriveOriginPublicDatabaseScheme` Specifies the URL scheme used to connect to your origin database. - `const HyperdriveOriginPublicDatabaseSchemePostgres HyperdriveOriginPublicDatabaseScheme = "postgres"` - `const HyperdriveOriginPublicDatabaseSchemePostgresql HyperdriveOriginPublicDatabaseScheme = "postgresql"` - `const HyperdriveOriginPublicDatabaseSchemeMysql HyperdriveOriginPublicDatabaseScheme = "mysql"` - `User string` Set the user of your origin database. - `type HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnel struct{…}` - `AccessClientID string` Defines the Client ID of the Access token to use when connecting to the origin database. - `AccessClientSecret string` Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value. - `Database string` Set the name of your origin database. - `Host string` Defines the host (hostname or IP) of your origin database. - `Password string` Set the password needed to access your origin database. The API never returns this write-only value. - `Scheme HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme` Specifies the URL scheme used to connect to your origin database. - `const HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelSchemePostgres HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = "postgres"` - `const HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelSchemePostgresql HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = "postgresql"` - `const HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelSchemeMysql HyperdriveOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = "mysql"` - `User string` Set the user of your origin database. - `Caching HyperdriveCaching` - `type HyperdriveCachingHyperdriveHyperdriveCachingCommon struct{…}` - `Disabled bool` Set to true to disable caching of SQL responses. Default is false. - `type HyperdriveCachingHyperdriveHyperdriveCachingEnabled struct{…}` - `Disabled bool` Set to true to disable caching of SQL responses. Default is false. - `MaxAge int64` Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. - `StaleWhileRevalidate int64` Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. - `CreatedOn Time` Defines the creation time of the Hyperdrive configuration. - `ModifiedOn Time` Defines the last modified time of the Hyperdrive configuration. - `MTLS HyperdriveMTLS` - `CACertificateID string` Define CA certificate ID obtained after uploading CA cert. - `MTLSCertificateID string` Define mTLS certificate ID obtained after uploading client cert. - `Sslmode string` Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. - `OriginConnectionLimit int64` The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database. Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts. If not specified, defaults to 20 for free tier and 60 for paid tier. Contact Cloudflare if you need a higher limit. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/hyperdrive" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) hyperdrive, err := client.Hyperdrive.Configs.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", hyperdrive.ConfigEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", hyperdrive.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "name": "example-hyperdrive", "origin": { "database": "postgres", "host": "database.example.com", "port": 5432, "scheme": "postgres", "user": "postgres" }, "caching": { "disabled": true }, "created_on": "2017-01-01T00:00:00Z", "modified_on": "2017-01-01T00:00:00Z", "mtls": { "ca_certificate_id": "00000000-0000-0000-0000-0000000000", "mtls_certificate_id": "00000000-0000-0000-0000-0000000000", "sslmode": "verify-full" }, "origin_connection_limit": 60 }, "success": true } ``` ## Delete Hyperdrive `client.Hyperdrive.Configs.Delete(ctx, hyperdriveID, body) (*ConfigDeleteResponse, error)` **delete** `/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}` Deletes the specified Hyperdrive. ### Parameters - `hyperdriveID string` Define configurations using a unique string identifier. - `body ConfigDeleteParams` - `AccountID param.Field[string]` Define configurations using a unique string identifier. ### Returns - `type ConfigDeleteResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/hyperdrive" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) config, err := client.Hyperdrive.Configs.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", hyperdrive.ConfigDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", config) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": {}, "success": true } ```