2020-08-26 09:56:23 +02:00
|
|
|
package model
|
|
|
|
|
|
|
|
import (
|
2022-04-27 01:01:45 +02:00
|
|
|
"github.com/zitadel/zitadel/internal/domain"
|
|
|
|
caos_errors "github.com/zitadel/zitadel/internal/errors"
|
2021-04-06 16:03:07 +02:00
|
|
|
|
2020-08-26 09:56:23 +02:00
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type IDPProviderView struct {
|
|
|
|
AggregateID string
|
|
|
|
IDPConfigID string
|
|
|
|
IDPProviderType IDPProviderType
|
|
|
|
Name string
|
2020-10-19 17:10:02 +02:00
|
|
|
StylingType IDPStylingType
|
2020-08-26 09:56:23 +02:00
|
|
|
IDPConfigType IdpConfigType
|
2020-09-23 16:52:19 +02:00
|
|
|
IDPState IDPConfigState
|
2020-08-26 09:56:23 +02:00
|
|
|
|
|
|
|
CreationDate time.Time
|
|
|
|
ChangeDate time.Time
|
|
|
|
Sequence uint64
|
|
|
|
}
|
|
|
|
|
|
|
|
type IDPProviderSearchRequest struct {
|
|
|
|
Offset uint64
|
|
|
|
Limit uint64
|
|
|
|
SortingColumn IDPProviderSearchKey
|
|
|
|
Asc bool
|
|
|
|
Queries []*IDPProviderSearchQuery
|
|
|
|
}
|
|
|
|
|
|
|
|
type IDPProviderSearchKey int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
IDPProviderSearchKeyUnspecified IDPProviderSearchKey = iota
|
|
|
|
IDPProviderSearchKeyAggregateID
|
|
|
|
IDPProviderSearchKeyIdpConfigID
|
2020-09-23 16:52:19 +02:00
|
|
|
IDPProviderSearchKeyState
|
2022-04-19 08:26:12 +02:00
|
|
|
IDPProviderSearchKeyInstanceID
|
2022-11-30 17:01:17 +01:00
|
|
|
IDPProviderSearchKeyOwnerRemoved
|
2020-08-26 09:56:23 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type IDPProviderSearchQuery struct {
|
|
|
|
Key IDPProviderSearchKey
|
2021-03-01 08:48:50 +01:00
|
|
|
Method domain.SearchMethod
|
2020-08-26 09:56:23 +02:00
|
|
|
Value interface{}
|
|
|
|
}
|
|
|
|
|
|
|
|
type IDPProviderSearchResponse struct {
|
|
|
|
Offset uint64
|
|
|
|
Limit uint64
|
|
|
|
TotalResult uint64
|
|
|
|
Result []*IDPProviderView
|
|
|
|
Sequence uint64
|
|
|
|
Timestamp time.Time
|
|
|
|
}
|
|
|
|
|
2021-04-06 16:03:07 +02:00
|
|
|
func (r *IDPProviderSearchRequest) EnsureLimit(limit uint64) error {
|
|
|
|
if r.Limit > limit {
|
|
|
|
return caos_errors.ThrowInvalidArgument(nil, "SEARCH-3n8fs", "Errors.Limit.ExceedsDefault")
|
|
|
|
}
|
|
|
|
if r.Limit == 0 {
|
2020-08-26 09:56:23 +02:00
|
|
|
r.Limit = limit
|
|
|
|
}
|
2021-04-06 16:03:07 +02:00
|
|
|
return nil
|
2020-08-26 09:56:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *IDPProviderSearchRequest) AppendAggregateIDQuery(aggregateID string) {
|
2021-03-01 08:48:50 +01:00
|
|
|
r.Queries = append(r.Queries, &IDPProviderSearchQuery{Key: IDPProviderSearchKeyAggregateID, Method: domain.SearchMethodEquals, Value: aggregateID})
|
2020-08-26 09:56:23 +02:00
|
|
|
}
|