managedidentity

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewManagedIdentityDelegateMap

func NewManagedIdentityDelegateMap(ctx context.Context, cfg *config.Config, pluginCatalog *plugin.Catalog) (map[models.ManagedIdentityType]Delegate, error)

NewManagedIdentityDelegateMap creates a map containing a delegate for each managed identity type

Types

type CreateManagedIdentityAliasInput added in v0.2.0

type CreateManagedIdentityAliasInput struct {
	Group         *models.Group
	Name          string
	AliasSourceID string
}

CreateManagedIdentityAliasInput is the input for creating a managed identity alias.

type CreateManagedIdentityInput added in v0.2.0

type CreateManagedIdentityInput struct {
	Type        models.ManagedIdentityType
	Name        string
	Description string
	GroupID     string
	Data        []byte
	AccessRules []struct {
		RunStage                 models.JobType
		AllowedUserIDs           []string
		AllowedServiceAccountIDs []string
		AllowedTeamIDs           []string
	}
}

CreateManagedIdentityInput contains the fields for creating a new managed identity

type Delegate

type Delegate interface {
	CreateCredentials(ctx context.Context, identity *models.ManagedIdentity, job *models.Job) ([]byte, error)
	SetManagedIdentityData(ctx context.Context, managedIdentity *models.ManagedIdentity, input []byte) error
}

Delegate handles the logic for a specific type of managed identity

type DeleteManagedIdentityInput

type DeleteManagedIdentityInput struct {
	ManagedIdentity *models.ManagedIdentity
	Force           bool
}

DeleteManagedIdentityInput is the input for deleting a managed identity or alias.

type GetManagedIdentitiesInput

type GetManagedIdentitiesInput struct {
	// Sort specifies the field to sort on and direction
	Sort *db.ManagedIdentitySortableField
	// PaginationOptions supports cursor based pagination
	PaginationOptions *db.PaginationOptions
	// Search returns only the managed identities with a name or resource path that starts with the value of search
	Search *string
	// AliasSourceID is used to return aliases for a given managed identity
	AliasSourceID *string
	// NamespacePath is the namespace to return managed identities for
	NamespacePath string
	// IncludeInherited includes inherited managed identities in the result
	IncludeInherited bool
}

GetManagedIdentitiesInput is the input for listing managed identities

type MockDelegate added in v0.2.0

type MockDelegate struct {
	mock.Mock
}

MockDelegate is an autogenerated mock type for the Delegate type

func NewMockDelegate added in v0.2.0

func NewMockDelegate(t mockConstructorTestingTNewMockDelegate) *MockDelegate

NewMockDelegate creates a new instance of MockDelegate. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockDelegate) CreateCredentials added in v0.2.0

func (_m *MockDelegate) CreateCredentials(ctx context.Context, identity *models.ManagedIdentity, job *models.Job) ([]byte, error)

CreateCredentials provides a mock function with given fields: ctx, identity, job

func (*MockDelegate) SetManagedIdentityData added in v0.2.0

func (_m *MockDelegate) SetManagedIdentityData(ctx context.Context, managedIdentity *models.ManagedIdentity, input []byte) error

SetManagedIdentityData provides a mock function with given fields: ctx, managedIdentity, input

type Service

type Service interface {
	GetManagedIdentityByID(ctx context.Context, id string) (*models.ManagedIdentity, error)
	GetManagedIdentityByPath(ctx context.Context, path string) (*models.ManagedIdentity, error)
	GetManagedIdentities(ctx context.Context, input *GetManagedIdentitiesInput) (*db.ManagedIdentitiesResult, error)
	GetManagedIdentitiesByIDs(ctx context.Context, ids []string) ([]models.ManagedIdentity, error)
	CreateManagedIdentity(ctx context.Context, input *CreateManagedIdentityInput) (*models.ManagedIdentity, error)
	UpdateManagedIdentity(ctx context.Context, input *UpdateManagedIdentityInput) (*models.ManagedIdentity, error)
	DeleteManagedIdentity(ctx context.Context, input *DeleteManagedIdentityInput) error
	CreateCredentials(ctx context.Context, identity *models.ManagedIdentity) ([]byte, error)
	GetManagedIdentitiesForWorkspace(ctx context.Context, workspaceID string) ([]models.ManagedIdentity, error)
	AddManagedIdentityToWorkspace(ctx context.Context, managedIdentityID string, workspaceID string) error
	RemoveManagedIdentityFromWorkspace(ctx context.Context, managedIdentityID string, workspaceID string) error
	GetManagedIdentityAccessRules(ctx context.Context, managedIdentity *models.ManagedIdentity) ([]models.ManagedIdentityAccessRule, error)
	GetManagedIdentityAccessRulesByIDs(ctx context.Context, ids []string) ([]models.ManagedIdentityAccessRule, error)
	GetManagedIdentityAccessRule(ctx context.Context, ruleID string) (*models.ManagedIdentityAccessRule, error)
	CreateManagedIdentityAccessRule(ctx context.Context, input *models.ManagedIdentityAccessRule) (*models.ManagedIdentityAccessRule, error)
	UpdateManagedIdentityAccessRule(ctx context.Context, input *models.ManagedIdentityAccessRule) (*models.ManagedIdentityAccessRule, error)
	DeleteManagedIdentityAccessRule(ctx context.Context, rule *models.ManagedIdentityAccessRule) error
	CreateManagedIdentityAlias(ctx context.Context, input *CreateManagedIdentityAliasInput) (*models.ManagedIdentity, error)
	DeleteManagedIdentityAlias(ctx context.Context, input *DeleteManagedIdentityInput) error
}

Service implements managed identity functionality

func NewService

func NewService(
	logger logger.Logger,
	dbClient *db.Client,
	managedIdentityDelegateMap map[models.ManagedIdentityType]Delegate,
	workspaceService workspace.Service,
	jobService job.Service,
	activityService activityevent.Service,
) Service

NewService creates an instance of Service

type UpdateManagedIdentityInput added in v0.2.0

type UpdateManagedIdentityInput struct {
	ID          string
	Description string
	Data        []byte
}

UpdateManagedIdentityInput contains the fields for updating a managed identity

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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