Documentation ¶
Index ¶
- type Client
- func (c Client) BuildEmptyPutRequest(endpoint string) (*http.Request, error)
- func (c Client) BuildGetRequest(endpoint string) (*http.Request, error)
- func (c Client) BuildPostRequest(endpoint string, content string) (*http.Request, error)
- func (c Client) BuildPutRequest(endpoint string, content string) (*http.Request, error)
- func (c Client) Do(req *http.Request) (*http.Response, error)
- func (c Client) Sign(method string, endpoint string, content string) (string, error)
- type HTTPError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { AppID string AppKey string Host string Port int Realm string SSL bool BypassCertValidation bool }
Client : struct to hold configuration information for connecting to the SecureAuth APIs.
func NewClient ¶
func NewClient(appID string, appKey string, host string, port int, realm string, ssl bool, bypassCert bool) (*Client, error)
NewClient :
Helper function to create a Client struct.
Parameters:
[Required] appId: SecureAuth API AppId. [Required] appKey: SecureAuth API AppKey. [Required] host: the host name (fully qualified/dns route-able) of the SecureAuth server. [Required] port: the port that SecureAuth's web service is running on. [Required] realm: the SecureAuth realm that will be serving the APIs. [Required] ssl: if the SecureAuth realm/web service is running over ssl, set to true. [Required] bypassCert: bypass certificate validation.
Returns:
Client: a pointer to a client struct with the supplied values. Error: If an error is encountered, response will be nil and the error must be handled
func (Client) BuildEmptyPutRequest ¶
BuildEmptyPutRequest :
Function to supporting the building of put requests without content for each service package. Will handle signing and creation of the auth header as well as timestamp and other headers needed.
Parameters:
[Required] c: passing in the client containing authorization and host information. [Required] endpoint: the api endpoint (after the SecureAuth# realm) that the get will be performed against.
Returns:
http.Request: Http Request struct that can be used via Http Client to make the request. Error: If an error is encountered, response will be nil and the error must be handled.
func (Client) BuildGetRequest ¶
BuildGetRequest :
Function supporting the building of get requests for each service package. Will handle signing and creation of the auth header as well as timestamp and other headers needed.
Parameters:
[Required] c: passing in the client containing authorization and host information. [Required] endpoint: the api endpoint (after the SecureAuth# realm) that the get will be performed against.
Returns:
http.Request: Http Request struct that can be used via Http Client to make the request. Error: If an error is encountered, response will be nil and the error must be handled.
func (Client) BuildPostRequest ¶
BuildPostRequest :
Function supporting the building of post requests for each service package. Will handle signing and creation of the auth header as well as timestamp and other headers needed.
Parameters:
[Required] c: passing in the client containing authorization and host information. [Required] endpoint: the api endpoint (after the SecureAuth# realm) that the get will be performed against. [Required] content: the json content to be posted to the api endpoint.
Returns:
http.Request: Http Request struct that can be used via Http Client to make the request. Error: If an error is encountered, response will be nil and the error must be handled.
func (Client) BuildPutRequest ¶
BuildPutRequest :
Function supporting the building of put requests for each service package. Will handle signing and creation of the auth header as well as timestamp and other headers needed.
Parameters:
[Required] c: passing in the client containing authorization and host information. [Required] endpoint: the api endpoint (after the SecureAuth# realm) that the get will be performed against. [Required] content: the json content to be put to the api endpoint.
Returns:
http.Request: Http Request struct that can be used via Http Client to make the request. Error: If an error is encountered, response will be nil and the error must be handled.
func (Client) Do ¶
Do :
Function to execute a Http Request.
Parameters:
[Required] c: passing in the client containing authorization and host information. [Required] req: http.Request struct to execute.
Returns:
http.Response: Http Response struct that can be used to get the body for the api response. Error: If an error is encountered, response will be nil and the error must be handled.
func (Client) Sign ¶
Sign :
Function to create the Authorization headed needed to perform API calls to SecureAuth.
Parameters:
[Required] c: passing in the client containing authorization and host information. [Required] method: the http verb of the method being used (GET, POST, PUT) [Required] endpoint: the api endpoint (after the SecureAuth# realm) that the get will be performed against. content: the json content to be put to the api endpoint.
Returns:
string: Authorization header string. Error: If an error is encountered, response will be nil and the error must be handled.
Click to show internal directories.
Click to hide internal directories.