connclient

package
v0.0.0-...-a892768 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Copyright (c) 2022, SailPoint Technologies, Inc. All rights reserved.

Copyright (c) 2023, SailPoint Technologies, Inc. All rights reserved.

Index

Constants

View Source
const (
	ResponseTypeOutput = "output"
	ResponseTypeState  = "state"
)
View Source
const LogsEndpoint = "/beta/platform-logs/query"
View Source
const StatsEndpoint = "/beta/platform-logs/stats"
View Source
const TimeFormatLocal = `2006-01-02T15:04:05.000-07:00`
View Source
const TimeLocationLocal = "Local"

Variables

This section is empty.

Functions

func ParseTime

func ParseTime(timeStr string, currentTime time.Time) (time.Time, error)

Parse the input string into a time.Time object. Provide the currentTime as a parameter to support relative time.

Types

type Account

type Account struct {
	Identity   string                 `json:"identity"`
	UUID       string                 `json:"uuid"`
	Key        Key                    `json:"key"`
	Attributes map[string]interface{} `json:"attributes"`
}

Account is an sail connect account. The is used for AccountList, AccountRead and AccountUpdate commands.

func (*Account) ID

func (a *Account) ID() string

func (*Account) UniqueID

func (a *Account) UniqueID() string

type AccountCreateTemplate

type AccountCreateTemplate struct {
	Fields []AccountCreateTemplateField `json:"fields"`
}

type AccountCreateTemplateField

type AccountCreateTemplateField struct {
	// Deprecated
	Name string `json:"name"`

	Key          string               `json:"key"`
	Type         string               `json:"type"`
	Required     bool                 `json:"required"`
	InitialValue TemplateInitialValue `json:"initialValue"`
}

type AccountSchema

type AccountSchema struct {
	DisplayAttribute  string                   `json:"displayAttribute"`
	GroupAttribute    string                   `json:"groupAttribute"`
	IdentityAttribute string                   `json:"identityAttribute"`
	Attributes        []AccountSchemaAttribute `json:"attributes"`
}

type AccountSchemaAttribute

type AccountSchemaAttribute struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Description string `json:"description"`

	Entitlement bool `json:"entitlement"`
	Managed     bool `json:"managed"`
	Multi       bool `json:"multi"`

	// Writable is not a standard spec field, yet
	Writable bool `json:"writable"`
}

type AttributeChange

type AttributeChange struct {
	Op        string      `json:"op"`
	Attribute string      `json:"attribute"`
	Value     interface{} `json:"value"`
}

AttributeChange describes a change to a specific attribute

type CommandStats

type CommandStats struct {
	CommandType     string  `json:"commandType"`
	InvocationCount uint32  `json:"invocationCount"`
	ErrorCount      uint32  `json:"errorCount"`
	ErrorRate       float64 `json:"errorRate"`
	ElapsedAvg      float64 `json:"elapsedAvg"`
	Elapsed95th     float64 `json:"elapsed95th"`
}

func (CommandStats) Columns

func (c CommandStats) Columns() []string

type CompoundKey

type CompoundKey struct {
	LookupID string `json:"lookupId"`
	UniqueID string `json:"uniqueId"`
}

type ConnClient

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

ConnClient is an sail connect client for a specific connector

func NewConnClient

func NewConnClient(client client.Client, version *int, config json.RawMessage, connectorRef string, endpoint string) *ConnClient

NewConnClient returns a client for the provided (connectorID, version, config)

func (*ConnClient) AccountCreate

func (cc *ConnClient) AccountCreate(ctx context.Context, identity *string, attributes map[string]interface{}, schema map[string]interface{}) (account *Account, raw []byte, err error)

AccountCreate creats an account

func (*ConnClient) AccountDelete

func (cc *ConnClient) AccountDelete(ctx context.Context, id string, uniqueID string, schema map[string]interface{}) (raw []byte, err error)

AccountDelete deletes an account

func (*ConnClient) AccountDiscoverSchema

func (cc *ConnClient) AccountDiscoverSchema(ctx context.Context) (accountSchema *AccountSchema, rawResponse []byte, err error)

AccountDiscoverSchema discovers schema for accounts

func (*ConnClient) AccountList

func (cc *ConnClient) AccountList(ctx context.Context, stateful *bool, stateId *string, schema map[string]interface{}) (accounts []Account, state json.RawMessage, printable []byte, err error)

AccountList lists all accounts

func (*ConnClient) AccountRead

func (cc *ConnClient) AccountRead(ctx context.Context, id string, uniqueID string, schema map[string]interface{}) (account *Account, rawResponse []byte, err error)

AccountRead reads a specific account

func (*ConnClient) AccountUpdate

func (cc *ConnClient) AccountUpdate(ctx context.Context, id string, uniqueID string, changes []AttributeChange, schema map[string]interface{}) (account *Account, rawResponse []byte, err error)

AccountUpdate updates an account

func (*ConnClient) BuildAccountSchema

func (cc *ConnClient) BuildAccountSchema(spec *ConnSpec) map[string]interface{}

Builds account schema that is used as cmd input

func (*ConnClient) BuildEntitlementSchema

func (cc *ConnClient) BuildEntitlementSchema(spec *ConnSpec) map[string]interface{}

Builds entitlement schema that is used as cmd input

func (*ConnClient) ChangePassword

func (cc *ConnClient) ChangePassword(ctx context.Context, identity string, uniqueID string, password string) (rawResponse []byte, err error)

ChangePassword runs the std:change-password command

func (*ConnClient) EntitlementList

func (cc *ConnClient) EntitlementList(ctx context.Context, t string, stateful *bool, stateId *string, schema map[string]interface{}) (entitlements []Entitlement, state json.RawMessage, printable []byte, err error)

EntitlementList lists all entitlements

func (*ConnClient) EntitlementRead

func (cc *ConnClient) EntitlementRead(ctx context.Context, id string, uniqueID string, t string, schema map[string]interface{}) (entitlement *Entitlement, rawResponse []byte, err error)

EntitlementRead reads all entitlements

func (*ConnClient) Invoke

func (cc *ConnClient) Invoke(ctx context.Context, cmdType string, input json.RawMessage) (rawResponse []byte, err error)

Invoke allows you to send an arbitrary json payload as a command

func (*ConnClient) SourceDataDiscover

func (cc *ConnClient) SourceDataDiscover(ctx context.Context, queryInput map[string]any) (sData []sourceData, raw []byte, err error)

func (*ConnClient) SourceDataRead

func (cc *ConnClient) SourceDataRead(ctx context.Context, sourceDataKey string, queryInput map[string]any) (sData []sourceData, raw []byte, err error)

func (*ConnClient) SpecRead

func (cc *ConnClient) SpecRead(ctx context.Context) (connSpec *ConnSpec, err error)

SpecRead issues a custom:config command which is expected to return the connector specification. This is an experimental command used by the validation suite.

func (*ConnClient) TestConnection

func (cc *ConnClient) TestConnection(ctx context.Context) (rawResponse []byte, err error)

TestConnection runs the std:test-connection command

func (*ConnClient) TestConnectionWithConfig

func (cc *ConnClient) TestConnectionWithConfig(ctx context.Context, cfg json.RawMessage) error

TestConnectionWithConfig provides a way to run std:test-connection with an arbitrary config

type ConnSpec

type ConnSpec struct {
	Name                  string                `json:"name"`
	Commands              []string              `json:"commands"`
	AccountCreateTemplate AccountCreateTemplate `json:"accountCreateTemplate"`
	AccountSchema         AccountSchema         `json:"accountSchema"`
	EntitlementSchemas    []EntitlementSchema   `json:"entitlementSchemas"`
}

ConnSpec is a connector config. See ConnConfig method.

type ConnectorStats

type ConnectorStats struct {
	ConnectorID    string         `json:"connectorID"`
	ConnectorAlias string         `json:"alias"`
	Stats          []CommandStats `json:"stats"`
}

type Entitlement

type Entitlement struct {
	Identity   string                 `json:"identity"`
	UUID       string                 `json:"uuid"`
	Key        Key                    `json:"key"`
	Attributes map[string]interface{} `json:"attributes"`
}

Entitlement is an sail connect entitlement, used for EntitlementList and EntitlementRead

func (*Entitlement) ID

func (a *Entitlement) ID() string

func (*Entitlement) UniqueID

func (a *Entitlement) UniqueID() string

type EntitlementSchema

type EntitlementSchema struct {
	Type               string                       `json:"type"`
	DisplayAttribute   string                       `json:"displayAttribute"`
	IdentityAttribute  string                       `json:"identityAttribute"`
	HierarchyAttribute string                       `json:"hierarchyAttribute"`
	Attributes         []EntitlementSchemaAttribute `json:"attributes"`
}

type EntitlementSchemaAttribute

type EntitlementSchemaAttribute struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Description string `json:"description"`

	Multi    bool `json:"multi"`
	Required bool `json:"required"`
}

type Key

type Key struct {
	Simple   *SimpleKey   `json:"simple,omitempty"`
	Compound *CompoundKey `json:"compound,omitempty"`
}

func NewCompoundKey

func NewCompoundKey(lookupID string, uniqueID string) Key

func NewSimpleKey

func NewSimpleKey(id string) Key

type LogEvents

type LogEvents struct {
	// The token for the next set of items in the forward direction. If you have reached the
	// end of the stream, it returns the same token you passed in.
	NextToken *string `json:"nextToken,omitempty"`
	//The log messages
	Logs []LogMessage `json:"logs"`
}

type LogFilter

type LogFilter struct {
	StartTime  *time.Time `json:"startTime,omitempty"`
	EndTime    *time.Time `json:"endTime,omitempty"`
	Component  string     `json:"component,omitempty"`
	LogLevels  []string   `json:"logLevels,omitempty"`
	TargetID   string     `json:"targetID,omitempty"`
	TargetName string     `json:"targetName,omitempty"`
	RequestID  string     `json:"requestID,omitempty"`
	Event      string     `json:"event,omitempty"`
}

type LogInput

type LogInput struct {
	Filter    LogFilter `json:"filter"`
	NextToken string    `json:"nextToken"`
}

type LogMessage

type LogMessage struct {
	TenantID   string      `json:"tenantID"`
	Timestamp  time.Time   `json:"timestamp"`
	Level      string      `json:"level"`
	Event      string      `json:"event"`
	Component  string      `json:"component"`
	TargetID   string      `json:"targetID"`
	TargetName string      `json:"targetName"`
	RequestID  string      `json:"requestID"`
	Message    interface{} `json:"message"`
}

func (LogMessage) MessageString

func (l LogMessage) MessageString() string

func (LogMessage) RawString

func (l LogMessage) RawString() string

func (LogMessage) TimestampFormatted

func (l LogMessage) TimestampFormatted() string

type LogsClient

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

func NewLogsClient

func NewLogsClient(client client.Client, endpoint string) *LogsClient

NewConnClient returns a client for the provided (connectorID, version, config)

func (*LogsClient) GetLogs

func (c *LogsClient) GetLogs(ctx context.Context, logInput LogInput) (*LogEvents, error)

func (*LogsClient) GetStats

func (c *LogsClient) GetStats(ctx context.Context, from time.Time, connectorID string) (*TenantStats, error)

type RawResponse

type RawResponse struct {
	Type string          `json:"type"`
	Data json.RawMessage `json:"data"`
}

RawResponse represents the response format from the connector

type ReadSpecOutput

type ReadSpecOutput struct {
	Specification *ConnSpec `json:"specification"`
}

type SimpleKey

type SimpleKey struct {
	ID string `json:"id"`
}

type TemplateAttributes

type TemplateAttributes struct {
	Name     string      `json:"name"`
	Value    interface{} `json:"value"`
	Template string      `json:"template"`
}

type TemplateInitialValue

type TemplateInitialValue struct {
	Type       string             `json:"type"`
	Attributes TemplateAttributes `json:"attributes"`
}

type TenantStats

type TenantStats struct {
	TenantID       string           `json:"tenantID"`
	ConnectorStats []ConnectorStats `json:"connectors"`
}

Jump to

Keyboard shortcuts

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