2020-08-26 07:56:23 +00:00
|
|
|
package model
|
|
|
|
|
|
|
|
import (
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/domain"
|
|
|
|
caos_errors "github.com/zitadel/zitadel/internal/errors"
|
2021-04-06 14:03:07 +00:00
|
|
|
|
2020-08-26 07:56:23 +00:00
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type IDPProviderView struct {
|
|
|
|
AggregateID string
|
|
|
|
IDPConfigID string
|
|
|
|
IDPProviderType IDPProviderType
|
|
|
|
Name string
|
2020-10-19 15:10:02 +00:00
|
|
|
StylingType IDPStylingType
|
2020-08-26 07:56:23 +00:00
|
|
|
IDPConfigType IdpConfigType
|
2020-09-23 14:52:19 +00:00
|
|
|
IDPState IDPConfigState
|
2020-08-26 07:56:23 +00: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 14:52:19 +00:00
|
|
|
IDPProviderSearchKeyState
|
2022-04-19 06:26:12 +00:00
|
|
|
IDPProviderSearchKeyInstanceID
|
2022-11-30 16:01:17 +00:00
|
|
|
IDPProviderSearchKeyOwnerRemoved
|
2020-08-26 07:56:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type IDPProviderSearchQuery struct {
|
|
|
|
Key IDPProviderSearchKey
|
2021-03-01 07:48:50 +00:00
|
|
|
Method domain.SearchMethod
|
2020-08-26 07:56:23 +00:00
|
|
|
Value interface{}
|
|
|
|
}
|
|
|
|
|
|
|
|
type IDPProviderSearchResponse struct {
|
|
|
|
Offset uint64
|
|
|
|
Limit uint64
|
|
|
|
TotalResult uint64
|
|
|
|
Result []*IDPProviderView
|
|
|
|
Sequence uint64
|
|
|
|
Timestamp time.Time
|
|
|
|
}
|
|
|
|
|
2021-04-06 14:03:07 +00: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 07:56:23 +00:00
|
|
|
r.Limit = limit
|
|
|
|
}
|
2021-04-06 14:03:07 +00:00
|
|
|
return nil
|
2020-08-26 07:56:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *IDPProviderSearchRequest) AppendAggregateIDQuery(aggregateID string) {
|
2021-03-01 07:48:50 +00:00
|
|
|
r.Queries = append(r.Queries, &IDPProviderSearchQuery{Key: IDPProviderSearchKeyAggregateID, Method: domain.SearchMethodEquals, Value: aggregateID})
|
2020-08-26 07:56:23 +00:00
|
|
|
}
|