oktapi

package
v0.0.0-...-be1fdc1 Latest Latest
Warning

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

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

README

Go API client for oktapi

The Okta System Log API (https://developer.okta.com/docs/api/resources/system_log) provides read access to your organization's system log. The API is intended to export event data as a batch job from your organization to another system for reporting or analysis.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit github.com/forter

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional

Put the package under your project folder and add the following in import:

import "./oktapi"

Documentation for API Endpoints

All URIs are relative to https://example.okta.com/api/v1

Class Method HTTP request Description
LogsApi GetLogs Get /logs Get logs

Documentation For Models

Documentation For Authorization

ApiKeyAuth

  • Type: API key

Example

auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
	Key: "APIKEY",
	Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)

Author

rnd@forter.com

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	LogsApi *LogsApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the System Log (Okta API) API v1.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the OpenAPI operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type Actor

type Actor struct {
	Id           string                 `json:"id"`
	Type         string                 `json:"type"`
	AleternateId string                 `json:"aleternateId,omitempty"`
	DisplayName  string                 `json:"displayName,omitempty"`
	DetailEntry  map[string]interface{} `json:"detailEntry,omitempty"`
}

type AuthenticationContext

type AuthenticationContext struct {
	AuthenticationProvider string                 `json:"authenticationProvider,omitempty"`
	CredentialProvider     string                 `json:"credentialProvider,omitempty"`
	CredentialType         string                 `json:"credentialType,omitempty"`
	Issuer                 map[string]interface{} `json:"issuer,omitempty"`
	ExternalSessionId      string                 `json:"externalSessionId,omitempty"`
	Interface              string                 `json:"interface,omitempty"`
}

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type Client

type Client struct {
	UserAgent           ClientUserAgent           `json:"userAgent,omitempty"`
	GeographicalContext ClientGeographicalContext `json:"geographicalContext,omitempty"`
	Zone                string                    `json:"zone,omitempty"`
	IpAddress           string                    `json:"ipAddress,omitempty"`
	Device              string                    `json:"device,omitempty"`
	Id                  string                    `json:"id,omitempty"`
}

type ClientGeographicalContext

type ClientGeographicalContext struct {
	Geolocation ClientGeographicalContextGeolocation `json:"geolocation,omitempty"`
	City        string                               `json:"city,omitempty"`
	State       string                               `json:"state,omitempty"`
	Country     string                               `json:"country,omitempty"`
	PostalCode  string                               `json:"postalCode,omitempty"`
}

type ClientGeographicalContextGeolocation

type ClientGeographicalContextGeolocation struct {
	Lat float32 `json:"lat,omitempty"`
	Lon float32 `json:"lon,omitempty"`
}

type ClientUserAgent

type ClientUserAgent struct {
	RawUserAgent string `json:"rawUserAgent,omitempty"`
	Os           string `json:"os,omitempty"`
	Browser      string `json:"browser,omitempty"`
}

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	HTTPClient    *http.Client
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

type GenericOpenAPIError

type GenericOpenAPIError struct {
	// contains filtered or unexported fields
}

GenericOpenAPIError Provides access to the body, error and model on returned errors.

func (GenericOpenAPIError) Body

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an error.

func (GenericOpenAPIError) Model

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

type GetLogsOpts

type GetLogsOpts struct {
	Since     optional.String
	Until     optional.String
	After     optional.String
	Filter    optional.String
	Q         optional.String
	SortOrder optional.String
	Limit     optional.Int32
}

type LogEvent

type LogEvent struct {
	Actor                 Actor                  `json:"actor"`
	Uuid                  string                 `json:"uuid"`
	Published             string                 `json:"published"`
	EventType             string                 `json:"eventType"`
	Version               string                 `json:"version"`
	Severity              string                 `json:"severity"`
	LegacyEventType       string                 `json:"legacyEventType,omitempty"`
	DisplayMessage        string                 `json:"displayMessage,omitempty"`
	Client                Client                 `json:"client,omitempty"`
	Outcome               LogEventOutcome        `json:"outcome,omitempty"`
	Target                []Target               `json:"target,omitempty"`
	Transaction           Transaction            `json:"transaction,omitempty"`
	DebugContext          map[string]interface{} `json:"debugContext,omitempty"`
	AuthenticationContext AuthenticationContext  `json:"authenticationContext,omitempty"`
	SecurityContext       SecurityContext        `json:"securityContext,omitempty"`
	Request               map[string]interface{} `json:"request,omitempty"`
}

Log Events from Syslog

type LogEventActor

type LogEventActor struct {
	Id           string                 `json:"id,omitempty"`
	Type         string                 `json:"type,omitempty"`
	AleternateId string                 `json:"aleternateId,omitempty"`
	DisplayName  string                 `json:"displayName,omitempty"`
	DetailEntry  map[string]interface{} `json:"detailEntry,omitempty"`
}

type LogEventOutcome

type LogEventOutcome struct {
	Result string `json:"result"`
	Reason string `json:"reason,omitempty"`
}

type LogEventTransaction

type LogEventTransaction struct {
	Id     string                 `json:"id,omitempty"`
	Type   string                 `json:"type,omitempty"`
	Detail map[string]interface{} `json:"detail,omitempty"`
}

type LogsApiService

type LogsApiService service

func (*LogsApiService) GetLogs

func (a *LogsApiService) GetLogs(ctx context.Context, localVarOptionals *GetLogsOpts) ([]LogEvent, *http.Response, error)

type SecurityContext

type SecurityContext struct {
	AsNumber float32 `json:"asNumber,omitempty"`
	AsOrg    string  `json:"asOrg,omitempty"`
	Isp      string  `json:"isp,omitempty"`
	Domain   string  `json:"domain,omitempty"`
	IsProxy  bool    `json:"isProxy,omitempty"`
}

type Target

type Target struct {
	Id          string                 `json:"id"`
	Type        string                 `json:"type"`
	AlternateId string                 `json:"alternateId,omitempty"`
	DisplayName string                 `json:"displayName,omitempty"`
	DetailEntry map[string]interface{} `json:"detailEntry,omitempty"`
}

type Transaction

type Transaction struct {
	Id     string                 `json:"id,omitempty"`
	Type   string                 `json:"type,omitempty"`
	Detail map[string]interface{} `json:"detail,omitempty"`
}

Jump to

Keyboard shortcuts

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