From dc7d00c6a13c81a4b6f41ec2e9b3cbf105483a60 Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Tue, 4 Apr 2023 19:34:36 +0200 Subject: [PATCH] Allow creating and updating observability tenant Signed-off-by: David van der Spek --- api-server/clients/observabilitytenant.go | 125 +- api-server/go.mod | 2 +- api-server/go.sum | 4 +- api-server/graph/custom/float_map.go | 1 + .../graph/custom/forwarding_rule_map.go | 1 + api-server/graph/generated/generated.go | 1283 +++++++++++++---- api-server/graph/model/models_gen.go | 10 +- api-server/graph/observabilitytenant.graphqls | 216 ++- .../observabilitytenant.resolvers.go | 8 +- 9 files changed, 1359 insertions(+), 291 deletions(-) diff --git a/api-server/clients/observabilitytenant.go b/api-server/clients/observabilitytenant.go index 16f904a..e4ae0d0 100644 --- a/api-server/clients/observabilitytenant.go +++ b/api-server/clients/observabilitytenant.go @@ -7,6 +7,7 @@ import ( rts "github.com/ory/keto/proto/ory/keto/relation_tuples/v1alpha2" px "github.com/ory/x/pointerx" "github.com/pluralsh/oauth-playground/api-server/graph/model" + observabilityv1alpha1 "github.com/pluralsh/trace-shield-controller/api/observability/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -17,7 +18,94 @@ const ( ObservabilityTenantPermissionEdit ObservabilityTenantPermission = "editors" ) -func (c *ClientWrapper) MutateObservabilityTenant(ctx context.Context, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput) (*model.ObservabilityTenant, error) { +func (c *ClientWrapper) CreateObservabilityTenant(ctx context.Context, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput, limits *model.ObservabilityTenantLimitsInput) (*model.ObservabilityTenant, error) { + log := c.Log.WithName("CreateObservabilityTenant").WithValues("Name", name) + + var mimirLimits *observabilityv1alpha1.MimirLimits + + if limits != nil && limits.Mimir != nil { + tmpMimirLimits := observabilityv1alpha1.MimirLimits(*limits.Mimir) + mimirLimits = &tmpMimirLimits + } + + tenantStruct := &observabilityv1alpha1.Tenant{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + }, + Spec: observabilityv1alpha1.TenantSpec{ + Limits: &observabilityv1alpha1.LimitSpec{ + Mimir: mimirLimits, + }, + }, + } + + tenant, err := c.ControllerClient.ObservabilityV1alpha1().Tenants().Create(ctx, tenantStruct, metav1.CreateOptions{}) + if err != nil { + log.Error(err, "Failed to create observability tenant") + return nil, err + } + + if err := c.MutateObservabilityTenantInKeto(ctx, name, viewers, editors); err != nil { + log.Error(err, "Failed to mutate observability tenant in keto") + return nil, err + } + + return &model.ObservabilityTenant{ + Name: tenant.Name, + Limits: &model.ObservabilityTenantLimits{ + Mimir: tenant.Spec.Limits.Mimir, + }, + }, nil +} + +func (c *ClientWrapper) UpdateObservabilityTenant(ctx context.Context, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput, limits *model.ObservabilityTenantLimitsInput) (*model.ObservabilityTenant, error) { + log := c.Log.WithName("UpdateObservabilityTenant").WithValues("Name", name) + + var mimirLimits *observabilityv1alpha1.MimirLimits + + if limits != nil && limits.Mimir != nil { + tmpMimirLimits := observabilityv1alpha1.MimirLimits(*limits.Mimir) + mimirLimits = &tmpMimirLimits + } + + existingTenant, err := c.ControllerClient.ObservabilityV1alpha1().Tenants().Get(ctx, name, metav1.GetOptions{}) + if err != nil { + log.Error(err, "Failed to get observability tenant") + return nil, err + } + + tenantStruct := &observabilityv1alpha1.Tenant{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + ResourceVersion: existingTenant.GetResourceVersion(), + }, + Spec: observabilityv1alpha1.TenantSpec{ + Limits: &observabilityv1alpha1.LimitSpec{ + Mimir: mimirLimits, + }, + }, + } + + tenant, err := c.ControllerClient.ObservabilityV1alpha1().Tenants().Update(ctx, tenantStruct, metav1.UpdateOptions{}) + if err != nil { + log.Error(err, "Failed to update observability tenant") + return nil, err + } + + if err := c.MutateObservabilityTenantInKeto(ctx, name, viewers, editors); err != nil { + log.Error(err, "Failed to mutate observability tenant in keto") + return nil, err + } + + return &model.ObservabilityTenant{ + Name: tenant.Name, + Limits: &model.ObservabilityTenantLimits{ + Mimir: tenant.Spec.Limits.Mimir, + }, + }, nil +} + +func (c *ClientWrapper) MutateObservabilityTenantInKeto(ctx context.Context, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput) error { // TODO: figure out which members to add or remove log := c.Log.WithName("ObservabilityTenant").WithValues("Name", name) @@ -26,24 +114,24 @@ func (c *ClientWrapper) MutateObservabilityTenant(ctx context.Context, name stri // updating a group would require that we first check if it exists and if a user is allowed to update it // creating a group would require that we first check if it exists and if a user is allowed to create it - tenantpExists, err := c.ObservabilityTenantExistsInKeto(ctx, name) - if err != nil { - log.Error(err, "Failed to check if observability tenant already exists in keto") - return nil, err - } + // tenantpExists, err := c.ObservabilityTenantExistsInKeto(ctx, name) + // if err != nil { + // log.Error(err, "Failed to check if observability tenant already exists in keto") + // return nil, err + // } - if !tenantpExists { - err := c.CreateObservabilityTenantInKeto(ctx, name) - if err != nil { - log.Error(err, "Failed to create observability tenant in keto") - return nil, err - } - } + // if !tenantpExists { + // err := c.CreateObservabilityTenantInKeto(ctx, name) + // if err != nil { + // log.Error(err, "Failed to create observability tenant in keto") + // return nil, err + // } + // } viewUsersToAdd, viewUsersToRemove, viewGroupsToAdd, viewGroupsToRemove, viewClientsToAdd, viewClientsToRemove, err := c.OsTenantChangeset(ctx, name, viewers, nil, ObservabilityTenantPermissionView) if err != nil { log.Error(err, "Failed to get observability tenant changeset") - return nil, err + return err } if err := c.AddUsersToTenantInKeto(ctx, name, viewUsersToAdd, ObservabilityTenantPermissionView); err != nil { @@ -79,7 +167,7 @@ func (c *ClientWrapper) MutateObservabilityTenant(ctx context.Context, name stri editUsersToAdd, editUsersToRemove, editGroupsToAdd, editGroupsToRemove, _, _, err := c.OsTenantChangeset(ctx, name, nil, editors, ObservabilityTenantPermissionEdit) if err != nil { log.Error(err, "Failed to get observability tenant changeset") - return nil, err + return err } if err := c.AddUsersToTenantInKeto(ctx, name, editUsersToAdd, ObservabilityTenantPermissionEdit); err != nil { @@ -102,12 +190,7 @@ func (c *ClientWrapper) MutateObservabilityTenant(ctx context.Context, name stri // return nil, err // TODO: add some way to wrap errors } - return &model.ObservabilityTenant{ - Name: name, - Organization: &model.Organization{ - Name: "main", //TODO: decide whether to hardcode this or not - }, - }, nil + return nil } // function that checks if an observability tenant exists in keto diff --git a/api-server/go.mod b/api-server/go.mod index d3ebd5f..8059e26 100644 --- a/api-server/go.mod +++ b/api-server/go.mod @@ -8,7 +8,7 @@ require ( github.com/go-logr/logr v1.2.3 github.com/ory/keto/proto v0.11.1-alpha.0 github.com/ory/kratos-client-go v0.11.1 - github.com/pluralsh/trace-shield-controller v0.0.0-20230404161307-a98fd77d4d44 + github.com/pluralsh/trace-shield-controller v0.0.0-20230404170210-f84361cc9dee github.com/rs/cors v1.8.3 github.com/vektah/gqlparser/v2 v2.5.1 sigs.k8s.io/controller-runtime v0.14.4 diff --git a/api-server/go.sum b/api-server/go.sum index d53c83e..00b1561 100644 --- a/api-server/go.sum +++ b/api-server/go.sum @@ -1209,8 +1209,8 @@ github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZ github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pluralsh/controller-reconcile-helper v0.0.4 h1:1o+7qYSyoeqKFjx+WgQTxDz4Q2VMpzprJIIKShxqG0E= github.com/pluralsh/controller-reconcile-helper v0.0.4/go.mod h1:AfY0gtteD6veBjmB6jiRx/aR4yevEf6K0M13/pGan/s= -github.com/pluralsh/trace-shield-controller v0.0.0-20230404161307-a98fd77d4d44 h1:bbcN7OGV4vrYcrk4AHiICMmV3VA393NnQv8ronuSF7A= -github.com/pluralsh/trace-shield-controller v0.0.0-20230404161307-a98fd77d4d44/go.mod h1:Mjf4+X7fVZhc1nK0DhtrYiB588QpvGt+IYE0Ob5pMi0= +github.com/pluralsh/trace-shield-controller v0.0.0-20230404170210-f84361cc9dee h1:cFN6H82uHFULmm6UAb60ORM0Zy8mfsfn4i3l2aLtYUw= +github.com/pluralsh/trace-shield-controller v0.0.0-20230404170210-f84361cc9dee/go.mod h1:Mjf4+X7fVZhc1nK0DhtrYiB588QpvGt+IYE0Ob5pMi0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/api-server/graph/custom/float_map.go b/api-server/graph/custom/float_map.go index 9088fcf..fac335a 100644 --- a/api-server/graph/custom/float_map.go +++ b/api-server/graph/custom/float_map.go @@ -17,6 +17,7 @@ func MarshalFloatMap(val map[string]*float64) graphql.Marshaler { }) } +// TODO: this unmarshaler is not working and is needed for input types func UnmarshalFloatMap(v interface{}) (map[string]*float64, error) { if m, ok := v.(map[string]*float64); ok { return m, nil diff --git a/api-server/graph/custom/forwarding_rule_map.go b/api-server/graph/custom/forwarding_rule_map.go index 206984d..b064517 100644 --- a/api-server/graph/custom/forwarding_rule_map.go +++ b/api-server/graph/custom/forwarding_rule_map.go @@ -20,6 +20,7 @@ func MarshalForwardingRuleMap(val map[string]*observabilityv1alpha1.ForwardingRu }) } +// TODO: this unmarshaler is not working and is needed for input types func UnmarshalForwardingRuleMap(v interface{}) (map[string]*observabilityv1alpha1.ForwardingRule, error) { if m, ok := v.(map[string]*observabilityv1alpha1.ForwardingRule); ok { return m, nil diff --git a/api-server/graph/generated/generated.go b/api-server/graph/generated/generated.go index 2370b6e..fa06904 100644 --- a/api-server/graph/generated/generated.go +++ b/api-server/graph/generated/generated.go @@ -159,7 +159,7 @@ type ComplexityRoot struct { Mutation struct { AcceptOAuth2ConsentRequest func(childComplexity int, challenge string, grantAccessTokenAudience []string, grantScope []string, remember *bool, rememberFor *int64, session *model.AcceptOAuth2ConsentRequestSession) int CreateOAuth2Client func(childComplexity int, allowedCorsOrigins []string, audience []string, authorizationCodeGrantAccessTokenLifespan *string, authorizationCodeGrantIDTokenLifespan *string, authorizationCodeGrantRefreshTokenLifespan *string, backChannelLogoutSessionRequired *bool, backChannelLogoutURI *string, clientCredentialsGrantAccessTokenLifespan *string, clientName *string, clientSecret *string, clientSecretExpiresAt *int64, clientURI *string, contacts []string, frontchannelLogoutSessionRequired *bool, frontchannelLogoutURI *string, grantTypes []string, implicitGrantAccessTokenLifespan *string, implicitGrantIDTokenLifespan *string, jwks map[string]interface{}, jwksURI *string, jwtBearerGrantAccessTokenLifespan *string, logoURI *string, metadata map[string]interface{}, policyURI *string, postLogoutRedirectUris []string, redirectUris []string, responseTypes []string, scope *string, sectorIdentifierURI *string, subjectType *string, tokenEndpointAuthMethod *string, tokenEndpointAuthSigningAlgorithm *string, tosURI *string, userinfoSignedResponseAlgorithm *string, loginBindings *model.LoginBindingsInput) int - CreateObservabilityTenant func(childComplexity int, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput) int + CreateObservabilityTenant func(childComplexity int, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput, limits *model.ObservabilityTenantLimitsInput) int CreateUser func(childComplexity int, email string, name *model.NameInput) int DeleteGroup func(childComplexity int, name string) int DeleteOAuth2Client func(childComplexity int, clientID string) int @@ -169,7 +169,7 @@ type ComplexityRoot struct { Organization func(childComplexity int, name string, admins []string) int RejectOAuth2ConsentRequest func(childComplexity int, challenge string) int UpdateOAuth2Client func(childComplexity int, allowedCorsOrigins []string, audience []string, authorizationCodeGrantAccessTokenLifespan *string, authorizationCodeGrantIDTokenLifespan *string, authorizationCodeGrantRefreshTokenLifespan *string, backChannelLogoutSessionRequired *bool, backChannelLogoutURI *string, clientCredentialsGrantAccessTokenLifespan *string, clientID string, clientName *string, clientSecret *string, clientSecretExpiresAt *int64, clientURI *string, contacts []string, frontchannelLogoutSessionRequired *bool, frontchannelLogoutURI *string, grantTypes []string, implicitGrantAccessTokenLifespan *string, implicitGrantIDTokenLifespan *string, jwks map[string]interface{}, jwksURI *string, jwtBearerGrantAccessTokenLifespan *string, logoURI *string, metadata map[string]interface{}, policyURI *string, postLogoutRedirectUris []string, redirectUris []string, responseTypes []string, scope *string, sectorIdentifierURI *string, subjectType *string, tokenEndpointAuthMethod *string, tokenEndpointAuthSigningAlgorithm *string, tosURI *string, userinfoSignedResponseAlgorithm *string, loginBindings *model.LoginBindingsInput) int - UpdateObservabilityTenant func(childComplexity int, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput) int + UpdateObservabilityTenant func(childComplexity int, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput, limits *model.ObservabilityTenantLimitsInput) int } Name struct { @@ -255,9 +255,7 @@ type ComplexityRoot struct { } ObservabilityTenantLimits struct { - Loki func(childComplexity int) int Mimir func(childComplexity int) int - Tempo func(childComplexity int) int } ObservabilityTenantViewers struct { @@ -323,8 +321,8 @@ type MutationResolver interface { DeleteOAuth2Client(ctx context.Context, clientID string) (*model.OAuth2Client, error) AcceptOAuth2ConsentRequest(ctx context.Context, challenge string, grantAccessTokenAudience []string, grantScope []string, remember *bool, rememberFor *int64, session *model.AcceptOAuth2ConsentRequestSession) (*model.OAuth2RedirectTo, error) RejectOAuth2ConsentRequest(ctx context.Context, challenge string) (*model.OAuth2RedirectTo, error) - CreateObservabilityTenant(ctx context.Context, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput) (*model.ObservabilityTenant, error) - UpdateObservabilityTenant(ctx context.Context, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput) (*model.ObservabilityTenant, error) + CreateObservabilityTenant(ctx context.Context, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput, limits *model.ObservabilityTenantLimitsInput) (*model.ObservabilityTenant, error) + UpdateObservabilityTenant(ctx context.Context, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput, limits *model.ObservabilityTenantLimitsInput) (*model.ObservabilityTenant, error) DeleteObservabilityTenant(ctx context.Context, name string) (*model.ObservabilityTenant, error) Organization(ctx context.Context, name string, admins []string) (*model.Organization, error) } @@ -995,7 +993,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Mutation.CreateObservabilityTenant(childComplexity, args["name"].(string), args["viewers"].(*model.ObservabilityTenantViewersInput), args["editors"].(*model.ObservabilityTenantEditorsInput)), true + return e.complexity.Mutation.CreateObservabilityTenant(childComplexity, args["name"].(string), args["viewers"].(*model.ObservabilityTenantViewersInput), args["editors"].(*model.ObservabilityTenantEditorsInput), args["limits"].(*model.ObservabilityTenantLimitsInput)), true case "Mutation.createUser": if e.complexity.Mutation.CreateUser == nil { @@ -1115,7 +1113,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Mutation.UpdateObservabilityTenant(childComplexity, args["name"].(string), args["viewers"].(*model.ObservabilityTenantViewersInput), args["editors"].(*model.ObservabilityTenantEditorsInput)), true + return e.complexity.Mutation.UpdateObservabilityTenant(childComplexity, args["name"].(string), args["viewers"].(*model.ObservabilityTenantViewersInput), args["editors"].(*model.ObservabilityTenantEditorsInput), args["limits"].(*model.ObservabilityTenantLimitsInput)), true case "Name.first": if e.complexity.Name.First == nil { @@ -1565,13 +1563,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ObservabilityTenantEditors.Users(childComplexity), true - case "ObservabilityTenantLimits.loki": - if e.complexity.ObservabilityTenantLimits.Loki == nil { - break - } - - return e.complexity.ObservabilityTenantLimits.Loki(childComplexity), true - case "ObservabilityTenantLimits.mimir": if e.complexity.ObservabilityTenantLimits.Mimir == nil { break @@ -1579,13 +1570,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ObservabilityTenantLimits.Mimir(childComplexity), true - case "ObservabilityTenantLimits.tempo": - if e.complexity.ObservabilityTenantLimits.Tempo == nil { - break - } - - return e.complexity.ObservabilityTenantLimits.Tempo(childComplexity), true - case "ObservabilityTenantViewers.groups": if e.complexity.ObservabilityTenantViewers.Groups == nil { break @@ -1811,8 +1795,10 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputAcceptOAuth2ConsentRequestSession, ec.unmarshalInputAdmin, ec.unmarshalInputLoginBindingsInput, + ec.unmarshalInputMimirLimitsInput, ec.unmarshalInputNameInput, ec.unmarshalInputObservabilityTenantEditorsInput, + ec.unmarshalInputObservabilityTenantLimitsInput, ec.unmarshalInputObservabilityTenantViewersInput, ) first := true @@ -2433,13 +2419,24 @@ type ObservabilityTenantLimits { "The limits for Mimir for the tenant." mimir: MimirLimits - "The limits for Loki for the tenant." - loki: LokiLimits + # "The limits for Loki for the tenant." + # loki: LokiLimits - "The limits for Tempo for the tenant." - tempo: TempoLimits + # "The limits for Tempo for the tenant." + # tempo: TempoLimits } +"Inputs for the limits of a tenant." +input ObservabilityTenantLimitsInput { + "The limits for Mimir for the tenant." + mimir: MimirLimitsInput + + # "The limits for Loki for the tenant." + # loki: LokiLimitsInput + + # "The limits for Tempo for the tenant." + # tempo: TempoLimitsInput +} scalar Duration scalar FloatMap @@ -2608,6 +2605,198 @@ type MimirLimits { + alertmanagerReceiversBlockCIDRNetworks: String + + alertmanagerReceiversBlockPrivateAddresses: Boolean + + + notificationRateLimit: Float + + notificationRateLimitPerIntegration: FloatMap + + + alertmanagerMaxConfigSizeBytes: Int + + alertmanagerMaxTemplatesCount: Int + + alertmanagerMaxTemplateSizeBytes: Int + + alertmanagerMaxDispatcherAggregationGroups: Int + + alertmanagerMaxAlertsCount: Int + + alertmanagerMaxAlertsSizeBytes: Int + + + forwardingEndpoint: String + + forwardingDropOlderThan: Duration + + forwardingRules: ForwardingRuleMap +} + +input MimirLimitsInput { + requestRate: Float + + requestBurstSize: Int + + ingestionRate: Float + + ingestionBurstSize: Int + + acceptHASamples: Boolean + + haClusterLabel: String + + haReplicaLabel: String + + haMaxClusters: Int + + dropLabels: [String] + + maxLabelNameLength: Int + + maxLabelValueLength: Int + + maxLabelNamesPerSeries: Int + + maxMetadataLength: Int + + creationGracePeriod: Duration + + enforceMetadataMetricName: Boolean + + ingestionTenantShardSize: Int + + # metricRelabelConfigs + + + + + + + maxGlobalSeriesPerUser: Int + + maxGlobalSeriesPerMetric: Int + + + maxGlobalMetricsWithMetadataPerUser: Int + + maxGlobalMetadataPerMetric: Int + + + + maxGlobalExemplarsPerUser: Int + + + nativeHistogramsIngestionEnabled: Boolean + + # activeSeriesCustomTrackersConfig: + + + outOfOrderTimeWindow: Duration + + outOfOrderBlocksExternalLabelEnabled: Boolean + + + + + separateMetricsGroupLabel: String + + + + maxChunksPerQuery: Int + + maxFetchedSeriesPerQuery: Int + + maxFetchedChunkBytesPerQuery: Int + + maxQueryLookback: Duration + + maxPartialQueryLength: Duration + + maxQueryParallelism: Int + + maxLabelsQueryLength: Duration + + maxCacheFreshness: Duration + + maxQueriersPerTenant: Int + + queryShardingTotalShards: Int + + queryShardingMaxShardedQueries: Int + + queryShardingMaxRegexpSizeBytes: Int + + splitInstantQueriesByInterval: Duration + + + + maxTotalQueryLength: Duration + + resultsCacheTTL: Duration + + resultsCacheTTLForOutOfOrderTimeWindow: Duration + + maxQueryExpressionSizeBytes: Int + + + + cardinalityAnalysisEnabled: Boolean + + labelNamesAndValuesResultsMaxSizeBytes: Int + + labelValuesMaxCardinalityLabelNamesPerRequest: Int + + + + rulerEvaluationDelay: Duration + + rulerTenantShardSize: Int + + rulerMaxRulesPerRuleGroup: Int + + rulerMaxRuleGroupsPerTenant: Int + + rulerRecordingRulesEvaluationEnabled: Boolean + + rulerAlertingRulesEvaluationEnabled: Boolean + + + + storeGatewayTenantShardSize: Int + + + + compactorBlocksRetentionPeriod: Duration + + compactorSplitAndMergeShards: Int + + compactorSplitGroups: Int + + compactorTenantShardSize: Int + + compactorPartialBlockDeletionDelay: Duration + + compactorBlockUploadEnabled: Boolean + + compactorBlockUploadValidationEnabled: Boolean + + compactorBlockUploadVerifyChunks: Boolean + + + + + s3SSEType: String + + s3SSEKMSKeyID: String + + s3SSEKMSEncryptionContext: String + + + + alertmanagerReceiversBlockCIDRNetworks: String alertmanagerReceiversBlockPrivateAddresses: Boolean @@ -2712,6 +2901,8 @@ extend type Mutation { viewers: ObservabilityTenantViewersInput "The users and groups that can edit a tenant to add users, groups or oauth2 clients to it." editors: ObservabilityTenantEditorsInput + "The limits for the tenant." + limits: ObservabilityTenantLimitsInput ): ObservabilityTenant! @checkPermissions @isAuthenticated "Update an observability tenant." @@ -2722,6 +2913,8 @@ extend type Mutation { viewers: ObservabilityTenantViewersInput "The users and groups that can edit a tenant to add users, groups or oauth2 clients to it." editors: ObservabilityTenantEditorsInput + "The limits for the tenant." + limits: ObservabilityTenantLimitsInput ): ObservabilityTenant! @checkPermissions @isAuthenticated "Delete an observability tenant." @@ -3250,6 +3443,15 @@ func (ec *executionContext) field_Mutation_createObservabilityTenant_args(ctx co } } args["editors"] = arg2 + var arg3 *model.ObservabilityTenantLimitsInput + if tmp, ok := rawArgs["limits"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limits")) + arg3, err = ec.unmarshalOObservabilityTenantLimitsInput2ᚖgithubᚗcomᚋpluralshᚋoauthᚑplaygroundᚋapiᚑserverᚋgraphᚋmodelᚐObservabilityTenantLimitsInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["limits"] = arg3 return args, nil } @@ -3760,6 +3962,15 @@ func (ec *executionContext) field_Mutation_updateObservabilityTenant_args(ctx co } } args["editors"] = arg2 + var arg3 *model.ObservabilityTenantLimitsInput + if tmp, ok := rawArgs["limits"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limits")) + arg3, err = ec.unmarshalOObservabilityTenantLimitsInput2ᚖgithubᚗcomᚋpluralshᚋoauthᚑplaygroundᚋapiᚑserverᚋgraphᚋmodelᚐObservabilityTenantLimitsInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["limits"] = arg3 return args, nil } @@ -8156,7 +8367,7 @@ func (ec *executionContext) _Mutation_createObservabilityTenant(ctx context.Cont resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().CreateObservabilityTenant(rctx, fc.Args["name"].(string), fc.Args["viewers"].(*model.ObservabilityTenantViewersInput), fc.Args["editors"].(*model.ObservabilityTenantEditorsInput)) + return ec.resolvers.Mutation().CreateObservabilityTenant(rctx, fc.Args["name"].(string), fc.Args["viewers"].(*model.ObservabilityTenantViewersInput), fc.Args["editors"].(*model.ObservabilityTenantEditorsInput), fc.Args["limits"].(*model.ObservabilityTenantLimitsInput)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.CheckPermissions == nil { @@ -8246,7 +8457,7 @@ func (ec *executionContext) _Mutation_updateObservabilityTenant(ctx context.Cont resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().UpdateObservabilityTenant(rctx, fc.Args["name"].(string), fc.Args["viewers"].(*model.ObservabilityTenantViewersInput), fc.Args["editors"].(*model.ObservabilityTenantEditorsInput)) + return ec.resolvers.Mutation().UpdateObservabilityTenant(rctx, fc.Args["name"].(string), fc.Args["viewers"].(*model.ObservabilityTenantViewersInput), fc.Args["editors"].(*model.ObservabilityTenantEditorsInput), fc.Args["limits"].(*model.ObservabilityTenantLimitsInput)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.CheckPermissions == nil { @@ -10995,10 +11206,6 @@ func (ec *executionContext) fieldContext_ObservabilityTenant_limits(ctx context. switch field.Name { case "mimir": return ec.fieldContext_ObservabilityTenantLimits_mimir(ctx, field) - case "loki": - return ec.fieldContext_ObservabilityTenantLimits_loki(ctx, field) - case "tempo": - return ec.fieldContext_ObservabilityTenantLimits_tempo(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type ObservabilityTenantLimits", field.Name) }, @@ -11296,8 +11503,8 @@ func (ec *executionContext) fieldContext_ObservabilityTenantLimits_mimir(ctx con return fc, nil } -func (ec *executionContext) _ObservabilityTenantLimits_loki(ctx context.Context, field graphql.CollectedField, obj *model.ObservabilityTenantLimits) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ObservabilityTenantLimits_loki(ctx, field) +func (ec *executionContext) _ObservabilityTenantViewers_users(ctx context.Context, field graphql.CollectedField, obj *model.ObservabilityTenantViewers) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ObservabilityTenantViewers_users(ctx, field) if err != nil { return graphql.Null } @@ -11310,36 +11517,46 @@ func (ec *executionContext) _ObservabilityTenantLimits_loki(ctx context.Context, }() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Loki, nil + return ec.resolvers.ObservabilityTenantViewers().Users(rctx, obj) }) if resTmp == nil { return graphql.Null } - res := resTmp.(*model.LokiLimits) + res := resTmp.([]*model.User) fc.Result = res - return ec.marshalOLokiLimits2ᚖgithubᚗcomᚋpluralshᚋoauthᚑplaygroundᚋapiᚑserverᚋgraphᚋmodelᚐLokiLimits(ctx, field.Selections, res) + return ec.marshalOUser2ᚕᚖgithubᚗcomᚋpluralshᚋoauthᚑplaygroundᚋapiᚑserverᚋgraphᚋmodelᚐUserᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ObservabilityTenantLimits_loki(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ObservabilityTenantViewers_users(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ObservabilityTenantLimits", + Object: "ObservabilityTenantViewers", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "requestRate": - return ec.fieldContext_LokiLimits_requestRate(ctx, field) + case "id": + return ec.fieldContext_User_id(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "groups": + return ec.fieldContext_User_groups(ctx, field) + case "organization": + return ec.fieldContext_User_organization(ctx, field) + case "recoveryLink": + return ec.fieldContext_User_recoveryLink(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type LokiLimits", field.Name) + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, } return fc, nil } -func (ec *executionContext) _ObservabilityTenantLimits_tempo(ctx context.Context, field graphql.CollectedField, obj *model.ObservabilityTenantLimits) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ObservabilityTenantLimits_tempo(ctx, field) +func (ec *executionContext) _ObservabilityTenantViewers_groups(ctx context.Context, field graphql.CollectedField, obj *model.ObservabilityTenantViewers) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ObservabilityTenantViewers_groups(ctx, field) if err != nil { return graphql.Null } @@ -11352,125 +11569,31 @@ func (ec *executionContext) _ObservabilityTenantLimits_tempo(ctx context.Context }() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Tempo, nil + return ec.resolvers.ObservabilityTenantViewers().Groups(rctx, obj) }) if resTmp == nil { return graphql.Null } - res := resTmp.(*model.TempoLimits) + res := resTmp.([]*model.Group) fc.Result = res - return ec.marshalOTempoLimits2ᚖgithubᚗcomᚋpluralshᚋoauthᚑplaygroundᚋapiᚑserverᚋgraphᚋmodelᚐTempoLimits(ctx, field.Selections, res) + return ec.marshalOGroup2ᚕᚖgithubᚗcomᚋpluralshᚋoauthᚑplaygroundᚋapiᚑserverᚋgraphᚋmodelᚐGroupᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ObservabilityTenantLimits_tempo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ObservabilityTenantViewers_groups(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ObservabilityTenantLimits", + Object: "ObservabilityTenantViewers", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "requestRate": - return ec.fieldContext_TempoLimits_requestRate(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type TempoLimits", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _ObservabilityTenantViewers_users(ctx context.Context, field graphql.CollectedField, obj *model.ObservabilityTenantViewers) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ObservabilityTenantViewers_users(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.ObservabilityTenantViewers().Users(rctx, obj) - }) - - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]*model.User) - fc.Result = res - return ec.marshalOUser2ᚕᚖgithubᚗcomᚋpluralshᚋoauthᚑplaygroundᚋapiᚑserverᚋgraphᚋmodelᚐUserᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_ObservabilityTenantViewers_users(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ObservabilityTenantViewers", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_User_id(ctx, field) - case "name": - return ec.fieldContext_User_name(ctx, field) - case "email": - return ec.fieldContext_User_email(ctx, field) - case "groups": - return ec.fieldContext_User_groups(ctx, field) - case "organization": - return ec.fieldContext_User_organization(ctx, field) - case "recoveryLink": - return ec.fieldContext_User_recoveryLink(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _ObservabilityTenantViewers_groups(ctx context.Context, field graphql.CollectedField, obj *model.ObservabilityTenantViewers) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ObservabilityTenantViewers_groups(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.ObservabilityTenantViewers().Groups(rctx, obj) - }) - - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]*model.Group) - fc.Result = res - return ec.marshalOGroup2ᚕᚖgithubᚗcomᚋpluralshᚋoauthᚑplaygroundᚋapiᚑserverᚋgraphᚋmodelᚐGroupᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_ObservabilityTenantViewers_groups(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ObservabilityTenantViewers", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_Group_name(ctx, field) - case "members": - return ec.fieldContext_Group_members(ctx, field) - case "organization": - return ec.fieldContext_Group_organization(ctx, field) + case "name": + return ec.fieldContext_Group_name(ctx, field) + case "members": + return ec.fieldContext_Group_members(ctx, field) + case "organization": + return ec.fieldContext_Group_organization(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Group", field.Name) }, @@ -15023,147 +15146,803 @@ func (ec *executionContext) unmarshalInputLoginBindingsInput(ctx context.Context return it, nil } -func (ec *executionContext) unmarshalInputNameInput(ctx context.Context, obj interface{}) (model.NameInput, error) { - var it model.NameInput +func (ec *executionContext) unmarshalInputMimirLimitsInput(ctx context.Context, obj interface{}) (v1alpha1.MimirLimitsInput, error) { + var it v1alpha1.MimirLimitsInput asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v } - fieldsInOrder := [...]string{"first", "last"} + fieldsInOrder := [...]string{"requestRate", "requestBurstSize", "ingestionRate", "ingestionBurstSize", "acceptHASamples", "haClusterLabel", "haReplicaLabel", "haMaxClusters", "dropLabels", "maxLabelNameLength", "maxLabelValueLength", "maxLabelNamesPerSeries", "maxMetadataLength", "creationGracePeriod", "enforceMetadataMetricName", "ingestionTenantShardSize", "maxGlobalSeriesPerUser", "maxGlobalSeriesPerMetric", "maxGlobalMetricsWithMetadataPerUser", "maxGlobalMetadataPerMetric", "maxGlobalExemplarsPerUser", "nativeHistogramsIngestionEnabled", "outOfOrderTimeWindow", "outOfOrderBlocksExternalLabelEnabled", "separateMetricsGroupLabel", "maxChunksPerQuery", "maxFetchedSeriesPerQuery", "maxFetchedChunkBytesPerQuery", "maxQueryLookback", "maxPartialQueryLength", "maxQueryParallelism", "maxLabelsQueryLength", "maxCacheFreshness", "maxQueriersPerTenant", "queryShardingTotalShards", "queryShardingMaxShardedQueries", "queryShardingMaxRegexpSizeBytes", "splitInstantQueriesByInterval", "maxTotalQueryLength", "resultsCacheTTL", "resultsCacheTTLForOutOfOrderTimeWindow", "maxQueryExpressionSizeBytes", "cardinalityAnalysisEnabled", "labelNamesAndValuesResultsMaxSizeBytes", "labelValuesMaxCardinalityLabelNamesPerRequest", "rulerEvaluationDelay", "rulerTenantShardSize", "rulerMaxRulesPerRuleGroup", "rulerMaxRuleGroupsPerTenant", "rulerRecordingRulesEvaluationEnabled", "rulerAlertingRulesEvaluationEnabled", "storeGatewayTenantShardSize", "compactorBlocksRetentionPeriod", "compactorSplitAndMergeShards", "compactorSplitGroups", "compactorTenantShardSize", "compactorPartialBlockDeletionDelay", "compactorBlockUploadEnabled", "compactorBlockUploadValidationEnabled", "compactorBlockUploadVerifyChunks", "s3SSEType", "s3SSEKMSKeyID", "s3SSEKMSEncryptionContext", "alertmanagerReceiversBlockCIDRNetworks", "alertmanagerReceiversBlockPrivateAddresses", "notificationRateLimit", "notificationRateLimitPerIntegration", "alertmanagerMaxConfigSizeBytes", "alertmanagerMaxTemplatesCount", "alertmanagerMaxTemplateSizeBytes", "alertmanagerMaxDispatcherAggregationGroups", "alertmanagerMaxAlertsCount", "alertmanagerMaxAlertsSizeBytes", "forwardingEndpoint", "forwardingDropOlderThan", "forwardingRules"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "first": + case "requestRate": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("first")) - it.First, err = ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("requestRate")) + it.RequestRate, err = ec.unmarshalOFloat2ᚖfloat64(ctx, v) if err != nil { return it, err } - case "last": + case "requestBurstSize": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("last")) - it.Last, err = ec.unmarshalOString2ᚖstring(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("requestBurstSize")) + it.RequestBurstSize, err = ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - } - } + case "ingestionRate": + var err error - return it, nil -} + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ingestionRate")) + it.IngestionRate, err = ec.unmarshalOFloat2ᚖfloat64(ctx, v) + if err != nil { + return it, err + } + case "ingestionBurstSize": + var err error -func (ec *executionContext) unmarshalInputObservabilityTenantEditorsInput(ctx context.Context, obj interface{}) (model.ObservabilityTenantEditorsInput, error) { - var it model.ObservabilityTenantEditorsInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ingestionBurstSize")) + it.IngestionBurstSize, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "acceptHASamples": + var err error - fieldsInOrder := [...]string{"users", "groups"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "users": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("acceptHASamples")) + it.AcceptHASamples, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "haClusterLabel": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("users")) - it.Users, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("haClusterLabel")) + it.HAClusterLabel, err = ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - case "groups": + case "haReplicaLabel": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groups")) - it.Groups, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("haReplicaLabel")) + it.HAReplicaLabel, err = ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - } - } + case "haMaxClusters": + var err error - return it, nil -} + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("haMaxClusters")) + it.HAMaxClusters, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "dropLabels": + var err error -func (ec *executionContext) unmarshalInputObservabilityTenantViewersInput(ctx context.Context, obj interface{}) (model.ObservabilityTenantViewersInput, error) { - var it model.ObservabilityTenantViewersInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dropLabels")) + it.DropLabels, err = ec.unmarshalOString2ᚕᚖstring(ctx, v) + if err != nil { + return it, err + } + case "maxLabelNameLength": + var err error - fieldsInOrder := [...]string{"users", "groups", "oauth2Clients"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "users": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxLabelNameLength")) + it.MaxLabelNameLength, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "maxLabelValueLength": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("users")) - it.Users, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxLabelValueLength")) + it.MaxLabelValueLength, err = ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - case "groups": + case "maxLabelNamesPerSeries": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groups")) - it.Groups, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxLabelNamesPerSeries")) + it.MaxLabelNamesPerSeries, err = ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - case "oauth2Clients": + case "maxMetadataLength": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("oauth2Clients")) - it.Oauth2Clients, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxMetadataLength")) + it.MaxMetadataLength, err = ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - } - } + case "creationGracePeriod": + var err error - return it, nil -} + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("creationGracePeriod")) + it.CreationGracePeriod, err = ec.unmarshalODuration2ᚖk8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐDuration(ctx, v) + if err != nil { + return it, err + } + case "enforceMetadataMetricName": + var err error -// endregion **************************** input.gotpl ***************************** + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("enforceMetadataMetricName")) + it.EnforceMetadataMetricName, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "ingestionTenantShardSize": + var err error -// region ************************** interface.gotpl *************************** + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ingestionTenantShardSize")) + it.IngestionTenantShardSize, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "maxGlobalSeriesPerUser": + var err error -// endregion ************************** interface.gotpl *************************** + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxGlobalSeriesPerUser")) + it.MaxGlobalSeriesPerUser, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "maxGlobalSeriesPerMetric": + var err error -// region **************************** object.gotpl **************************** + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxGlobalSeriesPerMetric")) + it.MaxGlobalSeriesPerMetric, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "maxGlobalMetricsWithMetadataPerUser": + var err error -var forwardingRuleImplementors = []string{"ForwardingRule"} + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxGlobalMetricsWithMetadataPerUser")) + it.MaxGlobalMetricsWithMetadataPerUser, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "maxGlobalMetadataPerMetric": + var err error -func (ec *executionContext) _ForwardingRule(ctx context.Context, sel ast.SelectionSet, obj *v1alpha1.ForwardingRule) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, forwardingRuleImplementors) - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("ForwardingRule") - case "ingest": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxGlobalMetadataPerMetric")) + it.MaxGlobalMetadataPerMetric, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "maxGlobalExemplarsPerUser": + var err error - out.Values[i] = ec._ForwardingRule_ingest(ctx, field, obj) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxGlobalExemplarsPerUser")) + it.MaxGlobalExemplarsPerUser, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "nativeHistogramsIngestionEnabled": + var err error - default: - panic("unknown field " + strconv.Quote(field.Name)) - } + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nativeHistogramsIngestionEnabled")) + it.NativeHistogramsIngestionEnabled, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "outOfOrderTimeWindow": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outOfOrderTimeWindow")) + it.OutOfOrderTimeWindow, err = ec.unmarshalODuration2ᚖk8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐDuration(ctx, v) + if err != nil { + return it, err + } + case "outOfOrderBlocksExternalLabelEnabled": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("outOfOrderBlocksExternalLabelEnabled")) + it.OutOfOrderBlocksExternalLabelEnabled, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "separateMetricsGroupLabel": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("separateMetricsGroupLabel")) + it.SeparateMetricsGroupLabel, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "maxChunksPerQuery": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxChunksPerQuery")) + it.MaxChunksPerQuery, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "maxFetchedSeriesPerQuery": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxFetchedSeriesPerQuery")) + it.MaxFetchedSeriesPerQuery, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "maxFetchedChunkBytesPerQuery": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxFetchedChunkBytesPerQuery")) + it.MaxFetchedChunkBytesPerQuery, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "maxQueryLookback": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxQueryLookback")) + it.MaxQueryLookback, err = ec.unmarshalODuration2ᚖk8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐDuration(ctx, v) + if err != nil { + return it, err + } + case "maxPartialQueryLength": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxPartialQueryLength")) + it.MaxPartialQueryLength, err = ec.unmarshalODuration2ᚖk8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐDuration(ctx, v) + if err != nil { + return it, err + } + case "maxQueryParallelism": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxQueryParallelism")) + it.MaxQueryParallelism, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "maxLabelsQueryLength": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxLabelsQueryLength")) + it.MaxLabelsQueryLength, err = ec.unmarshalODuration2ᚖk8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐDuration(ctx, v) + if err != nil { + return it, err + } + case "maxCacheFreshness": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxCacheFreshness")) + it.MaxCacheFreshness, err = ec.unmarshalODuration2ᚖk8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐDuration(ctx, v) + if err != nil { + return it, err + } + case "maxQueriersPerTenant": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxQueriersPerTenant")) + it.MaxQueriersPerTenant, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "queryShardingTotalShards": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("queryShardingTotalShards")) + it.QueryShardingTotalShards, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "queryShardingMaxShardedQueries": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("queryShardingMaxShardedQueries")) + it.QueryShardingMaxShardedQueries, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "queryShardingMaxRegexpSizeBytes": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("queryShardingMaxRegexpSizeBytes")) + it.QueryShardingMaxRegexpSizeBytes, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "splitInstantQueriesByInterval": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("splitInstantQueriesByInterval")) + it.SplitInstantQueriesByInterval, err = ec.unmarshalODuration2ᚖk8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐDuration(ctx, v) + if err != nil { + return it, err + } + case "maxTotalQueryLength": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxTotalQueryLength")) + it.MaxTotalQueryLength, err = ec.unmarshalODuration2ᚖk8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐDuration(ctx, v) + if err != nil { + return it, err + } + case "resultsCacheTTL": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resultsCacheTTL")) + it.ResultsCacheTTL, err = ec.unmarshalODuration2ᚖk8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐDuration(ctx, v) + if err != nil { + return it, err + } + case "resultsCacheTTLForOutOfOrderTimeWindow": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resultsCacheTTLForOutOfOrderTimeWindow")) + it.ResultsCacheTTLForOutOfOrderTimeWindow, err = ec.unmarshalODuration2ᚖk8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐDuration(ctx, v) + if err != nil { + return it, err + } + case "maxQueryExpressionSizeBytes": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxQueryExpressionSizeBytes")) + it.MaxQueryExpressionSizeBytes, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "cardinalityAnalysisEnabled": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cardinalityAnalysisEnabled")) + it.CardinalityAnalysisEnabled, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "labelNamesAndValuesResultsMaxSizeBytes": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("labelNamesAndValuesResultsMaxSizeBytes")) + it.LabelNamesAndValuesResultsMaxSizeBytes, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "labelValuesMaxCardinalityLabelNamesPerRequest": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("labelValuesMaxCardinalityLabelNamesPerRequest")) + it.LabelValuesMaxCardinalityLabelNamesPerRequest, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "rulerEvaluationDelay": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rulerEvaluationDelay")) + it.RulerEvaluationDelay, err = ec.unmarshalODuration2ᚖk8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐDuration(ctx, v) + if err != nil { + return it, err + } + case "rulerTenantShardSize": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rulerTenantShardSize")) + it.RulerTenantShardSize, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "rulerMaxRulesPerRuleGroup": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rulerMaxRulesPerRuleGroup")) + it.RulerMaxRulesPerRuleGroup, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "rulerMaxRuleGroupsPerTenant": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rulerMaxRuleGroupsPerTenant")) + it.RulerMaxRuleGroupsPerTenant, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "rulerRecordingRulesEvaluationEnabled": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rulerRecordingRulesEvaluationEnabled")) + it.RulerRecordingRulesEvaluationEnabled, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "rulerAlertingRulesEvaluationEnabled": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rulerAlertingRulesEvaluationEnabled")) + it.RulerAlertingRulesEvaluationEnabled, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "storeGatewayTenantShardSize": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("storeGatewayTenantShardSize")) + it.StoreGatewayTenantShardSize, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "compactorBlocksRetentionPeriod": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("compactorBlocksRetentionPeriod")) + it.CompactorBlocksRetentionPeriod, err = ec.unmarshalODuration2ᚖk8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐDuration(ctx, v) + if err != nil { + return it, err + } + case "compactorSplitAndMergeShards": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("compactorSplitAndMergeShards")) + it.CompactorSplitAndMergeShards, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "compactorSplitGroups": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("compactorSplitGroups")) + it.CompactorSplitGroups, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "compactorTenantShardSize": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("compactorTenantShardSize")) + it.CompactorTenantShardSize, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "compactorPartialBlockDeletionDelay": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("compactorPartialBlockDeletionDelay")) + it.CompactorPartialBlockDeletionDelay, err = ec.unmarshalODuration2ᚖk8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐDuration(ctx, v) + if err != nil { + return it, err + } + case "compactorBlockUploadEnabled": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("compactorBlockUploadEnabled")) + it.CompactorBlockUploadEnabled, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "compactorBlockUploadValidationEnabled": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("compactorBlockUploadValidationEnabled")) + it.CompactorBlockUploadValidationEnabled, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "compactorBlockUploadVerifyChunks": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("compactorBlockUploadVerifyChunks")) + it.CompactorBlockUploadVerifyChunks, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "s3SSEType": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("s3SSEType")) + it.S3SSEType, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "s3SSEKMSKeyID": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("s3SSEKMSKeyID")) + it.S3SSEKMSKeyID, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "s3SSEKMSEncryptionContext": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("s3SSEKMSEncryptionContext")) + it.S3SSEKMSEncryptionContext, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "alertmanagerReceiversBlockCIDRNetworks": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("alertmanagerReceiversBlockCIDRNetworks")) + it.AlertmanagerReceiversBlockCIDRNetworks, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "alertmanagerReceiversBlockPrivateAddresses": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("alertmanagerReceiversBlockPrivateAddresses")) + it.AlertmanagerReceiversBlockPrivateAddresses, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "notificationRateLimit": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("notificationRateLimit")) + it.NotificationRateLimit, err = ec.unmarshalOFloat2ᚖfloat64(ctx, v) + if err != nil { + return it, err + } + case "notificationRateLimitPerIntegration": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("notificationRateLimitPerIntegration")) + it.NotificationRateLimitPerIntegration, err = ec.unmarshalOFloatMap2map(ctx, v) + if err != nil { + return it, err + } + case "alertmanagerMaxConfigSizeBytes": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("alertmanagerMaxConfigSizeBytes")) + it.AlertmanagerMaxConfigSizeBytes, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "alertmanagerMaxTemplatesCount": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("alertmanagerMaxTemplatesCount")) + it.AlertmanagerMaxTemplatesCount, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "alertmanagerMaxTemplateSizeBytes": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("alertmanagerMaxTemplateSizeBytes")) + it.AlertmanagerMaxTemplateSizeBytes, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "alertmanagerMaxDispatcherAggregationGroups": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("alertmanagerMaxDispatcherAggregationGroups")) + it.AlertmanagerMaxDispatcherAggregationGroups, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "alertmanagerMaxAlertsCount": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("alertmanagerMaxAlertsCount")) + it.AlertmanagerMaxAlertsCount, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "alertmanagerMaxAlertsSizeBytes": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("alertmanagerMaxAlertsSizeBytes")) + it.AlertmanagerMaxAlertsSizeBytes, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "forwardingEndpoint": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("forwardingEndpoint")) + it.ForwardingEndpoint, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "forwardingDropOlderThan": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("forwardingDropOlderThan")) + it.ForwardingDropOlderThan, err = ec.unmarshalODuration2ᚖk8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐDuration(ctx, v) + if err != nil { + return it, err + } + case "forwardingRules": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("forwardingRules")) + it.ForwardingRules, err = ec.unmarshalOForwardingRuleMap2map(ctx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputNameInput(ctx context.Context, obj interface{}) (model.NameInput, error) { + var it model.NameInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"first", "last"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "first": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("first")) + it.First, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "last": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("last")) + it.Last, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputObservabilityTenantEditorsInput(ctx context.Context, obj interface{}) (model.ObservabilityTenantEditorsInput, error) { + var it model.ObservabilityTenantEditorsInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"users", "groups"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "users": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("users")) + it.Users, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + case "groups": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groups")) + it.Groups, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputObservabilityTenantLimitsInput(ctx context.Context, obj interface{}) (model.ObservabilityTenantLimitsInput, error) { + var it model.ObservabilityTenantLimitsInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"mimir"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "mimir": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("mimir")) + it.Mimir, err = ec.unmarshalOMimirLimitsInput2ᚖgithubᚗcomᚋpluralshᚋtraceᚑshieldᚑcontrollerᚋapiᚋobservabilityᚋv1alpha1ᚐMimirLimitsInput(ctx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputObservabilityTenantViewersInput(ctx context.Context, obj interface{}) (model.ObservabilityTenantViewersInput, error) { + var it model.ObservabilityTenantViewersInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"users", "groups", "oauth2Clients"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "users": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("users")) + it.Users, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + case "groups": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("groups")) + it.Groups, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + case "oauth2Clients": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("oauth2Clients")) + it.Oauth2Clients, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var forwardingRuleImplementors = []string{"ForwardingRule"} + +func (ec *executionContext) _ForwardingRule(ctx context.Context, sel ast.SelectionSet, obj *v1alpha1.ForwardingRule) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, forwardingRuleImplementors) + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ForwardingRule") + case "ingest": + + out.Values[i] = ec._ForwardingRule_ingest(ctx, field, obj) + + default: + panic("unknown field " + strconv.Quote(field.Name)) + } } out.Dispatch() if invalids > 0 { @@ -16228,14 +17007,6 @@ func (ec *executionContext) _ObservabilityTenantLimits(ctx context.Context, sel out.Values[i] = ec._ObservabilityTenantLimits_mimir(ctx, field, obj) - case "loki": - - out.Values[i] = ec._ObservabilityTenantLimits_loki(ctx, field, obj) - - case "tempo": - - out.Values[i] = ec._ObservabilityTenantLimits_tempo(ctx, field, obj) - default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -17873,13 +18644,6 @@ func (ec *executionContext) unmarshalOLoginBindingsInput2ᚖgithubᚗcomᚋplura return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOLokiLimits2ᚖgithubᚗcomᚋpluralshᚋoauthᚑplaygroundᚋapiᚑserverᚋgraphᚋmodelᚐLokiLimits(ctx context.Context, sel ast.SelectionSet, v *model.LokiLimits) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._LokiLimits(ctx, sel, v) -} - func (ec *executionContext) unmarshalOMap2map(ctx context.Context, v interface{}) (map[string]interface{}, error) { if v == nil { return nil, nil @@ -17903,6 +18667,14 @@ func (ec *executionContext) marshalOMimirLimits2ᚖgithubᚗcomᚋpluralshᚋtra return ec._MimirLimits(ctx, sel, v) } +func (ec *executionContext) unmarshalOMimirLimitsInput2ᚖgithubᚗcomᚋpluralshᚋtraceᚑshieldᚑcontrollerᚋapiᚋobservabilityᚋv1alpha1ᚐMimirLimitsInput(ctx context.Context, v interface{}) (*v1alpha1.MimirLimitsInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputMimirLimitsInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalOName2ᚖgithubᚗcomᚋpluralshᚋoauthᚑplaygroundᚋapiᚑserverᚋgraphᚋmodelᚐName(ctx context.Context, sel ast.SelectionSet, v *model.Name) graphql.Marshaler { if v == nil { return graphql.Null @@ -18001,6 +18773,14 @@ func (ec *executionContext) marshalOObservabilityTenantLimits2ᚖgithubᚗcomᚋ return ec._ObservabilityTenantLimits(ctx, sel, v) } +func (ec *executionContext) unmarshalOObservabilityTenantLimitsInput2ᚖgithubᚗcomᚋpluralshᚋoauthᚑplaygroundᚋapiᚑserverᚋgraphᚋmodelᚐObservabilityTenantLimitsInput(ctx context.Context, v interface{}) (*model.ObservabilityTenantLimitsInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputObservabilityTenantLimitsInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalOObservabilityTenantViewers2ᚖgithubᚗcomᚋpluralshᚋoauthᚑplaygroundᚋapiᚑserverᚋgraphᚋmodelᚐObservabilityTenantViewers(ctx context.Context, sel ast.SelectionSet, v *model.ObservabilityTenantViewers) graphql.Marshaler { if v == nil { return graphql.Null @@ -18109,13 +18889,6 @@ func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel as return res } -func (ec *executionContext) marshalOTempoLimits2ᚖgithubᚗcomᚋpluralshᚋoauthᚑplaygroundᚋapiᚑserverᚋgraphᚋmodelᚐTempoLimits(ctx context.Context, sel ast.SelectionSet, v *model.TempoLimits) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._TempoLimits(ctx, sel, v) -} - func (ec *executionContext) unmarshalOTime2ᚖtimeᚐTime(ctx context.Context, v interface{}) (*time.Time, error) { if v == nil { return nil, nil diff --git a/api-server/graph/model/models_gen.go b/api-server/graph/model/models_gen.go index 6ad48d4..126be53 100644 --- a/api-server/graph/model/models_gen.go +++ b/api-server/graph/model/models_gen.go @@ -219,10 +219,12 @@ type ObservabilityTenantEditorsInput struct { type ObservabilityTenantLimits struct { // The limits for Mimir for the tenant. Mimir *v1alpha1.MimirLimits `json:"mimir"` - // The limits for Loki for the tenant. - Loki *LokiLimits `json:"loki"` - // The limits for Tempo for the tenant. - Tempo *TempoLimits `json:"tempo"` +} + +// Inputs for the limits of a tenant. +type ObservabilityTenantLimitsInput struct { + // The limits for Mimir for the tenant. + Mimir *v1alpha1.MimirLimitsInput `json:"mimir"` } // Representation of the users, groups and oauth2 clients that can view or send data a tenant. diff --git a/api-server/graph/observabilitytenant.graphqls b/api-server/graph/observabilitytenant.graphqls index ef16367..8c0cef1 100644 --- a/api-server/graph/observabilitytenant.graphqls +++ b/api-server/graph/observabilitytenant.graphqls @@ -21,11 +21,23 @@ type ObservabilityTenantLimits { "The limits for Mimir for the tenant." mimir: MimirLimits - "The limits for Loki for the tenant." - loki: LokiLimits + # "The limits for Loki for the tenant." + # loki: LokiLimits - "The limits for Tempo for the tenant." - tempo: TempoLimits + # "The limits for Tempo for the tenant." + # tempo: TempoLimits +} + +"Inputs for the limits of a tenant." +input ObservabilityTenantLimitsInput { + "The limits for Mimir for the tenant." + mimir: MimirLimitsInput + + # "The limits for Loki for the tenant." + # loki: LokiLimitsInput + + # "The limits for Tempo for the tenant." + # tempo: TempoLimitsInput } scalar Duration @@ -195,6 +207,198 @@ type MimirLimits { + alertmanagerReceiversBlockCIDRNetworks: String + + alertmanagerReceiversBlockPrivateAddresses: Boolean + + + notificationRateLimit: Float + + notificationRateLimitPerIntegration: FloatMap + + + alertmanagerMaxConfigSizeBytes: Int + + alertmanagerMaxTemplatesCount: Int + + alertmanagerMaxTemplateSizeBytes: Int + + alertmanagerMaxDispatcherAggregationGroups: Int + + alertmanagerMaxAlertsCount: Int + + alertmanagerMaxAlertsSizeBytes: Int + + + forwardingEndpoint: String + + forwardingDropOlderThan: Duration + + forwardingRules: ForwardingRuleMap +} + +input MimirLimitsInput { + requestRate: Float + + requestBurstSize: Int + + ingestionRate: Float + + ingestionBurstSize: Int + + acceptHASamples: Boolean + + haClusterLabel: String + + haReplicaLabel: String + + haMaxClusters: Int + + dropLabels: [String] + + maxLabelNameLength: Int + + maxLabelValueLength: Int + + maxLabelNamesPerSeries: Int + + maxMetadataLength: Int + + creationGracePeriod: Duration + + enforceMetadataMetricName: Boolean + + ingestionTenantShardSize: Int + + # metricRelabelConfigs + + + + + + + maxGlobalSeriesPerUser: Int + + maxGlobalSeriesPerMetric: Int + + + maxGlobalMetricsWithMetadataPerUser: Int + + maxGlobalMetadataPerMetric: Int + + + + maxGlobalExemplarsPerUser: Int + + + nativeHistogramsIngestionEnabled: Boolean + + # activeSeriesCustomTrackersConfig: + + + outOfOrderTimeWindow: Duration + + outOfOrderBlocksExternalLabelEnabled: Boolean + + + + + separateMetricsGroupLabel: String + + + + maxChunksPerQuery: Int + + maxFetchedSeriesPerQuery: Int + + maxFetchedChunkBytesPerQuery: Int + + maxQueryLookback: Duration + + maxPartialQueryLength: Duration + + maxQueryParallelism: Int + + maxLabelsQueryLength: Duration + + maxCacheFreshness: Duration + + maxQueriersPerTenant: Int + + queryShardingTotalShards: Int + + queryShardingMaxShardedQueries: Int + + queryShardingMaxRegexpSizeBytes: Int + + splitInstantQueriesByInterval: Duration + + + + maxTotalQueryLength: Duration + + resultsCacheTTL: Duration + + resultsCacheTTLForOutOfOrderTimeWindow: Duration + + maxQueryExpressionSizeBytes: Int + + + + cardinalityAnalysisEnabled: Boolean + + labelNamesAndValuesResultsMaxSizeBytes: Int + + labelValuesMaxCardinalityLabelNamesPerRequest: Int + + + + rulerEvaluationDelay: Duration + + rulerTenantShardSize: Int + + rulerMaxRulesPerRuleGroup: Int + + rulerMaxRuleGroupsPerTenant: Int + + rulerRecordingRulesEvaluationEnabled: Boolean + + rulerAlertingRulesEvaluationEnabled: Boolean + + + + storeGatewayTenantShardSize: Int + + + + compactorBlocksRetentionPeriod: Duration + + compactorSplitAndMergeShards: Int + + compactorSplitGroups: Int + + compactorTenantShardSize: Int + + compactorPartialBlockDeletionDelay: Duration + + compactorBlockUploadEnabled: Boolean + + compactorBlockUploadValidationEnabled: Boolean + + compactorBlockUploadVerifyChunks: Boolean + + + + + s3SSEType: String + + s3SSEKMSKeyID: String + + s3SSEKMSEncryptionContext: String + + + + alertmanagerReceiversBlockCIDRNetworks: String alertmanagerReceiversBlockPrivateAddresses: Boolean @@ -299,6 +503,8 @@ extend type Mutation { viewers: ObservabilityTenantViewersInput "The users and groups that can edit a tenant to add users, groups or oauth2 clients to it." editors: ObservabilityTenantEditorsInput + "The limits for the tenant." + limits: ObservabilityTenantLimitsInput ): ObservabilityTenant! @checkPermissions @isAuthenticated "Update an observability tenant." @@ -309,6 +515,8 @@ extend type Mutation { viewers: ObservabilityTenantViewersInput "The users and groups that can edit a tenant to add users, groups or oauth2 clients to it." editors: ObservabilityTenantEditorsInput + "The limits for the tenant." + limits: ObservabilityTenantLimitsInput ): ObservabilityTenant! @checkPermissions @isAuthenticated "Delete an observability tenant." diff --git a/api-server/graph/resolvers/observabilitytenant.resolvers.go b/api-server/graph/resolvers/observabilitytenant.resolvers.go index c808bf0..07f69ea 100644 --- a/api-server/graph/resolvers/observabilitytenant.resolvers.go +++ b/api-server/graph/resolvers/observabilitytenant.resolvers.go @@ -12,13 +12,13 @@ import ( ) // CreateObservabilityTenant is the resolver for the createObservabilityTenant field. -func (r *mutationResolver) CreateObservabilityTenant(ctx context.Context, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput) (*model.ObservabilityTenant, error) { - return r.C.MutateObservabilityTenant(ctx, name, viewers, editors) +func (r *mutationResolver) CreateObservabilityTenant(ctx context.Context, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput, limits *model.ObservabilityTenantLimitsInput) (*model.ObservabilityTenant, error) { + return r.C.CreateObservabilityTenant(ctx, name, viewers, editors, limits) } // UpdateObservabilityTenant is the resolver for the updateObservabilityTenant field. -func (r *mutationResolver) UpdateObservabilityTenant(ctx context.Context, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput) (*model.ObservabilityTenant, error) { - return r.C.MutateObservabilityTenant(ctx, name, viewers, editors) +func (r *mutationResolver) UpdateObservabilityTenant(ctx context.Context, name string, viewers *model.ObservabilityTenantViewersInput, editors *model.ObservabilityTenantEditorsInput, limits *model.ObservabilityTenantLimitsInput) (*model.ObservabilityTenant, error) { + return r.C.UpdateObservabilityTenant(ctx, name, viewers, editors, limits) } // DeleteObservabilityTenant is the resolver for the deleteObservabilityTenant field.