rest

package
v1.57.2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const MaxWaitDuration = 1 * time.Minute
View Source
const MinWaitDuration = 1 * time.Second
View Source
const PARAM_NEXT_PAGE_KEY = "nextPageKey"
View Source
const RESPONSE_HEADER_RATE_LIMIT = "X-RateLimit-Limit"
View Source
const RESPONSE_HEADER_RATE_LIMIT_RESET = "X-RateLimit-Reset"

Variables

This section is empty.

Functions

func AddNextPageQueryParams

func AddNextPageQueryParams(u *url.URL, nextPage string) *url.URL

AddNextPageQueryParams handles both Dynatrace v1 and v2 pagination logic. For api/v2 URLs the given next page key will be the only query parameter of the modified URL For any other ULRs the given next page key will be added to existing query parameters

func ApplyMinMaxDefaults

func ApplyMinMaxDefaults(sleepDuration time.Duration) time.Duration

func DeleteConfig

func DeleteConfig(client *http.Client, url string, id string, urlParams map[string]string) error

the name delete() would collide with the built-in function

func GenerateSleepDuration

func GenerateSleepDuration(multiplier int) (duration time.Duration)

func ParseTimeStamp

func ParseTimeStamp(unixTimestampAsString string) (parsedTimestamp int64, err error)

ParseTimeStamp parses and sanity-checks a unix timestamp as string and returns it as int64

Types

type Pagination

type Pagination struct {
	NextPageKey string `json:"nextPageKey"`
	TotalCount  int    `json:"totalCount"`
	PageSize    int    `json:"pageSize"`
}

type Response

type Response struct {
	StatusCode int
	Body       []byte
	Headers    map[string][]string
	Pagination Pagination
}

func Get

func Get(client *http.Client, url string) (response Response, err error)

func PatchMultiPartFile added in v1.55.0

func PatchMultiPartFile(client *http.Client, url string, data *bytes.Buffer, contentType string, urlParams map[string]string) (Response, error)

func Post

func Post(client *http.Client, url string, data []byte) (Response, error)

func PostMultiPartFile

func PostMultiPartFile(client *http.Client, url string, data *bytes.Buffer, contentType string) (Response, error)

func Put

func Put(client *http.Client, url string, data []byte) (Response, error)

func (Response) Is4xxError

func (resp Response) Is4xxError() bool

func (Response) Is5xxError

func (resp Response) Is5xxError() bool

func (Response) SleepDuration

func (resp Response) SleepDuration() (sleepDuration time.Duration, err error)

func (Response) Success

func (resp Response) Success() bool

Jump to

Keyboard shortcuts

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