client

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExpandedApp             = "App"
	ExpandedAppResource     = "AppResource"
	ExpandedAppResourceType = "AppResourceType"
)
View Source
const ConeClientID = "2RGdOS94VDferT9e80mdgntl36K"

Variables

View Source
var (
	ErrInvalidClientSecret = errors.New("invalid client secret")
	ErrInvalidClientID     = errors.New("invalid client id")
)

Functions

func As added in v0.0.9

func As[T AnyType, V any](input T) (*V, error)

func GetExpanded added in v0.0.9

func GetExpanded[T any](e ExpandedReponse, key string) *T

func GetJSONPathIndex added in v0.0.9

func GetJSONPathIndex(jsonpath *string) (int, error)

Implementation of JSONPath only intended to allow expansion of non nested search results using array indexing. If you need to support more complex JSONPath operations, please use a library. Example: matches "$.expanded[0]".

func HandleErrors added in v0.0.14

func HandleErrors(ctx context.Context, v *viper.Viper, input error) error

func NewC1TokenSource

func NewC1TokenSource(
	ctx context.Context,
	clientID string,
	clientSecret string,
	forceTokenHost string,
	debug bool,
) (oauth2.TokenSource, string, string, error)

func PopulateExpandedMap added in v0.0.9

func PopulateExpandedMap(expandMap map[string]int, expanded []any) map[string]*any

Populate the expanded map with references to the related objects.

func StringFromPtr

func StringFromPtr(s *string) string

func UnmarshalAnyType added in v0.0.9

func UnmarshalAnyType[T AnyType, PT interface {
	*T
	GetAtType() *string
}](input PT) (any, error)

Types

type AnyType added in v0.0.9

type AnyType interface {
	MarshalJSON() ([]byte, error)
}

type AppEntitlement added in v0.0.4

type AppEntitlement shared.AppEntitlement

func (AppEntitlement) GetAppId added in v0.0.4

func (a AppEntitlement) GetAppId() string

func (AppEntitlement) GetAppResourceId added in v0.0.4

func (a AppEntitlement) GetAppResourceId() string

func (AppEntitlement) GetAppResourceTypeId added in v0.0.4

func (a AppEntitlement) GetAppResourceTypeId() string

type C1Client

type C1Client interface {
	BaseURL() string

	AuthIntrospect(ctx context.Context) (*shared.IntrospectResponse, error)
	GetUser(ctx context.Context, userID string) (*shared.User, error)
	GetEntitlement(ctx context.Context, appID string, entitlementID string) (*shared.AppEntitlement, error)
	SearchEntitlements(ctx context.Context, filter *SearchEntitlementsFilter) ([]*EntitlementWithBindings, error)
	GetResource(ctx context.Context, appID string, resourceID string, resourceTypeID string) (*shared.AppResource, error)
	GetResourceType(ctx context.Context, appID string, resourceTypeID string) (*shared.AppResourceType, error)
	GetApp(ctx context.Context, appID string) (*shared.App, error)
	GetTask(ctx context.Context, taskId string) (*shared.TaskServiceGetResponse, error)
	CreateGrantTask(
		ctx context.Context,
		appId string,
		appEntitlementId string,
		identityUserId string,
		justification string,
		duration string,
		emergencyAccess bool,
	) (*shared.TaskServiceCreateGrantResponse, error)
	CreateRevokeTask(
		ctx context.Context,
		appId string,
		appEntitlementId string,
		identityUserId string,
		justification string,
	) (*shared.TaskServiceCreateRevokeResponse, error)
	GetGrantsForIdentity(ctx context.Context, appID string, appEntitlementID string, identityID string) ([]shared.AppEntitlementUserBinding, error)
	SearchTasks(ctx context.Context, taskFilter shared.TaskSearchRequestInput) (*shared.TaskSearchResponse, error)
	CommentOnTask(ctx context.Context, taskID string, comment string) (*shared.TaskActionsServiceCommentResponse, error)
	ApproveTask(ctx context.Context, taskId string, comment string, policyId string) (*shared.TaskActionsServiceApproveResponse, error)
	DenyTask(ctx context.Context, taskId string, comment string, policyId string) (*shared.TaskActionsServiceDenyResponse, error)
	EscalateTask(ctx context.Context, taskId string) (*shared.TaskServiceActionResponse, error)
	ListApps(ctx context.Context) ([]shared.App, error)
	ListPolicies(ctx context.Context) ([]shared.Policy, error)
	ListEntitlements(ctx context.Context, appId string) ([]shared.AppEntitlement, error)
}

func New

func New(
	ctx context.Context,
	clientId string,
	clientSecret string,
	v *viper.Viper,
	cmdName string,
) (C1Client, error)

type EntitlementWithBindings

type EntitlementWithBindings struct {
	Entitlement AppEntitlement
	Bindings    []shared.AppEntitlementUserBinding
	// contains filtered or unexported fields
}

func (*EntitlementWithBindings) GetExpanded added in v0.0.9

func (e *EntitlementWithBindings) GetExpanded() map[string]*any

type Expandable added in v0.0.9

type Expandable interface {
	GetPaths() []PathDetails
	SetPath(pathname string, value int)
}

type ExpandableEntitlementWithBindings added in v0.0.9

type ExpandableEntitlementWithBindings struct {
	shared.AppEntitlementWithUserBindings
	ExpandedMap map[string]int
}

func NewExpandableEntitlementWithBindings added in v0.0.9

func NewExpandableEntitlementWithBindings(v shared.AppEntitlementWithUserBindings) *ExpandableEntitlementWithBindings

func (*ExpandableEntitlementWithBindings) GetPaths added in v0.0.9

func (*ExpandableEntitlementWithBindings) SetPath added in v0.0.9

func (e *ExpandableEntitlementWithBindings) SetPath(pathname string, value int)

type ExpandableReponse added in v0.0.9

type ExpandableReponse[T Expandable] struct {
	List []T
}

func (ExpandableReponse[T]) PopulateExpandedIndexes added in v0.0.9

func (o ExpandableReponse[T]) PopulateExpandedIndexes() error

type ExpandedReponse added in v0.0.9

type ExpandedReponse interface {
	GetExpanded() map[string]*any
}

type Expander

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

func (*Expander) ExpandApp

func (ee *Expander) ExpandApp(v hasAppID)

func (*Expander) ExpandResource

func (ee *Expander) ExpandResource(v hasResourceID)

func (*Expander) ExpandResourceType

func (ee *Expander) ExpandResourceType(v hasResourceTypeID)

func (*Expander) GetApp

func (ee *Expander) GetApp(appID string) (*shared.App, bool)

func (*Expander) GetResource

func (ee *Expander) GetResource(appID string, resourceTypeID string, resourceID string) (*shared.AppResource, bool)

func (*Expander) GetResourceType

func (ee *Expander) GetResourceType(appID string, resourceTypeID string) (*shared.AppResourceType, bool)

func (*Expander) Run

func (ee *Expander) Run(ctx context.Context, c C1Client) error

type HTTPError added in v0.0.14

type HTTPError struct {
	StatusCode int    `json:"status_code"`
	Body       string `json:"body"`
}

func NewHTTPError added in v0.0.14

func NewHTTPError(resp *http.Response) *HTTPError

func (*HTTPError) Error added in v0.0.14

func (e *HTTPError) Error() string

type JSONError added in v0.0.14

type JSONError struct {
	Error string `json:"error"`
}

type PathDetails added in v0.0.9

type PathDetails struct {
	Name string
	Path *string
}

type SearchEntitlementsFilter

type SearchEntitlementsFilter struct {
	Query                    string
	EntitlementAlias         string
	AppDisplayName           string
	GrantedStatus            shared.RequestCatalogSearchServiceSearchEntitlementsRequestGrantedStatus
	IncludeDeleted           bool
	AppEntitlementExpandMask shared.AppEntitlementExpandMask
}

Jump to

Keyboard shortcuts

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