Documentation ¶
Overview ¶
Package volcengine provides core functionality for making requests to volcengine services.
Index ¶
- Constants
- Variables
- func Bool(v bool) *bool
- func BoolMap(src map[string]bool) map[string]*bool
- func BoolSlice(src []bool) []*bool
- func BoolValue(v *bool) bool
- func BoolValueMap(src map[string]*bool) map[string]bool
- func BoolValueSlice(src []*bool) []bool
- func Float32(v float32) *float32
- func Float32Map(src map[string]float32) map[string]*float32
- func Float32Slice(src []float32) []*float32
- func Float32Value(v *float32) float32
- func Float32ValueMap(src map[string]*float32) map[string]float32
- func Float32ValueSlice(src []*float32) []float32
- func Float64(v float64) *float64
- func Float64Map(src map[string]float64) map[string]*float64
- func Float64Slice(src []float64) []*float64
- func Float64Value(v *float64) float64
- func Float64ValueMap(src map[string]*float64) map[string]float64
- func Float64ValueSlice(src []*float64) []float64
- func Int(v int) *int
- func Int16(v int16) *int16
- func Int16Map(src map[string]int16) map[string]*int16
- func Int16Slice(src []int16) []*int16
- func Int16Value(v *int16) int16
- func Int16ValueMap(src map[string]*int16) map[string]int16
- func Int16ValueSlice(src []*int16) []int16
- func Int32(v int32) *int32
- func Int32Map(src map[string]int32) map[string]*int32
- func Int32Slice(src []int32) []*int32
- func Int32Value(v *int32) int32
- func Int32ValueMap(src map[string]*int32) map[string]int32
- func Int32ValueSlice(src []*int32) []int32
- func Int64(v int64) *int64
- func Int64Map(src map[string]int64) map[string]*int64
- func Int64Slice(src []int64) []*int64
- func Int64Value(v *int64) int64
- func Int64ValueMap(src map[string]*int64) map[string]int64
- func Int64ValueSlice(src []*int64) []int64
- func Int8(v int8) *int8
- func Int8Map(src map[string]int8) map[string]*int8
- func Int8Slice(src []int8) []*int8
- func Int8Value(v *int8) int8
- func Int8ValueMap(src map[string]*int8) map[string]int8
- func Int8ValueSlice(src []*int8) []int8
- func IntMap(src map[string]int) map[string]*int
- func IntSlice(src []int) []*int
- func IntValue(v *int) int
- func IntValueMap(src map[string]*int) map[string]int
- func IntValueSlice(src []*int) []int
- func IsReaderSeekable(r io.Reader) bool
- func JsonNumber(v string) *json.Number
- func JsonNumberValue(v *string) json.Number
- func MillisecondsTimeValue(v *int64) time.Time
- func SecondsTimeValue(v *int64) time.Time
- func SeekerLen(s io.Seeker) (int64, error)
- func SleepWithContext(ctx Context, dur time.Duration) error
- func String(v string) *string
- func StringMap(src map[string]string) map[string]*string
- func StringSlice(src []string) []*string
- func StringValue(v *string) string
- func StringValueMap(src map[string]*string) map[string]string
- func StringValueSlice(src []*string) []string
- func Time(v time.Time) *time.Time
- func TimeMap(src map[string]time.Time) map[string]*time.Time
- func TimeSlice(src []time.Time) []*time.Time
- func TimeUnixMilli(t time.Time) int64
- func TimeValue(v *time.Time) time.Time
- func TimeValueMap(src map[string]*time.Time) map[string]time.Time
- func TimeValueSlice(src []*time.Time) []time.Time
- func URLHostname(url *url.URL) string
- func Uint(v uint) *uint
- func Uint16(v uint16) *uint16
- func Uint16Map(src map[string]uint16) map[string]*uint16
- func Uint16Slice(src []uint16) []*uint16
- func Uint16Value(v *uint16) uint16
- func Uint16ValueMap(src map[string]*uint16) map[string]uint16
- func Uint16ValueSlice(src []*uint16) []uint16
- func Uint32(v uint32) *uint32
- func Uint32Map(src map[string]uint32) map[string]*uint32
- func Uint32Slice(src []uint32) []*uint32
- func Uint32Value(v *uint32) uint32
- func Uint32ValueMap(src map[string]*uint32) map[string]uint32
- func Uint32ValueSlice(src []*uint32) []uint32
- func Uint64(v uint64) *uint64
- func Uint64Map(src map[string]uint64) map[string]*uint64
- func Uint64Slice(src []uint64) []*uint64
- func Uint64Value(v *uint64) uint64
- func Uint64ValueMap(src map[string]*uint64) map[string]uint64
- func Uint64ValueSlice(src []*uint64) []uint64
- func Uint8(v uint8) *uint8
- func Uint8Map(src map[string]uint8) map[string]*uint8
- func Uint8Slice(src []uint8) []*uint8
- func Uint8Value(v *uint8) uint8
- func Uint8ValueMap(src map[string]*uint8) map[string]uint8
- func Uint8ValueSlice(src []*uint8) []uint8
- func UintMap(src map[string]uint) map[string]*uint
- func UintSlice(src []uint) []*uint
- func UintValue(v *uint) uint
- func UintValueMap(src map[string]*uint) map[string]uint
- func UintValueSlice(src []*uint) []uint
- type Config
- func (c *Config) AddInterceptor(interceptor custom.SdkInterceptor) *Config
- func (c *Config) Copy(cfgs ...*Config) *Config
- func (c *Config) MergeIn(cfgs ...*Config)
- func (c *Config) WithAkSk(ak, sk string) *Config
- func (c *Config) WithCredentials(creds *credentials.Credentials) *Config
- func (c *Config) WithCredentialsChainVerboseErrors(verboseErrs bool) *Config
- func (c *Config) WithCustomerUnmarshalData(f custom.CustomerUnmarshalData) *Config
- func (c *Config) WithCustomerUnmarshalError(f custom.CustomerUnmarshalError) *Config
- func (c *Config) WithDisableSSL(disable bool) *Config
- func (c *Config) WithDynamicCredentials(f custom.DynamicCredentials) *Config
- func (c *Config) WithDynamicCredentialsIncludeError(f custom.DynamicCredentialsIncludeError) *Config
- func (c *Config) WithEndpoint(endpoint string) *Config
- func (c *Config) WithEndpointResolver(resolver endpoints.Resolver) *Config
- func (c *Config) WithExtendHttpRequest(extendHttpRequest custom.ExtendHttpRequest) *Config
- func (c *Config) WithExtendHttpRequestWithMeta(extendHttpRequestWithMeta custom.ExtendHttpRequestWithMeta) *Config
- func (c *Config) WithExtraHttpJsonBody(extraHttpJsonBody custom.ExtraHttpJsonBody) *Config
- func (c *Config) WithExtraHttpParameters(extraHttpParameters custom.ExtraHttpParameters) *Config
- func (c *Config) WithExtraHttpParametersWithMeta(extraHttpParametersWithMeta custom.ExtraHttpParametersWithMeta) *Config
- func (c *Config) WithExtraUserAgent(extra *string) *Config
- func (c *Config) WithForceJsonNumberDecode(f custom.ForceJsonNumberDecode) *Config
- func (c *Config) WithHTTPClient(client *http.Client) *Config
- func (c *Config) WithLogAccount(account custom.LogAccount) *Config
- func (c *Config) WithLogLevel(level LogLevelType) *Config
- func (c *Config) WithLogSensitives(sensitives []string) *Config
- func (c *Config) WithLogger(logger Logger) *Config
- func (c *Config) WithMaxRetries(max int) *Config
- func (c *Config) WithRegion(region string) *Config
- func (c *Config) WithSimpleError(simpleError bool) *Config
- func (c *Config) WithSleepDelay(fn func(time.Duration)) *Config
- type Context
- type JSONValue
- type LogLevelType
- type Logger
- type LoggerFunc
- type ReaderSeekerCloser
- func (r ReaderSeekerCloser) Close() error
- func (r ReaderSeekerCloser) GetLen() (int64, error)
- func (r ReaderSeekerCloser) HasLen() (int, bool)
- func (r ReaderSeekerCloser) IsSeeker() bool
- func (r ReaderSeekerCloser) Read(p []byte) (int, error)
- func (r ReaderSeekerCloser) Seek(offset int64, whence int) (int64, error)
- type RequestRetryer
- type WriteAtBuffer
Constants ¶
const SDKName = "volcengine-go-sdk"
SDKName is the name of this volcengine SDK
const SDKVersion = "1.0.52"
SDKVersion is the version of this SDK
const UseServiceDefaultRetries = -1
UseServiceDefaultRetries instructs the config to use the service's own default number of retries. This will be the default action if Config.MaxRetries is nil also.
Variables ¶
var ( // ErrMissingRegion is an error that is returned if region configuration is // not found. ErrMissingRegion = volcengineerr.New("MissingRegion", "could not find region configuration", nil) // ErrMissingEndpoint is an error that is returned if an endpoint cannot be // resolved for a service. ErrMissingEndpoint = volcengineerr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil) )
Functions ¶
func BoolValue ¶
BoolValue returns the value of the bool pointer passed in or false if the pointer is nil.
func BoolValueMap ¶
BoolValueMap converts a string map of bool pointers into a string map of bool values
func BoolValueSlice ¶
BoolValueSlice converts a slice of bool pointers into a slice of bool values
func Float32Map ¶
Float32Map converts a string map of float32 values into a string map of float32 pointers
func Float32Slice ¶
Float32Slice converts a slice of float32 values into a slice of float32 pointers
func Float32Value ¶
Float32Value returns the value of the float32 pointer passed in or 0 if the pointer is nil.
func Float32ValueMap ¶
Float32ValueMap converts a string map of float32 pointers into a string map of float32 values
func Float32ValueSlice ¶
Float32ValueSlice converts a slice of float32 pointers into a slice of float32 values
func Float64Map ¶
Float64Map converts a string map of float64 values into a string map of float64 pointers
func Float64Slice ¶
Float64Slice converts a slice of float64 values into a slice of float64 pointers
func Float64Value ¶
Float64Value returns the value of the float64 pointer passed in or 0 if the pointer is nil.
func Float64ValueMap ¶
Float64ValueMap converts a string map of float64 pointers into a string map of float64 values
func Float64ValueSlice ¶
Float64ValueSlice converts a slice of float64 pointers into a slice of float64 values
func Int16Slice ¶
Int16Slice converts a slice of int16 values into a slice of int16 pointers
func Int16Value ¶
Int16Value returns the value of the int16 pointer passed in or 0 if the pointer is nil.
func Int16ValueMap ¶
Int16ValueMap converts a string map of int16 pointers into a string map of int16 values
func Int16ValueSlice ¶
Int16ValueSlice converts a slice of int16 pointers into a slice of int16 values
func Int32Slice ¶
Int32Slice converts a slice of int32 values into a slice of int32 pointers
func Int32Value ¶
Int32Value returns the value of the int32 pointer passed in or 0 if the pointer is nil.
func Int32ValueMap ¶
Int32ValueMap converts a string map of int32 pointers into a string map of int32 values
func Int32ValueSlice ¶
Int32ValueSlice converts a slice of int32 pointers into a slice of int32 values
func Int64Slice ¶
Int64Slice converts a slice of int64 values into a slice of int64 pointers
func Int64Value ¶
Int64Value returns the value of the int64 pointer passed in or 0 if the pointer is nil.
func Int64ValueMap ¶
Int64ValueMap converts a string map of int64 pointers into a string map of int64 values
func Int64ValueSlice ¶
Int64ValueSlice converts a slice of int64 pointers into a slice of int64 values
func Int8Value ¶
Int8Value returns the value of the int8 pointer passed in or 0 if the pointer is nil.
func Int8ValueMap ¶
Int8ValueMap converts a string map of int8 pointers into a string map of int8 values
func Int8ValueSlice ¶
Int8ValueSlice converts a slice of int8 pointers into a slice of int8 values
func IntValueMap ¶
IntValueMap converts a string map of int pointers into a string map of int values
func IntValueSlice ¶
IntValueSlice converts a slice of int pointers into a slice of int values
func IsReaderSeekable ¶
IsReaderSeekable returns if the underlying reader type can be seeked. A io.Reader might not actually be seekable if it is the ReaderSeekerCloser type.
func JsonNumber ¶
JsonNumber returns a pointer to the json.Number passed in.
func JsonNumberValue ¶
func MillisecondsTimeValue ¶
MillisecondsTimeValue converts an int64 pointer to a time.Time value representing milliseconds sinch Epoch or time.Time{} if the pointer is nil.
func SecondsTimeValue ¶
SecondsTimeValue converts an int64 pointer to a time.Time value representing seconds since Epoch or time.Time{} if the pointer is nil.
func SeekerLen ¶
SeekerLen attempts to get the number of bytes remaining at the seeker's current position. Returns the number of bytes remaining or error.
func SleepWithContext ¶
SleepWithContext will wait for the timer duration to expire, or the context is canceled. Which ever happens first. If the context is canceled the Context's error will be returned.
Expects Context to always return a non-nil error if the Done channel is closed.
func StringMap ¶
StringMap converts a string map of string values into a string map of string pointers
func StringSlice ¶
StringSlice converts a slice of string values into a slice of string pointers
func StringValue ¶
StringValue returns the value of the string pointer passed in or "" if the pointer is nil.
func StringValueMap ¶
StringValueMap converts a string map of string pointers into a string map of string values
func StringValueSlice ¶
StringValueSlice converts a slice of string pointers into a slice of string values
func TimeMap ¶
TimeMap converts a string map of time.Time values into a string map of time.Time pointers
func TimeUnixMilli ¶
TimeUnixMilli returns a Unix timestamp in milliseconds from "January 1, 1970 UTC". The result is undefined if the Unix time cannot be represented by an int64. Which includes calling TimeUnixMilli on a zero Time is undefined.
This utility is useful for service API's such as CloudWatch Logs which require their unix time values to be in milliseconds.
See Go stdlib https://golang.org/pkg/time/#Time.UnixNano for more information.
func TimeValue ¶
TimeValue returns the value of the time.Time pointer passed in or time.Time{} if the pointer is nil.
func TimeValueMap ¶
TimeValueMap converts a string map of time.Time pointers into a string map of time.Time values
func TimeValueSlice ¶
TimeValueSlice converts a slice of time.Time pointers into a slice of time.Time values
func URLHostname ¶
URLHostname will extract the Hostname without port from the URL value.
Wrapper of net/url#URL.Hostname for backwards Go version compatibility.
func Uint16Map ¶
Uint16Map converts a string map of uint16 values into a string map of uint16 pointers
func Uint16Slice ¶
Uint16Slice converts a slice of uint16 values into a slice of uint16 pointers
func Uint16Value ¶
Uint16Value returns the value of the uint16 pointer passed in or 0 if the pointer is nil.
func Uint16ValueMap ¶
Uint16ValueMap converts a string map of uint16 pointers into a string map of uint16 values
func Uint16ValueSlice ¶
Uint16ValueSlice converts a slice of uint16 pointers into a slice of uint16 values
func Uint32Map ¶
Uint32Map converts a string map of uint32 values into a string map of uint32 pointers
func Uint32Slice ¶
Uint32Slice converts a slice of uint32 values into a slice of uint32 pointers
func Uint32Value ¶
Uint32Value returns the value of the uint32 pointer passed in or 0 if the pointer is nil.
func Uint32ValueMap ¶
Uint32ValueMap converts a string map of uint32 pointers into a string map of uint32 values
func Uint32ValueSlice ¶
Uint32ValueSlice converts a slice of uint32 pointers into a slice of uint32 values
func Uint64Map ¶
Uint64Map converts a string map of uint64 values into a string map of uint64 pointers
func Uint64Slice ¶
Uint64Slice converts a slice of uint64 values into a slice of uint64 pointers
func Uint64Value ¶
Uint64Value returns the value of the uint64 pointer passed in or 0 if the pointer is nil.
func Uint64ValueMap ¶
Uint64ValueMap converts a string map of uint64 pointers into a string map of uint64 values
func Uint64ValueSlice ¶
Uint64ValueSlice converts a slice of uint64 pointers into a slice of uint64 values
func Uint8Slice ¶
Uint8Slice converts a slice of uint8 values into a slice of uint8 pointers
func Uint8Value ¶
Uint8Value returns the value of the uint8 pointer passed in or 0 if the pointer is nil.
func Uint8ValueMap ¶
Uint8ValueMap converts a string map of uint8 pointers into a string map of uint8 values
func Uint8ValueSlice ¶
Uint8ValueSlice converts a slice of uint8 pointers into a slice of uint8 values
func UintValue ¶
UintValue returns the value of the uint pointer passed in or 0 if the pointer is nil.
func UintValueMap ¶
UintValueMap converts a string map of uint pointers uinto a string map of uint values
func UintValueSlice ¶
UintValueSlice converts a slice of uint pointers uinto a slice of uint values
Types ¶
type Config ¶
type Config struct { // Enables verbose error printing of all credential chain errors. // Should be used when wanting to see all errors while attempting to // retrieve credentials. CredentialsChainVerboseErrors *bool // The credentials object to use when signing requests. Defaults to a // chain of credential providers to search for credentials in environment // variables, shared credential file, and EC2 Instance Roles. Credentials *credentials.Credentials // An optional endpoint URL (hostname only or fully qualified URI) // that overrides the default generated endpoint for a client. Set this // to `""` to use the default generated endpoint. // // Note: You must still provide a `Region` value when specifying an // endpoint for a client. Endpoint *string // The resolver to use for looking up endpoints for volcengine service clients // to use based on region. EndpointResolver endpoints.Resolver // EnforceShouldRetryCheck is used in the AfterRetryHandler to always call // ShouldRetry regardless of whether or not if request.Retryable is set. // This will utilize ShouldRetry method of custom retryers. If EnforceShouldRetryCheck // is not set, then ShouldRetry will only be called if request.Retryable is nil. // Proper handling of the request.Retryable field is important when setting this field. EnforceShouldRetryCheck *bool // The region to send requests to. This parameter is required and must // be configured globally or on a per-client basis unless otherwise // noted. A full list of regions is found in the "Regions and Endpoints" // document. // // Regions and Endpoints. Region *string // Set this to `true` to disable SSL when sending requests. Defaults // to `false`. DisableSSL *bool // The HTTP client to use when sending requests. Defaults to // `http.DefaultClient`. HTTPClient *http.Client // An integer value representing the logging level. The default log level // is zero (LogOff), which represents no logging. To enable logging set // to a LogLevel Value. LogLevel *LogLevelType // The logger writer interface to write logging messages to. Defaults to // standard out. Logger Logger // The maximum number of times that a request will be retried for failures. // Defaults to -1, which defers the max retry setting to the service // specific configuration. MaxRetries *int // Retryer guides how HTTP requests should be retried in case of // recoverable failures. // // When nil or the value does not implement the request.Retryer interface, // the client.DefaultRetryer will be used. // // When both Retryer and MaxRetries are non-nil, the former is used and // the latter ignored. // // To set the Retryer field in a type-safe manner and with chaining, use // the request.WithRetryer helper function: // // cfg := request.WithRetryer(volcengine.NewConfig(), myRetryer) // Retryer RequestRetryer // SleepDelay is an override for the func the SDK will call when sleeping // during the lifecycle of a request. Specifically this will be used for // request delays. This value should only be used for testing. To adjust // the delay of a request see the volcengine/client.DefaultRetryer and // volcengine/request.Retryer. // // SleepDelay will prevent any Context from being used for canceling retry // delay of an API operation. It is recommended to not use SleepDelay at all // and specify a Retryer instead. SleepDelay func(time.Duration) // DisableRestProtocolURICleaning will not clean the URL path when making rest protocol requests. // Will default to false. This would only be used for empty directory names in s3 requests. // // Example: // sess := session.Must(session.NewSession(&volcengine.Config{ // DisableRestProtocolURICleaning: volcengine.Bool(true), // })) // // svc := s3.New(sess) // out, err := svc.GetObject(&s3.GetObjectInput { // Bucket: volcengine.String("bucketname"), // Key: volcengine.String("//foo//bar//moo"), // }) DisableRestProtocolURICleaning *bool LogSensitives []string DynamicCredentials custom.DynamicCredentials DynamicCredentialsIncludeError custom.DynamicCredentialsIncludeError LogAccount custom.LogAccount ExtendHttpRequest custom.ExtendHttpRequest ExtendHttpRequestWithMeta custom.ExtendHttpRequestWithMeta ExtraHttpParameters custom.ExtraHttpParameters ExtraHttpParametersWithMeta custom.ExtraHttpParametersWithMeta ExtraHttpJsonBody custom.ExtraHttpJsonBody CustomerUnmarshalError custom.CustomerUnmarshalError CustomerUnmarshalData custom.CustomerUnmarshalData ExtraUserAgent *string Interceptors []custom.SdkInterceptor SimpleError *bool ForceJsonNumberDecode custom.ForceJsonNumberDecode }
A Config provides service configuration for service clients. By default, all clients will use the defaults.DefaultConfig structure.
func NewConfig ¶
func NewConfig() *Config
NewConfig returns a new Config pointer that can be chained with builder methods to set multiple configuration values inline without using pointers.
// Create Session with MaxRetries configuration to be shared by multiple // service clients. sess := session.Must(session.NewSession(volcengine.NewConfig(). WithMaxRetries(3), )) // Create S3 service client with a specific Region. svc := s3.New(sess, volcengine.NewConfig(). WithRegion("us-west-2"), )
func (*Config) AddInterceptor ¶
func (c *Config) AddInterceptor(interceptor custom.SdkInterceptor) *Config
func (*Config) Copy ¶
Copy will return a shallow copy of the Config object. If any additional configurations are provided they will be merged into the new config returned.
func (*Config) WithAkSk ¶
WithAkSk sets a config Credentials value returning a Config pointer for chaining.
func (*Config) WithCredentials ¶
func (c *Config) WithCredentials(creds *credentials.Credentials) *Config
WithCredentials sets a config Credentials value returning a Config pointer for chaining.
func (*Config) WithCredentialsChainVerboseErrors ¶
WithCredentialsChainVerboseErrors sets a config verbose errors boolean and returning a Config pointer.
func (*Config) WithCustomerUnmarshalData ¶
func (c *Config) WithCustomerUnmarshalData(f custom.CustomerUnmarshalData) *Config
func (*Config) WithCustomerUnmarshalError ¶
func (c *Config) WithCustomerUnmarshalError(f custom.CustomerUnmarshalError) *Config
func (*Config) WithDisableSSL ¶
WithDisableSSL sets a config DisableSSL value returning a Config pointer for chaining.
func (*Config) WithDynamicCredentials ¶
func (c *Config) WithDynamicCredentials(f custom.DynamicCredentials) *Config
func (*Config) WithDynamicCredentialsIncludeError ¶
func (c *Config) WithDynamicCredentialsIncludeError(f custom.DynamicCredentialsIncludeError) *Config
WithDynamicCredentialsIncludeError sets a config DynamicCredentialsIncludeError value returning a Config pointer for chaining.
func (*Config) WithEndpoint ¶
WithEndpoint sets a config Endpoint value returning a Config pointer for chaining.
func (*Config) WithEndpointResolver ¶
WithEndpointResolver sets a config EndpointResolver value returning a Config pointer for chaining.
func (*Config) WithExtendHttpRequest ¶
func (c *Config) WithExtendHttpRequest(extendHttpRequest custom.ExtendHttpRequest) *Config
func (*Config) WithExtendHttpRequestWithMeta ¶
func (c *Config) WithExtendHttpRequestWithMeta(extendHttpRequestWithMeta custom.ExtendHttpRequestWithMeta) *Config
func (*Config) WithExtraHttpJsonBody ¶
func (c *Config) WithExtraHttpJsonBody(extraHttpJsonBody custom.ExtraHttpJsonBody) *Config
func (*Config) WithExtraHttpParameters ¶
func (c *Config) WithExtraHttpParameters(extraHttpParameters custom.ExtraHttpParameters) *Config
func (*Config) WithExtraHttpParametersWithMeta ¶
func (c *Config) WithExtraHttpParametersWithMeta(extraHttpParametersWithMeta custom.ExtraHttpParametersWithMeta) *Config
func (*Config) WithExtraUserAgent ¶
func (*Config) WithForceJsonNumberDecode ¶
func (c *Config) WithForceJsonNumberDecode(f custom.ForceJsonNumberDecode) *Config
func (*Config) WithHTTPClient ¶
WithHTTPClient sets a config HTTPClient value returning a Config pointer for chaining.
func (*Config) WithLogAccount ¶
func (c *Config) WithLogAccount(account custom.LogAccount) *Config
func (*Config) WithLogLevel ¶
func (c *Config) WithLogLevel(level LogLevelType) *Config
WithLogLevel sets a config LogLevel value returning a Config pointer for chaining.
func (*Config) WithLogSensitives ¶
func (*Config) WithLogger ¶
WithLogger sets a config Logger value returning a Config pointer for chaining.
func (*Config) WithMaxRetries ¶
WithMaxRetries sets a config MaxRetries value returning a Config pointer for chaining.
func (*Config) WithRegion ¶
WithRegion sets a config Region value returning a Config pointer for chaining.
func (*Config) WithSimpleError ¶
type Context ¶
Context is an alias of the Go stdlib's context.Context interface. It can be used within the SDK's API operation "WithContext" methods.
See https://golang.org/pkg/context on how to use contexts.
func BackgroundContext ¶
func BackgroundContext() Context
BackgroundContext returns a context that will never be canceled, has no values, and no deadline. This context is used by the SDK to provide backwards compatibility with non-context API operations and functionality. See https://golang.org/pkg/context for more information on Contexts.
type JSONValue ¶
type JSONValue map[string]interface{}
JSONValue is a representation of a grab bag type that will be marshaled into a json string. This type can be used just like any other map.
Example: values := volcengine.JSONValue{ "Foo": "Bar", } values["Baz"] = "Qux"
type LogLevelType ¶
type LogLevelType uint
A LogLevelType defines the level logging should be performed at. Used to instruct the SDK which statements should be logged.
const ( // LogOff states that no logging should be performed by the SDK. This is the // default state of the SDK, and should be use to disable all logging. LogOff LogLevelType = iota * 0x1000 // LogDebug state that debug output should be logged by the SDK. This should // be used to inspect request made and responses received. LogDebug )
const ( // LogDebugWithSigning states that the SDK should log request signing and // presigning events. This should be used to log the signing details of // requests for debugging. Will also enable LogDebug. LogDebugWithSigning LogLevelType = LogDebug | (1 << iota) // LogDebugWithHTTPBody states the SDK should log HTTP request and response // HTTP bodys in addition to the headers and path. This should be used to // see the volcenginebody content of requests and responses made while using the SDK // Will also enable LogDebug. LogDebugWithHTTPBody // LogDebugWithRequestRetries states the SDK should log when service requests will // be retried. This should be used to log when you want to log when service // requests are being retried. Will also enable LogDebug. LogDebugWithRequestRetries // LogDebugWithRequestErrors states the SDK should log when service requests fail // to build, send, validate, or unmarshal. LogDebugWithRequestErrors // LogDebugWithEventStreamBody states the SDK should log EventStream // request and response bodys. This should be used to log the EventStream // wire unmarshaled message content of requests and responses made while // using the SDK Will also enable LogDebug. LogDebugWithEventStreamBody // LogInfoWithInputAndOutput states the SDK should log STRUCT input and output // Will also enable LogInfo. LogInfoWithInputAndOutput // LogDebugWithInputAndOutput states the SDK should log STRUCT input and output // Will also enable LogDebug. LogDebugWithInputAndOutput )
Debug Logging Sub Levels
func LogLevel ¶
func LogLevel(l LogLevelType) *LogLevelType
LogLevel returns the pointer to a LogLevel. Should be used to workaround not being able to take the address of a non-composite literal.
func (*LogLevelType) AtLeast ¶
func (l *LogLevelType) AtLeast(v LogLevelType) bool
AtLeast returns true if this LogLevel is at least high enough to satisfies v. Is safe to use on nil value LogLevelTypes. If LogLevel is nil, will default to LogOff comparison.
func (*LogLevelType) Matches ¶
func (l *LogLevelType) Matches(v LogLevelType) bool
Matches returns true if the v LogLevel is enabled by this LogLevel. Should be used with logging sub levels. Is safe to use on nil value LogLevelTypes. If LogLevel is nil, will default to LogOff comparison.
func (*LogLevelType) Value ¶
func (l *LogLevelType) Value() LogLevelType
Value returns the LogLevel value or the default value LogOff if the LogLevel is nil. Safe to use on nil value LogLevelTypes.
type Logger ¶
type Logger interface {
Log(...interface{})
}
A Logger is a minimalistic interface for the SDK to log messages to. Should be used to provide custom logging writers for the SDK to use.
func NewDefaultLogger ¶
func NewDefaultLogger() Logger
NewDefaultLogger returns a Logger which will write log messages to stdout, and use same formatting runes as the stdlib log.Logger
type LoggerFunc ¶
type LoggerFunc func(...interface{})
A LoggerFunc is a convenience type to convert a function taking a variadic list of arguments and wrap it so the Logger interface can be used.
func (LoggerFunc) Log ¶
func (f LoggerFunc) Log(args ...interface{})
Log calls the wrapped function with the arguments provided
type ReaderSeekerCloser ¶
type ReaderSeekerCloser struct {
// contains filtered or unexported fields
}
ReaderSeekerCloser represents a reader that can also delegate io.Seeker and io.Closer interfaces to the underlying object if they are available.
func ReadSeekCloser ¶
func ReadSeekCloser(r io.Reader) ReaderSeekerCloser
ReadSeekCloser wraps a io.Reader returning a ReaderSeekerCloser. Allows the SDK to accept an io.Reader that is not also an io.Seeker for unsigned streaming payload API operations.
A ReadSeekCloser wrapping an nonseekable io.Reader used in an API operation's input will prevent that operation being retried in the case of network errors, and cause operation requests to fail if the operation requires payload signing.
Note: If using With S3 PutObject to stream an object upload The SDK's S3 Upload manager (s3manager.Uploader) provides support for streaming with the ability to retry network errors.
func (ReaderSeekerCloser) Close ¶
func (r ReaderSeekerCloser) Close() error
Close closes the ReaderSeekerCloser.
If the ReaderSeekerCloser is not an io.Closer nothing will be done.
func (ReaderSeekerCloser) GetLen ¶
func (r ReaderSeekerCloser) GetLen() (int64, error)
GetLen returns the length of the bytes remaining in the underlying reader. Checks first for Len(), then io.Seeker to determine the size of the underlying reader.
Will return -1 if the length cannot be determined.
func (ReaderSeekerCloser) HasLen ¶
func (r ReaderSeekerCloser) HasLen() (int, bool)
HasLen returns the length of the underlying reader if the value implements the Len() int method.
func (ReaderSeekerCloser) IsSeeker ¶
func (r ReaderSeekerCloser) IsSeeker() bool
IsSeeker returns if the underlying reader is also a seeker.
func (ReaderSeekerCloser) Read ¶
func (r ReaderSeekerCloser) Read(p []byte) (int, error)
Read reads from the reader up to size of p. The number of bytes read, and error if it occurred will be returned.
If the reader is not an io.Reader zero bytes read, and nil error will be returned.
Performs the same functionality as io.Reader Read
func (ReaderSeekerCloser) Seek ¶
func (r ReaderSeekerCloser) Seek(offset int64, whence int) (int64, error)
Seek sets the offset for the next Read to offset, interpreted according to whence: 0 means relative to the origin of the file, 1 means relative to the current offset, and 2 means relative to the end. Seek returns the new offset and an error, if any.
If the ReaderSeekerCloser is not an io.Seeker nothing will be done.
type RequestRetryer ¶
type RequestRetryer interface{}
RequestRetryer is an alias for a type that implements the request.Retryer interface.
type WriteAtBuffer ¶
type WriteAtBuffer struct { // GrowthCoeff defines the growth rate of the internal buffer. By // default, the growth rate is 1, where expanding the internal // buffer will allocate only enough capacity to fit the new expected // length. GrowthCoeff float64 // contains filtered or unexported fields }
A WriteAtBuffer provides a in memory buffer supporting the io.WriterAt interface Can be used with the s3manager.Downloader to download content to a buffer in memory. Safe to use concurrently.
func NewWriteAtBuffer ¶
func NewWriteAtBuffer(buf []byte) *WriteAtBuffer
NewWriteAtBuffer creates a WriteAtBuffer with an internal buffer provided by buf.
func (*WriteAtBuffer) Bytes ¶
func (b *WriteAtBuffer) Bytes() []byte
Bytes returns a slice of bytes written to the buffer.
func (*WriteAtBuffer) WriteAt ¶
func (b *WriteAtBuffer) WriteAt(p []byte, pos int64) (n int, err error)
WriteAt writes a slice of bytes to a buffer starting at the position provided The number of bytes written will be returned, or error. Can overwrite previous written slices if the write ats overlap.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package credentials provides credential retrieval and management
|
Package credentials provides credential retrieval and management |
Package defaults is a collection of helpers to retrieve the SDK's default configuration and handlers.
|
Package defaults is a collection of helpers to retrieve the SDK's default configuration and handlers. |
signer
|
|
Package volcengineerr represents API error interface accessors for the SDK.
|
Package volcengineerr represents API error interface accessors for the SDK. |