restapi

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

View Source
const (
	SourceHeader string = "golang-sdk"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseAPIResponse

type BaseAPIResponse struct {
	Success   bool `json:"success"`
	Result    json.RawMessage
	Message   string
	Exception string
}

BaseAPIResponse represents the most basic standard Centrify API response,

where Result itself is left as raw json

type BoolResponse

type BoolResponse struct {
	BaseAPIResponse
	Result bool
}

type GenericMapResponse

type GenericMapResponse struct {
	BaseAPIResponse
	Result map[string]interface{}
}

GenericMapResponse represents Centrify API responses where results are map[string]interface{},

this type allows direct access to these without further decoding.

type HttpClientFactory

type HttpClientFactory func() *http.Client

type HttpError

type HttpError struct {
	StatusCode int // HTTP status
	// contains filtered or unexported fields
}

type RestClient

type RestClient struct {
	Service         string
	Client          *http.Client
	Headers         map[string]string
	SourceHeader    string
	ResponseHeaders http.Header
}

RestClient represents a stateful API client (cookies maintained between calls, single service etc)

func GetNewRestClient

func GetNewRestClient(service string, httpFactory HttpClientFactory) (*RestClient, error)

GetNewRestClient creates a new RestClient for the specified endpoint. If a factory for creating

http.Client's is not provided, you'll get a new: &http.Client{}.

func (*RestClient) CallBaseAPI

func (r *RestClient) CallBaseAPI(method string, args map[string]interface{}) (*BaseAPIResponse, error)

func (*RestClient) CallBoolAPI

func (r *RestClient) CallBoolAPI(method string, args map[string]interface{}) (*BoolResponse, error)

func (*RestClient) CallGenericMapAPI

func (r *RestClient) CallGenericMapAPI(method string, args map[string]interface{}) (*GenericMapResponse, error)

func (*RestClient) CallGenericMapListAPI

func (r *RestClient) CallGenericMapListAPI(method string, args []map[string]interface{}) (*GenericMapResponse, error)

CallGenericMapListAPI is currently used by admin right assignment and removal for Role

func (*RestClient) CallRawAPI

func (r *RestClient) CallRawAPI(method string, args map[string]interface{}) ([]byte, error)

func (*RestClient) CallSliceAPI

func (r *RestClient) CallSliceAPI(method string, args map[string]interface{}) (*SliceResponse, error)

func (*RestClient) CallStringAPI

func (r *RestClient) CallStringAPI(method string, args map[string]interface{}) (*StringResponse, error)

func (*RestClient) DownloadFile added in v0.1.3

func (r *RestClient) DownloadFile(method string, args map[string]interface{}, filepath string) error

func (*RestClient) GetLastResponseHeaders

func (r *RestClient) GetLastResponseHeaders() http.Header

GetLastResponseHeaders returns the response headers from last REST call

type RestClientMode

type RestClientMode uint32

type SliceResponse

type SliceResponse struct {
	BaseAPIResponse
	Result []interface{}
}

type StringResponse

type StringResponse struct {
	BaseAPIResponse
	Result string
}

Jump to

Keyboard shortcuts

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