{"modulePath":"github.com/quicknode/terraform-provider-quicknode","version":"v0.5.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package client\n\n## Constants\n\n```go\nconst (\n\t// RateLimitUnset is what the Admin API reports for a bucket with no\n\t// endpoint-level override.\n\tRateLimitUnset = -1\n\n\tSourcePlanDefault  = \"plan_default\"\n\tSourceUserOverride = \"user_override\"\n\n\tBucketRPS = \"rps\"\n\tBucketRPM = \"rpm\"\n\tBucketRPD = \"rpd\"\n)\n```\n\n```go\nconst (\n\tStreamStatusActive     = \"active\"\n\tStreamStatusPaused     = \"paused\"\n\tStreamStatusTerminated = \"terminated\"\n\tStreamStatusCompleted  = \"completed\"\n)\n```\n\n```go\nconst (\n\tDestinationWebhook  = \"webhook\"\n\tDestinationS3       = \"s3\"\n\tDestinationAzure    = \"azure\"\n\tDestinationPostgres = \"postgres\"\n\tDestinationKafka    = \"kafka\"\n)\n```\n\n```go\nconst DefaultBaseURL = \"https://api.quicknode.com\"\n```\n\n```go\nconst KVBatchLimit = 1500\n```\nKVBatchLimit is the most items one list write may add and remove together. Larger changes are split into several writes, so a failure part way through leaves some of them applied.\n\n```go\nconst StreamRangeUnset int64 = -1\n```\nStreamRangeUnset is what the API reports for an end\\_range that runs forever, and what it accepts as a start\\_range meaning the latest block.\n\n```go\nconst URLTokenPlaceholder = \"REPLACE_WITH_TOKEN\"\n```\nURLTokenPlaceholder stands in for the auth token in SafeHTTPURL and SafeWSSURL. It keeps the shape of the real URL, including any path suffix the chain appends, so the token's position stays visible and a caller can substitute one without guessing where it goes.\n\n## Variables\n\n```go\nvar KVKeyPattern = regexp.MustCompile(`^[A-Za-z0-9 ._:$-]+$`)\n```\nKVKeyPattern matches the list and value keys the Key-Value API accepts.\n\n## Functions\n\n```go\nfunc EndpointURLWithToken(raw, token string) string\n```\nEndpointURLWithToken puts token in the credential's position of an endpoint URL, whether that position holds a real token or URLTokenPlaceholder.\n\n```go\nfunc IsAlreadyExists(err error) bool\n```\n\n```go\nfunc IsNotFound(err error) bool\n```\n\n```go\nfunc IsUnauthorized(err error) bool\n```\nIsUnauthorized reports the two ways the Admin API rejects a key: an invalid key, and a key on a plan without Admin API access.\n\n```go\nfunc RedactEndpointURL(raw string) string\n```\nRedactEndpointURL replaces the credential in an endpoint URL with URLTokenPlaceholder. The Admin API returns URLs shaped https://\\\u003csubdomain\u003e.quiknode.pro/\\\u003ctoken\u003e\\[/\\\u003csuffix\u003e], and the suffix differs by chain, so the placeholder goes in the token's position and nothing is cut out. The result keeps the real URL's shape and is safe to log.\n\n## Types\n\n```go\ntype AzureDestination struct {\n\tStorageAccount      string `json:\"storage_account\"`\n\tContainer           string `json:\"container\"`\n\tBlobPrefix          string `json:\"blob_prefix\"`\n\tFileType            string `json:\"file_type\"`\n\tFileCompressionType string `json:\"file_compression_type\"`\n\tSASToken            string `json:\"sas_token,omitempty\"`\n\tMaxRetry            int64  `json:\"max_retry\"`\n\tRetryIntervalSec    int64  `json:\"retry_interval_sec\"`\n}\n```\n\n```go\ntype Chain struct {\n\tSlug          string\n\tIsSelectChain bool\n\tNetworks      []Network\n}\n```\n\n```go\ntype Client struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New(apiKey string, opts ...Option) (*Client, error)\n```\n\n```go\nfunc (c *Client) ActivateStream(ctx context.Context, id string) error\n```\n\n```go\nfunc (c *Client) AddDomainMask(ctx context.Context, endpointID, domainMask string) (*SecurityEntry, error)\n```\n\n```go\nfunc (c *Client) AddEndpointIP(ctx context.Context, endpointID, ip string) (*SecurityEntry, error)\n```\n\n```go\nfunc (c *Client) AddEndpointTag(ctx context.Context, id, label string) error\n```\n\n```go\nfunc (c *Client) AddEndpointToken(ctx context.Context, endpointID string) (*EndpointToken, error)\n```\n\n```go\nfunc (c *Client) AddJWT(ctx context.Context, endpointID string, jwt JWT) (*JWT, error)\n```\n\n```go\nfunc (c *Client) AddMethodRateLimit(ctx context.Context, endpointID string, limiter MethodRateLimit) (*MethodRateLimit, error)\n```\n\n```go\nfunc (c *Client) AddReferrer(ctx context.Context, endpointID, referrer string) (*SecurityEntry, error)\n```\n\n```go\nfunc (c *Client) AddRequestFilter(ctx context.Context, endpointID string, methods []string) (*RequestFilter, error)\n```\n\n```go\nfunc (c *Client) CreateEndpoint(ctx context.Context, chain, network string) (*Endpoint, error)\n```\n\n```go\nfunc (c *Client) CreateKVList(ctx context.Context, key string, items []string) error\n```\nCreateKVList writes a new list. Creating a list whose key already exists adds the items to it rather than replacing it, so callers check first.\n\n```go\nfunc (c *Client) CreateStream(ctx context.Context, input StreamInput) (*Stream, error)\n```\n\n```go\nfunc (c *Client) DeleteEndpoint(ctx context.Context, id string) error\n```\n\n```go\nfunc (c *Client) DeleteIPCustomHeader(ctx context.Context, endpointID string) error\n```\n\n```go\nfunc (c *Client) DeleteKVList(ctx context.Context, key string) error\n```\n\n```go\nfunc (c *Client) DeleteKVValue(ctx context.Context, key string) error\n```\n\n```go\nfunc (c *Client) DeleteRateLimitOverride(ctx context.Context, endpointID, overrideID string) error\n```\nDeleteRateLimitOverride drops one bucket back to the plan default. A 404 is success, since an absent override is the state the caller asked for.\n\n```go\nfunc (c *Client) DeleteStream(ctx context.Context, id string) error\n```\n\n```go\nfunc (c *Client) FindEndpointByLabel(ctx context.Context, label string) (*EndpointSummary, error)\n```\nFindEndpointByLabel resolves a label to a single endpoint. Labels are not unique, so more than one match is an error.\n\n```go\nfunc (c *Client) GetEndpoint(ctx context.Context, id string) (*Endpoint, error)\n```\n\n```go\nfunc (c *Client) GetEndpointSecurity(ctx context.Context, endpointID string) (*EndpointSecurity, error)\n```\n\n```go\nfunc (c *Client) GetEndpointURLs(ctx context.Context, id string) (*EndpointURLs, error)\n```\n\n```go\nfunc (c *Client) GetKVList(ctx context.Context, key string) ([]string, error)\n```\nGetKVList returns every item in the list, in the API's sorted order. A list that does not exist reads the same as an empty one, so both return no items and no error.\n\n```go\nfunc (c *Client) GetKVValue(ctx context.Context, key string) (string, error)\n```\nGetKVValue returns an error that satisfies IsNotFound when the key has no value.\n\n```go\nfunc (c *Client) GetRateLimits(ctx context.Context, endpointID string) (*EndpointRateLimits, error)\n```\n\n```go\nfunc (c *Client) GetStream(ctx context.Context, id string) (*Stream, error)\n```\n\n```go\nfunc (c *Client) ListChains(ctx context.Context) ([]Chain, error)\n```\n\n```go\nfunc (c *Client) ListEndpoints(ctx context.Context, filter EndpointFilter) ([]EndpointSummary, error)\n```\nListEndpoints walks every page, so a caller gets the whole account rather than the first twenty rows.\n\n```go\nfunc (c *Client) ListMethodRateLimits(ctx context.Context, endpointID string) ([]MethodRateLimit, error)\n```\n\n```go\nfunc (c *Client) PauseStream(ctx context.Context, id string) error\n```\n\n```go\nfunc (c *Client) RemoveDomainMask(ctx context.Context, endpointID, domainMaskID string) error\n```\n\n```go\nfunc (c *Client) RemoveEndpointIP(ctx context.Context, endpointID, ipID string) error\n```\n\n```go\nfunc (c *Client) RemoveEndpointTag(ctx context.Context, id string, tagID int64) error\n```\n\n```go\nfunc (c *Client) RemoveEndpointToken(ctx context.Context, endpointID, tokenID string) error\n```\n\n```go\nfunc (c *Client) RemoveJWT(ctx context.Context, endpointID, jwtID string) error\n```\n\n```go\nfunc (c *Client) RemoveMethodRateLimit(ctx context.Context, endpointID, limiterID string) error\n```\n\n```go\nfunc (c *Client) RemoveReferrer(ctx context.Context, endpointID, referrerID string) error\n```\n\n```go\nfunc (c *Client) RemoveRequestFilter(ctx context.Context, endpointID, filterID string) error\n```\n\n```go\nfunc (c *Client) SetEndpointLabel(ctx context.Context, id, label string) error\n```\n\n```go\nfunc (c *Client) SetEndpointMultichain(ctx context.Context, id string, enabled bool) error\n```\n\n```go\nfunc (c *Client) SetEndpointStatus(ctx context.Context, id, status string) error\n```\n\n```go\nfunc (c *Client) SetIPCustomHeader(ctx context.Context, endpointID, headerName string) error\n```\n\n```go\nfunc (c *Client) SetKVValue(ctx context.Context, key, value string) error\n```\nSetKVValue stores the value, replacing any value the key already has.\n\n```go\nfunc (c *Client) SetRateLimits(ctx context.Context, endpointID string, overrides RateLimitOverrides) error\n```\nSetRateLimits writes the settings the caller manages. Managing none sends no request at all. The route rejects an empty rate\\_limits object, so it is left out when no bucket is set.\n\n```go\nfunc (c *Client) SetSecurityOptions(ctx context.Context, endpointID string, patch SecurityOptionsPatch) error\n```\nSetSecurityOptions writes the settable toggles. The read path reports them as booleans and the write path takes the strings \"enabled\" and \"disabled\", so the conversion happens here once, for every caller. A patch that manages nothing sends no request at all.\n\n```go\nfunc (c *Client) UpdateKVList(ctx context.Context, key string, add, remove []string) error\n```\nUpdateKVList adds and removes items in batches of at most KVBatchLimit.\n\n```go\nfunc (c *Client) UpdateMethodRateLimit(ctx context.Context, endpointID, limiterID string, limiter MethodRateLimit) error\n```\nUpdateMethodRateLimit edits a limiter in place. The route takes the whole object, not a delta, and it does not accept interval, so a changed interval has to replace the limiter.\n\n```go\nfunc (c *Client) UpdateRequestFilter(ctx context.Context, endpointID, filterID string, methods []string) error\n```\n\n```go\nfunc (c *Client) UpdateStream(ctx context.Context, id string, update StreamUpdate) (*Stream, error)\n```\n\n```go\ntype Endpoint struct {\n\tID      string\n\tChain   string\n\tNetwork string\n\tLabel   string\n\tStatus  string\n\n\t// SafeHTTPURL and SafeWSSURL carry URLTokenPlaceholder where the token\n\t// belongs, so they can be logged or displayed. HTTPURLWithToken and\n\t// WSSURLWithToken are what the API returned, credential included.\n\tSafeHTTPURL      string\n\tSafeWSSURL       string\n\tHTTPURLWithToken string\n\tWSSURLWithToken  string\n\n\tMultichain bool\n\tTokens     []EndpointToken\n\tTags       []Tag\n\tSecurity   SecurityOptions\n}\n```\n\n```go\ntype EndpointFilter struct {\n\tSearch    string\n\tNetworks  []string\n\tStatuses  []string\n\tLabels    []string\n\tTagLabels []string\n}\n```\nEndpointFilter narrows a listing. Empty fields are left off the query, and the API treats several values in one field as \"any of\".\n\n```go\ntype EndpointRateLimits struct {\n\tLimits    []RateLimit\n\tLimitByIP bool\n}\n```\n\n```go\ntype EndpointSecurity struct {\n\tOptions        SecurityOptions\n\tIPs            []SecurityEntry\n\tDomainMasks    []SecurityEntry\n\tReferrers      []SecurityEntry\n\tJWTs           []JWT\n\tRequestFilters []RequestFilter\n\tTokens         []EndpointToken\n}\n```\n\n```go\ntype EndpointSummary struct {\n\tID          string\n\tName        string\n\tLabel       string\n\tChain       string\n\tNetwork     string\n\tStatus      string\n\tSafeHTTPURL string\n\tSafeWSSURL  string\n\tDedicated   bool\n\tFlatRate    bool\n\tMultichain  bool\n\tTags        []Tag\n}\n```\nEndpointSummary is one row of the list route. It carries less than a full endpoint read: no tokens, no security and no rate limits. The list route returns credentialed URLs, so the URLs here are redacted on the way in and the working form is only available from a full endpoint read.\n\n```go\ntype EndpointToken struct {\n\tID    string\n\tValue string\n}\n```\nEndpointToken is one of an endpoint's auth tokens. An endpoint can carry several, so this is a list.\n\n```go\ntype EndpointURLs struct {\n\tNetworkURLs\n\tMultichain map[string]NetworkURLs\n}\n```\nEndpointURLs is what the URLs route returns: the endpoint's own network, and for a multichain endpoint every network it serves, keyed by network slug.\n\n```go\ntype Error struct {\n\tOperation string\n\tStatus    int\n\tMessage   string\n}\n```\nError carries an Admin API failure. The Admin API can report a failure either through the HTTP status or through the \"error\" field of a 200 response body, so both paths produce this type.\n\n```go\nfunc (e *Error) Error() string\n```\n\n```go\ntype HeaderMap map[string]string\n```\nHeaderMap is a webhook's extra request headers. The API stores header values as strings or numbers, so decoding accepts both, and it rejects a missing headers object, so a nil map encodes as an empty one.\n\n```go\nfunc (h HeaderMap) MarshalJSON() ([]byte, error)\n```\n\n```go\nfunc (h *HeaderMap) UnmarshalJSON(raw []byte) error\n```\n\n```go\ntype JWT struct {\n\tID        string\n\tName      string\n\tKID       string\n\tPublicKey string\n}\n```\n\n```go\ntype KafkaDestination struct {\n\tBootstrapServers  string `json:\"bootstrap_servers\"`\n\tTopicName         string `json:\"topic_name\"`\n\tUsername          string `json:\"username,omitempty\"`\n\tPassword          string `json:\"password,omitempty\"`\n\tMechanisms        string `json:\"mechanisms,omitempty\"`\n\tProtocol          string `json:\"protocol,omitempty\"`\n\tCompressionType   string `json:\"compression_type\"`\n\tBatchSize         int64  `json:\"batch_size\"`\n\tLingerMs          int64  `json:\"linger_ms\"`\n\tMaxMessageBytes   int64  `json:\"max_message_bytes\"`\n\tTimeoutSec        int64  `json:\"timeout_sec\"`\n\tMaxRetry          int64  `json:\"max_retry\"`\n\tRetryIntervalSec  int64  `json:\"retry_interval_sec\"`\n\tSSLCAPEM          string `json:\"ssl_ca_pem,omitempty\"`\n\tSSLCertificatePEM string `json:\"ssl_certificate_pem,omitempty\"`\n\tSSLKeyPEM         string `json:\"ssl_key_pem,omitempty\"`\n}\n```\n\n```go\ntype MethodRateLimit struct {\n\tID       string\n\tMethods  []string\n\tRate     int\n\tInterval string\n\tStatus   string\n\tCreated  string\n\n\tLimitByIP bool\n}\n```\nMethodRateLimit throttles a named set of RPC methods independently of the endpoint-wide buckets.\n\n```go\ntype Network struct {\n\tSlug    string\n\tName    string\n\tChainID *int64\n}\n```\n\n```go\ntype NetworkURLs struct {\n\tSafeHTTPURL      string\n\tSafeWSSURL       string\n\tHTTPURLWithToken string\n\tWSSURLWithToken  string\n}\n```\nNetworkURLs is one network's URLs, in the same safe and credentialed forms as Endpoint's.\n\n```go\ntype Option func(*options)\n```\n\n```go\nfunc WithBaseURL(baseURL string) Option\n```\n\n```go\nfunc WithHTTPClient(httpClient *http.Client) Option\n```\n\n```go\nfunc WithMaxRetries(maxRetries int) Option\n```\n\n```go\nfunc WithRequestsPerSecond(requestsPerSecond int) Option\n```\nWithRequestsPerSecond throttles outbound calls. A terraform apply over a large workspace bursts many Admin API calls at once, so the provider paces itself and does not lean on the API to reject the excess.\n\n```go\nfunc WithUserAgent(userAgent string) Option\n```\nWithUserAgent sets the User-Agent header on every request.\n\n```go\ntype PostgresDestination struct {\n\tHost             string `json:\"host\"`\n\tPort             int64  `json:\"port\"`\n\tDatabase         string `json:\"database\"`\n\tTableName        string `json:\"table_name\"`\n\tUsername         string `json:\"username\"`\n\tPassword         string `json:\"password\"`\n\tSSLMode          string `json:\"sslmode\"`\n\tMaxRetry         int64  `json:\"max_retry\"`\n\tRetryIntervalSec int64  `json:\"retry_interval_sec\"`\n}\n```\n\n```go\ntype RateLimit struct {\n\tBucket string\n\tValue  int\n\tSource string\n\tID     string\n}\n```\nRateLimit is one bucket as the API reports it. A plan\\_default carries no id, because only an override can be deleted.\n\n```go\ntype RateLimitOverrides struct {\n\tRPS       *int\n\tRPM       *int\n\tRPD       *int\n\tLimitByIP *bool\n}\n```\nRateLimitOverrides names the settings a write can change. A nil field is left alone, so a configuration that manages only one bucket does not disturb the others.\n\n```go\ntype RequestFilter struct {\n\tID      string\n\tMethods []string\n}\n```\n\n```go\ntype S3Destination struct {\n\tEndpoint            string `json:\"endpoint\"`\n\tBucket              string `json:\"bucket\"`\n\tRegion              string `json:\"region,omitempty\"`\n\tObjectPrefix        string `json:\"object_prefix\"`\n\tFileType            string `json:\"file_type\"`\n\tFileCompressionType string `json:\"file_compression_type\"`\n\tUseSSL              bool   `json:\"use_ssl\"`\n\tAccessKey           string `json:\"access_key\"`\n\tSecretKey           string `json:\"secret_key\"`\n\tMaxRetry            int64  `json:\"max_retry\"`\n\tRetryIntervalSec    int64  `json:\"retry_interval_sec\"`\n}\n```\n\n```go\ntype SecurityEntry struct {\n\tID    string\n\tValue string\n}\n```\n\n```go\ntype SecurityOptions struct {\n\tTokens      bool\n\tReferrers   bool\n\tJWTs        bool\n\tIPs         bool\n\tDomainMasks bool\n\tHSTS        bool\n\tCors        bool\n\n\tRequestFilters  bool\n\tResponseLogging bool\n\n\tIPCustomHeader string\n}\n```\nSecurityOptions carries the toggles the Admin API reports for an endpoint. Tokens through Cors are settable. RequestFilters and ResponseLogging are reported but cannot be written, so the provider surfaces them read-only.\n\n```go\ntype SecurityOptionsPatch struct {\n\tTokens      *bool\n\tReferrers   *bool\n\tJWTs        *bool\n\tIPs         *bool\n\tDomainMasks *bool\n\tHSTS        *bool\n\tCors        *bool\n}\n```\nSecurityOptionsPatch names the settable toggles. A nil field is left alone, which keeps a write from clobbering a toggle the configuration does not manage.\n\n```go\ntype Stream struct {\n\tID      string\n\tName    string\n\tStatus  string\n\tNetwork string\n\tDataset string\n\tRegion  string\n\n\t// FilterFunction is the filter's source code. The API carries it base64\n\t// encoded; the client encodes and decodes it.\n\tFilterFunction string\n\tFilterLanguage string\n\n\tStartRange           int64\n\tEndRange             int64\n\tDatasetBatchSize     int64\n\tElasticBatchEnabled  bool\n\tRestreamBatchOnReorg bool\n\tFixBlockReorgs       int64\n\tKeepDistanceFromTip  int64\n\tNotificationEmail    string\n\n\t// Sequence is the last block delivered. It moves on its own while the\n\t// stream runs.\n\tSequence int64\n\n\tDestination       StreamDestination\n\tExtraDestinations []StreamDestination\n}\n```\n\n```go\ntype StreamDestination struct {\n\tWebhook  *WebhookDestination\n\tS3       *S3Destination\n\tAzure    *AzureDestination\n\tPostgres *PostgresDestination\n\tKafka    *KafkaDestination\n\t// contains filtered or unexported fields\n}\n```\nStreamDestination holds exactly one destination type. A type the API reports but the client does not model, such as one configured in the dashboard, leaves every field nil and is named by Type.\n\n```go\nfunc (d StreamDestination) MarshalJSON() ([]byte, error)\n```\n\n```go\nfunc (d StreamDestination) Type() string\n```\n\n```go\nfunc (d *StreamDestination) UnmarshalJSON(raw []byte) error\n```\n\n```go\ntype StreamInput struct {\n\tName           string\n\tNetwork        string\n\tDataset        string\n\tRegion         string\n\tStatus         string\n\tFilterFunction string\n\tFilterLanguage string\n\n\tStartRange           *int64\n\tEndRange             *int64\n\tDatasetBatchSize     int64\n\tElasticBatchEnabled  bool\n\tRestreamBatchOnReorg *bool\n\tFixBlockReorgs       *int64\n\tKeepDistanceFromTip  *int64\n\tNotificationEmail    *string\n\n\tDestination       StreamDestination\n\tExtraDestinations []StreamDestination\n}\n```\n\n```go\ntype StreamUpdate struct {\n\tName           *string\n\tFilterFunction *string\n\tFilterLanguage *string\n\n\tStartRange           *int64\n\tEndRange             *int64\n\tDatasetBatchSize     *int64\n\tElasticBatchEnabled  *bool\n\tRestreamBatchOnReorg *bool\n\tFixBlockReorgs       *int64\n\tKeepDistanceFromTip  *int64\n\tNotificationEmail    *string\n\n\tDestination       *StreamDestination\n\tExtraDestinations *[]StreamDestination\n}\n```\nStreamUpdate sends only the fields that are set. Network, dataset and region cannot change after creation, and status changes go through PauseStream and ActivateStream, which run the plan checks a PATCH skips.\n\n```go\ntype Tag struct {\n\tID    int64\n\tLabel string\n}\n```\n\n```go\ntype WebhookDestination struct {\n\tURL              string    `json:\"url\"`\n\tCompression      string    `json:\"compression\"`\n\tHeaders          HeaderMap `json:\"headers\"`\n\tMaxRetry         int64     `json:\"max_retry\"`\n\tRetryIntervalSec int64     `json:\"retry_interval_sec\"`\n\tPostTimeoutSec   int64     `json:\"post_timeout_sec\"`\n\tSecurityToken    string    `json:\"security_token,omitempty\"`\n\tMTLS             *bool     `json:\"mtls,omitempty\"`\n\tSSLCAPEM         string    `json:\"ssl_ca_pem,omitempty\"`\n}\n```\n\n","path":"github.com/quicknode/terraform-provider-quicknode/internal/client","name":"client","synopsis":"","isRedistributable":true}
