byteplusutil

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 added in v1.0.2

func GetDefaultEndpointByServiceInfo(service string, regionCode string) *string

GetDefaultEndpointByServiceInfo retrieves the default endpoint for a given service and region.

This function takes in the service name and region code, and returns a pointer to the default endpoint string. It checks if the service has a global endpoint or a region-specific endpoint. If neither is found, it returns a pointer to the default endpoint.

Parameters: - service: The name of the service for which to retrieve the endpoint. - regionCode: The region code to look up the region-specific endpoint.

Returns: - *string: A pointer to the endpoint string. It could be a global endpoint, a region-specific endpoint, or a default endpoint if the specified service or region does not have a defined endpoint.

Example:

endpoint := GetDefaultEndpointByServiceInfo("exampleService", "cn-beijing")

Note: Ensure the `defaultEndpoint` map is properly populated with service and region endpoint information before calling this function.

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 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 {
	//UseSSL bool
	//Locate bool
	//UseInternal                 bool
	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 RegionEndpointMap added in v1.0.2

type RegionEndpointMap map[string]string

type ServiceEndpointInfo added in v1.0.2

type ServiceEndpointInfo struct {
	Service         string
	IsGlobal        bool
	GlobalEndpoint  string
	DefaultEndpoint string
	RegionEndpointMap
}

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