response

package
v0.12.12 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticatorStatusJSONResponse added in v0.12.5

func AuthenticatorStatusJSONResponse(resp *http.Response, obj interface{}) error

AuthenticatorStatusJSONResponse checks the HTTP status of the response. If it's less than 300 or equal to 500, it returns the response body as JSON. Otherwise it returns a NewConjurError.

func DataResponse added in v0.3.0

func DataResponse(resp *http.Response) ([]byte, error)

DataResponse checks the HTTP status of the response. If it's less than 300, it returns the response body as a byte array. Otherwise it returns a NewConjurError.

func DryRunPolicyJSONResponse added in v0.12.3

func DryRunPolicyJSONResponse(resp *http.Response, obj interface{}) error

DryRunPolicyJSONResponse checks the HTTP status of the response. If it's less than 300 or equal to 422, it returns the response body as JSON. Otherwise it returns a NewConjurError.

func EmptyResponse

func EmptyResponse(resp *http.Response) error

EmptyResponse checks the HTTP status of the response. If it's less than 300, it returns without an error. Otherwise it returns a NewConjurError.

func JSONResponse

func JSONResponse(resp *http.Response, obj interface{}) error

JSONResponse checks the HTTP status of the response. If it's less than 300, it returns the response body as JSON. Otherwise it returns a NewConjurError.

func JSONResponseWithAllowedStatusCodes added in v0.12.5

func JSONResponseWithAllowedStatusCodes(resp *http.Response, obj interface{}, allowedStatusCodes []int) error

JSONResponseWithAllowedStatusCodes checks the HTTP status of the response. If it's less than 300 or equal to one of the provided values, it returns the response body as JSON. Otherwise it returns a NewConjurError.

func NewConjurError

func NewConjurError(resp *http.Response) error

func SecretDataResponse

func SecretDataResponse(resp *http.Response) (io.ReadCloser, error)

SecretDataResponse checks the HTTP status of the response. If it's less than 300, it returns the response body as a stream. Otherwise it returns a NewConjurError.

Types

type ConjurError

type ConjurError struct {
	Code    int
	Message string
	Details *ConjurErrorDetails `json:"error"`
}

func (*ConjurError) Error

func (cerr *ConjurError) Error() string

type ConjurErrorDetails

type ConjurErrorDetails struct {
	Message string
	Code    string
	Target  string
	Details map[string]interface{}
}

Jump to

Keyboard shortcuts

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