Documentation ¶
Index ¶
- Variables
- func NewConverter() *converter
- func NewRepository(conv entityConverter) *repository
- func NewService(repo CertMappingRepository) *service
- type CertMappingRepository
- type CertSubjectMappingService
- type Converter
- type Entity
- type EntityCollection
- type Resolver
- func (r *Resolver) CertificateSubjectMapping(ctx context.Context, id string) (*graphql.CertificateSubjectMapping, error)
- func (r *Resolver) CertificateSubjectMappings(ctx context.Context, first *int, after *graphql.PageCursor) (*graphql.CertificateSubjectMappingPage, error)
- func (r *Resolver) CreateCertificateSubjectMapping(ctx context.Context, in graphql.CertificateSubjectMappingInput) (*graphql.CertificateSubjectMapping, error)
- func (r *Resolver) DeleteCertificateSubjectMapping(ctx context.Context, id string) (*graphql.CertificateSubjectMapping, error)
- func (r *Resolver) UpdateCertificateSubjectMapping(ctx context.Context, id string, in graphql.CertificateSubjectMappingInput) (*graphql.CertificateSubjectMapping, error)
- type UIDService
Constants ¶
This section is empty.
Variables ¶
var ( // Now is a function variable that returns the current time. It is used, so we could mock it in the tests. Now = time.Now )
Functions ¶
func NewConverter ¶
func NewConverter() *converter
NewConverter creates a new certificate subject mapping converter
func NewRepository ¶
func NewRepository(conv entityConverter) *repository
NewRepository creates a new CertSubjectMapping repository
func NewService ¶
func NewService(repo CertMappingRepository) *service
NewService returns a new object responsible for service-layer certificate subject mapping operations.
Types ¶
type CertMappingRepository ¶
type CertMappingRepository interface { Create(ctx context.Context, item *model.CertSubjectMapping) error Get(ctx context.Context, id string) (*model.CertSubjectMapping, error) Update(ctx context.Context, model *model.CertSubjectMapping) error Delete(ctx context.Context, id string) error DeleteByConsumerID(ctx context.Context, consumerID string) error Exists(ctx context.Context, id string) (bool, error) List(ctx context.Context, pageSize int, cursor string) (*model.CertSubjectMappingPage, error) ListAll(ctx context.Context) ([]*model.CertSubjectMapping, error) }
CertMappingRepository represents the certificate subject mapping repository layer
type CertSubjectMappingService ¶
type CertSubjectMappingService interface { Create(ctx context.Context, in *model.CertSubjectMapping) (string, error) Get(ctx context.Context, id string) (*model.CertSubjectMapping, error) Update(ctx context.Context, in *model.CertSubjectMapping) error Delete(ctx context.Context, id string) error Exists(ctx context.Context, id string) (bool, error) List(ctx context.Context, pageSize int, cursor string) (*model.CertSubjectMappingPage, error) }
CertSubjectMappingService is responsible for service-layer certificate subject mapping operations
type Converter ¶
type Converter interface { ToGraphQL(in *model.CertSubjectMapping) *graphql.CertificateSubjectMapping MultipleToGraphQL(in []*model.CertSubjectMapping) []*graphql.CertificateSubjectMapping FromGraphql(id string, in graphql.CertificateSubjectMappingInput) *model.CertSubjectMapping }
Converter converts between the graphql and internal model
type Entity ¶
type Entity struct { ID string `db:"id"` Subject string `db:"subject"` ConsumerType string `db:"consumer_type"` InternalConsumerID *string `db:"internal_consumer_id"` TenantAccessLevels string `db:"tenant_access_levels"` CreatedAt time.Time `db:"created_at"` UpdatedAt *time.Time `db:"updated_at"` }
Entity is a representation of a certificate subject mapping in the DB
type EntityCollection ¶
type EntityCollection []*Entity
EntityCollection is a collection of certificate subject mapping entities.
func (EntityCollection) Len ¶
func (s EntityCollection) Len() int
Len returns the number of entities in the collection.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver is an object responsible for resolver-layer operations.
func NewResolver ¶
func NewResolver(transact persistence.Transactioner, conv Converter, certSubjectMappingSvc CertSubjectMappingService, uidSvc UIDService) *Resolver
NewResolver returns a new object responsible for resolver-layer certificate subject mapping operations.
func (*Resolver) CertificateSubjectMapping ¶
func (r *Resolver) CertificateSubjectMapping(ctx context.Context, id string) (*graphql.CertificateSubjectMapping, error)
CertificateSubjectMapping queries the CertificateSubjectMapping matching ID `id`
func (*Resolver) CertificateSubjectMappings ¶
func (r *Resolver) CertificateSubjectMappings(ctx context.Context, first *int, after *graphql.PageCursor) (*graphql.CertificateSubjectMappingPage, error)
CertificateSubjectMappings list all CertificateSubjectMapping with pagination based on `first` and `after`
func (*Resolver) CreateCertificateSubjectMapping ¶
func (r *Resolver) CreateCertificateSubjectMapping(ctx context.Context, in graphql.CertificateSubjectMappingInput) (*graphql.CertificateSubjectMapping, error)
CreateCertificateSubjectMapping creates a CertificateSubjectMapping with the provided input `in`
func (*Resolver) DeleteCertificateSubjectMapping ¶
func (r *Resolver) DeleteCertificateSubjectMapping(ctx context.Context, id string) (*graphql.CertificateSubjectMapping, error)
DeleteCertificateSubjectMapping deletes the CertificateSubjectMapping matching ID `id`
func (*Resolver) UpdateCertificateSubjectMapping ¶
func (r *Resolver) UpdateCertificateSubjectMapping(ctx context.Context, id string, in graphql.CertificateSubjectMappingInput) (*graphql.CertificateSubjectMapping, error)
UpdateCertificateSubjectMapping updates the CertificateSubjectMapping matching ID `id` using `in`
type UIDService ¶
type UIDService interface {
Generate() string
}
UIDService generates UUIDs for new entities