Help us shape the future of Go! Take the 2026 Go Developer Survey

byteplusutil

package
v1.0.79 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingRegion = errors.New("byteplusutil: missing region for regional service")

ErrMissingRegion is returned by ResolveDefaultEndpoint when a Regional service is asked to resolve an endpoint without a region. Without this guard the SDK used to produce a double-dot host such as "vpc..byteplusapi.com" and return err=nil, which callers could not tell from a legitimate result.

View Source
var ErrServiceEndpointInfoMissing = errors.New("byteplusutil: service endpoint info missing")

ErrServiceEndpointInfoMissing indicates that the requested service is not registered in defaultEndpoint. Surfaced by ResolveDefaultEndpoint and wrapped by the Session default addressing pipeline.

Functions

func BodyToMap

func BodyToMap(input map[string]interface{}, sensitive []string, enable bool) map[string]interface{}

func Copy

func Copy(dst, src interface{})

Copy deeply copies a src structure to dst. Useful for copying request and response structures.

Can copy between structs of different type, but will only copy fields which are assignable, and exist in both structs. Fields which are not assignable, or do not exist in both structs are ignored.

func CopyOf

func CopyOf(src interface{}) (dst interface{})

CopyOf returns a copy of src while also allocating the memory for dst. src must be a pointer type or this operation will fail.

func DeepEqual

func DeepEqual(a, b interface{}) bool

DeepEqual returns if the two values are deeply equal like reflect.DeepEqual. In addition to this, this method will also dereference the input values if possible so the DeepEqual performed will not fail if one parameter is a pointer and the other is not.

DeepEqual will not perform indirection of nested values of the input parameters.

func GetDefaultEndpointByServiceInfo deprecated added in v1.0.2

func GetDefaultEndpointByServiceInfo(service string, regionCode string,
	customBootstrapRegion map[string]struct{}, useDualStack *bool, logger byteplus.Logger) *string

GetDefaultEndpointByServiceInfo is the backwards-compatible entry point that preserves the original signature. Internally it delegates to ResolveDefaultEndpoint and, on any resolution error, falls back to the shared open endpoint so external callers that dereference the returned pointer keep working.

Deprecated: the customBootstrapRegion parameter is retained for API compatibility only and is ignored at runtime; bootstrap-region-based routing no longer participates in default addressing. New SDK-internal call sites should prefer ResolveDefaultEndpoint so that a missing service registration surfaces as an error instead of being silently swallowed.

func ObtainSdkValue

func ObtainSdkValue(keyPattern string, obj interface{}) (interface{}, error)

func ParameterToMap

func ParameterToMap(body string, sensitive []string, enable bool) map[string]interface{}

func Prettify

func Prettify(i interface{}) string

Prettify returns the string representation of a value.

func ResolveDefaultEndpoint added in v1.0.75

func ResolveDefaultEndpoint(service, regionCode string, useDualStack *bool, logger byteplus.Logger) (string, error)

ResolveDefaultEndpoint is the SDK-internal entry point used by the default Session request pipeline when neither Config.Endpoint nor Config.EndpointResolver is provided.

It implements the addressing decision described in the Endpoint auto-address spec: consult the defaultEndpoint map, then combine RegionType (IsGlobal) with GoChinaEnabled to produce a deterministic {service}[.{region}].byteplusapi.com[.cn] endpoint.

Returns ErrServiceEndpointInfoMissing when the service is not registered in defaultEndpoint.

func SetValueAtPath

func SetValueAtPath(i interface{}, path string, v interface{})

SetValueAtPath sets a value at the case insensitive lexical path inside of a structure.

func StringValue

func StringValue(i interface{}) string

StringValue returns the string representation of a value.

func ValuesAtPath

func ValuesAtPath(i interface{}, path string) ([]interface{}, error)

ValuesAtPath returns a list of values at the case insensitive lexical path inside of a structure.

Types

type Endpoint

type Endpoint struct {
	CustomerEndpoint string
}

func NewEndpoint

func NewEndpoint() *Endpoint

func (*Endpoint) GetEndpoint

func (c *Endpoint) GetEndpoint() string

func (*Endpoint) WithCustomerEndpoint

func (c *Endpoint) WithCustomerEndpoint(customerEndpoint string) *Endpoint

type ServiceEndpointInfo added in v1.0.2

type ServiceEndpointInfo struct {
	Service        string
	IsGlobal       bool
	GoChinaEnabled bool
}

type ServiceInfo

type ServiceInfo struct {
	Service string
	Region  string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL