Documentation
¶
Overview ¶
Copyright (c) 2019 Dell Inc, or its subsidiaries.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2019 Dell Inc, or its subsidiaries.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2022 Dell Inc, or its subsidiaries.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func FetchValueIndexForKey(l string, match string, sep string) (int, int, int)
- func GetSecuredCipherSuites() (suites []uint16)
- func SetSkipAuthForAuthorization(skipAuth bool)
- func WriteIndented(w io.Writer, b []byte) error
- func WriteIndentedN(w io.Writer, b []byte, n int) error
- type Client
- type ClientOptions
- type Error
- type HTMLError
- type JSONError
- type OrderedValues
- func (v *OrderedValues) Add(key, val []byte)
- func (v *OrderedValues) Del(key []byte)
- func (v *OrderedValues) Encode() string
- func (v *OrderedValues) EncodeTo(w io.Writer) error
- func (v *OrderedValues) Get(key []byte) []byte
- func (v *OrderedValues) GetOk(key []byte) ([]byte, bool)
- func (v *OrderedValues) Set(key, val []byte)
- func (v *OrderedValues) String() string
- func (v *OrderedValues) StringAdd(key, val string)
- func (v *OrderedValues) StringDel(key string)
- func (v *OrderedValues) StringGet(key string) string
- func (v *OrderedValues) StringGetOk(key string) (string, bool)
- func (v *OrderedValues) StringSet(key, val string)
- type SafeHeader
- type VerboseType
Constants ¶
const (
LevelKey contextKey = iota
)
Variables ¶
This section is empty.
Functions ¶
func FetchValueIndexForKey ¶
func GetSecuredCipherSuites ¶
func GetSecuredCipherSuites() (suites []uint16)
GetSecuredCipherSuites returns a set of secure cipher suites.
func SetSkipAuthForAuthorization ¶ added in v1.22.0
func SetSkipAuthForAuthorization(skipAuth bool)
SetSkipAuthForAuthorization sets the global flag to skip authentication for authorization mode
func WriteIndented ¶
WriteIndented indents all lines four spaces.
Types ¶
type Client ¶
type Client interface {
// Do sends an HTTP request to the OneFS API.
Do(
ctx context.Context,
method, path, id string,
params OrderedValues,
body, resp interface{}) error
// DoWithHeaders sends an HTTP request to the OneFS API.
DoWithHeaders(
ctx context.Context,
method, path, id string,
params OrderedValues, headers map[string]string,
body, resp interface{}) error
// Get sends an HTTP request using the GET method to the OneFS API.
Get(
ctx context.Context,
path, id string,
params OrderedValues, headers map[string]string,
resp interface{}) error
// Post sends an HTTP request using the POST method to the OneFS API.
Post(
ctx context.Context,
path, id string,
params OrderedValues, headers map[string]string,
body, resp interface{}) error
// Put sends an HTTP request using the PUT method to the OneFS API.
Put(
ctx context.Context,
path, id string,
params OrderedValues, headers map[string]string,
body, resp interface{}) error
// Delete sends an HTTP request using the DELETE method to the OneFS API.
Delete(
ctx context.Context,
path, id string,
params OrderedValues, headers map[string]string,
resp interface{}) error
// APIVersion returns the API version.
APIVersion() uint8
// User returns the user name used to access the OneFS API.
User() string
// Group returns the group name used to access the OneFS API.
Group() string
// VolumesPath returns the client's configured volumes path.
VolumesPath() string
// VolumePath returns the path to a volume with the provided name.
VolumePath(name string) string
// SetAuthToken sets the Auth token/Cookie for the HTTP client
SetAuthToken(token string)
// SetCSRFToken sets the Auth token for the HTTP client
SetCSRFToken(csrf string)
// SetReferer sets the Referer header
SetReferer(referer string)
// GetAuthToken gets the Auth token/Cookie for the HTTP client
GetAuthToken() string
// GetCSRFToken gets the CSRF token for the HTTP client
GetCSRFToken() string
// GetReferer gets the Referer header
GetReferer() string
// SetCustomHTTPHeaders sets custom HTTP headers that will be sent with every request
SetCustomHTTPHeaders(headers http.Header)
// GetCustomHTTPHeaders returns the current custom HTTP headers
GetCustomHTTPHeaders() http.Header
}
Client is an API client.
type ClientOptions ¶
type ClientOptions struct {
// Insecure is a flag that indicates whether or not to supress SSL errors.
Insecure bool
// VolumesPath is the location on the Isilon server where volumes are
// stored.
VolumesPath string
// VolumesPathPermissions is the directory permissions for VolumesPath
VolumesPathPermissions string
// IgnoreUnresolvableHosts is the unresolvable hosts param from platform
IgnoreUnresolvableHosts bool
// CAFilePath is the path to the CA file
CAFilePath string
// Timeout specifies a time limit for requests made by this client.
Timeout time.Duration
}
ClientOptions are options for the API client.
type Error ¶
type Error struct {
Code string `json:"code"`
Field string `json:"field"`
Message string `json:"message"`
}
Error is an API error.
type OrderedValues ¶
type OrderedValues [][][]byte
OrderedValues maps a string key to a list of values and preserves insertion order of the keys. It is typically used for query parameters and form values. Unlike in the http.Header map, the keys in a Values map are case-sensitive.
func NewOrderedValues ¶
func NewOrderedValues(vals [][]string) OrderedValues
NewOrderedValues returns a new OrderedValues object.
func ParseQuery ¶
func ParseQuery(query string) (OrderedValues, error)
ParseQuery parses the URL-encoded query string and returns an OrderedValues object. ParseQuery may return nil if no valid query parameters are found. The return error object is set to the first encountered decoding error, if any.
func StructToOrderedValues ¶
func StructToOrderedValues(s interface{}) OrderedValues
StructToOrderedValues returns ordered value
func (*OrderedValues) Add ¶
func (v *OrderedValues) Add(key, val []byte)
Add adds the value to key. It appends to any existing values associated with key.
func (*OrderedValues) Del ¶
func (v *OrderedValues) Del(key []byte)
Del deletes the values associated with key.
func (*OrderedValues) Encode ¶
func (v *OrderedValues) Encode() string
Encode encodes the values into “URL encoded” form ("bar=baz&foo=quux") using insertion order.
func (*OrderedValues) EncodeTo ¶
func (v *OrderedValues) EncodeTo(w io.Writer) error
EncodeTo encodes the values into “URL encoded” form ("bar=baz&foo=quux") using insertion order.
func (*OrderedValues) Get ¶
func (v *OrderedValues) Get(key []byte) []byte
Get gets the first value associated with the given key. If there are no values associated with the key, Get returns the empty string. To access multiple values, use the array directly.
func (*OrderedValues) GetOk ¶
func (v *OrderedValues) GetOk(key []byte) ([]byte, bool)
GetOk returns a flag indicating whether or not the key exists. The Get method can return an empty value for keys that do not have values, so it cannot be trusted to indicate the existence of a key.
func (*OrderedValues) Set ¶
func (v *OrderedValues) Set(key, val []byte)
Set sets the key to value. It replaces any existing values.
func (*OrderedValues) String ¶
func (v *OrderedValues) String() string
func (*OrderedValues) StringAdd ¶
func (v *OrderedValues) StringAdd(key, val string)
StringAdd adds the value to key. It appends to any existing values associated with key.
func (*OrderedValues) StringDel ¶
func (v *OrderedValues) StringDel(key string)
StringDel deletes the values associated with key.
func (*OrderedValues) StringGet ¶
func (v *OrderedValues) StringGet(key string) string
StringGet gets the first value associated with the given key. If there are no values associated with the key, Get returns the empty string. To access multiple values, use the array directly.
func (*OrderedValues) StringGetOk ¶
func (v *OrderedValues) StringGetOk(key string) (string, bool)
StringGetOk returns a flag indicating whether or not the key exists. The StringGet method can return an empty value for keys that do not have values, so it cannot be trusted to indicate the existence of a key.
func (*OrderedValues) StringSet ¶
func (v *OrderedValues) StringSet(key, val string)
StringSet sets the key to value. It replaces any existing values.
type SafeHeader ¶ added in v1.22.0
type SafeHeader struct {
// contains filtered or unexported fields
}
SafeHeader provides thread-safe storage for HTTP headers
func NewSafeHeader ¶ added in v1.22.0
func NewSafeHeader() *SafeHeader
NewSafeHeader creates a new SafeHeader instance
func (*SafeHeader) GetHeader ¶ added in v1.22.0
func (s *SafeHeader) GetHeader() http.Header
GetHeader safely returns a copy of the HTTP headers
func (*SafeHeader) SetHeader ¶ added in v1.22.0
func (s *SafeHeader) SetHeader(h http.Header)
SetHeader safely sets the HTTP headers
type VerboseType ¶
type VerboseType uint
const ( VerboseHigh VerboseType = 0 VerboseMedium VerboseType = 1 VerboseLow VerboseType = 2 )