Documentation
¶
Index ¶
- Constants
- Variables
- func ConstructEndpoint(request *Request) (string, *framework.Error)
- func NewAdapter(client Client) framework.Adapter[Config]
- func ParseResponse(body []byte) (objects []map[string]any, err *framework.Error)
- type AccountObject
- type Adapter
- func (a *Adapter) GetPage(ctx context.Context, request *framework.Request[Config]) framework.Response
- func (a *Adapter) RequestPageFromDatasource(ctx context.Context, request *framework.Request[Config]) framework.Response
- func (a *Adapter) ValidateGetPageRequest(ctx context.Context, request *framework.Request[Config]) *framework.Error
- type Client
- type Config
- type Datasource
- type DatasourceResponse
- type EntityConfig
- type Request
- type Response
Constants ¶
const ( AccountEntitlements = "accountEntitlements" Accounts = "accounts" DefaultAccountCollectionPageSize = 100 // TODO [sc-19214]: Remove after POC complete. Delimiter string = " | " )
const ( // MaxPageSize is the maximum page size allowed in a GetPage request. // The IdentityNow documentation specifies a page size limit of 250. // https://developer.sailpoint.com/idn/api/standard-collection-parameters/#paginating-results. MaxPageSize = 250 )
Variables ¶
var ( // TODO [sc-19214]: Remove after POC complete. AttributesToConcatenate = []string{"groups", "Groups", "memberOf"} DefaultAccountSorter = "id" Validate = validator.New(validator.WithRequiredStructEnabled()) )
Functions ¶
func ConstructEndpoint ¶
ConstructEndpoint constructs and returns the endpoint to query the datasource.
func NewAdapter ¶
NewAdapter instantiates a new Adapter.
Types ¶
type AccountObject ¶
type Adapter ¶
type Adapter struct {
IdentityNowClient Client
}
Adapter implements the framework.Adapter interface to query pages of objects from datasources.
func (*Adapter) GetPage ¶
func (a *Adapter) GetPage(ctx context.Context, request *framework.Request[Config]) framework.Response
GetPage is called by SGNL's ingestion service to query a page of objects from a datasource.
type Client ¶
type Client interface {
GetPage(ctx context.Context, request *Request) (*Response, *framework.Error)
}
Client is a client that allows querying the IdentityNow datasource which contains JSON objects.
type Config ¶
type Config struct {
*config.CommonConfig
// APIVersion is the default API version to use for a request. Required.
APIVersion string `json:"apiVersion,omitempty"`
// EntityConfig is a map of configs for each entity associated with this datasource.
// The key is the entity's external ID, and the value is a map of config values.
EntityConfig map[string]EntityConfig `json:"entityConfig,omitempty"`
}
Config is the configuration passed in each GetPage calls to the adapter. Adapter configuration example: nolint: godot
{
"requestTimeoutSeconds": 10,
"localTimeZoneOffset": 43200,
"apiVersion": "v3",
"entityConfig": {
"accounts": {
"uniqueIDAttribute": "id",
"filter": "identityId eq \"1700926aca594aa2861d9dbd24ca64b9\"",
"apiVersion": "v3"
}
}
}
type Datasource ¶
Datasource directly implements a Client interface to allow querying an external datasource.
type DatasourceResponse ¶
DatasouceResponse represents the API response from the datasource, which is an array of objects.
type EntityConfig ¶
type EntityConfig struct {
// UniqueIDAttribute is the name of the attribute containing the unique ID of
// each returned object for the requested entity. Required.
UniqueIDAttribute string `json:"uniqueIDAttribute"`
// Filter is the filter to apply to the entity request. Optional.
Filter *string `json:"filter,omitempty"`
// APIVersion is the API version to use for the entity request. Optional.
// If set, overrides the default Config.APIVersion.
APIVersion *string `json:"apiVersion,omitempty"`
}
type Request ¶
type Request struct {
// BaseURL is the Base URL of the datasource to query.
// For example, https://{tenant}.api.identitynow.com.
BaseURL string
// Token is the API token to authenticate a request. IdentityNow supports OAuth2 Client Credential auth
// so this must be in the form "Bearer eyJhbG[...]1LQ".
Token string
// PageSize is the maximum number of objects to return from the entity.
PageSize int64
// EntityExternalID is the external ID of the entity.
// The external ID should match the API's resource name.
EntityExternalID string
// Cursor identifies the first object of the page to return, as returned by
// the last request for the entity.
// nil in the request for the first page.
Cursor *pagination.CompositeCursor[int64]
// APIVersion the API version to use.
APIVersion string
// RequestTimeoutSeconds is the timeout duration for requests made to datasources.
// This should be set to the number of seconds to wait before timing out.
RequestTimeoutSeconds int
// Filter contains the optional filter to apply to the current request.
// It's applied using the `filters` query parameter.
Filter *string
// Sorters contains the optional sorters param to apply to the current request.
// It contains a comma separated value of field names by which the results are sorted.
//
// Example: sorters=type,-modified
// Results are sorted primarily by type in ascending order, and secondarily by modified date in descending order.
Sorters *string
}
Request is a request to IdentityNow.
type Response ¶
type Response struct {
// StatusCode is an HTTP status code.
StatusCode int
// RetryAfterHeader is the Retry-After response HTTP header, if set.
RetryAfterHeader string
// Objects is the list of
// May be empty.
Objects []map[string]any
// NextCursor is the cursor that identifies the first object of the next page.
// nil if this is the last page in this full sync.
NextCursor *pagination.CompositeCursor[int64]
}
Response is a response returned by the datasource.