diff --git a/.tools/nvim/__http__/console/import-mres.graphql.yml b/.tools/nvim/__http__/console/import-mres.graphql.yml new file mode 100644 index 000000000..9c9420e53 --- /dev/null +++ b/.tools/nvim/__http__/console/import-mres.graphql.yml @@ -0,0 +1,71 @@ +--- +label: List Imported Managed Resources +query: |+ #graphql + query Core_listImportedManagedResources($envName: String!, $search: SearchImportedManagedResources) { + core_listImportedManagedResources(envName: $envName, search: $search) { + edges { + node { + name + accountName + environmentName + displayName + createdBy { + userEmail + } + managedResource { + spec { + resourceTemplate { + kind + } + } + } + } + } + } + } +variables: + envName: "nxt-dev-1" + search: {} + +--- + +label: Read Secret for Imported Managed Resource +query: |+ #graphql + query Core_getSecret($envName: String!, $name: String!) { + core_getSecret(envName: $envName, name: $name) { + metadata { + name + } + stringData + } + } +variables: + envName: "nxt-dev-1" + name: "copy-root-mongo" + +--- +label: Delete Imported Managed Resources +query: |+ #graphql + mutation Core_deleteImportedManagedResource($envName: String!, $importName: String!) { + core_deleteImportedManagedResource(envName: $envName, importName: $importName) + } +variables: + envName: "nxt-dev-1" + importName: "copy-root-pg" +--- + +label: Import Managed Resources +query: |+ #graphql + mutation Core_ImportManagedResource($envName: String!, $msvcName: String!, $mresName: String!, $importName: String!) { + core_importManagedResource(envName: $envName, msvcName: $msvcName, mresName: $mresName, importName: $importName) { + accountName + environmentName + } + } +variables: + envName: "nxt-dev-1" + # msvcName: "t-postgres" + msvcName: "sample" + mresName: "root-credentials" + importName: "copy-root-mongo" +--- diff --git a/.tools/nvim/__http__/console/msvc.graphql.yml b/.tools/nvim/__http__/console/msvc.graphql.yml index a88ca3b6e..5628c0bf4 100644 --- a/.tools/nvim/__http__/console/msvc.graphql.yml +++ b/.tools/nvim/__http__/console/msvc.graphql.yml @@ -7,7 +7,7 @@ global: label: List Managed Service Templates query: |+ query Core_listManagedServiceTemplates { - core_listManagedServiceTemplates { + infra_listManagedServiceTemplates { category displayName items { diff --git a/apps/console/Taskfile.yml b/apps/console/Taskfile.yml index 64504f43c..a91e5c93a 100644 --- a/apps/console/Taskfile.yml +++ b/apps/console/Taskfile.yml @@ -34,13 +34,14 @@ tasks: --struct github.com/kloudlite/api/apps/console/internal/domain.ManagedResourceKeyValueRef --struct github.com/kloudlite/api/apps/console/internal/entities.Router --struct github.com/kloudlite/api/apps/console/internal/entities.ManagedResource + --struct github.com/kloudlite/api/apps/console/internal/entities.ImportedManagedResource --struct github.com/kloudlite/api/apps/console/internal/entities.ImagePullSecret --struct github.com/kloudlite/api/pkg/repos.MatchFilter --struct github.com/kloudlite/api/pkg/repos.CursorPagination > ./internal/app/_struct-to-graphql/main.go - |+ pushd ./internal/app/_struct-to-graphql - go run main.go --dev --out-dir ../graph/struct-to-graphql --with-pagination Environment,App,ExternalApp,Secret,Config,Router,ManagedResource,ImagePullSecret,ConsoleVPNDevice + go run main.go --dev --out-dir ../graph/struct-to-graphql --with-pagination Environment,App,ExternalApp,Secret,Config,Router,ManagedResource,ImportedManagedResource,ImagePullSecret,ConsoleVPNDevice popd - rm -rf ./internal/app/_struct-to-graphql diff --git a/apps/console/internal/app/adapter-resource-update-publish.go b/apps/console/internal/app/adapter-resource-update-publish.go index 118cab3b0..660d1f1f6 100644 --- a/apps/console/internal/app/adapter-resource-update-publish.go +++ b/apps/console/internal/app/adapter-resource-update-publish.go @@ -14,6 +14,11 @@ type ResourceEventPublisherImpl struct { logger logging.Logger } +func (r *ResourceEventPublisherImpl) PublishClusterManagedServiceEvent(ctx domain.ConsoleContext, msvcName string, resourceType entities.ResourceType, name string, update domain.PublishMsg) { + subject := fmt.Sprintf("res-updates.account.%s.cluster_managed_service.%s.%s.%s", ctx.AccountName, msvcName, resourceType, name) + r.publish(subject, update) +} + func (r *ResourceEventPublisherImpl) PublishEnvironmentResourceEvent(ctx domain.ConsoleContext, envName string, resourceType entities.ResourceType, name string, update domain.PublishMsg) { subject := fmt.Sprintf("res-updates.account.%s.environment.%s.%s.%s", ctx.AccountName, envName, resourceType, name) r.publish(subject, update) diff --git a/apps/console/internal/app/app.go b/apps/console/internal/app/app.go index 67dac3395..528d7dc9a 100644 --- a/apps/console/internal/app/app.go +++ b/apps/console/internal/app/app.go @@ -2,6 +2,7 @@ package app import ( "context" + "github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/console" "github.com/kloudlite/api/pkg/k8s" @@ -53,14 +54,13 @@ func toConsoleContext(requestCtx context.Context, accountCookieName string) (dom } var Module = fx.Module("app", - // repos.NewFxMongoRepo[*entities.Project]("projects", "prj", entities.ProjectIndexes), - // repos.NewFxMongoRepo[*entities.ProjectManagedService]("project_managed_service", "pmsvc", entities.ProjectManagedServiceIndices), repos.NewFxMongoRepo[*entities.Environment]("environments", "env", entities.EnvironmentIndexes), repos.NewFxMongoRepo[*entities.App]("apps", "app", entities.AppIndexes), repos.NewFxMongoRepo[*entities.ExternalApp]("ext_apps", "extapp", entities.ExternalAppIndexes), repos.NewFxMongoRepo[*entities.Config]("configs", "cfg", entities.ConfigIndexes), repos.NewFxMongoRepo[*entities.Secret]("secrets", "scrt", entities.SecretIndexes), repos.NewFxMongoRepo[*entities.ManagedResource]("managed_resources", "mres", entities.MresIndexes), + repos.NewFxMongoRepo[*entities.ImportedManagedResource]("imported_managed_resources", "impmres", entities.ImportedManagedResourceIndexes), repos.NewFxMongoRepo[*entities.Router]("routers", "rt", entities.RouterIndexes), repos.NewFxMongoRepo[*entities.ImagePullSecret]("image_pull_secrets", "ips", entities.ImagePullSecretIndexes), repos.NewFxMongoRepo[*entities.ResourceMapping]("resource_mappings", "rmap", entities.ResourceMappingIndices), diff --git a/apps/console/internal/app/gqlgen.yml b/apps/console/internal/app/gqlgen.yml index 6efaeff16..fc7e6dba1 100644 --- a/apps/console/internal/app/gqlgen.yml +++ b/apps/console/internal/app/gqlgen.yml @@ -141,6 +141,12 @@ models: model: github.com/kloudlite/api/apps/console/internal/entities.ManagedResource ManagedResourceIn: *managed-resource-model + ImportedManagedResource: &managed-resource-model + model: github.com/kloudlite/api/apps/console/internal/entities.ImportedManagedResource + fields: + managedResource: + resolver: true + ManagedResourceKeyRefIn: model: github.com/kloudlite/api/apps/console/internal/domain.ManagedResourceKeyRef diff --git a/apps/console/internal/app/graph/common-types.resolvers.go b/apps/console/internal/app/graph/common-types.resolvers.go index 2984b6d01..3b8069bb2 100644 --- a/apps/console/internal/app/graph/common-types.resolvers.go +++ b/apps/console/internal/app/graph/common-types.resolvers.go @@ -165,6 +165,16 @@ func (r *metadataResolver) Labels(ctx context.Context, obj *v1.ObjectMeta) (map[ return m, nil } +// LastSyncedAt is the resolver for the lastSyncedAt field. +func (r *github__com___kloudlite___api___pkg___types__SyncStatusInResolver) LastSyncedAt(ctx context.Context, obj *types.SyncStatus, data *string) error { + panic(fmt.Errorf("not implemented: LastSyncedAt - lastSyncedAt")) +} + +// SyncScheduledAt is the resolver for the syncScheduledAt field. +func (r *github__com___kloudlite___api___pkg___types__SyncStatusInResolver) SyncScheduledAt(ctx context.Context, obj *types.SyncStatus, data *string) error { + panic(fmt.Errorf("not implemented: SyncScheduledAt - syncScheduledAt")) +} + // AppPort is the resolver for the appPort field. func (r *github__com___kloudlite___operator___apis___crds___v1__AppInterceptPortMappingsInResolver) AppPort(ctx context.Context, obj *v12.AppInterceptPortMappings, data int) error { if obj == nil { @@ -226,6 +236,11 @@ func (r *Resolver) K8s__io___api___core___v1__Secret() generated.K8s__io___api__ // Metadata returns generated.MetadataResolver implementation. func (r *Resolver) Metadata() generated.MetadataResolver { return &metadataResolver{r} } +// Github__com___kloudlite___api___pkg___types__SyncStatusIn returns generated.Github__com___kloudlite___api___pkg___types__SyncStatusInResolver implementation. +func (r *Resolver) Github__com___kloudlite___api___pkg___types__SyncStatusIn() generated.Github__com___kloudlite___api___pkg___types__SyncStatusInResolver { + return &github__com___kloudlite___api___pkg___types__SyncStatusInResolver{r} +} + // Github__com___kloudlite___operator___apis___crds___v1__AppInterceptPortMappingsIn returns generated.Github__com___kloudlite___operator___apis___crds___v1__AppInterceptPortMappingsInResolver implementation. func (r *Resolver) Github__com___kloudlite___operator___apis___crds___v1__AppInterceptPortMappingsIn() generated.Github__com___kloudlite___operator___apis___crds___v1__AppInterceptPortMappingsInResolver { return &github__com___kloudlite___operator___apis___crds___v1__AppInterceptPortMappingsInResolver{r} @@ -239,5 +254,6 @@ type github__com___kloudlite___api___pkg___types__SyncStatusResolver struct{ *Re type github__com___kloudlite___operator___pkg___operator__StatusResolver struct{ *Resolver } type k8s__io___api___core___v1__SecretResolver struct{ *Resolver } type metadataResolver struct{ *Resolver } +type github__com___kloudlite___api___pkg___types__SyncStatusInResolver struct{ *Resolver } type github__com___kloudlite___operator___apis___crds___v1__AppInterceptPortMappingsInResolver struct{ *Resolver } type metadataInResolver struct{ *Resolver } diff --git a/apps/console/internal/app/graph/generated/generated.go b/apps/console/internal/app/graph/generated/generated.go index a20617e0d..c18344743 100644 --- a/apps/console/internal/app/graph/generated/generated.go +++ b/apps/console/internal/app/graph/generated/generated.go @@ -59,6 +59,7 @@ type ResolverRoot interface { Github__com___kloudlite___api___pkg___types__SyncStatus() Github__com___kloudlite___api___pkg___types__SyncStatusResolver Github__com___kloudlite___operator___pkg___operator__Status() Github__com___kloudlite___operator___pkg___operator__StatusResolver ImagePullSecret() ImagePullSecretResolver + ImportedManagedResource() ImportedManagedResourceResolver K8s__io___api___core___v1__Secret() K8s__io___api___core___v1__SecretResolver ManagedResource() ManagedResourceResolver Metadata() MetadataResolver @@ -71,6 +72,7 @@ type ResolverRoot interface { ConsoleVPNDeviceIn() ConsoleVPNDeviceInResolver EnvironmentIn() EnvironmentInResolver ExternalAppIn() ExternalAppInResolver + Github__com___kloudlite___api___pkg___types__SyncStatusIn() Github__com___kloudlite___api___pkg___types__SyncStatusInResolver Github__com___kloudlite___operator___apis___crds___v1__AppInterceptPortMappingsIn() Github__com___kloudlite___operator___apis___crds___v1__AppInterceptPortMappingsInResolver ImagePullSecretIn() ImagePullSecretInResolver ManagedResourceIn() ManagedResourceInResolver @@ -277,6 +279,19 @@ type ComplexityRoot struct { TotalCount func(childComplexity int) int } + Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef struct { + ID func(childComplexity int) int + Name func(childComplexity int) int + Namespace func(childComplexity int) int + } + + Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor struct { + Name func(childComplexity int) int + Namespace func(childComplexity int) int + RefID func(childComplexity int) int + ResourceType func(childComplexity int) int + } + Github__com___kloudlite___api___common__CreatedOrUpdatedBy struct { UserEmail func(childComplexity int) int UserID func(childComplexity int) int @@ -305,6 +320,11 @@ type ComplexityRoot struct { Namespace func(childComplexity int) int } + Github__com___kloudlite___operator___apis___common____types__SecretRef struct { + Name func(childComplexity int) int + Namespace func(childComplexity int) int + } + Github__com___kloudlite___operator___apis___crds___v1__AppContainer struct { Args func(childComplexity int) int Command func(childComplexity int) int @@ -590,6 +610,35 @@ type ComplexityRoot struct { TotalCount func(childComplexity int) int } + ImportedManagedResource struct { + AccountName func(childComplexity int) int + CreatedBy func(childComplexity int) int + CreationTime func(childComplexity int) int + DisplayName func(childComplexity int) int + EnvironmentName func(childComplexity int) int + ID func(childComplexity int) int + LastUpdatedBy func(childComplexity int) int + ManagedResource func(childComplexity int) int + ManagedResourceRef func(childComplexity int) int + MarkedForDeletion func(childComplexity int) int + Name func(childComplexity int) int + RecordVersion func(childComplexity int) int + SecretRef func(childComplexity int) int + SyncStatus func(childComplexity int) int + UpdateTime func(childComplexity int) int + } + + ImportedManagedResourceEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + + ImportedManagedResourcePaginatedRecords struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + TotalCount func(childComplexity int) int + } + K8s__io___api___core___v1__Secret struct { APIVersion func(childComplexity int) int Data func(childComplexity int) int @@ -711,12 +760,12 @@ type ComplexityRoot struct { CoreDeleteEnvironment func(childComplexity int, envName string) int CoreDeleteExternalApp func(childComplexity int, envName string, externalAppName string) int CoreDeleteImagePullSecret func(childComplexity int, name string) int - CoreDeleteImportedManagedResource func(childComplexity int, envName string, mresName string) int + CoreDeleteImportedManagedResource func(childComplexity int, envName string, importName string) int CoreDeleteManagedResource func(childComplexity int, msvcName string, mresName string) int CoreDeleteRouter func(childComplexity int, envName string, routerName string) int CoreDeleteSecret func(childComplexity int, envName string, secretName string) int CoreDeleteVPNDevice func(childComplexity int, deviceName string) int - CoreImportManagedResource func(childComplexity int, envName string, msvcName string, mresName string) int + CoreImportManagedResource func(childComplexity int, envName string, msvcName string, mresName string, importName string) int CoreInterceptApp func(childComplexity int, envName string, appname string, deviceName string, intercept bool, portMappings []*v1.AppInterceptPortMappings) int CoreInterceptExternalApp func(childComplexity int, envName string, externalAppName string, deviceName string, intercept bool, portMappings []*v1.AppInterceptPortMappings) int CoreUpdateApp func(childComplexity int, envName string, app entities.App) int @@ -766,6 +815,7 @@ type ComplexityRoot struct { CoreListEnvironments func(childComplexity int, search *model.SearchEnvironments, pq *repos.CursorPagination) int CoreListExternalApps func(childComplexity int, envName string, search *model.SearchExternalApps, pq *repos.CursorPagination) int CoreListImagePullSecrets func(childComplexity int, search *model.SearchImagePullSecrets, pq *repos.CursorPagination) int + CoreListImportedManagedResources func(childComplexity int, envName string, search *model.SearchImportedManagedResources, pq *repos.CursorPagination) int CoreListManagedResources func(childComplexity int, search *model.SearchManagedResources, pq *repos.CursorPagination) int CoreListRouters func(childComplexity int, envName string, search *model.SearchRouters, pq *repos.CursorPagination) int CoreListSecrets func(childComplexity int, envName string, search *model.SearchSecrets, pq *repos.CursorPagination) int @@ -823,6 +873,7 @@ type ComplexityRoot struct { Data func(childComplexity int) int DisplayName func(childComplexity int) int EnvironmentName func(childComplexity int) int + For func(childComplexity int) int Id func(childComplexity int) int Immutable func(childComplexity int) int IsReadyOnly func(childComplexity int) int @@ -928,6 +979,18 @@ type ImagePullSecretResolver interface { UpdateTime(ctx context.Context, obj *entities.ImagePullSecret) (string, error) } +type ImportedManagedResourceResolver interface { + CreationTime(ctx context.Context, obj *entities.ImportedManagedResource) (string, error) + + ID(ctx context.Context, obj *entities.ImportedManagedResource) (repos.ID, error) + + ManagedResourceRef(ctx context.Context, obj *entities.ImportedManagedResource) (*model.GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRef, error) + + SecretRef(ctx context.Context, obj *entities.ImportedManagedResource) (*model.GithubComKloudliteOperatorApisCommonTypesSecretRef, error) + + UpdateTime(ctx context.Context, obj *entities.ImportedManagedResource) (string, error) + ManagedResource(ctx context.Context, obj *entities.ImportedManagedResource) (*entities.ManagedResource, error) +} type K8s__io___api___core___v1__SecretResolver interface { Data(ctx context.Context, obj *v12.Secret) (map[string]interface{}, error) @@ -976,8 +1039,8 @@ type MutationResolver interface { CoreCreateManagedResource(ctx context.Context, msvcName string, mres entities.ManagedResource) (*entities.ManagedResource, error) CoreUpdateManagedResource(ctx context.Context, msvcName string, mres entities.ManagedResource) (*entities.ManagedResource, error) CoreDeleteManagedResource(ctx context.Context, msvcName string, mresName string) (bool, error) - CoreImportManagedResource(ctx context.Context, envName string, msvcName string, mresName string) (*entities.ManagedResource, error) - CoreDeleteImportedManagedResource(ctx context.Context, envName string, mresName string) (bool, error) + CoreImportManagedResource(ctx context.Context, envName string, msvcName string, mresName string, importName string) (*entities.ImportedManagedResource, error) + CoreDeleteImportedManagedResource(ctx context.Context, envName string, importName string) (bool, error) CoreCreateVPNDevice(ctx context.Context, vpnDevice entities.ConsoleVPNDevice) (*entities.ConsoleVPNDevice, error) CoreUpdateVPNDevice(ctx context.Context, vpnDevice entities.ConsoleVPNDevice) (*entities.ConsoleVPNDevice, error) CoreUpdateVPNDevicePorts(ctx context.Context, deviceName string, ports []*v11.Port) (bool, error) @@ -1017,6 +1080,7 @@ type QueryResolver interface { CoreListManagedResources(ctx context.Context, search *model.SearchManagedResources, pq *repos.CursorPagination) (*model.ManagedResourcePaginatedRecords, error) CoreGetManagedResource(ctx context.Context, msvcName *string, envName *string, name string) (*entities.ManagedResource, error) CoreResyncManagedResource(ctx context.Context, msvcName string, name string) (bool, error) + CoreListImportedManagedResources(ctx context.Context, envName string, search *model.SearchImportedManagedResources, pq *repos.CursorPagination) (*model.ImportedManagedResourcePaginatedRecords, error) CoreListVPNDevices(ctx context.Context, search *model.CoreSearchVPNDevices, pq *repos.CursorPagination) (*model.ConsoleVPNDevicePaginatedRecords, error) CoreListVPNDevicesForUser(ctx context.Context) ([]*entities.ConsoleVPNDevice, error) CoreGetVPNDevice(ctx context.Context, name string) (*entities.ConsoleVPNDevice, error) @@ -1032,6 +1096,8 @@ type SecretResolver interface { CreationTime(ctx context.Context, obj *entities.Secret) (string, error) Data(ctx context.Context, obj *entities.Secret) (map[string]interface{}, error) + For(ctx context.Context, obj *entities.Secret) (*model.GithubComKloudliteAPIAppsConsoleInternalEntitiesSecretCreatedFor, error) + IsReadyOnly(ctx context.Context, obj *entities.Secret) (bool, error) StringData(ctx context.Context, obj *entities.Secret) (map[string]interface{}, error) @@ -1063,6 +1129,11 @@ type ExternalAppInResolver interface { Spec(ctx context.Context, obj *entities.ExternalApp, data *model.GithubComKloudliteOperatorApisCrdsV1ExternalAppSpecIn) error Status(ctx context.Context, obj *entities.ExternalApp, data *model.GithubComKloudliteOperatorPkgOperatorStatusIn) error } +type Github__com___kloudlite___api___pkg___types__SyncStatusInResolver interface { + LastSyncedAt(ctx context.Context, obj *types.SyncStatus, data *string) error + + SyncScheduledAt(ctx context.Context, obj *types.SyncStatus, data *string) error +} type Github__com___kloudlite___operator___apis___crds___v1__AppInterceptPortMappingsInResolver interface { AppPort(ctx context.Context, obj *v1.AppInterceptPortMappings, data int) error DevicePort(ctx context.Context, obj *v1.AppInterceptPortMappings, data int) error @@ -2011,6 +2082,55 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ExternalAppPaginatedRecords.TotalCount(childComplexity), true + case "Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef.id": + if e.complexity.Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef.ID == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef.ID(childComplexity), true + + case "Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef.name": + if e.complexity.Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef.Name == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef.Name(childComplexity), true + + case "Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef.namespace": + if e.complexity.Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef.Namespace == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef.Namespace(childComplexity), true + + case "Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor.name": + if e.complexity.Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor.Name == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor.Name(childComplexity), true + + case "Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor.namespace": + if e.complexity.Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor.Namespace == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor.Namespace(childComplexity), true + + case "Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor.refId": + if e.complexity.Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor.RefID == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor.RefID(childComplexity), true + + case "Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor.resourceType": + if e.complexity.Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor.ResourceType == nil { + break + } + + return e.complexity.Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor.ResourceType(childComplexity), true + case "Github__com___kloudlite___api___common__CreatedOrUpdatedBy.userEmail": if e.complexity.Github__com___kloudlite___api___common__CreatedOrUpdatedBy.UserEmail == nil { break @@ -2123,6 +2243,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Github__com___kloudlite___operator___apis___common____types__MsvcRef.Namespace(childComplexity), true + case "Github__com___kloudlite___operator___apis___common____types__SecretRef.name": + if e.complexity.Github__com___kloudlite___operator___apis___common____types__SecretRef.Name == nil { + break + } + + return e.complexity.Github__com___kloudlite___operator___apis___common____types__SecretRef.Name(childComplexity), true + + case "Github__com___kloudlite___operator___apis___common____types__SecretRef.namespace": + if e.complexity.Github__com___kloudlite___operator___apis___common____types__SecretRef.Namespace == nil { + break + } + + return e.complexity.Github__com___kloudlite___operator___apis___common____types__SecretRef.Namespace(childComplexity), true + case "Github__com___kloudlite___operator___apis___crds___v1__AppContainer.args": if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppContainer.Args == nil { break @@ -3320,6 +3454,146 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ImagePullSecretPaginatedRecords.TotalCount(childComplexity), true + case "ImportedManagedResource.accountName": + if e.complexity.ImportedManagedResource.AccountName == nil { + break + } + + return e.complexity.ImportedManagedResource.AccountName(childComplexity), true + + case "ImportedManagedResource.createdBy": + if e.complexity.ImportedManagedResource.CreatedBy == nil { + break + } + + return e.complexity.ImportedManagedResource.CreatedBy(childComplexity), true + + case "ImportedManagedResource.creationTime": + if e.complexity.ImportedManagedResource.CreationTime == nil { + break + } + + return e.complexity.ImportedManagedResource.CreationTime(childComplexity), true + + case "ImportedManagedResource.displayName": + if e.complexity.ImportedManagedResource.DisplayName == nil { + break + } + + return e.complexity.ImportedManagedResource.DisplayName(childComplexity), true + + case "ImportedManagedResource.environmentName": + if e.complexity.ImportedManagedResource.EnvironmentName == nil { + break + } + + return e.complexity.ImportedManagedResource.EnvironmentName(childComplexity), true + + case "ImportedManagedResource.id": + if e.complexity.ImportedManagedResource.ID == nil { + break + } + + return e.complexity.ImportedManagedResource.ID(childComplexity), true + + case "ImportedManagedResource.lastUpdatedBy": + if e.complexity.ImportedManagedResource.LastUpdatedBy == nil { + break + } + + return e.complexity.ImportedManagedResource.LastUpdatedBy(childComplexity), true + + case "ImportedManagedResource.managedResource": + if e.complexity.ImportedManagedResource.ManagedResource == nil { + break + } + + return e.complexity.ImportedManagedResource.ManagedResource(childComplexity), true + + case "ImportedManagedResource.managedResourceRef": + if e.complexity.ImportedManagedResource.ManagedResourceRef == nil { + break + } + + return e.complexity.ImportedManagedResource.ManagedResourceRef(childComplexity), true + + case "ImportedManagedResource.markedForDeletion": + if e.complexity.ImportedManagedResource.MarkedForDeletion == nil { + break + } + + return e.complexity.ImportedManagedResource.MarkedForDeletion(childComplexity), true + + case "ImportedManagedResource.name": + if e.complexity.ImportedManagedResource.Name == nil { + break + } + + return e.complexity.ImportedManagedResource.Name(childComplexity), true + + case "ImportedManagedResource.recordVersion": + if e.complexity.ImportedManagedResource.RecordVersion == nil { + break + } + + return e.complexity.ImportedManagedResource.RecordVersion(childComplexity), true + + case "ImportedManagedResource.secretRef": + if e.complexity.ImportedManagedResource.SecretRef == nil { + break + } + + return e.complexity.ImportedManagedResource.SecretRef(childComplexity), true + + case "ImportedManagedResource.syncStatus": + if e.complexity.ImportedManagedResource.SyncStatus == nil { + break + } + + return e.complexity.ImportedManagedResource.SyncStatus(childComplexity), true + + case "ImportedManagedResource.updateTime": + if e.complexity.ImportedManagedResource.UpdateTime == nil { + break + } + + return e.complexity.ImportedManagedResource.UpdateTime(childComplexity), true + + case "ImportedManagedResourceEdge.cursor": + if e.complexity.ImportedManagedResourceEdge.Cursor == nil { + break + } + + return e.complexity.ImportedManagedResourceEdge.Cursor(childComplexity), true + + case "ImportedManagedResourceEdge.node": + if e.complexity.ImportedManagedResourceEdge.Node == nil { + break + } + + return e.complexity.ImportedManagedResourceEdge.Node(childComplexity), true + + case "ImportedManagedResourcePaginatedRecords.edges": + if e.complexity.ImportedManagedResourcePaginatedRecords.Edges == nil { + break + } + + return e.complexity.ImportedManagedResourcePaginatedRecords.Edges(childComplexity), true + + case "ImportedManagedResourcePaginatedRecords.pageInfo": + if e.complexity.ImportedManagedResourcePaginatedRecords.PageInfo == nil { + break + } + + return e.complexity.ImportedManagedResourcePaginatedRecords.PageInfo(childComplexity), true + + case "ImportedManagedResourcePaginatedRecords.totalCount": + if e.complexity.ImportedManagedResourcePaginatedRecords.TotalCount == nil { + break + } + + return e.complexity.ImportedManagedResourcePaginatedRecords.TotalCount(childComplexity), true + case "K8s__io___api___core___v1__Secret.apiVersion": if e.complexity.K8s__io___api___core___v1__Secret.APIVersion == nil { break @@ -3993,7 +4267,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Mutation.CoreDeleteImportedManagedResource(childComplexity, args["envName"].(string), args["mresName"].(string)), true + return e.complexity.Mutation.CoreDeleteImportedManagedResource(childComplexity, args["envName"].(string), args["importName"].(string)), true case "Mutation.core_deleteManagedResource": if e.complexity.Mutation.CoreDeleteManagedResource == nil { @@ -4053,7 +4327,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Mutation.CoreImportManagedResource(childComplexity, args["envName"].(string), args["msvcName"].(string), args["mresName"].(string)), true + return e.complexity.Mutation.CoreImportManagedResource(childComplexity, args["envName"].(string), args["msvcName"].(string), args["mresName"].(string), args["importName"].(string)), true case "Mutation.core_interceptApp": if e.complexity.Mutation.CoreInterceptApp == nil { @@ -4505,6 +4779,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.CoreListImagePullSecrets(childComplexity, args["search"].(*model.SearchImagePullSecrets), args["pq"].(*repos.CursorPagination)), true + case "Query.core_listImportedManagedResources": + if e.complexity.Query.CoreListImportedManagedResources == nil { + break + } + + args, err := ec.field_Query_core_listImportedManagedResources_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.CoreListImportedManagedResources(childComplexity, args["envName"].(string), args["search"].(*model.SearchImportedManagedResources), args["pq"].(*repos.CursorPagination)), true + case "Query.core_listManagedResources": if e.complexity.Query.CoreListManagedResources == nil { break @@ -4890,6 +5176,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Secret.EnvironmentName(childComplexity), true + case "Secret.for": + if e.complexity.Secret.For == nil { + break + } + + return e.complexity.Secret.For(childComplexity), true + case "Secret.id": if e.complexity.Secret.Id == nil { break @@ -5068,7 +5361,10 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputCursorPaginationIn, ec.unmarshalInputEnvironmentIn, ec.unmarshalInputExternalAppIn, + ec.unmarshalInputGithub__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRefIn, + ec.unmarshalInputGithub__com___kloudlite___api___pkg___types__SyncStatusIn, ec.unmarshalInputGithub__com___kloudlite___operator___apis___common____types__MsvcRefIn, + ec.unmarshalInputGithub__com___kloudlite___operator___apis___common____types__SecretRefIn, ec.unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__AppContainerIn, ec.unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__AppInterceptPortMappingsIn, ec.unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__AppRouterIn, @@ -5105,6 +5401,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputGithub__com___kloudlite___operator___pkg___operator__StatusIn, ec.unmarshalInputGithub__com___kloudlite___operator___pkg___raw____json__RawJsonIn, ec.unmarshalInputImagePullSecretIn, + ec.unmarshalInputImportedManagedResourceIn, ec.unmarshalInputK8s__io___api___core___v1__TolerationIn, ec.unmarshalInputK8s__io___api___core___v1__TopologySpreadConstraintIn, ec.unmarshalInputK8s__io___apimachinery___pkg___apis___meta___v1__LabelSelectorIn, @@ -5121,6 +5418,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputSearchEnvironments, ec.unmarshalInputSearchExternalApps, ec.unmarshalInputSearchImagePullSecrets, + ec.unmarshalInputSearchImportedManagedResources, ec.unmarshalInputSearchManagedResources, ec.unmarshalInputSearchProjectManagedService, ec.unmarshalInputSearchProjects, @@ -5302,6 +5600,12 @@ input SearchManagedResources { markedForDeletion: MatchFilterIn } +input SearchImportedManagedResources { + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn +} + input SearchProjectManagedService { text: MatchFilterIn managedServiceName: MatchFilterIn @@ -5362,6 +5666,8 @@ type Query { # core_listImportedManagedResources(envName: String! ,search: SearchManagedResources, pq: CursorPaginationIn): ManagedResourcePaginatedRecords @isLoggedInAndVerified @hasAccount # core_getImportedManagedResource(envName: String!, name: String!): ManagedResource @isLoggedInAndVerified @hasAccount + core_listImportedManagedResources(envName: String!, search: SearchImportedManagedResources, pq: CursorPaginationIn): ImportedManagedResourcePaginatedRecords @isLoggedInAndVerified @hasAccount + # core_listProjectManagedServices(search: SearchProjectManagedService, pq: CursorPaginationIn): ProjectManagedServicePaginatedRecords @isLoggedInAndVerified @hasAccount # core_getProjectManagedService( name: String!): ProjectManagedService @isLoggedInAndVerified @hasAccount # core_resyncProjectManagedService(name: String!): Boolean! @isLoggedInAndVerified @hasAccount @@ -5412,8 +5718,12 @@ type Mutation { core_createManagedResource(msvcName: String! ,mres: ManagedResourceIn!): ManagedResource @isLoggedInAndVerified @hasAccount core_updateManagedResource(msvcName: String!, mres: ManagedResourceIn!): ManagedResource @isLoggedInAndVerified @hasAccount core_deleteManagedResource(msvcName: String!, mresName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_importManagedResource(envName: String!, msvcName: String! ,mresName: String!): ManagedResource @isLoggedInAndVerified @hasAccount - core_deleteImportedManagedResource(envName: String!, mresName: String!): Boolean! @isLoggedInAndVerified @hasAccount + + # core_importManagedResource(envName: String!, msvcName: String!, mresName: String!, importName: String!): ManagedResource @isLoggedInAndVerified @hasAccount + # core_deleteImportedManagedResource(envName: String!, importName: String!): Boolean! @isLoggedInAndVerified @hasAccount + + core_importManagedResource(envName: String!, msvcName: String!, mresName: String!, importName: String!): ImportedManagedResource @isLoggedInAndVerified @hasAccount + core_deleteImportedManagedResource(envName: String!, importName: String!): Boolean! @isLoggedInAndVerified @hasAccount # core_createProjectManagedService(pmsvc: ProjectManagedServiceIn!): ProjectManagedService @isLoggedInAndVerified @hasAccount # core_updateProjectManagedService(pmsvc: ProjectManagedServiceIn!): ProjectManagedService @isLoggedInAndVerified @hasAccount @@ -5437,6 +5747,10 @@ type Build @key(fields: "id") { extend type App { build: Build } + +extend type ImportedManagedResource { + managedResource: ManagedResource +} `, BuiltIn: false}, {Name: "../struct-to-graphql/app.graphqls", Input: `type App @shareable { accountName: String! @@ -5481,7 +5795,20 @@ input AppIn { } `, BuiltIn: false}, - {Name: "../struct-to-graphql/common-types.graphqls", Input: `type Github__com___kloudlite___api___common__CreatedOrUpdatedBy @shareable { + {Name: "../struct-to-graphql/common-types.graphqls", Input: `type Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef @shareable { + id: String! + name: String! + namespace: String! +} + +type Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor @shareable { + name: String! + namespace: String! + refId: String! + resourceType: Github__com___kloudlite___api___apps___console___internal___entities__ResourceType! +} + +type Github__com___kloudlite___api___common__CreatedOrUpdatedBy @shareable { userEmail: String! userId: String! userName: String! @@ -5509,6 +5836,11 @@ type Github__com___kloudlite___operator___apis___common____types__MsvcRef @share namespace: String! } +type Github__com___kloudlite___operator___apis___common____types__SecretRef @shareable { + name: String! + namespace: String +} + type Github__com___kloudlite___operator___apis___crds___v1__AppContainer @shareable { args: [String!] command: [String!] @@ -5657,7 +5989,7 @@ type Github__com___kloudlite___operator___apis___crds___v1__MresResourceTemplate apiVersion: String! kind: String! msvcRef: Github__com___kloudlite___operator___apis___common____types__MsvcRef! - spec: Map! + spec: Map } type Github__com___kloudlite___operator___apis___crds___v1__Probe @shareable { @@ -5820,6 +6152,21 @@ type PageInfo @shareable { startCursor: String } +input Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRefIn { + id: String! + name: String! + namespace: String! +} + +input Github__com___kloudlite___api___pkg___types__SyncStatusIn { + action: Github__com___kloudlite___api___pkg___types__SyncAction! + error: String + lastSyncedAt: Date + recordVersion: Int! + state: Github__com___kloudlite___api___pkg___types__SyncState! + syncScheduledAt: Date +} + input Github__com___kloudlite___operator___apis___common____types__MsvcRefIn { apiVersion: String clusterName: String @@ -5828,6 +6175,11 @@ input Github__com___kloudlite___operator___apis___common____types__MsvcRefIn { namespace: String! } +input Github__com___kloudlite___operator___apis___common____types__SecretRefIn { + name: String! + namespace: String +} + input Github__com___kloudlite___operator___apis___crds___v1__AppContainerIn { args: [String!] command: [String!] @@ -5974,7 +6326,7 @@ input Github__com___kloudlite___operator___apis___crds___v1__MresResourceTemplat apiVersion: String! kind: String! msvcRef: Github__com___kloudlite___operator___apis___common____types__MsvcRefIn! - spec: Map! + spec: Map } input Github__com___kloudlite___operator___apis___crds___v1__ProbeIn { @@ -6119,6 +6471,19 @@ enum Github__com___kloudlite___api___apps___console___internal___entities__PullS params } +enum Github__com___kloudlite___api___apps___console___internal___entities__ResourceType { + app + config + environment + external_app + image_pull_secret + imported_managed_resource + managed_resource + router + secret + vpn_device +} + enum Github__com___kloudlite___api___pkg___repos__MatchType { array exact @@ -6463,6 +6828,44 @@ input ImagePullSecretIn { registryUsername: String } +`, BuiltIn: false}, + {Name: "../struct-to-graphql/importedmanagedresource.graphqls", Input: `type ImportedManagedResource @shareable { + accountName: String! + createdBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! + creationTime: Date! + displayName: String! + environmentName: String! + id: ID! + lastUpdatedBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! + managedResourceRef: Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef! + markedForDeletion: Boolean + name: String! + recordVersion: Int! + secretRef: Github__com___kloudlite___operator___apis___common____types__SecretRef! + syncStatus: Github__com___kloudlite___api___pkg___types__SyncStatus! + updateTime: Date! +} + +type ImportedManagedResourceEdge @shareable { + cursor: String! + node: ImportedManagedResource! +} + +type ImportedManagedResourcePaginatedRecords @shareable { + edges: [ImportedManagedResourceEdge!]! + pageInfo: PageInfo! + totalCount: Int! +} + +input ImportedManagedResourceIn { + displayName: String! + environmentName: String! + managedResourceRef: Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRefIn! + name: String! + secretRef: Github__com___kloudlite___operator___apis___common____types__SecretRefIn! + syncStatus: Github__com___kloudlite___api___pkg___types__SyncStatusIn! +} + `, BuiltIn: false}, {Name: "../struct-to-graphql/managedresource.graphqls", Input: `type ManagedResource @shareable { accountName: String! @@ -6616,6 +7019,7 @@ scalar Date data: Map displayName: String! environmentName: String! + for: Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor id: ID! immutable: Boolean isReadyOnly: Boolean! @@ -7124,14 +7528,14 @@ func (ec *executionContext) field_Mutation_core_deleteImportedManagedResource_ar } args["envName"] = arg0 var arg1 string - if tmp, ok := rawArgs["mresName"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("mresName")) + if tmp, ok := rawArgs["importName"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("importName")) arg1, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } } - args["mresName"] = arg1 + args["importName"] = arg1 return args, nil } @@ -7252,6 +7656,15 @@ func (ec *executionContext) field_Mutation_core_importManagedResource_args(ctx c } } args["mresName"] = arg2 + var arg3 string + if tmp, ok := rawArgs["importName"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("importName")) + arg3, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["importName"] = arg3 return args, nil } @@ -8164,6 +8577,39 @@ func (ec *executionContext) field_Query_core_listImagePullSecrets_args(ctx conte return args, nil } +func (ec *executionContext) field_Query_core_listImportedManagedResources_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["envName"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envName")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["envName"] = arg0 + var arg1 *model.SearchImportedManagedResources + if tmp, ok := rawArgs["search"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("search")) + arg1, err = ec.unmarshalOSearchImportedManagedResources2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐSearchImportedManagedResources(ctx, tmp) + if err != nil { + return nil, err + } + } + args["search"] = arg1 + var arg2 *repos.CursorPagination + if tmp, ok := rawArgs["pq"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pq")) + arg2, err = ec.unmarshalOCursorPaginationIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐCursorPagination(ctx, tmp) + if err != nil { + return nil, err + } + } + args["pq"] = arg2 + return args, nil +} + func (ec *executionContext) field_Query_core_listManagedResources_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -14678,6 +15124,314 @@ func (ec *executionContext) fieldContext_ExternalAppPaginatedRecords_totalCount( return fc, nil } +func (ec *executionContext) _Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef_id(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRef) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef_id(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef_name(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRef) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef_name(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef_namespace(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRef) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef_namespace(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Namespace, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef_namespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_name(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsConsoleInternalEntitiesSecretCreatedFor) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_name(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_namespace(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsConsoleInternalEntitiesSecretCreatedFor) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_namespace(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Namespace, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_namespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_refId(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsConsoleInternalEntitiesSecretCreatedFor) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_refId(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RefID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_refId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_resourceType(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteAPIAppsConsoleInternalEntitiesSecretCreatedFor) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_resourceType(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ResourceType, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType) + fc.Result = res + return ec.marshalNGithub__com___kloudlite___api___apps___console___internal___entities__ResourceType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_resourceType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Github__com___kloudlite___api___apps___console___internal___entities__ResourceType does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userEmail(ctx context.Context, field graphql.CollectedField, obj *common.CreatedOrUpdatedBy) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userEmail(ctx, field) if err != nil { @@ -15364,6 +16118,91 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___ap return fc, nil } +func (ec *executionContext) _Github__com___kloudlite___operator___apis___common____types__SecretRef_name(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCommonTypesSecretRef) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___common____types__SecretRef_name(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___common____types__SecretRef_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___operator___apis___common____types__SecretRef", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Github__com___kloudlite___operator___apis___common____types__SecretRef_namespace(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCommonTypesSecretRef) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___common____types__SecretRef_namespace(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Namespace, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___common____types__SecretRef_namespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___operator___apis___common____types__SecretRef", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__AppContainer_args(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1AppContainer) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppContainer_args(ctx, field) if err != nil { @@ -19303,14 +20142,11 @@ func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___ return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } res := resTmp.(map[string]interface{}) fc.Result = res - return ec.marshalNMap2map(ctx, field.Selections, res) + return ec.marshalOMap2map(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___crds___v1__MresResourceTemplate_spec(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -22401,9 +23237,1027 @@ func (ec *executionContext) _ImagePullSecret_markedForDeletion(ctx context.Conte return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImagePullSecret_markedForDeletion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImagePullSecret_markedForDeletion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImagePullSecret", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ImagePullSecret_metadata(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImagePullSecret_metadata(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ObjectMeta, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(v13.ObjectMeta) + fc.Result = res + return ec.marshalNMetadata2k8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐObjectMeta(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImagePullSecret_metadata(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImagePullSecret", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "annotations": + return ec.fieldContext_Metadata_annotations(ctx, field) + case "creationTimestamp": + return ec.fieldContext_Metadata_creationTimestamp(ctx, field) + case "deletionTimestamp": + return ec.fieldContext_Metadata_deletionTimestamp(ctx, field) + case "generation": + return ec.fieldContext_Metadata_generation(ctx, field) + case "labels": + return ec.fieldContext_Metadata_labels(ctx, field) + case "name": + return ec.fieldContext_Metadata_name(ctx, field) + case "namespace": + return ec.fieldContext_Metadata_namespace(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Metadata", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ImagePullSecret_recordVersion(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImagePullSecret_recordVersion(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RecordVersion, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImagePullSecret_recordVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImagePullSecret", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ImagePullSecret_registryPassword(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImagePullSecret_registryPassword(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RegistryPassword, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImagePullSecret_registryPassword(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImagePullSecret", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ImagePullSecret_registryURL(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImagePullSecret_registryURL(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RegistryURL, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImagePullSecret_registryURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImagePullSecret", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ImagePullSecret_registryUsername(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImagePullSecret_registryUsername(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RegistryUsername, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImagePullSecret_registryUsername(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImagePullSecret", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ImagePullSecret_syncStatus(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImagePullSecret_syncStatus(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SyncStatus, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(types.SyncStatus) + fc.Result = res + return ec.marshalNGithub__com___kloudlite___api___pkg___types__SyncStatus2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋtypesᚐSyncStatus(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImagePullSecret_syncStatus(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImagePullSecret", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "action": + return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_action(ctx, field) + case "error": + return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_error(ctx, field) + case "lastSyncedAt": + return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_lastSyncedAt(ctx, field) + case "recordVersion": + return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_recordVersion(ctx, field) + case "state": + return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_state(ctx, field) + case "syncScheduledAt": + return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_syncScheduledAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___pkg___types__SyncStatus", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ImagePullSecret_updateTime(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImagePullSecret_updateTime(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.ImagePullSecret().UpdateTime(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNDate2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImagePullSecret_updateTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImagePullSecret", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Date does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ImagePullSecretEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *model.ImagePullSecretEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImagePullSecretEdge_cursor(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Cursor, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImagePullSecretEdge_cursor(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImagePullSecretEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ImagePullSecretEdge_node(ctx context.Context, field graphql.CollectedField, obj *model.ImagePullSecretEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImagePullSecretEdge_node(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Node, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*entities.ImagePullSecret) + fc.Result = res + return ec.marshalNImagePullSecret2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋentitiesᚐImagePullSecret(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImagePullSecretEdge_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImagePullSecretEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "accountName": + return ec.fieldContext_ImagePullSecret_accountName(ctx, field) + case "createdBy": + return ec.fieldContext_ImagePullSecret_createdBy(ctx, field) + case "creationTime": + return ec.fieldContext_ImagePullSecret_creationTime(ctx, field) + case "displayName": + return ec.fieldContext_ImagePullSecret_displayName(ctx, field) + case "dockerConfigJson": + return ec.fieldContext_ImagePullSecret_dockerConfigJson(ctx, field) + case "environments": + return ec.fieldContext_ImagePullSecret_environments(ctx, field) + case "format": + return ec.fieldContext_ImagePullSecret_format(ctx, field) + case "id": + return ec.fieldContext_ImagePullSecret_id(ctx, field) + case "lastUpdatedBy": + return ec.fieldContext_ImagePullSecret_lastUpdatedBy(ctx, field) + case "markedForDeletion": + return ec.fieldContext_ImagePullSecret_markedForDeletion(ctx, field) + case "metadata": + return ec.fieldContext_ImagePullSecret_metadata(ctx, field) + case "recordVersion": + return ec.fieldContext_ImagePullSecret_recordVersion(ctx, field) + case "registryPassword": + return ec.fieldContext_ImagePullSecret_registryPassword(ctx, field) + case "registryURL": + return ec.fieldContext_ImagePullSecret_registryURL(ctx, field) + case "registryUsername": + return ec.fieldContext_ImagePullSecret_registryUsername(ctx, field) + case "syncStatus": + return ec.fieldContext_ImagePullSecret_syncStatus(ctx, field) + case "updateTime": + return ec.fieldContext_ImagePullSecret_updateTime(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ImagePullSecret", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ImagePullSecretPaginatedRecords_edges(ctx context.Context, field graphql.CollectedField, obj *model.ImagePullSecretPaginatedRecords) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImagePullSecretPaginatedRecords_edges(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Edges, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.ImagePullSecretEdge) + fc.Result = res + return ec.marshalNImagePullSecretEdge2ᚕᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐImagePullSecretEdgeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImagePullSecretPaginatedRecords_edges(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImagePullSecretPaginatedRecords", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "cursor": + return ec.fieldContext_ImagePullSecretEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_ImagePullSecretEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ImagePullSecretEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ImagePullSecretPaginatedRecords_pageInfo(ctx context.Context, field graphql.CollectedField, obj *model.ImagePullSecretPaginatedRecords) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImagePullSecretPaginatedRecords_pageInfo(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PageInfo, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.PageInfo) + fc.Result = res + return ec.marshalNPageInfo2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐPageInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImagePullSecretPaginatedRecords_pageInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImagePullSecretPaginatedRecords", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ImagePullSecretPaginatedRecords_totalCount(ctx context.Context, field graphql.CollectedField, obj *model.ImagePullSecretPaginatedRecords) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImagePullSecretPaginatedRecords_totalCount(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TotalCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImagePullSecretPaginatedRecords_totalCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImagePullSecretPaginatedRecords", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ImportedManagedResource_accountName(ctx context.Context, field graphql.CollectedField, obj *entities.ImportedManagedResource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResource_accountName(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.AccountName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImportedManagedResource_accountName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImportedManagedResource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ImportedManagedResource_createdBy(ctx context.Context, field graphql.CollectedField, obj *entities.ImportedManagedResource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResource_createdBy(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedBy, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(common.CreatedOrUpdatedBy) + fc.Result = res + return ec.marshalNGithub__com___kloudlite___api___common__CreatedOrUpdatedBy2githubᚗcomᚋkloudliteᚋapiᚋcommonᚐCreatedOrUpdatedBy(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImportedManagedResource_createdBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImportedManagedResource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "userEmail": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userEmail(ctx, field) + case "userId": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userId(ctx, field) + case "userName": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userName(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___common__CreatedOrUpdatedBy", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ImportedManagedResource_creationTime(ctx context.Context, field graphql.CollectedField, obj *entities.ImportedManagedResource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResource_creationTime(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.ImportedManagedResource().CreationTime(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNDate2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImportedManagedResource_creationTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImportedManagedResource", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Date does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ImportedManagedResource_displayName(ctx context.Context, field graphql.CollectedField, obj *entities.ImportedManagedResource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResource_displayName(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DisplayName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImportedManagedResource_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImportedManagedResource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ImportedManagedResource_environmentName(ctx context.Context, field graphql.CollectedField, obj *entities.ImportedManagedResource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResource_environmentName(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EnvironmentName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImportedManagedResource_environmentName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImportedManagedResource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ImportedManagedResource_id(ctx context.Context, field graphql.CollectedField, obj *entities.ImportedManagedResource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResource_id(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.ImportedManagedResource().ID(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(repos.ID) + fc.Result = res + return ec.marshalNID2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐID(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImportedManagedResource_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImportedManagedResource", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ImportedManagedResource_lastUpdatedBy(ctx context.Context, field graphql.CollectedField, obj *entities.ImportedManagedResource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResource_lastUpdatedBy(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.LastUpdatedBy, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(common.CreatedOrUpdatedBy) + fc.Result = res + return ec.marshalNGithub__com___kloudlite___api___common__CreatedOrUpdatedBy2githubᚗcomᚋkloudliteᚋapiᚋcommonᚐCreatedOrUpdatedBy(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImportedManagedResource_lastUpdatedBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImportedManagedResource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "userEmail": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userEmail(ctx, field) + case "userId": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userId(ctx, field) + case "userName": + return ec.fieldContext_Github__com___kloudlite___api___common__CreatedOrUpdatedBy_userName(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___common__CreatedOrUpdatedBy", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ImportedManagedResource_managedResourceRef(ctx context.Context, field graphql.CollectedField, obj *entities.ImportedManagedResource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResource_managedResourceRef(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.ImportedManagedResource().ManagedResourceRef(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRef) + fc.Result = res + return ec.marshalNGithub__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRef(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImportedManagedResource_managedResourceRef(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ImportedManagedResource", + 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_Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef_id(ctx, field) + case "name": + return ec.fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef_name(ctx, field) + case "namespace": + return ec.fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef_namespace(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ImportedManagedResource_markedForDeletion(ctx context.Context, field graphql.CollectedField, obj *entities.ImportedManagedResource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResource_markedForDeletion(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MarkedForDeletion, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*bool) + fc.Result = res + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ImportedManagedResource_markedForDeletion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ImagePullSecret", + Object: "ImportedManagedResource", Field: field, IsMethod: false, IsResolver: false, @@ -22414,8 +24268,8 @@ func (ec *executionContext) fieldContext_ImagePullSecret_markedForDeletion(ctx c return fc, nil } -func (ec *executionContext) _ImagePullSecret_metadata(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ImagePullSecret_metadata(ctx, field) +func (ec *executionContext) _ImportedManagedResource_name(ctx context.Context, field graphql.CollectedField, obj *entities.ImportedManagedResource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResource_name(ctx, field) if err != nil { return graphql.Null } @@ -22428,7 +24282,7 @@ func (ec *executionContext) _ImagePullSecret_metadata(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ObjectMeta, nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -22440,42 +24294,26 @@ func (ec *executionContext) _ImagePullSecret_metadata(ctx context.Context, field } return graphql.Null } - res := resTmp.(v13.ObjectMeta) + res := resTmp.(string) fc.Result = res - return ec.marshalNMetadata2k8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐObjectMeta(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImagePullSecret_metadata(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImportedManagedResource_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ImagePullSecret", + Object: "ImportedManagedResource", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "annotations": - return ec.fieldContext_Metadata_annotations(ctx, field) - case "creationTimestamp": - return ec.fieldContext_Metadata_creationTimestamp(ctx, field) - case "deletionTimestamp": - return ec.fieldContext_Metadata_deletionTimestamp(ctx, field) - case "generation": - return ec.fieldContext_Metadata_generation(ctx, field) - case "labels": - return ec.fieldContext_Metadata_labels(ctx, field) - case "name": - return ec.fieldContext_Metadata_name(ctx, field) - case "namespace": - return ec.fieldContext_Metadata_namespace(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Metadata", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _ImagePullSecret_recordVersion(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ImagePullSecret_recordVersion(ctx, field) +func (ec *executionContext) _ImportedManagedResource_recordVersion(ctx context.Context, field graphql.CollectedField, obj *entities.ImportedManagedResource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResource_recordVersion(ctx, field) if err != nil { return graphql.Null } @@ -22505,9 +24343,9 @@ func (ec *executionContext) _ImagePullSecret_recordVersion(ctx context.Context, return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImagePullSecret_recordVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImportedManagedResource_recordVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ImagePullSecret", + Object: "ImportedManagedResource", Field: field, IsMethod: false, IsResolver: false, @@ -22518,8 +24356,8 @@ func (ec *executionContext) fieldContext_ImagePullSecret_recordVersion(ctx conte return fc, nil } -func (ec *executionContext) _ImagePullSecret_registryPassword(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ImagePullSecret_registryPassword(ctx, field) +func (ec *executionContext) _ImportedManagedResource_secretRef(ctx context.Context, field graphql.CollectedField, obj *entities.ImportedManagedResource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResource_secretRef(ctx, field) if err != nil { return graphql.Null } @@ -22532,76 +24370,44 @@ func (ec *executionContext) _ImagePullSecret_registryPassword(ctx context.Contex }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.RegistryPassword, nil + return ec.resolvers.ImportedManagedResource().SecretRef(rctx, obj) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_ImagePullSecret_registryPassword(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ImagePullSecret", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _ImagePullSecret_registryURL(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ImagePullSecret_registryURL(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 + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.RegistryURL, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*model.GithubComKloudliteOperatorApisCommonTypesSecretRef) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNGithub__com___kloudlite___operator___apis___common____types__SecretRef2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCommonTypesSecretRef(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImagePullSecret_registryURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImportedManagedResource_secretRef(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ImagePullSecret", + Object: "ImportedManagedResource", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext_Github__com___kloudlite___operator___apis___common____types__SecretRef_name(ctx, field) + case "namespace": + return ec.fieldContext_Github__com___kloudlite___operator___apis___common____types__SecretRef_namespace(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___operator___apis___common____types__SecretRef", field.Name) }, } return fc, nil } -func (ec *executionContext) _ImagePullSecret_registryUsername(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ImagePullSecret_registryUsername(ctx, field) +func (ec *executionContext) _ImportedManagedResource_syncStatus(ctx context.Context, field graphql.CollectedField, obj *entities.ImportedManagedResource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResource_syncStatus(ctx, field) if err != nil { return graphql.Null } @@ -22614,35 +24420,52 @@ func (ec *executionContext) _ImagePullSecret_registryUsername(ctx context.Contex }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.RegistryUsername, nil + return obj.SyncStatus, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(types.SyncStatus) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNGithub__com___kloudlite___api___pkg___types__SyncStatus2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋtypesᚐSyncStatus(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImagePullSecret_registryUsername(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImportedManagedResource_syncStatus(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ImagePullSecret", + Object: "ImportedManagedResource", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "action": + return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_action(ctx, field) + case "error": + return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_error(ctx, field) + case "lastSyncedAt": + return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_lastSyncedAt(ctx, field) + case "recordVersion": + return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_recordVersion(ctx, field) + case "state": + return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_state(ctx, field) + case "syncScheduledAt": + return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_syncScheduledAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___pkg___types__SyncStatus", field.Name) }, } return fc, nil } -func (ec *executionContext) _ImagePullSecret_syncStatus(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ImagePullSecret_syncStatus(ctx, field) +func (ec *executionContext) _ImportedManagedResource_updateTime(ctx context.Context, field graphql.CollectedField, obj *entities.ImportedManagedResource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResource_updateTime(ctx, field) if err != nil { return graphql.Null } @@ -22655,7 +24478,7 @@ func (ec *executionContext) _ImagePullSecret_syncStatus(ctx context.Context, fie }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.SyncStatus, nil + return ec.resolvers.ImportedManagedResource().UpdateTime(rctx, obj) }) if err != nil { ec.Error(ctx, err) @@ -22667,40 +24490,26 @@ func (ec *executionContext) _ImagePullSecret_syncStatus(ctx context.Context, fie } return graphql.Null } - res := resTmp.(types.SyncStatus) + res := resTmp.(string) fc.Result = res - return ec.marshalNGithub__com___kloudlite___api___pkg___types__SyncStatus2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋtypesᚐSyncStatus(ctx, field.Selections, res) + return ec.marshalNDate2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImagePullSecret_syncStatus(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImportedManagedResource_updateTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ImagePullSecret", + Object: "ImportedManagedResource", 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 "action": - return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_action(ctx, field) - case "error": - return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_error(ctx, field) - case "lastSyncedAt": - return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_lastSyncedAt(ctx, field) - case "recordVersion": - return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_recordVersion(ctx, field) - case "state": - return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_state(ctx, field) - case "syncScheduledAt": - return ec.fieldContext_Github__com___kloudlite___api___pkg___types__SyncStatus_syncScheduledAt(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___pkg___types__SyncStatus", field.Name) + return nil, errors.New("field of type Date does not have child fields") }, } return fc, nil } -func (ec *executionContext) _ImagePullSecret_updateTime(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ImagePullSecret_updateTime(ctx, field) +func (ec *executionContext) _ImportedManagedResource_managedResource(ctx context.Context, field graphql.CollectedField, obj *entities.ImportedManagedResource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResource_managedResource(ctx, field) if err != nil { return graphql.Null } @@ -22713,38 +24522,81 @@ func (ec *executionContext) _ImagePullSecret_updateTime(ctx context.Context, fie }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.ImagePullSecret().UpdateTime(rctx, obj) + return ec.resolvers.ImportedManagedResource().ManagedResource(rctx, obj) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*entities.ManagedResource) fc.Result = res - return ec.marshalNDate2string(ctx, field.Selections, res) + return ec.marshalOManagedResource2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋentitiesᚐManagedResource(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImagePullSecret_updateTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImportedManagedResource_managedResource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ImagePullSecret", + Object: "ImportedManagedResource", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Date does not have child fields") + switch field.Name { + case "accountName": + return ec.fieldContext_ManagedResource_accountName(ctx, field) + case "apiVersion": + return ec.fieldContext_ManagedResource_apiVersion(ctx, field) + case "clusterName": + return ec.fieldContext_ManagedResource_clusterName(ctx, field) + case "createdBy": + return ec.fieldContext_ManagedResource_createdBy(ctx, field) + case "creationTime": + return ec.fieldContext_ManagedResource_creationTime(ctx, field) + case "displayName": + return ec.fieldContext_ManagedResource_displayName(ctx, field) + case "enabled": + return ec.fieldContext_ManagedResource_enabled(ctx, field) + case "environmentName": + return ec.fieldContext_ManagedResource_environmentName(ctx, field) + case "id": + return ec.fieldContext_ManagedResource_id(ctx, field) + case "isImported": + return ec.fieldContext_ManagedResource_isImported(ctx, field) + case "kind": + return ec.fieldContext_ManagedResource_kind(ctx, field) + case "lastUpdatedBy": + return ec.fieldContext_ManagedResource_lastUpdatedBy(ctx, field) + case "managedServiceName": + return ec.fieldContext_ManagedResource_managedServiceName(ctx, field) + case "markedForDeletion": + return ec.fieldContext_ManagedResource_markedForDeletion(ctx, field) + case "metadata": + return ec.fieldContext_ManagedResource_metadata(ctx, field) + case "mresRef": + return ec.fieldContext_ManagedResource_mresRef(ctx, field) + case "recordVersion": + return ec.fieldContext_ManagedResource_recordVersion(ctx, field) + case "spec": + return ec.fieldContext_ManagedResource_spec(ctx, field) + case "status": + return ec.fieldContext_ManagedResource_status(ctx, field) + case "syncedOutputSecretRef": + return ec.fieldContext_ManagedResource_syncedOutputSecretRef(ctx, field) + case "syncStatus": + return ec.fieldContext_ManagedResource_syncStatus(ctx, field) + case "updateTime": + return ec.fieldContext_ManagedResource_updateTime(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ManagedResource", field.Name) }, } return fc, nil } -func (ec *executionContext) _ImagePullSecretEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *model.ImagePullSecretEdge) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ImagePullSecretEdge_cursor(ctx, field) +func (ec *executionContext) _ImportedManagedResourceEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *model.ImportedManagedResourceEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResourceEdge_cursor(ctx, field) if err != nil { return graphql.Null } @@ -22774,9 +24626,9 @@ func (ec *executionContext) _ImagePullSecretEdge_cursor(ctx context.Context, fie return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImagePullSecretEdge_cursor(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImportedManagedResourceEdge_cursor(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ImagePullSecretEdge", + Object: "ImportedManagedResourceEdge", Field: field, IsMethod: false, IsResolver: false, @@ -22787,8 +24639,8 @@ func (ec *executionContext) fieldContext_ImagePullSecretEdge_cursor(ctx context. return fc, nil } -func (ec *executionContext) _ImagePullSecretEdge_node(ctx context.Context, field graphql.CollectedField, obj *model.ImagePullSecretEdge) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ImagePullSecretEdge_node(ctx, field) +func (ec *executionContext) _ImportedManagedResourceEdge_node(ctx context.Context, field graphql.CollectedField, obj *model.ImportedManagedResourceEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResourceEdge_node(ctx, field) if err != nil { return graphql.Null } @@ -22813,62 +24665,58 @@ func (ec *executionContext) _ImagePullSecretEdge_node(ctx context.Context, field } return graphql.Null } - res := resTmp.(*entities.ImagePullSecret) + res := resTmp.(*entities.ImportedManagedResource) fc.Result = res - return ec.marshalNImagePullSecret2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋentitiesᚐImagePullSecret(ctx, field.Selections, res) + return ec.marshalNImportedManagedResource2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋentitiesᚐImportedManagedResource(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImagePullSecretEdge_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImportedManagedResourceEdge_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ImagePullSecretEdge", + Object: "ImportedManagedResourceEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "accountName": - return ec.fieldContext_ImagePullSecret_accountName(ctx, field) + return ec.fieldContext_ImportedManagedResource_accountName(ctx, field) case "createdBy": - return ec.fieldContext_ImagePullSecret_createdBy(ctx, field) + return ec.fieldContext_ImportedManagedResource_createdBy(ctx, field) case "creationTime": - return ec.fieldContext_ImagePullSecret_creationTime(ctx, field) + return ec.fieldContext_ImportedManagedResource_creationTime(ctx, field) case "displayName": - return ec.fieldContext_ImagePullSecret_displayName(ctx, field) - case "dockerConfigJson": - return ec.fieldContext_ImagePullSecret_dockerConfigJson(ctx, field) - case "environments": - return ec.fieldContext_ImagePullSecret_environments(ctx, field) - case "format": - return ec.fieldContext_ImagePullSecret_format(ctx, field) + return ec.fieldContext_ImportedManagedResource_displayName(ctx, field) + case "environmentName": + return ec.fieldContext_ImportedManagedResource_environmentName(ctx, field) case "id": - return ec.fieldContext_ImagePullSecret_id(ctx, field) + return ec.fieldContext_ImportedManagedResource_id(ctx, field) case "lastUpdatedBy": - return ec.fieldContext_ImagePullSecret_lastUpdatedBy(ctx, field) + return ec.fieldContext_ImportedManagedResource_lastUpdatedBy(ctx, field) + case "managedResourceRef": + return ec.fieldContext_ImportedManagedResource_managedResourceRef(ctx, field) case "markedForDeletion": - return ec.fieldContext_ImagePullSecret_markedForDeletion(ctx, field) - case "metadata": - return ec.fieldContext_ImagePullSecret_metadata(ctx, field) + return ec.fieldContext_ImportedManagedResource_markedForDeletion(ctx, field) + case "name": + return ec.fieldContext_ImportedManagedResource_name(ctx, field) case "recordVersion": - return ec.fieldContext_ImagePullSecret_recordVersion(ctx, field) - case "registryPassword": - return ec.fieldContext_ImagePullSecret_registryPassword(ctx, field) - case "registryURL": - return ec.fieldContext_ImagePullSecret_registryURL(ctx, field) - case "registryUsername": - return ec.fieldContext_ImagePullSecret_registryUsername(ctx, field) + return ec.fieldContext_ImportedManagedResource_recordVersion(ctx, field) + case "secretRef": + return ec.fieldContext_ImportedManagedResource_secretRef(ctx, field) case "syncStatus": - return ec.fieldContext_ImagePullSecret_syncStatus(ctx, field) + return ec.fieldContext_ImportedManagedResource_syncStatus(ctx, field) case "updateTime": - return ec.fieldContext_ImagePullSecret_updateTime(ctx, field) + return ec.fieldContext_ImportedManagedResource_updateTime(ctx, field) + case "managedResource": + return ec.fieldContext_ImportedManagedResource_managedResource(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type ImagePullSecret", field.Name) + return nil, fmt.Errorf("no field named %q was found under type ImportedManagedResource", field.Name) }, } return fc, nil } -func (ec *executionContext) _ImagePullSecretPaginatedRecords_edges(ctx context.Context, field graphql.CollectedField, obj *model.ImagePullSecretPaginatedRecords) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ImagePullSecretPaginatedRecords_edges(ctx, field) +func (ec *executionContext) _ImportedManagedResourcePaginatedRecords_edges(ctx context.Context, field graphql.CollectedField, obj *model.ImportedManagedResourcePaginatedRecords) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResourcePaginatedRecords_edges(ctx, field) if err != nil { return graphql.Null } @@ -22893,32 +24741,32 @@ func (ec *executionContext) _ImagePullSecretPaginatedRecords_edges(ctx context.C } return graphql.Null } - res := resTmp.([]*model.ImagePullSecretEdge) + res := resTmp.([]*model.ImportedManagedResourceEdge) fc.Result = res - return ec.marshalNImagePullSecretEdge2ᚕᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐImagePullSecretEdgeᚄ(ctx, field.Selections, res) + return ec.marshalNImportedManagedResourceEdge2ᚕᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐImportedManagedResourceEdgeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImagePullSecretPaginatedRecords_edges(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImportedManagedResourcePaginatedRecords_edges(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ImagePullSecretPaginatedRecords", + Object: "ImportedManagedResourcePaginatedRecords", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "cursor": - return ec.fieldContext_ImagePullSecretEdge_cursor(ctx, field) + return ec.fieldContext_ImportedManagedResourceEdge_cursor(ctx, field) case "node": - return ec.fieldContext_ImagePullSecretEdge_node(ctx, field) + return ec.fieldContext_ImportedManagedResourceEdge_node(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type ImagePullSecretEdge", field.Name) + return nil, fmt.Errorf("no field named %q was found under type ImportedManagedResourceEdge", field.Name) }, } return fc, nil } -func (ec *executionContext) _ImagePullSecretPaginatedRecords_pageInfo(ctx context.Context, field graphql.CollectedField, obj *model.ImagePullSecretPaginatedRecords) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ImagePullSecretPaginatedRecords_pageInfo(ctx, field) +func (ec *executionContext) _ImportedManagedResourcePaginatedRecords_pageInfo(ctx context.Context, field graphql.CollectedField, obj *model.ImportedManagedResourcePaginatedRecords) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResourcePaginatedRecords_pageInfo(ctx, field) if err != nil { return graphql.Null } @@ -22948,9 +24796,9 @@ func (ec *executionContext) _ImagePullSecretPaginatedRecords_pageInfo(ctx contex return ec.marshalNPageInfo2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐPageInfo(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImagePullSecretPaginatedRecords_pageInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImportedManagedResourcePaginatedRecords_pageInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ImagePullSecretPaginatedRecords", + Object: "ImportedManagedResourcePaginatedRecords", Field: field, IsMethod: false, IsResolver: false, @@ -22971,8 +24819,8 @@ func (ec *executionContext) fieldContext_ImagePullSecretPaginatedRecords_pageInf return fc, nil } -func (ec *executionContext) _ImagePullSecretPaginatedRecords_totalCount(ctx context.Context, field graphql.CollectedField, obj *model.ImagePullSecretPaginatedRecords) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ImagePullSecretPaginatedRecords_totalCount(ctx, field) +func (ec *executionContext) _ImportedManagedResourcePaginatedRecords_totalCount(ctx context.Context, field graphql.CollectedField, obj *model.ImportedManagedResourcePaginatedRecords) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImportedManagedResourcePaginatedRecords_totalCount(ctx, field) if err != nil { return graphql.Null } @@ -23002,9 +24850,9 @@ func (ec *executionContext) _ImagePullSecretPaginatedRecords_totalCount(ctx cont return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImagePullSecretPaginatedRecords_totalCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImportedManagedResourcePaginatedRecords_totalCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ImagePullSecretPaginatedRecords", + Object: "ImportedManagedResourcePaginatedRecords", Field: field, IsMethod: false, IsResolver: false, @@ -28023,6 +29871,8 @@ func (ec *executionContext) fieldContext_Mutation_core_createSecret(ctx context. return ec.fieldContext_Secret_displayName(ctx, field) case "environmentName": return ec.fieldContext_Secret_environmentName(ctx, field) + case "for": + return ec.fieldContext_Secret_for(ctx, field) case "id": return ec.fieldContext_Secret_id(ctx, field) case "immutable": @@ -28141,6 +29991,8 @@ func (ec *executionContext) fieldContext_Mutation_core_updateSecret(ctx context. return ec.fieldContext_Secret_displayName(ctx, field) case "environmentName": return ec.fieldContext_Secret_environmentName(ctx, field) + case "for": + return ec.fieldContext_Secret_for(ctx, field) case "id": return ec.fieldContext_Secret_id(ctx, field) case "immutable": @@ -28917,7 +30769,7 @@ func (ec *executionContext) _Mutation_core_importManagedResource(ctx context.Con resTmp, err := ec.ResolverMiddleware(ctx, 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().CoreImportManagedResource(rctx, fc.Args["envName"].(string), fc.Args["msvcName"].(string), fc.Args["mresName"].(string)) + return ec.resolvers.Mutation().CoreImportManagedResource(rctx, fc.Args["envName"].(string), fc.Args["msvcName"].(string), fc.Args["mresName"].(string), fc.Args["importName"].(string)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsLoggedInAndVerified == nil { @@ -28939,10 +30791,10 @@ func (ec *executionContext) _Mutation_core_importManagedResource(ctx context.Con if tmp == nil { return nil, nil } - if data, ok := tmp.(*entities.ManagedResource); ok { + if data, ok := tmp.(*entities.ImportedManagedResource); ok { return data, nil } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/kloudlite/api/apps/console/internal/entities.ManagedResource`, tmp) + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/kloudlite/api/apps/console/internal/entities.ImportedManagedResource`, tmp) }) if err != nil { ec.Error(ctx, err) @@ -28951,9 +30803,9 @@ func (ec *executionContext) _Mutation_core_importManagedResource(ctx context.Con if resTmp == nil { return graphql.Null } - res := resTmp.(*entities.ManagedResource) + res := resTmp.(*entities.ImportedManagedResource) fc.Result = res - return ec.marshalOManagedResource2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋentitiesᚐManagedResource(ctx, field.Selections, res) + return ec.marshalOImportedManagedResource2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋentitiesᚐImportedManagedResource(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Mutation_core_importManagedResource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -28965,51 +30817,37 @@ func (ec *executionContext) fieldContext_Mutation_core_importManagedResource(ctx Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "accountName": - return ec.fieldContext_ManagedResource_accountName(ctx, field) - case "apiVersion": - return ec.fieldContext_ManagedResource_apiVersion(ctx, field) - case "clusterName": - return ec.fieldContext_ManagedResource_clusterName(ctx, field) + return ec.fieldContext_ImportedManagedResource_accountName(ctx, field) case "createdBy": - return ec.fieldContext_ManagedResource_createdBy(ctx, field) + return ec.fieldContext_ImportedManagedResource_createdBy(ctx, field) case "creationTime": - return ec.fieldContext_ManagedResource_creationTime(ctx, field) + return ec.fieldContext_ImportedManagedResource_creationTime(ctx, field) case "displayName": - return ec.fieldContext_ManagedResource_displayName(ctx, field) - case "enabled": - return ec.fieldContext_ManagedResource_enabled(ctx, field) + return ec.fieldContext_ImportedManagedResource_displayName(ctx, field) case "environmentName": - return ec.fieldContext_ManagedResource_environmentName(ctx, field) + return ec.fieldContext_ImportedManagedResource_environmentName(ctx, field) case "id": - return ec.fieldContext_ManagedResource_id(ctx, field) - case "isImported": - return ec.fieldContext_ManagedResource_isImported(ctx, field) - case "kind": - return ec.fieldContext_ManagedResource_kind(ctx, field) + return ec.fieldContext_ImportedManagedResource_id(ctx, field) case "lastUpdatedBy": - return ec.fieldContext_ManagedResource_lastUpdatedBy(ctx, field) - case "managedServiceName": - return ec.fieldContext_ManagedResource_managedServiceName(ctx, field) + return ec.fieldContext_ImportedManagedResource_lastUpdatedBy(ctx, field) + case "managedResourceRef": + return ec.fieldContext_ImportedManagedResource_managedResourceRef(ctx, field) case "markedForDeletion": - return ec.fieldContext_ManagedResource_markedForDeletion(ctx, field) - case "metadata": - return ec.fieldContext_ManagedResource_metadata(ctx, field) - case "mresRef": - return ec.fieldContext_ManagedResource_mresRef(ctx, field) + return ec.fieldContext_ImportedManagedResource_markedForDeletion(ctx, field) + case "name": + return ec.fieldContext_ImportedManagedResource_name(ctx, field) case "recordVersion": - return ec.fieldContext_ManagedResource_recordVersion(ctx, field) - case "spec": - return ec.fieldContext_ManagedResource_spec(ctx, field) - case "status": - return ec.fieldContext_ManagedResource_status(ctx, field) - case "syncedOutputSecretRef": - return ec.fieldContext_ManagedResource_syncedOutputSecretRef(ctx, field) + return ec.fieldContext_ImportedManagedResource_recordVersion(ctx, field) + case "secretRef": + return ec.fieldContext_ImportedManagedResource_secretRef(ctx, field) case "syncStatus": - return ec.fieldContext_ManagedResource_syncStatus(ctx, field) + return ec.fieldContext_ImportedManagedResource_syncStatus(ctx, field) case "updateTime": - return ec.fieldContext_ManagedResource_updateTime(ctx, field) + return ec.fieldContext_ImportedManagedResource_updateTime(ctx, field) + case "managedResource": + return ec.fieldContext_ImportedManagedResource_managedResource(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type ManagedResource", field.Name) + return nil, fmt.Errorf("no field named %q was found under type ImportedManagedResource", field.Name) }, } defer func() { @@ -29041,7 +30879,7 @@ func (ec *executionContext) _Mutation_core_deleteImportedManagedResource(ctx con resTmp, err := ec.ResolverMiddleware(ctx, 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().CoreDeleteImportedManagedResource(rctx, fc.Args["envName"].(string), fc.Args["mresName"].(string)) + return ec.resolvers.Mutation().CoreDeleteImportedManagedResource(rctx, fc.Args["envName"].(string), fc.Args["importName"].(string)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsLoggedInAndVerified == nil { @@ -31903,6 +33741,8 @@ func (ec *executionContext) fieldContext_Query_core_getSecret(ctx context.Contex return ec.fieldContext_Secret_displayName(ctx, field) case "environmentName": return ec.fieldContext_Secret_environmentName(ctx, field) + case "for": + return ec.fieldContext_Secret_for(ctx, field) case "id": return ec.fieldContext_Secret_id(ctx, field) case "immutable": @@ -32768,6 +34608,92 @@ func (ec *executionContext) fieldContext_Query_core_resyncManagedResource(ctx co return fc, nil } +func (ec *executionContext) _Query_core_listImportedManagedResources(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_core_listImportedManagedResources(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, err := ec.ResolverMiddleware(ctx, 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.Query().CoreListImportedManagedResources(rctx, fc.Args["envName"].(string), fc.Args["search"].(*model.SearchImportedManagedResources), fc.Args["pq"].(*repos.CursorPagination)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.IsLoggedInAndVerified == nil { + return nil, errors.New("directive isLoggedInAndVerified is not implemented") + } + return ec.directives.IsLoggedInAndVerified(ctx, nil, directive0) + } + directive2 := func(ctx context.Context) (interface{}, error) { + if ec.directives.HasAccount == nil { + return nil, errors.New("directive hasAccount is not implemented") + } + return ec.directives.HasAccount(ctx, nil, directive1) + } + + tmp, err := directive2(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*model.ImportedManagedResourcePaginatedRecords); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/kloudlite/api/apps/console/internal/app/graph/model.ImportedManagedResourcePaginatedRecords`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.ImportedManagedResourcePaginatedRecords) + fc.Result = res + return ec.marshalOImportedManagedResourcePaginatedRecords2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐImportedManagedResourcePaginatedRecords(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_core_listImportedManagedResources(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_ImportedManagedResourcePaginatedRecords_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_ImportedManagedResourcePaginatedRecords_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_ImportedManagedResourcePaginatedRecords_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ImportedManagedResourcePaginatedRecords", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_core_listImportedManagedResources_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Query_core_listVPNDevices(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_core_listVPNDevices(ctx, field) if err != nil { @@ -34705,6 +36631,57 @@ func (ec *executionContext) fieldContext_Secret_environmentName(ctx context.Cont return fc, nil } +func (ec *executionContext) _Secret_for(ctx context.Context, field graphql.CollectedField, obj *entities.Secret) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Secret_for(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, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Secret().For(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.GithubComKloudliteAPIAppsConsoleInternalEntitiesSecretCreatedFor) + fc.Result = res + return ec.marshalOGithub__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsConsoleInternalEntitiesSecretCreatedFor(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Secret_for(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Secret", + 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_Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_name(ctx, field) + case "namespace": + return ec.fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_namespace(ctx, field) + case "refId": + return ec.fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_refId(ctx, field) + case "resourceType": + return ec.fieldContext_Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_resourceType(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _Secret_id(ctx context.Context, field graphql.CollectedField, obj *entities.Secret) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Secret_id(ctx, field) if err != nil { @@ -35350,6 +37327,8 @@ func (ec *executionContext) fieldContext_SecretEdge_node(ctx context.Context, fi return ec.fieldContext_Secret_displayName(ctx, field) case "environmentName": return ec.fieldContext_Secret_environmentName(ctx, field) + case "for": + return ec.fieldContext_Secret_for(ctx, field) case "id": return ec.fieldContext_Secret_id(ctx, field) case "immutable": @@ -38103,6 +40082,113 @@ func (ec *executionContext) unmarshalInputExternalAppIn(ctx context.Context, obj return it, nil } +func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRefIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRefIn, error) { + var it model.GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRefIn + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"id", "name", "namespace"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "namespace": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Namespace = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputGithub__com___kloudlite___api___pkg___types__SyncStatusIn(ctx context.Context, obj interface{}) (types.SyncStatus, error) { + var it types.SyncStatus + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"action", "error", "lastSyncedAt", "recordVersion", "state", "syncScheduledAt"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "action": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("action")) + data, err := ec.unmarshalNGithub__com___kloudlite___api___pkg___types__SyncAction2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋtypesᚐSyncAction(ctx, v) + if err != nil { + return it, err + } + it.Action = data + case "error": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("error")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Error = data + case "lastSyncedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastSyncedAt")) + data, err := ec.unmarshalODate2ᚖstring(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.Github__com___kloudlite___api___pkg___types__SyncStatusIn().LastSyncedAt(ctx, &it, data); err != nil { + return it, err + } + case "recordVersion": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("recordVersion")) + data, err := ec.unmarshalNInt2int(ctx, v) + if err != nil { + return it, err + } + it.RecordVersion = data + case "state": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("state")) + data, err := ec.unmarshalNGithub__com___kloudlite___api___pkg___types__SyncState2githubᚗcomᚋkloudliteᚋapiᚋpkgᚋtypesᚐSyncState(ctx, v) + if err != nil { + return it, err + } + it.State = data + case "syncScheduledAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("syncScheduledAt")) + data, err := ec.unmarshalODate2ᚖstring(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.Github__com___kloudlite___api___pkg___types__SyncStatusIn().SyncScheduledAt(ctx, &it, data); err != nil { + return it, err + } + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___apis___common____types__MsvcRefIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteOperatorApisCommonTypesMsvcRefIn, error) { var it model.GithubComKloudliteOperatorApisCommonTypesMsvcRefIn asMap := map[string]interface{}{} @@ -38158,6 +40244,40 @@ func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___a return it, nil } +func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___apis___common____types__SecretRefIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteOperatorApisCommonTypesSecretRefIn, error) { + var it model.GithubComKloudliteOperatorApisCommonTypesSecretRefIn + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "namespace"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "namespace": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Namespace = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__AppContainerIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteOperatorApisCrdsV1AppContainerIn, error) { var it model.GithubComKloudliteOperatorApisCrdsV1AppContainerIn asMap := map[string]interface{}{} @@ -39173,7 +41293,7 @@ func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___a it.MsvcRef = data case "spec": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("spec")) - data, err := ec.unmarshalNMap2map(ctx, v) + data, err := ec.unmarshalOMap2map(ctx, v) if err != nil { return it, err } @@ -39950,6 +42070,68 @@ func (ec *executionContext) unmarshalInputImagePullSecretIn(ctx context.Context, return it, nil } +func (ec *executionContext) unmarshalInputImportedManagedResourceIn(ctx context.Context, obj interface{}) (model.ImportedManagedResourceIn, error) { + var it model.ImportedManagedResourceIn + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"displayName", "environmentName", "managedResourceRef", "name", "secretRef", "syncStatus"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "displayName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayName")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.DisplayName = data + case "environmentName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environmentName")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.EnvironmentName = data + case "managedResourceRef": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("managedResourceRef")) + data, err := ec.unmarshalNGithub__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRefIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRefIn(ctx, v) + if err != nil { + return it, err + } + it.ManagedResourceRef = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "secretRef": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretRef")) + data, err := ec.unmarshalNGithub__com___kloudlite___operator___apis___common____types__SecretRefIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCommonTypesSecretRefIn(ctx, v) + if err != nil { + return it, err + } + it.SecretRef = data + case "syncStatus": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("syncStatus")) + data, err := ec.unmarshalNGithub__com___kloudlite___api___pkg___types__SyncStatusIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋpkgᚋtypesᚐSyncStatus(ctx, v) + if err != nil { + return it, err + } + it.SyncStatus = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputK8s__io___api___core___v1__TolerationIn(ctx context.Context, obj interface{}) (model.K8sIoAPICoreV1TolerationIn, error) { var it model.K8sIoAPICoreV1TolerationIn asMap := map[string]interface{}{} @@ -40709,6 +42891,47 @@ func (ec *executionContext) unmarshalInputSearchImagePullSecrets(ctx context.Con return it, nil } +func (ec *executionContext) unmarshalInputSearchImportedManagedResources(ctx context.Context, obj interface{}) (model.SearchImportedManagedResources, error) { + var it model.SearchImportedManagedResources + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"text", "isReady", "markedForDeletion"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "text": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("text")) + data, err := ec.unmarshalOMatchFilterIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐMatchFilter(ctx, v) + if err != nil { + return it, err + } + it.Text = data + case "isReady": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isReady")) + data, err := ec.unmarshalOMatchFilterIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐMatchFilter(ctx, v) + if err != nil { + return it, err + } + it.IsReady = data + case "markedForDeletion": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("markedForDeletion")) + data, err := ec.unmarshalOMatchFilterIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐMatchFilter(ctx, v) + if err != nil { + return it, err + } + it.MarkedForDeletion = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputSearchManagedResources(ctx context.Context, obj interface{}) (model.SearchManagedResources, error) { var it model.SearchManagedResources asMap := map[string]interface{}{} @@ -42638,172 +44861,265 @@ func (ec *executionContext) _EnvironmentPaginatedRecords(ctx context.Context, se return out } -var externalAppImplementors = []string{"ExternalApp"} +var externalAppImplementors = []string{"ExternalApp"} + +func (ec *executionContext) _ExternalApp(ctx context.Context, sel ast.SelectionSet, obj *entities.ExternalApp) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, externalAppImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ExternalApp") + case "accountName": + out.Values[i] = ec._ExternalApp_accountName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "apiVersion": + out.Values[i] = ec._ExternalApp_apiVersion(ctx, field, obj) + case "createdBy": + out.Values[i] = ec._ExternalApp_createdBy(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "creationTime": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ExternalApp_creationTime(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "displayName": + out.Values[i] = ec._ExternalApp_displayName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "environmentName": + out.Values[i] = ec._ExternalApp_environmentName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "id": + out.Values[i] = ec._ExternalApp_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "kind": + out.Values[i] = ec._ExternalApp_kind(ctx, field, obj) + case "lastUpdatedBy": + out.Values[i] = ec._ExternalApp_lastUpdatedBy(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "markedForDeletion": + out.Values[i] = ec._ExternalApp_markedForDeletion(ctx, field, obj) + case "metadata": + out.Values[i] = ec._ExternalApp_metadata(ctx, field, obj) + case "recordVersion": + out.Values[i] = ec._ExternalApp_recordVersion(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "spec": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ExternalApp_spec(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "status": + out.Values[i] = ec._ExternalApp_status(ctx, field, obj) + case "syncStatus": + out.Values[i] = ec._ExternalApp_syncStatus(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "updateTime": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ExternalApp_updateTime(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var externalAppEdgeImplementors = []string{"ExternalAppEdge"} -func (ec *executionContext) _ExternalApp(ctx context.Context, sel ast.SelectionSet, obj *entities.ExternalApp) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, externalAppImplementors) +func (ec *executionContext) _ExternalAppEdge(ctx context.Context, sel ast.SelectionSet, obj *model.ExternalAppEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, externalAppEdgeImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("ExternalApp") - case "accountName": - out.Values[i] = ec._ExternalApp_accountName(ctx, field, obj) + out.Values[i] = graphql.MarshalString("ExternalAppEdge") + case "cursor": + out.Values[i] = ec._ExternalAppEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + out.Invalids++ } - case "apiVersion": - out.Values[i] = ec._ExternalApp_apiVersion(ctx, field, obj) - case "createdBy": - out.Values[i] = ec._ExternalApp_createdBy(ctx, field, obj) + case "node": + out.Values[i] = ec._ExternalAppEdge_node(ctx, field, obj) if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "creationTime": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._ExternalApp_creationTime(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res + out.Invalids++ } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } + atomic.AddInt32(&ec.deferred, int32(len(deferred))) - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "displayName": - out.Values[i] = ec._ExternalApp_displayName(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "environmentName": - out.Values[i] = ec._ExternalApp_environmentName(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "id": - out.Values[i] = ec._ExternalApp_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "kind": - out.Values[i] = ec._ExternalApp_kind(ctx, field, obj) - case "lastUpdatedBy": - out.Values[i] = ec._ExternalApp_lastUpdatedBy(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "markedForDeletion": - out.Values[i] = ec._ExternalApp_markedForDeletion(ctx, field, obj) - case "metadata": - out.Values[i] = ec._ExternalApp_metadata(ctx, field, obj) - case "recordVersion": - out.Values[i] = ec._ExternalApp_recordVersion(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "spec": - field := field + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._ExternalApp_spec(ctx, field, obj) - return res - } + return out +} - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) +var externalAppPaginatedRecordsImplementors = []string{"ExternalAppPaginatedRecords"} - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } +func (ec *executionContext) _ExternalAppPaginatedRecords(ctx context.Context, sel ast.SelectionSet, obj *model.ExternalAppPaginatedRecords) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, externalAppPaginatedRecordsImplementors) - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "status": - out.Values[i] = ec._ExternalApp_status(ctx, field, obj) - case "syncStatus": - out.Values[i] = ec._ExternalApp_syncStatus(ctx, field, obj) + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ExternalAppPaginatedRecords") + case "edges": + out.Values[i] = ec._ExternalAppPaginatedRecords_edges(ctx, field, obj) if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + out.Invalids++ } - case "updateTime": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._ExternalApp_updateTime(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res + case "pageInfo": + out.Values[i] = ec._ExternalAppPaginatedRecords_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue + case "totalCount": + out.Values[i] = ec._ExternalAppPaginatedRecords_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -42827,24 +45143,29 @@ func (ec *executionContext) _ExternalApp(ctx context.Context, sel ast.SelectionS return out } -var externalAppEdgeImplementors = []string{"ExternalAppEdge"} +var github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRefImplementors = []string{"Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef"} -func (ec *executionContext) _ExternalAppEdge(ctx context.Context, sel ast.SelectionSet, obj *model.ExternalAppEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, externalAppEdgeImplementors) +func (ec *executionContext) _Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRef) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRefImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("ExternalAppEdge") - case "cursor": - out.Values[i] = ec._ExternalAppEdge_cursor(ctx, field, obj) + out.Values[i] = graphql.MarshalString("Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef") + case "id": + out.Values[i] = ec._Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef_id(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "node": - out.Values[i] = ec._ExternalAppEdge_node(ctx, field, obj) + case "name": + out.Values[i] = ec._Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "namespace": + out.Values[i] = ec._Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef_namespace(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -42871,29 +45192,34 @@ func (ec *executionContext) _ExternalAppEdge(ctx context.Context, sel ast.Select return out } -var externalAppPaginatedRecordsImplementors = []string{"ExternalAppPaginatedRecords"} +var github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedForImplementors = []string{"Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor"} -func (ec *executionContext) _ExternalAppPaginatedRecords(ctx context.Context, sel ast.SelectionSet, obj *model.ExternalAppPaginatedRecords) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, externalAppPaginatedRecordsImplementors) +func (ec *executionContext) _Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteAPIAppsConsoleInternalEntitiesSecretCreatedFor) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedForImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("ExternalAppPaginatedRecords") - case "edges": - out.Values[i] = ec._ExternalAppPaginatedRecords_edges(ctx, field, obj) + out.Values[i] = graphql.MarshalString("Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor") + case "name": + out.Values[i] = ec._Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_name(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "pageInfo": - out.Values[i] = ec._ExternalAppPaginatedRecords_pageInfo(ctx, field, obj) + case "namespace": + out.Values[i] = ec._Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_namespace(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "totalCount": - out.Values[i] = ec._ExternalAppPaginatedRecords_totalCount(ctx, field, obj) + case "refId": + out.Values[i] = ec._Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_refId(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "resourceType": + out.Values[i] = ec._Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor_resourceType(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -43211,6 +45537,47 @@ func (ec *executionContext) _Github__com___kloudlite___operator___apis___common_ return out } +var github__com___kloudlite___operator___apis___common____types__SecretRefImplementors = []string{"Github__com___kloudlite___operator___apis___common____types__SecretRef"} + +func (ec *executionContext) _Github__com___kloudlite___operator___apis___common____types__SecretRef(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteOperatorApisCommonTypesSecretRef) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___operator___apis___common____types__SecretRefImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Github__com___kloudlite___operator___apis___common____types__SecretRef") + case "name": + out.Values[i] = ec._Github__com___kloudlite___operator___apis___common____types__SecretRef_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "namespace": + out.Values[i] = ec._Github__com___kloudlite___operator___apis___common____types__SecretRef_namespace(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var github__com___kloudlite___operator___apis___crds___v1__AppContainerImplementors = []string{"Github__com___kloudlite___operator___apis___crds___v1__AppContainer"} func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__AppContainer(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteOperatorApisCrdsV1AppContainer) graphql.Marshaler { @@ -44159,9 +46526,6 @@ func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___ } case "spec": out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__MresResourceTemplate_spec(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -45037,16 +47401,393 @@ func (ec *executionContext) _ImagePullSecret(ctx context.Context, sel ast.Select } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "displayName": - out.Values[i] = ec._ImagePullSecret_displayName(ctx, field, obj) + case "displayName": + out.Values[i] = ec._ImagePullSecret_displayName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "dockerConfigJson": + out.Values[i] = ec._ImagePullSecret_dockerConfigJson(ctx, field, obj) + case "environments": + out.Values[i] = ec._ImagePullSecret_environments(ctx, field, obj) + case "format": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ImagePullSecret_format(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "id": + out.Values[i] = ec._ImagePullSecret_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "lastUpdatedBy": + out.Values[i] = ec._ImagePullSecret_lastUpdatedBy(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "markedForDeletion": + out.Values[i] = ec._ImagePullSecret_markedForDeletion(ctx, field, obj) + case "metadata": + out.Values[i] = ec._ImagePullSecret_metadata(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "recordVersion": + out.Values[i] = ec._ImagePullSecret_recordVersion(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "registryPassword": + out.Values[i] = ec._ImagePullSecret_registryPassword(ctx, field, obj) + case "registryURL": + out.Values[i] = ec._ImagePullSecret_registryURL(ctx, field, obj) + case "registryUsername": + out.Values[i] = ec._ImagePullSecret_registryUsername(ctx, field, obj) + case "syncStatus": + out.Values[i] = ec._ImagePullSecret_syncStatus(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "updateTime": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ImagePullSecret_updateTime(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var imagePullSecretEdgeImplementors = []string{"ImagePullSecretEdge"} + +func (ec *executionContext) _ImagePullSecretEdge(ctx context.Context, sel ast.SelectionSet, obj *model.ImagePullSecretEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, imagePullSecretEdgeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ImagePullSecretEdge") + case "cursor": + out.Values[i] = ec._ImagePullSecretEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "node": + out.Values[i] = ec._ImagePullSecretEdge_node(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var imagePullSecretPaginatedRecordsImplementors = []string{"ImagePullSecretPaginatedRecords"} + +func (ec *executionContext) _ImagePullSecretPaginatedRecords(ctx context.Context, sel ast.SelectionSet, obj *model.ImagePullSecretPaginatedRecords) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, imagePullSecretPaginatedRecordsImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ImagePullSecretPaginatedRecords") + case "edges": + out.Values[i] = ec._ImagePullSecretPaginatedRecords_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pageInfo": + out.Values[i] = ec._ImagePullSecretPaginatedRecords_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "totalCount": + out.Values[i] = ec._ImagePullSecretPaginatedRecords_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var importedManagedResourceImplementors = []string{"ImportedManagedResource"} + +func (ec *executionContext) _ImportedManagedResource(ctx context.Context, sel ast.SelectionSet, obj *entities.ImportedManagedResource) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, importedManagedResourceImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ImportedManagedResource") + case "accountName": + out.Values[i] = ec._ImportedManagedResource_accountName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "createdBy": + out.Values[i] = ec._ImportedManagedResource_createdBy(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "creationTime": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ImportedManagedResource_creationTime(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "displayName": + out.Values[i] = ec._ImportedManagedResource_displayName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "environmentName": + out.Values[i] = ec._ImportedManagedResource_environmentName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "id": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ImportedManagedResource_id(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "lastUpdatedBy": + out.Values[i] = ec._ImportedManagedResource_lastUpdatedBy(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "managedResourceRef": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ImportedManagedResource_managedResourceRef(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "markedForDeletion": + out.Values[i] = ec._ImportedManagedResource_markedForDeletion(ctx, field, obj) + case "name": + out.Values[i] = ec._ImportedManagedResource_name(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "dockerConfigJson": - out.Values[i] = ec._ImagePullSecret_dockerConfigJson(ctx, field, obj) - case "environments": - out.Values[i] = ec._ImagePullSecret_environments(ctx, field, obj) - case "format": + case "recordVersion": + out.Values[i] = ec._ImportedManagedResource_recordVersion(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "secretRef": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -45055,7 +47796,7 @@ func (ec *executionContext) _ImagePullSecret(ctx context.Context, sel ast.Select ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._ImagePullSecret_format(ctx, field, obj) + res = ec._ImportedManagedResource_secretRef(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -45082,36 +47823,8 @@ func (ec *executionContext) _ImagePullSecret(ctx context.Context, sel ast.Select } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "id": - out.Values[i] = ec._ImagePullSecret_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "lastUpdatedBy": - out.Values[i] = ec._ImagePullSecret_lastUpdatedBy(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "markedForDeletion": - out.Values[i] = ec._ImagePullSecret_markedForDeletion(ctx, field, obj) - case "metadata": - out.Values[i] = ec._ImagePullSecret_metadata(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "recordVersion": - out.Values[i] = ec._ImagePullSecret_recordVersion(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "registryPassword": - out.Values[i] = ec._ImagePullSecret_registryPassword(ctx, field, obj) - case "registryURL": - out.Values[i] = ec._ImagePullSecret_registryURL(ctx, field, obj) - case "registryUsername": - out.Values[i] = ec._ImagePullSecret_registryUsername(ctx, field, obj) case "syncStatus": - out.Values[i] = ec._ImagePullSecret_syncStatus(ctx, field, obj) + out.Values[i] = ec._ImportedManagedResource_syncStatus(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } @@ -45124,7 +47837,7 @@ func (ec *executionContext) _ImagePullSecret(ctx context.Context, sel ast.Select ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._ImagePullSecret_updateTime(ctx, field, obj) + res = ec._ImportedManagedResource_updateTime(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -45150,6 +47863,39 @@ func (ec *executionContext) _ImagePullSecret(ctx context.Context, sel ast.Select continue } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "managedResource": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ImportedManagedResource_managedResource(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) @@ -45174,24 +47920,24 @@ func (ec *executionContext) _ImagePullSecret(ctx context.Context, sel ast.Select return out } -var imagePullSecretEdgeImplementors = []string{"ImagePullSecretEdge"} +var importedManagedResourceEdgeImplementors = []string{"ImportedManagedResourceEdge"} -func (ec *executionContext) _ImagePullSecretEdge(ctx context.Context, sel ast.SelectionSet, obj *model.ImagePullSecretEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, imagePullSecretEdgeImplementors) +func (ec *executionContext) _ImportedManagedResourceEdge(ctx context.Context, sel ast.SelectionSet, obj *model.ImportedManagedResourceEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, importedManagedResourceEdgeImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("ImagePullSecretEdge") + out.Values[i] = graphql.MarshalString("ImportedManagedResourceEdge") case "cursor": - out.Values[i] = ec._ImagePullSecretEdge_cursor(ctx, field, obj) + out.Values[i] = ec._ImportedManagedResourceEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "node": - out.Values[i] = ec._ImagePullSecretEdge_node(ctx, field, obj) + out.Values[i] = ec._ImportedManagedResourceEdge_node(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -45218,29 +47964,29 @@ func (ec *executionContext) _ImagePullSecretEdge(ctx context.Context, sel ast.Se return out } -var imagePullSecretPaginatedRecordsImplementors = []string{"ImagePullSecretPaginatedRecords"} +var importedManagedResourcePaginatedRecordsImplementors = []string{"ImportedManagedResourcePaginatedRecords"} -func (ec *executionContext) _ImagePullSecretPaginatedRecords(ctx context.Context, sel ast.SelectionSet, obj *model.ImagePullSecretPaginatedRecords) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, imagePullSecretPaginatedRecordsImplementors) +func (ec *executionContext) _ImportedManagedResourcePaginatedRecords(ctx context.Context, sel ast.SelectionSet, obj *model.ImportedManagedResourcePaginatedRecords) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, importedManagedResourcePaginatedRecordsImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("ImagePullSecretPaginatedRecords") + out.Values[i] = graphql.MarshalString("ImportedManagedResourcePaginatedRecords") case "edges": - out.Values[i] = ec._ImagePullSecretPaginatedRecords_edges(ctx, field, obj) + out.Values[i] = ec._ImportedManagedResourcePaginatedRecords_edges(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "pageInfo": - out.Values[i] = ec._ImagePullSecretPaginatedRecords_pageInfo(ctx, field, obj) + out.Values[i] = ec._ImportedManagedResourcePaginatedRecords_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "totalCount": - out.Values[i] = ec._ImagePullSecretPaginatedRecords_totalCount(ctx, field, obj) + out.Values[i] = ec._ImportedManagedResourcePaginatedRecords_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -47163,6 +49909,25 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "core_listImportedManagedResources": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_core_listImportedManagedResources(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "core_listVPNDevices": field := field @@ -47685,6 +50450,39 @@ func (ec *executionContext) _Secret(ctx context.Context, sel ast.SelectionSet, o if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } + case "for": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Secret_for(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "id": out.Values[i] = ec._Secret_id(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -48887,6 +51685,25 @@ func (ec *executionContext) marshalNFieldSet2string(ctx context.Context, sel ast return res } +func (ec *executionContext) marshalNGithub__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef2githubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRef(ctx context.Context, sel ast.SelectionSet, v model.GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRef) graphql.Marshaler { + return ec._Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef(ctx, sel, &v) +} + +func (ec *executionContext) marshalNGithub__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRef(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRef) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNGithub__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRefIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRefIn(ctx context.Context, v interface{}) (*model.GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRefIn, error) { + res, err := ec.unmarshalInputGithub__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRefIn(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) unmarshalNGithub__com___kloudlite___api___apps___console___internal___entities__PullSecretFormat2githubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsConsoleInternalEntitiesPullSecretFormat(ctx context.Context, v interface{}) (model.GithubComKloudliteAPIAppsConsoleInternalEntitiesPullSecretFormat, error) { var res model.GithubComKloudliteAPIAppsConsoleInternalEntitiesPullSecretFormat err := res.UnmarshalGQL(v) @@ -48897,6 +51714,16 @@ func (ec *executionContext) marshalNGithub__com___kloudlite___api___apps___conso return v } +func (ec *executionContext) unmarshalNGithub__com___kloudlite___api___apps___console___internal___entities__ResourceType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType(ctx context.Context, v interface{}) (model.GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType, error) { + var res model.GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNGithub__com___kloudlite___api___apps___console___internal___entities__ResourceType2githubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType(ctx context.Context, sel ast.SelectionSet, v model.GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType) graphql.Marshaler { + return v +} + func (ec *executionContext) marshalNGithub__com___kloudlite___api___common__CreatedOrUpdatedBy2githubᚗcomᚋkloudliteᚋapiᚋcommonᚐCreatedOrUpdatedBy(ctx context.Context, sel ast.SelectionSet, v common.CreatedOrUpdatedBy) graphql.Marshaler { return ec._Github__com___kloudlite___api___common__CreatedOrUpdatedBy(ctx, sel, &v) } @@ -48953,6 +51780,11 @@ func (ec *executionContext) marshalNGithub__com___kloudlite___api___pkg___types_ return ec._Github__com___kloudlite___api___pkg___types__SyncStatus(ctx, sel, &v) } +func (ec *executionContext) unmarshalNGithub__com___kloudlite___api___pkg___types__SyncStatusIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋpkgᚋtypesᚐSyncStatus(ctx context.Context, v interface{}) (*types.SyncStatus, error) { + res, err := ec.unmarshalInputGithub__com___kloudlite___api___pkg___types__SyncStatusIn(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalNGithub__com___kloudlite___operator___apis___common____types__MsvcRef2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCommonTypesMsvcRef(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteOperatorApisCommonTypesMsvcRef) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -48968,6 +51800,25 @@ func (ec *executionContext) unmarshalNGithub__com___kloudlite___operator___apis_ return &res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalNGithub__com___kloudlite___operator___apis___common____types__SecretRef2githubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCommonTypesSecretRef(ctx context.Context, sel ast.SelectionSet, v model.GithubComKloudliteOperatorApisCommonTypesSecretRef) graphql.Marshaler { + return ec._Github__com___kloudlite___operator___apis___common____types__SecretRef(ctx, sel, &v) +} + +func (ec *executionContext) marshalNGithub__com___kloudlite___operator___apis___common____types__SecretRef2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCommonTypesSecretRef(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteOperatorApisCommonTypesSecretRef) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Github__com___kloudlite___operator___apis___common____types__SecretRef(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNGithub__com___kloudlite___operator___apis___common____types__SecretRefIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCommonTypesSecretRefIn(ctx context.Context, v interface{}) (*model.GithubComKloudliteOperatorApisCommonTypesSecretRefIn, error) { + res, err := ec.unmarshalInputGithub__com___kloudlite___operator___apis___common____types__SecretRefIn(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalNGithub__com___kloudlite___operator___apis___crds___v1__AppContainer2ᚕᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCrdsV1AppContainerᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.GithubComKloudliteOperatorApisCrdsV1AppContainer) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup @@ -49417,6 +52268,70 @@ func (ec *executionContext) unmarshalNImagePullSecretIn2githubᚗcomᚋkloudlite return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalNImportedManagedResource2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋentitiesᚐImportedManagedResource(ctx context.Context, sel ast.SelectionSet, v *entities.ImportedManagedResource) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._ImportedManagedResource(ctx, sel, v) +} + +func (ec *executionContext) marshalNImportedManagedResourceEdge2ᚕᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐImportedManagedResourceEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.ImportedManagedResourceEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNImportedManagedResourceEdge2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐImportedManagedResourceEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNImportedManagedResourceEdge2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐImportedManagedResourceEdge(ctx context.Context, sel ast.SelectionSet, v *model.ImportedManagedResourceEdge) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._ImportedManagedResourceEdge(ctx, sel, v) +} + func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { res, err := graphql.UnmarshalInt(v) return res, graphql.ErrorOnPath(ctx, err) @@ -49635,27 +52550,6 @@ func (ec *executionContext) marshalNManagedResourceKeyValueRef2ᚖgithubᚗcom return ec._ManagedResourceKeyValueRef(ctx, sel, v) } -func (ec *executionContext) unmarshalNMap2map(ctx context.Context, v interface{}) (map[string]interface{}, error) { - res, err := graphql.UnmarshalMap(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNMap2map(ctx context.Context, sel ast.SelectionSet, v map[string]interface{}) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - res := graphql.MarshalMap(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - } - return res -} - func (ec *executionContext) marshalNMetadata2k8sᚗioᚋapimachineryᚋpkgᚋapisᚋmetaᚋv1ᚐObjectMeta(ctx context.Context, sel ast.SelectionSet, v v13.ObjectMeta) graphql.Marshaler { return ec._Metadata(ctx, sel, &v) } @@ -50730,6 +53624,13 @@ func (ec *executionContext) marshalOExternalAppPaginatedRecords2ᚖgithubᚗcom return ec._ExternalAppPaginatedRecords(ctx, sel, v) } +func (ec *executionContext) marshalOGithub__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIAppsConsoleInternalEntitiesSecretCreatedFor(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIAppsConsoleInternalEntitiesSecretCreatedFor) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor(ctx, sel, v) +} + func (ec *executionContext) marshalOGithub__com___kloudlite___api___pkg___types__EncodedString2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteAPIPkgTypesEncodedString(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteAPIPkgTypesEncodedString) graphql.Marshaler { if v == nil { return graphql.Null @@ -51821,6 +54722,20 @@ func (ec *executionContext) marshalOImagePullSecretPaginatedRecords2ᚖgithubᚗ return ec._ImagePullSecretPaginatedRecords(ctx, sel, v) } +func (ec *executionContext) marshalOImportedManagedResource2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋentitiesᚐImportedManagedResource(ctx context.Context, sel ast.SelectionSet, v *entities.ImportedManagedResource) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ImportedManagedResource(ctx, sel, v) +} + +func (ec *executionContext) marshalOImportedManagedResourcePaginatedRecords2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐImportedManagedResourcePaginatedRecords(ctx context.Context, sel ast.SelectionSet, v *model.ImportedManagedResourcePaginatedRecords) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ImportedManagedResourcePaginatedRecords(ctx, sel, v) +} + func (ec *executionContext) unmarshalOInt2int32(ctx context.Context, v interface{}) (int32, error) { res, err := graphql.UnmarshalInt32(v) return res, graphql.ErrorOnPath(ctx, err) @@ -52276,6 +55191,14 @@ func (ec *executionContext) unmarshalOSearchImagePullSecrets2ᚖgithubᚗcomᚋk return &res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalOSearchImportedManagedResources2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐSearchImportedManagedResources(ctx context.Context, v interface{}) (*model.SearchImportedManagedResources, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputSearchImportedManagedResources(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) unmarshalOSearchManagedResources2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐSearchManagedResources(ctx context.Context, v interface{}) (*model.SearchManagedResources, error) { if v == nil { return nil, nil diff --git a/apps/console/internal/app/graph/importedmanagedresource.resolvers.go b/apps/console/internal/app/graph/importedmanagedresource.resolvers.go new file mode 100644 index 000000000..aacb9cee1 --- /dev/null +++ b/apps/console/internal/app/graph/importedmanagedresource.resolvers.go @@ -0,0 +1,70 @@ +package graph + +// This file will be automatically regenerated based on the schema, any resolver implementations +// will be copied through when generating and any unknown code will be moved to the end. +// Code generated by github.com/99designs/gqlgen version v0.17.45 + +import ( + "context" + "time" + + "github.com/kloudlite/api/apps/console/internal/app/graph/generated" + "github.com/kloudlite/api/apps/console/internal/app/graph/model" + "github.com/kloudlite/api/apps/console/internal/entities" + "github.com/kloudlite/api/pkg/repos" +) + +// CreationTime is the resolver for the creationTime field. +func (r *importedManagedResourceResolver) CreationTime(ctx context.Context, obj *entities.ImportedManagedResource) (string, error) { + if obj == nil { + return "", errNilManagedResource + } + return obj.CreationTime.Format(time.RFC3339), nil +} + +// ID is the resolver for the id field. +func (r *importedManagedResourceResolver) ID(ctx context.Context, obj *entities.ImportedManagedResource) (repos.ID, error) { + if obj == nil { + return "", errNilManagedResource + } + return obj.ID, nil +} + +// ManagedResourceRef is the resolver for the managedResourceRef field. +func (r *importedManagedResourceResolver) ManagedResourceRef(ctx context.Context, obj *entities.ImportedManagedResource) (*model.GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRef, error) { + if obj == nil { + return nil, errNilManagedResource + } + return &model.GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRef{ + ID: string(obj.ManagedResourceRef.ID), + Name: obj.ManagedResourceRef.Name, + Namespace: obj.ManagedResourceRef.Namespace, + }, nil +} + +// SecretRef is the resolver for the secretRef field. +func (r *importedManagedResourceResolver) SecretRef(ctx context.Context, obj *entities.ImportedManagedResource) (*model.GithubComKloudliteOperatorApisCommonTypesSecretRef, error) { + if obj == nil { + return nil, errNilImportedManagedResource + } + + return &model.GithubComKloudliteOperatorApisCommonTypesSecretRef{ + Name: obj.SecretRef.Name, + Namespace: &obj.SecretRef.Namespace, + }, nil +} + +// UpdateTime is the resolver for the updateTime field. +func (r *importedManagedResourceResolver) UpdateTime(ctx context.Context, obj *entities.ImportedManagedResource) (string, error) { + if obj == nil { + return "", errNilImportedManagedResource + } + return obj.BaseEntity.UpdateTime.Format(time.RFC3339), nil +} + +// ImportedManagedResource returns generated.ImportedManagedResourceResolver implementation. +func (r *Resolver) ImportedManagedResource() generated.ImportedManagedResourceResolver { + return &importedManagedResourceResolver{r} +} + +type importedManagedResourceResolver struct{ *Resolver } diff --git a/apps/console/internal/app/graph/model/models_gen.go b/apps/console/internal/app/graph/model/models_gen.go index dfe3d4164..3254fa262 100644 --- a/apps/console/internal/app/graph/model/models_gen.go +++ b/apps/console/internal/app/graph/model/models_gen.go @@ -9,6 +9,7 @@ import ( "github.com/kloudlite/api/apps/console/internal/entities" "github.com/kloudlite/api/pkg/repos" + "github.com/kloudlite/api/pkg/types" "github.com/kloudlite/operator/apis/crds/v1" ) @@ -90,6 +91,25 @@ type ExternalAppPaginatedRecords struct { TotalCount int `json:"totalCount"` } +type GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRef struct { + ID string `json:"id"` + Name string `json:"name"` + Namespace string `json:"namespace"` +} + +type GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRefIn struct { + ID string `json:"id"` + Name string `json:"name"` + Namespace string `json:"namespace"` +} + +type GithubComKloudliteAPIAppsConsoleInternalEntitiesSecretCreatedFor struct { + Name string `json:"name"` + Namespace string `json:"namespace"` + RefID string `json:"refId"` + ResourceType GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType `json:"resourceType"` +} + type GithubComKloudliteAPIPkgTypesEncodedString struct { Encoding string `json:"encoding"` Value string `json:"value"` @@ -111,6 +131,16 @@ type GithubComKloudliteOperatorApisCommonTypesMsvcRefIn struct { Namespace string `json:"namespace"` } +type GithubComKloudliteOperatorApisCommonTypesSecretRef struct { + Name string `json:"name"` + Namespace *string `json:"namespace,omitempty"` +} + +type GithubComKloudliteOperatorApisCommonTypesSecretRefIn struct { + Name string `json:"name"` + Namespace *string `json:"namespace,omitempty"` +} + type GithubComKloudliteOperatorApisCrdsV1AppContainer struct { Args []string `json:"args,omitempty"` Command []string `json:"command,omitempty"` @@ -396,14 +426,14 @@ type GithubComKloudliteOperatorApisCrdsV1MresResourceTemplate struct { APIVersion string `json:"apiVersion"` Kind string `json:"kind"` MsvcRef *GithubComKloudliteOperatorApisCommonTypesMsvcRef `json:"msvcRef"` - Spec map[string]interface{} `json:"spec"` + Spec map[string]interface{} `json:"spec,omitempty"` } type GithubComKloudliteOperatorApisCrdsV1MresResourceTemplateIn struct { APIVersion string `json:"apiVersion"` Kind string `json:"kind"` MsvcRef *GithubComKloudliteOperatorApisCommonTypesMsvcRefIn `json:"msvcRef"` - Spec map[string]interface{} `json:"spec"` + Spec map[string]interface{} `json:"spec,omitempty"` } type GithubComKloudliteOperatorApisCrdsV1Probe struct { @@ -610,6 +640,26 @@ type ImagePullSecretPaginatedRecords struct { TotalCount int `json:"totalCount"` } +type ImportedManagedResourceEdge struct { + Cursor string `json:"cursor"` + Node *entities.ImportedManagedResource `json:"node"` +} + +type ImportedManagedResourceIn struct { + DisplayName string `json:"displayName"` + EnvironmentName string `json:"environmentName"` + ManagedResourceRef *GithubComKloudliteAPIAppsConsoleInternalEntitiesManagedResourceRefIn `json:"managedResourceRef"` + Name string `json:"name"` + SecretRef *GithubComKloudliteOperatorApisCommonTypesSecretRefIn `json:"secretRef"` + SyncStatus *types.SyncStatus `json:"syncStatus"` +} + +type ImportedManagedResourcePaginatedRecords struct { + Edges []*ImportedManagedResourceEdge `json:"edges"` + PageInfo *PageInfo `json:"pageInfo"` + TotalCount int `json:"totalCount"` +} + type K8sIoAPICoreV1Toleration struct { Effect *K8sIoAPICoreV1TaintEffect `json:"effect,omitempty"` Key *string `json:"key,omitempty"` @@ -751,6 +801,12 @@ type SearchImagePullSecrets struct { MarkedForDeletion *repos.MatchFilter `json:"markedForDeletion,omitempty"` } +type SearchImportedManagedResources struct { + Text *repos.MatchFilter `json:"text,omitempty"` + IsReady *repos.MatchFilter `json:"isReady,omitempty"` + MarkedForDeletion *repos.MatchFilter `json:"markedForDeletion,omitempty"` +} + type SearchManagedResources struct { Text *repos.MatchFilter `json:"text,omitempty"` ManagedServiceName *repos.MatchFilter `json:"managedServiceName,omitempty"` @@ -847,6 +903,63 @@ func (e GithubComKloudliteAPIAppsConsoleInternalEntitiesPullSecretFormat) Marsha fmt.Fprint(w, strconv.Quote(e.String())) } +type GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType string + +const ( + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeApp GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType = "app" + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeConfig GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType = "config" + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeEnvironment GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType = "environment" + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeExternalApp GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType = "external_app" + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeImagePullSecret GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType = "image_pull_secret" + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeImportedManagedResource GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType = "imported_managed_resource" + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeManagedResource GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType = "managed_resource" + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeRouter GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType = "router" + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeSecret GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType = "secret" + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeVpnDevice GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType = "vpn_device" +) + +var AllGithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType = []GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType{ + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeApp, + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeConfig, + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeEnvironment, + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeExternalApp, + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeImagePullSecret, + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeImportedManagedResource, + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeManagedResource, + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeRouter, + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeSecret, + GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeVpnDevice, +} + +func (e GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType) IsValid() bool { + switch e { + case GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeApp, GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeConfig, GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeEnvironment, GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeExternalApp, GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeImagePullSecret, GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeImportedManagedResource, GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeManagedResource, GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeRouter, GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeSecret, GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceTypeVpnDevice: + return true + } + return false +} + +func (e GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType) String() string { + return string(e) +} + +func (e *GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid Github__com___kloudlite___api___apps___console___internal___entities__ResourceType", str) + } + return nil +} + +func (e GithubComKloudliteAPIAppsConsoleInternalEntitiesResourceType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + type GithubComKloudliteOperatorApisCrdsV1ConfigOrSecret string const ( diff --git a/apps/console/internal/app/graph/resolver-utils.go b/apps/console/internal/app/graph/resolver-utils.go index d1d533d77..44ebc606d 100644 --- a/apps/console/internal/app/graph/resolver-utils.go +++ b/apps/console/internal/app/graph/resolver-utils.go @@ -86,17 +86,18 @@ func toConsoleContext(ctx context.Context) (domain.ConsoleContext, error) { // } var ( - errNilApp = errors.Newf("app obj is nil") - errNilExternalApp = errors.Newf("external app obj is nil") - errNilConfig = errors.Newf("config obj is nil") - errNilSecret = errors.Newf("secret obj is nil") - errNilEnvironment = errors.Newf("environment obj is nil") - errNilVPNDevice = errors.Newf("vpn device obj is nil") - errNilImagePullSecret = errors.Newf("imagePullSecret obj is nil") - errNilManagedResource = errors.Newf("managed resource obj is nil") - errNilProject = errors.Newf("project obj is nil") - errNilProjectManagedService = errors.Newf("project manged svc obj is nil") - errNilRouter = errors.Newf("router obj is nil") + errNilApp = errors.Newf("app obj is nil") + errNilExternalApp = errors.Newf("external app obj is nil") + errNilConfig = errors.Newf("config obj is nil") + errNilSecret = errors.Newf("secret obj is nil") + errNilEnvironment = errors.Newf("environment obj is nil") + errNilVPNDevice = errors.Newf("vpn device obj is nil") + errNilImagePullSecret = errors.Newf("imagePullSecret obj is nil") + errNilManagedResource = errors.Newf("managed resource obj is nil") + errNilImportedManagedResource = errors.Newf("imported managed resource obj is nil") + errNilProject = errors.Newf("project obj is nil") + errNilProjectManagedService = errors.Newf("project manged svc obj is nil") + errNilRouter = errors.Newf("router obj is nil") ) func newResourceContext(ctx domain.ConsoleContext, environmentName string) domain.ResourceContext { diff --git a/apps/console/internal/app/graph/schema.graphqls b/apps/console/internal/app/graph/schema.graphqls index 078dd8eb7..e90567021 100644 --- a/apps/console/internal/app/graph/schema.graphqls +++ b/apps/console/internal/app/graph/schema.graphqls @@ -74,6 +74,12 @@ input SearchManagedResources { markedForDeletion: MatchFilterIn } +input SearchImportedManagedResources { + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn +} + input SearchProjectManagedService { text: MatchFilterIn managedServiceName: MatchFilterIn @@ -90,10 +96,6 @@ input CoreSearchVPNDevices { type Query { core_checkNameAvailability(envName: String, resType: ConsoleResType!, name: String!): ConsoleCheckNameAvailabilityOutput! @isLoggedIn @hasAccount - # core_listProjects(search: SearchProjects, pq: CursorPaginationIn): ProjectPaginatedRecords @isLoggedInAndVerified @hasAccount - # core_getProject(name: String!): Project @isLoggedInAndVerified @hasAccount - # core_resyncProject(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_listEnvironments(search: SearchEnvironments, pq: CursorPaginationIn): EnvironmentPaginatedRecords @isLoggedInAndVerified @hasAccount core_getEnvironment(name: String!): Environment @isLoggedInAndVerified @hasAccount core_resyncEnvironment(name: String!): Boolean! @isLoggedInAndVerified @hasAccount @@ -128,16 +130,11 @@ type Query { core_getManagedResouceOutputKeys(msvcName: String, envName:String , name: String!): [String!]! @isLoggedInAndVerified @hasAccount core_getManagedResouceOutputKeyValues(msvcName: String, envName:String, keyrefs: [ManagedResourceKeyRefIn]): [ManagedResourceKeyValueRef!]! @isLoggedInAndVerified @hasAccount + core_listManagedResources(search: SearchManagedResources, pq: CursorPaginationIn): ManagedResourcePaginatedRecords @isLoggedInAndVerified @hasAccount core_getManagedResource(msvcName: String, envName: String, name: String!): ManagedResource @isLoggedInAndVerified @hasAccount core_resyncManagedResource(msvcName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount - # core_listImportedManagedResources(envName: String! ,search: SearchManagedResources, pq: CursorPaginationIn): ManagedResourcePaginatedRecords @isLoggedInAndVerified @hasAccount - # core_getImportedManagedResource(envName: String!, name: String!): ManagedResource @isLoggedInAndVerified @hasAccount - - # core_listProjectManagedServices(search: SearchProjectManagedService, pq: CursorPaginationIn): ProjectManagedServicePaginatedRecords @isLoggedInAndVerified @hasAccount - # core_getProjectManagedService( name: String!): ProjectManagedService @isLoggedInAndVerified @hasAccount - # core_resyncProjectManagedService(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - # core_restartProjectManagedService(name: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_listImportedManagedResources(envName: String!, search: SearchImportedManagedResources, pq: CursorPaginationIn): ImportedManagedResourcePaginatedRecords @isLoggedInAndVerified @hasAccount core_listVPNDevices(search: CoreSearchVPNDevices, pq: CursorPaginationIn): ConsoleVPNDevicePaginatedRecords @isLoggedInAndVerified @hasAccount core_listVPNDevicesForUser: [ConsoleVPNDevice!] @isLoggedInAndVerified @hasAccount @@ -145,10 +142,6 @@ type Query { } type Mutation { - # core_createProject(project: ProjectIn!): Project @isLoggedInAndVerified @hasAccount - # core_updateProject(project: ProjectIn!): Project @isLoggedInAndVerified @hasAccount - # core_deleteProject(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_createEnvironment(env: EnvironmentIn!): Environment @isLoggedInAndVerified @hasAccount core_updateEnvironment(env: EnvironmentIn!): Environment @isLoggedInAndVerified @hasAccount core_deleteEnvironment(envName: String!): Boolean! @isLoggedInAndVerified @hasAccount @@ -184,12 +177,9 @@ type Mutation { core_createManagedResource(msvcName: String! ,mres: ManagedResourceIn!): ManagedResource @isLoggedInAndVerified @hasAccount core_updateManagedResource(msvcName: String!, mres: ManagedResourceIn!): ManagedResource @isLoggedInAndVerified @hasAccount core_deleteManagedResource(msvcName: String!, mresName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_importManagedResource(envName: String!, msvcName: String! ,mresName: String!): ManagedResource @isLoggedInAndVerified @hasAccount - core_deleteImportedManagedResource(envName: String!, mresName: String!): Boolean! @isLoggedInAndVerified @hasAccount - # core_createProjectManagedService(pmsvc: ProjectManagedServiceIn!): ProjectManagedService @isLoggedInAndVerified @hasAccount - # core_updateProjectManagedService(pmsvc: ProjectManagedServiceIn!): ProjectManagedService @isLoggedInAndVerified @hasAccount - # core_deleteProjectManagedService(pmsvcName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_importManagedResource(envName: String!, msvcName: String!, mresName: String!, importName: String!): ImportedManagedResource @isLoggedInAndVerified @hasAccount + core_deleteImportedManagedResource(envName: String!, importName: String!): Boolean! @isLoggedInAndVerified @hasAccount core_createVPNDevice(vpnDevice: ConsoleVPNDeviceIn!): ConsoleVPNDevice @isLoggedInAndVerified @hasAccount core_updateVPNDevice(vpnDevice: ConsoleVPNDeviceIn!): ConsoleVPNDevice @isLoggedInAndVerified @hasAccount @@ -209,3 +199,7 @@ type Build @key(fields: "id") { extend type App { build: Build } + +extend type ImportedManagedResource { + managedResource: ManagedResource +} diff --git a/apps/console/internal/app/graph/schema.resolvers.go b/apps/console/internal/app/graph/schema.resolvers.go index ad693cbda..3ff30bfde 100644 --- a/apps/console/internal/app/graph/schema.resolvers.go +++ b/apps/console/internal/app/graph/schema.resolvers.go @@ -28,6 +28,15 @@ func (r *appResolver) Build(ctx context.Context, obj *entities.App) (*model.Buil return &model.Build{ID: *obj.CIBuildId}, nil } +// ManagedResource is the resolver for the ManagedResource field. +func (r *importedManagedResourceResolver) ManagedResource(ctx context.Context, obj *entities.ImportedManagedResource) (*entities.ManagedResource, error) { + cc, err := toConsoleContext(ctx) + if err != nil { + return nil, errors.NewE(err) + } + return r.Domain.GetManagedResourceByID(cc, obj.ManagedResourceRef.ID) +} + // CoreCreateEnvironment is the resolver for the core_createEnvironment field. func (r *mutationResolver) CoreCreateEnvironment(ctx context.Context, env entities.Environment) (*entities.Environment, error) { cc, err := toConsoleContext(ctx) @@ -321,22 +330,22 @@ func (r *mutationResolver) CoreDeleteManagedResource(ctx context.Context, msvcNa } // CoreImportManagedResource is the resolver for the core_importManagedResource field. -func (r *mutationResolver) CoreImportManagedResource(ctx context.Context, envName string, msvcName string, mresName string) (*entities.ManagedResource, error) { +func (r *mutationResolver) CoreImportManagedResource(ctx context.Context, envName string, msvcName string, mresName string, importName string) (*entities.ImportedManagedResource, error) { cc, err := toConsoleContext(ctx) if err != nil { return nil, errors.NewE(err) } - return r.Domain.ImportManagedResource(newMresContext(cc, &msvcName, &envName), mresName) + return r.Domain.ImportManagedResource(newMresContext(cc, &msvcName, &envName), mresName, importName) } // CoreDeleteImportedManagedResource is the resolver for the core_deleteImportedManagedResource field. -func (r *mutationResolver) CoreDeleteImportedManagedResource(ctx context.Context, envName string, mresName string) (bool, error) { +func (r *mutationResolver) CoreDeleteImportedManagedResource(ctx context.Context, envName string, importName string) (bool, error) { cc, err := toConsoleContext(ctx) if err != nil { return false, errors.NewE(err) } - if err := r.Domain.DeleteImportedManagedResource(newResourceContext(cc, envName), mresName); err != nil { + if err := r.Domain.DeleteImportedManagedResource(newResourceContext(cc, envName), importName); err != nil { return false, errors.NewE(err) } return true, nil @@ -837,6 +846,10 @@ func (r *queryResolver) CoreGetManagedResouceOutputKeys(ctx context.Context, msv return nil, errors.New("must specify either msvcName or envName") } + if envName != nil { + return r.Domain.GetImportedManagedResourceOutputKeys(newResourceContext(cc, *envName), name) + } + return r.Domain.GetManagedResourceOutputKeys(newMresContext(cc, msvcName, envName), name) } @@ -856,6 +869,10 @@ func (r *queryResolver) CoreGetManagedResouceOutputKeyValues(ctx context.Context return nil, errors.New("must specify either msvcName or envName") } + if envName != nil { + return r.Domain.GetImportedManagedResourceOutputKVs(newResourceContext(cc, *envName), m) + } + return r.Domain.GetManagedResourceOutputKVs(newMresContext(cc, msvcName, envName), m) } @@ -871,36 +888,37 @@ func (r *queryResolver) CoreListManagedResources(ctx context.Context, search *mo return nil, errors.New("must specify search") } - if search != nil { - if search.Text != nil { - filter["metadata.name"] = *search.Text - filter[fc.MetadataName] = *search.Text - } - if search.IsReady != nil { - filter["status.isReady"] = *search.IsReady - } - if search.MarkedForDeletion != nil { - filter["markedForDeletion"] = *search.MarkedForDeletion - } - - if search.ManagedServiceName != nil { - filter[fc.ManagedResourceManagedServiceName] = *search.ManagedServiceName - } + if search.Text != nil { + filter["metadata.name"] = *search.Text + filter[fc.MetadataName] = *search.Text + } + if search.IsReady != nil { + filter["status.isReady"] = *search.IsReady + } + if search.MarkedForDeletion != nil { + filter["markedForDeletion"] = *search.MarkedForDeletion + } - if search.EnvName != nil { - filter["environmentName"] = *search.EnvName - } + if search.ManagedServiceName != nil { + filter[fc.ManagedResourceManagedServiceName] = *search.ManagedServiceName + } - filter[fc.ManagedResourceIsImported] = repos.MatchFilter{ - MatchType: repos.MatchTypeExact, - Exact: search.EnvName != nil, - } + if search.EnvName != nil { + filter["environmentName"] = *search.EnvName } if search.EnvName == nil && search.ManagedServiceName == nil { return nil, errors.New("either envName or managedServiceName must be specified") } + if search.EnvName != nil { + pr, err := r.Domain.ListImportedManagedResources(cc, search.EnvName.Exact.(string), filter, fn.DefaultIfNil(pq, repos.DefaultCursorPagination)) + if err != nil { + return nil, errors.NewE(err) + } + return fn.JsonConvertP[model.ManagedResourcePaginatedRecords](pr) + } + pmsvcs, err := r.Domain.ListManagedResources(cc, filter, fn.DefaultIfNil(pq, repos.DefaultCursorPagination)) if err != nil { return nil, errors.NewE(err) @@ -930,6 +948,35 @@ func (r *queryResolver) CoreResyncManagedResource(ctx context.Context, msvcName return true, nil } +// CoreListImportedManagedResources is the resolver for the core_listImportedManagedResources field. +func (r *queryResolver) CoreListImportedManagedResources(ctx context.Context, envName string, search *model.SearchImportedManagedResources, pq *repos.CursorPagination) (*model.ImportedManagedResourcePaginatedRecords, error) { + cc, err := toConsoleContext(ctx) + if err != nil { + return nil, errors.NewE(err) + } + filter := map[string]repos.MatchFilter{} + + if search != nil { + if search.Text != nil { + filter[fc.ImportedManagedResourceName] = *search.Text + } + + if search.IsReady != nil { + filter["status.isReady"] = *search.IsReady + } + + if search.MarkedForDeletion != nil { + filter[fc.MarkedForDeletion] = *search.MarkedForDeletion + } + } + + pr, err := r.Domain.ListImportedManagedResources(cc, envName, filter, fn.DefaultIfNil(pq, repos.DefaultCursorPagination)) + if err != nil { + return nil, errors.NewE(err) + } + return fn.JsonConvertP[model.ImportedManagedResourcePaginatedRecords](pr) +} + // CoreListVPNDevices is the resolver for the core_listVPNDevices field. func (r *queryResolver) CoreListVPNDevices(ctx context.Context, search *model.CoreSearchVPNDevices, pq *repos.CursorPagination) (*model.ConsoleVPNDevicePaginatedRecords, error) { filter := map[string]repos.MatchFilter{} diff --git a/apps/console/internal/app/graph/secret.resolvers.go b/apps/console/internal/app/graph/secret.resolvers.go index c7969555a..ff6ad460f 100644 --- a/apps/console/internal/app/graph/secret.resolvers.go +++ b/apps/console/internal/app/graph/secret.resolvers.go @@ -6,6 +6,7 @@ package graph import ( "context" + "fmt" "github.com/kloudlite/api/pkg/errors" "time" @@ -37,6 +38,11 @@ func (r *secretResolver) Data(ctx context.Context, obj *entities.Secret) (map[st return m, nil } +// For is the resolver for the for field. +func (r *secretResolver) For(ctx context.Context, obj *entities.Secret) (*model.GithubComKloudliteAPIAppsConsoleInternalEntitiesSecretCreatedFor, error) { + panic(fmt.Errorf("not implemented: For - for")) +} + // IsReadyOnly is the resolver for the isReadyOnly field. func (r *secretResolver) IsReadyOnly(ctx context.Context, obj *entities.Secret) (bool, error) { if obj == nil { diff --git a/apps/console/internal/app/graph/struct-to-graphql/common-types.graphqls b/apps/console/internal/app/graph/struct-to-graphql/common-types.graphqls index 72dd19b71..28f805cbb 100644 --- a/apps/console/internal/app/graph/struct-to-graphql/common-types.graphqls +++ b/apps/console/internal/app/graph/struct-to-graphql/common-types.graphqls @@ -1,3 +1,16 @@ +type Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef @shareable { + id: String! + name: String! + namespace: String! +} + +type Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor @shareable { + name: String! + namespace: String! + refId: String! + resourceType: Github__com___kloudlite___api___apps___console___internal___entities__ResourceType! +} + type Github__com___kloudlite___api___common__CreatedOrUpdatedBy @shareable { userEmail: String! userId: String! @@ -26,6 +39,11 @@ type Github__com___kloudlite___operator___apis___common____types__MsvcRef @share namespace: String! } +type Github__com___kloudlite___operator___apis___common____types__SecretRef @shareable { + name: String! + namespace: String +} + type Github__com___kloudlite___operator___apis___crds___v1__AppContainer @shareable { args: [String!] command: [String!] @@ -174,7 +192,7 @@ type Github__com___kloudlite___operator___apis___crds___v1__MresResourceTemplate apiVersion: String! kind: String! msvcRef: Github__com___kloudlite___operator___apis___common____types__MsvcRef! - spec: Map! + spec: Map } type Github__com___kloudlite___operator___apis___crds___v1__Probe @shareable { @@ -337,6 +355,21 @@ type PageInfo @shareable { startCursor: String } +input Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRefIn { + id: String! + name: String! + namespace: String! +} + +input Github__com___kloudlite___api___pkg___types__SyncStatusIn { + action: Github__com___kloudlite___api___pkg___types__SyncAction! + error: String + lastSyncedAt: Date + recordVersion: Int! + state: Github__com___kloudlite___api___pkg___types__SyncState! + syncScheduledAt: Date +} + input Github__com___kloudlite___operator___apis___common____types__MsvcRefIn { apiVersion: String clusterName: String @@ -345,6 +378,11 @@ input Github__com___kloudlite___operator___apis___common____types__MsvcRefIn { namespace: String! } +input Github__com___kloudlite___operator___apis___common____types__SecretRefIn { + name: String! + namespace: String +} + input Github__com___kloudlite___operator___apis___crds___v1__AppContainerIn { args: [String!] command: [String!] @@ -491,7 +529,7 @@ input Github__com___kloudlite___operator___apis___crds___v1__MresResourceTemplat apiVersion: String! kind: String! msvcRef: Github__com___kloudlite___operator___apis___common____types__MsvcRefIn! - spec: Map! + spec: Map } input Github__com___kloudlite___operator___apis___crds___v1__ProbeIn { @@ -636,6 +674,19 @@ enum Github__com___kloudlite___api___apps___console___internal___entities__PullS params } +enum Github__com___kloudlite___api___apps___console___internal___entities__ResourceType { + app + config + environment + external_app + image_pull_secret + imported_managed_resource + managed_resource + router + secret + vpn_device +} + enum Github__com___kloudlite___api___pkg___repos__MatchType { array exact diff --git a/apps/console/internal/app/graph/struct-to-graphql/importedmanagedresource.graphqls b/apps/console/internal/app/graph/struct-to-graphql/importedmanagedresource.graphqls new file mode 100644 index 000000000..bf1936c74 --- /dev/null +++ b/apps/console/internal/app/graph/struct-to-graphql/importedmanagedresource.graphqls @@ -0,0 +1,37 @@ +type ImportedManagedResource @shareable { + accountName: String! + createdBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! + creationTime: Date! + displayName: String! + environmentName: String! + id: ID! + lastUpdatedBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! + managedResourceRef: Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRef! + markedForDeletion: Boolean + name: String! + recordVersion: Int! + secretRef: Github__com___kloudlite___operator___apis___common____types__SecretRef! + syncStatus: Github__com___kloudlite___api___pkg___types__SyncStatus! + updateTime: Date! +} + +type ImportedManagedResourceEdge @shareable { + cursor: String! + node: ImportedManagedResource! +} + +type ImportedManagedResourcePaginatedRecords @shareable { + edges: [ImportedManagedResourceEdge!]! + pageInfo: PageInfo! + totalCount: Int! +} + +input ImportedManagedResourceIn { + displayName: String! + environmentName: String! + managedResourceRef: Github__com___kloudlite___api___apps___console___internal___entities__ManagedResourceRefIn! + name: String! + secretRef: Github__com___kloudlite___operator___apis___common____types__SecretRefIn! + syncStatus: Github__com___kloudlite___api___pkg___types__SyncStatusIn! +} + diff --git a/apps/console/internal/app/graph/struct-to-graphql/secret.graphqls b/apps/console/internal/app/graph/struct-to-graphql/secret.graphqls index d44905e92..004e4ebc3 100644 --- a/apps/console/internal/app/graph/struct-to-graphql/secret.graphqls +++ b/apps/console/internal/app/graph/struct-to-graphql/secret.graphqls @@ -6,6 +6,7 @@ type Secret @shareable { data: Map displayName: String! environmentName: String! + for: Github__com___kloudlite___api___apps___console___internal___entities__SecretCreatedFor id: ID! immutable: Boolean isReadyOnly: Boolean! diff --git a/apps/console/internal/app/grpc-server.go b/apps/console/internal/app/grpc-server.go index da0a18c94..d0caa937f 100644 --- a/apps/console/internal/app/grpc-server.go +++ b/apps/console/internal/app/grpc-server.go @@ -2,10 +2,21 @@ package app import ( "context" + "encoding/json" + "fmt" + "github.com/kloudlite/api/apps/console/internal/domain" + "github.com/kloudlite/api/apps/console/internal/entities" + "github.com/kloudlite/api/common" "github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/console" "github.com/kloudlite/api/pkg/k8s" "github.com/kloudlite/api/pkg/repos" + common_types "github.com/kloudlite/operator/apis/common-types" + crdsv1 "github.com/kloudlite/operator/apis/crds/v1" + operator "github.com/kloudlite/operator/pkg/operator" + corev1 "k8s.io/api/core/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) type grpcServer struct { @@ -31,6 +42,78 @@ func (g *grpcServer) ArchiveEnvironmentsForCluster(ctx context.Context, in *cons return &console.ArchiveEnvironmentsForClusterOut{Archived: archiveStatus}, nil } +// CreateManagedResource implements console.ConsoleServer. +func (g *grpcServer) CreateManagedResource(ctx context.Context, in *console.CreateManagedResourceIn) (*console.CreateManagedResourceOut, error) { + consoleCtx := domain.ConsoleContext{ + Context: ctx, + UserId: repos.ID(in.UserId), + UserName: in.UserName, + UserEmail: in.UserEmail, + AccountName: in.AccountName, + } + + // domain.ManagedResourceContext{ + // ConsoleContext: ctx, + // ManagedServiceName: new(string), + // EnvironmentName: new(string), + // } + + var outputSecret corev1.Secret + if err := json.Unmarshal(in.OutputSecret, &outputSecret); err != nil { + return nil, err + } + + createdBy := common.CreatedOrUpdatedBy{ + UserId: repos.ID(in.UserId), + UserName: in.UserName, + UserEmail: in.UserEmail, + } + + _, err := g.d.CreateRootManagedResource(consoleCtx, in.AccountNamespace, &entities.ManagedResource{ + ManagedResource: crdsv1.ManagedResource{ + ObjectMeta: metav1.ObjectMeta{ + Name: in.MresName, + Namespace: in.MsvcTargetNamespace, + }, + Spec: crdsv1.ManagedResourceSpec{ + ResourceTemplate: crdsv1.MresResourceTemplate{ + TypeMeta: metav1.TypeMeta{ + Kind: "RootCredentials", + APIVersion: in.MsvcApiVersion, + }, + MsvcRef: common_types.MsvcRef{ + Name: in.MsvcName, + Namespace: "", + }, + Spec: map[string]apiextensionsv1.JSON{}, + }, + }, + Status: operator.Status{ + IsReady: true, + }, + Output: common_types.ManagedResourceOutput{ + CredentialsRef: common_types.LocalObjectReference{ + Name: outputSecret.Name, + }, + }, + }, + AccountName: in.AccountName, + ManagedServiceName: in.MsvcName, + ClusterName: in.ClusterName, + SyncedOutputSecretRef: &outputSecret, + ResourceMetadata: common.ResourceMetadata{ + DisplayName: fmt.Sprintf("%s/%s", in.MsvcName, in.MresName), + CreatedBy: createdBy, + LastUpdatedBy: createdBy, + }, + // SyncStatus: types.SyncStatus{}, + }) + if err != nil { + return nil, err + } + return &console.CreateManagedResourceOut{Ok: true}, nil +} + func newConsoleGrpcServer(d domain.Domain, kcli k8s.Client) console.ConsoleServer { return &grpcServer{ d: d, diff --git a/apps/console/internal/app/process-error-on-apply.go b/apps/console/internal/app/process-error-on-apply.go index 3ddacc234..4bb931fc5 100644 --- a/apps/console/internal/app/process-error-on-apply.go +++ b/apps/console/internal/app/process-error-on-apply.go @@ -52,6 +52,7 @@ func ProcessErrorOnApply(consumer ErrorOnApplyConsumer, d domain.Domain, logger mLogger := logger.WithKV( "gvk", obj.GroupVersionKind(), + "nn", fmt.Sprintf("%s/%s", obj.GetNamespace(), obj.GetName()), "accountName", em.AccountName, "clusterName", em.ClusterName, ) @@ -81,19 +82,6 @@ func ProcessErrorOnApply(consumer ErrorOnApplyConsumer, d domain.Domain, logger return d.OnVPNDeviceDeleteMessage(dctx, p) } - //case projectGVK.String(): - // { - // if errObj.Action == t.ActionApply { - // return d.OnProjectApplyError(dctx, errObj.Error, obj.GetName(), opts) - // } - // - // p, err := fn.JsonConvert[entities.Project](obj.Object) - // if err != nil { - // return err - // } - // - // return d.OnProjectDeleteMessage(dctx, p) - // } case environmentGVK.String(): { @@ -108,28 +96,6 @@ func ProcessErrorOnApply(consumer ErrorOnApplyConsumer, d domain.Domain, logger return d.OnEnvironmentDeleteMessage(dctx, p) } - //case projectManagedServiceGVK.String(): - // { - // mapping, err := d.GetProjectResourceMapping(dctx, entities.ResourceTypeProjectManagedService, em.ClusterName, obj.GetNamespace(), obj.GetName()) - // if err != nil { - // return err - // } - // if mapping == nil { - // return err - // } - // - // if errObj.Action == t.ActionApply { - // return d.OnProjectManagedServiceApplyError(dctx, mapping.ProjectName, obj.GetName(), errObj.Error, opts) - // } - // - // pmsvc, err := fn.JsonConvert[entities.ProjectManagedService](obj.Object) - // if err != nil { - // return err - // } - // - // return d.OnProjectManagedServiceDeleteMessage(dctx, mapping.ProjectName, pmsvc) - // } - case appsGVK.String(): { rctx, err := getEnvironmentResourceContext(dctx, entities.ResourceTypeApp, em.ClusterName, obj) @@ -219,11 +185,6 @@ func ProcessErrorOnApply(consumer ErrorOnApplyConsumer, d domain.Domain, logger } case managedResourceGVK.String(): { - //rctx, err := getEnvironmentResourceContext(dctx, entities.ResourceTypeManagedResource, em.ClusterName, obj) - //if err != nil { - // return errors.NewE(err) - //} - mres, err := fn.JsonConvert[entities.ManagedResource](obj.Object) if err != nil { return err diff --git a/apps/console/internal/app/process-resource-updates.go b/apps/console/internal/app/process-resource-updates.go index 741bc27f6..cb39f3959 100644 --- a/apps/console/internal/app/process-resource-updates.go +++ b/apps/console/internal/app/process-resource-updates.go @@ -265,17 +265,6 @@ func ProcessResourceUpdates(consumer ResourceUpdateConsumer, d domain.Domain, lo return errors.NewE(err) } - if secret.Type == corev1.SecretTypeDockerConfigJson { - // secret is an image pull secret - ips := entities.ImagePullSecret{ - ObjectMeta: secret.ObjectMeta, - } - if resStatus == types.ResourceStatusDeleted { - return d.OnImagePullSecretDeleteMessage(dctx, ips) - } - return d.OnImagePullSecretUpdateMessage(dctx, ips, resStatus, opts) - } - rctx, err := getResourceContext(dctx, entities.ResourceTypeSecret, ru.ClusterName, obj) if err != nil { return errors.NewE(err) @@ -285,6 +274,15 @@ func ProcessResourceUpdates(consumer ResourceUpdateConsumer, d domain.Domain, lo return d.OnSecretDeleteMessage(rctx, secret) } return d.OnSecretUpdateMessage(rctx, secret, resStatus, opts) + // { + // ips := entities.ImagePullSecret{ + // ObjectMeta: secret.ObjectMeta, + // } + // if resStatus == types.ResourceStatusDeleted { + // return d.OnImagePullSecretDeleteMessage(dctx, ips) + // } + // return d.OnImagePullSecretUpdateMessage(dctx, ips, resStatus, opts) + // } } case routerGVK.String(): diff --git a/apps/console/internal/domain/api.go b/apps/console/internal/domain/api.go index 942eefe67..cc23a84d9 100644 --- a/apps/console/internal/domain/api.go +++ b/apps/console/internal/domain/api.go @@ -14,7 +14,6 @@ import ( "github.com/kloudlite/operator/operators/resource-watcher/types" "github.com/kloudlite/api/apps/console/internal/entities" - "github.com/kloudlite/api/pkg/errors" "github.com/kloudlite/api/pkg/repos" ) @@ -55,21 +54,10 @@ type ManagedResourceContext struct { } func (m ManagedResourceContext) MresDBFilters() (*repos.Filter, error) { - if m.EnvironmentName != nil { - return &repos.Filter{ - fields.AccountName: m.AccountName, - fields.EnvironmentName: m.EnvironmentName, - }, nil - } - - if m.ManagedServiceName != nil { - return &repos.Filter{ - fields.AccountName: m.AccountName, - fc.ManagedResourceManagedServiceName: m.ManagedServiceName, - }, nil - } - - return nil, errors.New("environment or managed service name is required") + return &repos.Filter{ + fields.AccountName: m.AccountName, + fc.ManagedResourceManagedServiceName: m.ManagedServiceName, + }, nil } func (r ResourceContext) DBFilters() repos.Filter { @@ -236,19 +224,32 @@ type Domain interface { ListManagedResources(ctx ConsoleContext, search map[string]repos.MatchFilter, pq repos.CursorPagination) (*repos.PaginatedRecord[*entities.ManagedResource], error) GetManagedResource(ctx ManagedResourceContext, name string) (*entities.ManagedResource, error) + GetManagedResourceByID(ctx ConsoleContext, id repos.ID) (*entities.ManagedResource, error) // ListImportedManagedResources(ctx ResourceContext, search map[string]repos.MatchFilter, pq repos.CursorPagination) (*repos.PaginatedRecord[*entities.ManagedResource], error) // GetImportedManagedResource(ctx ResourceContext, name string) (*entities.ManagedResource, error) GetManagedResourceOutputKeys(ctx ManagedResourceContext, name string) ([]string, error) + GetImportedManagedResourceOutputKeys(ctx ResourceContext, name string) ([]string, error) GetManagedResourceOutputKVs(ctx ManagedResourceContext, keyrefs []ManagedResourceKeyRef) ([]*ManagedResourceKeyValueRef, error) + GetImportedManagedResourceOutputKVs(ctx ResourceContext, keyrefs []ManagedResourceKeyRef) ([]*ManagedResourceKeyValueRef, error) + CreateRootManagedResource(ctx ConsoleContext, accountNamespace string, mres *entities.ManagedResource) (*entities.ManagedResource, error) CreateManagedResource(ctx ManagedResourceContext, mres entities.ManagedResource) (*entities.ManagedResource, error) UpdateManagedResource(ctx ManagedResourceContext, mres entities.ManagedResource) (*entities.ManagedResource, error) DeleteManagedResource(ctx ManagedResourceContext, name string) error - ImportManagedResource(ctx ManagedResourceContext, mresName string) (*entities.ManagedResource, error) - DeleteImportedManagedResource(ctx ResourceContext, mresName string) error + // ImportManagedResource(ctx ManagedResourceContext, mresName string, importName string) (*entities.ManagedResource, error) + ImportManagedResource(ctx ManagedResourceContext, mresName string, importName string) (*entities.ImportedManagedResource, error) + // ListImportedManagedResources(ctx ConsoleContext, search map[string]repos.MatchFilter, pq repos.CursorPagination) (*repos.PaginatedRecord[*entities.ManagedResource], error) + ListImportedManagedResources(ctx ConsoleContext, envName string, search map[string]repos.MatchFilter, pq repos.CursorPagination) (*repos.PaginatedRecord[*entities.ImportedManagedResource], error) + DeleteImportedManagedResource(ctx ResourceContext, importName string) error + + // ImportManagedResource(ctx ConsoleContext, imr entities.ImportedManagedResource) (*entities.ImportedManagedResource, error) + // DeleteImportedManagedResource(ctx ConsoleContext, name string) error + + // OnImportedManagedResourceDeleteMessage(ctx ConsoleContext, secret *corev1.Secret) error + // OnImportedManagedResourceUpdateMessage(ctx ConsoleContext, secret *corev1.Secret, status types.ResourceStatus, opts UpdateAndDeleteOpts) error OnManagedResourceApplyError(ctx ConsoleContext, errMsg string, msvcName string, name string, opts UpdateAndDeleteOpts) error OnManagedResourceDeleteMessage(ctx ConsoleContext, msvcName string, mres entities.ManagedResource) error @@ -330,4 +331,5 @@ type ResourceEventPublisher interface { PublishConsoleEvent(ctx ConsoleContext, resourceType entities.ResourceType, name string, update PublishMsg) PublishEnvironmentResourceEvent(ctx ConsoleContext, envName string, resourceType entities.ResourceType, name string, update PublishMsg) PublishResourceEvent(ctx ResourceContext, resourceType entities.ResourceType, name string, update PublishMsg) + PublishClusterManagedServiceEvent(ctx ConsoleContext, msvcName string, resourceType entities.ResourceType, name string, update PublishMsg) } diff --git a/apps/console/internal/domain/domain.go b/apps/console/internal/domain/domain.go index e861b92f1..77af9171f 100644 --- a/apps/console/internal/domain/domain.go +++ b/apps/console/internal/domain/domain.go @@ -55,6 +55,7 @@ type domain struct { secretRepo repos.DbRepo[*entities.Secret] routerRepo repos.DbRepo[*entities.Router] mresRepo repos.DbRepo[*entities.ManagedResource] + importedMresRepo repos.DbRepo[*entities.ImportedManagedResource] pullSecretsRepo repos.DbRepo[*entities.ImagePullSecret] envVars *env.Env @@ -182,6 +183,54 @@ func (d *domain) applyK8sResource(ctx K8sContext, envName string, obj client.Obj return errors.NewE(err) } +type ApplyK8sResourceArgs struct { + ClusterName string + Object client.Object + RecordVersion int + + Dispatcher MessageDispatcher +} + +func applyK8sResource(ctx K8sContext, args ApplyK8sResourceArgs) error { + if args.ClusterName == "" { + // d.logger.Infof("skipping apply of k8s resource %s/%s, cluster name not provided", args.Object.GetNamespace(), args.Object.GetName()) + return nil + } + + if args.Object.GetObjectKind().GroupVersionKind().Empty() { + return errors.Newf("args.Objectect GVK is not set, can not apply") + } + + ann := args.Object.GetAnnotations() + if ann == nil { + ann = make(map[string]string, 1) + } + ann[constants.RecordVersionKey] = fmt.Sprintf("%d", args.RecordVersion) + args.Object.SetAnnotations(ann) + + m, err := fn.K8sObjToMap(args.Object) + if err != nil { + return errors.NewE(err) + } + b, err := json.Marshal(t.AgentMessage{ + AccountName: ctx.GetAccountName(), + ClusterName: args.ClusterName, + Action: t.ActionApply, + Object: m, + }) + if err != nil { + return errors.NewE(err) + } + + subject := common.GetTenantClusterMessagingTopic(ctx.GetAccountName(), args.ClusterName) + + err = args.Dispatcher.Produce(ctx, msgTypes.ProduceMsg{ + Subject: subject, + Payload: b, + }) + return errors.NewE(err) +} + func (d *domain) restartK8sResource(ctx K8sContext, projectName string, namespace string, labels map[string]string) error { clusterName, err := d.getClusterAttachedToEnvironment(ctx, projectName) if err != nil { @@ -250,7 +299,7 @@ func (d *domain) deleteK8sResourceOfCluster(ctx K8sContext, clusterName string, func (d *domain) deleteK8sResource(ctx K8sContext, environmentName string, obj client.Object) error { clusterName, err := d.getClusterAttachedToEnvironment(ctx, environmentName) if err != nil { - return errors.NewE(err) + return ErrNoClusterAttached } if clusterName == nil || *clusterName == "" { @@ -509,6 +558,7 @@ var Module = fx.Module("domain", secretRepo repos.DbRepo[*entities.Secret], routerRepo repos.DbRepo[*entities.Router], mresRepo repos.DbRepo[*entities.ManagedResource], + importedMresRepo repos.DbRepo[*entities.ImportedManagedResource], ipsRepo repos.DbRepo[*entities.ImagePullSecret], resourceMappingRepo repos.DbRepo[*entities.ResourceMapping], vpnDeviceRepo repos.DbRepo[*entities.ConsoleVPNDevice], @@ -536,6 +586,7 @@ var Module = fx.Module("domain", routerRepo: routerRepo, secretRepo: secretRepo, mresRepo: mresRepo, + importedMresRepo: importedMresRepo, pullSecretsRepo: ipsRepo, resourceMappingRepo: resourceMappingRepo, vpnDeviceRepo: vpnDeviceRepo, diff --git a/apps/console/internal/domain/environment.go b/apps/console/internal/domain/environment.go index 08f149e16..b7837af37 100644 --- a/apps/console/internal/domain/environment.go +++ b/apps/console/internal/domain/environment.go @@ -145,7 +145,7 @@ func (d *domain) CreateEnvironment(ctx ConsoleContext, env entities.Environment) return nil, errors.NewE(err) } - d.resourceEventPublisher.PublishEnvironmentResourceEvent(ctx, nenv.Name, entities.ResourceTypeEnvironment, nenv.Name, PublishAdd) + d.resourceEventPublisher.PublishConsoleEvent(ctx, entities.ResourceTypeEnvironment, nenv.Name, PublishAdd) if _, err := d.iamClient.AddMembership(ctx, &iam.AddMembershipIn{ UserId: string(ctx.UserId), @@ -493,7 +493,7 @@ func (d *domain) UpdateEnvironment(ctx ConsoleContext, env entities.Environment) if err != nil { return nil, errors.NewE(err) } - d.resourceEventPublisher.PublishEnvironmentResourceEvent(ctx, upEnv.Name, entities.ResourceTypeEnvironment, upEnv.Name, PublishUpdate) + d.resourceEventPublisher.PublishConsoleEvent(ctx, entities.ResourceTypeEnvironment, upEnv.Name, PublishUpdate) if err := d.applyK8sResource(ctx, upEnv.Name, &upEnv.Environment, upEnv.RecordVersion); err != nil { return nil, errors.NewE(err) @@ -512,7 +512,7 @@ func (d *domain) DeleteEnvironment(ctx ConsoleContext, name string) error { return errors.NewE(err) } - d.resourceEventPublisher.PublishEnvironmentResourceEvent(ctx, uenv.Name, entities.ResourceTypeEnvironment, uenv.Name, PublishUpdate) + d.resourceEventPublisher.PublishConsoleEvent(ctx, entities.ResourceTypeEnvironment, uenv.Name, PublishUpdate) if uenv.IsArchived != nil && *uenv.IsArchived { return d.environmentRepo.DeleteById(ctx, uenv.Id) @@ -547,7 +547,7 @@ func (d *domain) OnEnvironmentApplyError(ctx ConsoleContext, errMsg, namespace, return errors.NewE(err) } - d.resourceEventPublisher.PublishEnvironmentResourceEvent(ctx, uenv.Name, entities.ResourceTypeEnvironment, uenv.Name, PublishDelete) + d.resourceEventPublisher.PublishConsoleEvent(ctx, entities.ResourceTypeEnvironment, uenv.Name, PublishDelete) return errors.NewE(err) } @@ -570,7 +570,7 @@ func (d *domain) OnEnvironmentDeleteMessage(ctx ConsoleContext, env entities.Env return errors.NewE(err) } - d.resourceEventPublisher.PublishEnvironmentResourceEvent(ctx, env.Name, entities.ResourceTypeEnvironment, env.Name, PublishDelete) + d.resourceEventPublisher.PublishConsoleEvent(ctx, entities.ResourceTypeEnvironment, env.Name, PublishDelete) return nil } @@ -603,7 +603,7 @@ func (d *domain) OnEnvironmentUpdateMessage(ctx ConsoleContext, env entities.Env return err } - d.resourceEventPublisher.PublishEnvironmentResourceEvent(ctx, uenv.Name, entities.ResourceTypeEnvironment, uenv.Name, PublishUpdate) + d.resourceEventPublisher.PublishConsoleEvent(ctx, entities.ResourceTypeEnvironment, uenv.Name, PublishUpdate) return nil } diff --git a/apps/console/internal/domain/imported-managed-resource.go b/apps/console/internal/domain/imported-managed-resource.go new file mode 100644 index 000000000..48168688b --- /dev/null +++ b/apps/console/internal/domain/imported-managed-resource.go @@ -0,0 +1,275 @@ +package domain + +import ( + "github.com/kloudlite/api/apps/console/internal/entities" + fc "github.com/kloudlite/api/apps/console/internal/entities/field-constants" + iamT "github.com/kloudlite/api/apps/iam/types" + "github.com/kloudlite/api/common" + "github.com/kloudlite/api/pkg/errors" + "github.com/kloudlite/api/pkg/repos" + t "github.com/kloudlite/api/pkg/types" + common_types "github.com/kloudlite/operator/apis/common-types" + "github.com/kloudlite/operator/operators/resource-watcher/types" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func (d *domain) ImportManagedResource(ctx ManagedResourceContext, mresName string, importName string) (*entities.ImportedManagedResource, error) { + mr, err := d.findMRes(ctx, mresName) + if err != nil { + return nil, err + } + + if mr.SyncedOutputSecretRef == nil { + return nil, errors.Newf("synced output secret not found") + } + + outputSecret := mr.SyncedOutputSecretRef + + outputSecret.ObjectMeta = metav1.ObjectMeta{ + Name: importName, + Namespace: d.getEnvironmentTargetNamespace(*ctx.EnvironmentName), + } + + imr, err := d.importedMresRepo.Create(ctx, &entities.ImportedManagedResource{ + Name: importName, + ManagedResourceRef: entities.ManagedResourceRef{ + ID: mr.Id, + Name: mresName, + Namespace: mr.Namespace, + }, + SecretRef: common_types.SecretRef{ + Name: importName, + Namespace: outputSecret.Namespace, + }, + ResourceMetadata: common.ResourceMetadata{ + DisplayName: importName, + CreatedBy: common.CreatedOrUpdatedBy{ + UserId: ctx.UserId, + UserName: ctx.UserName, + UserEmail: ctx.UserEmail, + }, + LastUpdatedBy: common.CreatedOrUpdatedBy{ + UserId: ctx.UserId, + UserName: ctx.UserName, + UserEmail: ctx.UserEmail, + }, + }, + AccountName: ctx.AccountName, + EnvironmentName: *ctx.EnvironmentName, + SyncStatus: t.GenSyncStatus(t.SyncActionApply, mr.RecordVersion), + }) + if err != nil { + return nil, errors.NewE(err) + } + + if _, err := d.createSecret(ResourceContext{ConsoleContext: ctx.ConsoleContext, EnvironmentName: *ctx.EnvironmentName}, entities.Secret{ + Secret: *outputSecret, + AccountName: ctx.AccountName, + EnvironmentName: *ctx.EnvironmentName, + For: &entities.SecretCreatedFor{ + RefId: imr.Id, + ResourceType: entities.ResourceTypeImportedManagedResource, + Name: mresName, + Namespace: mr.Namespace, + }, + IsReadOnly: true, + }); err != nil { + return nil, errors.NewE(err) + } + + d.resourceEventPublisher.PublishEnvironmentResourceEvent(ctx.ConsoleContext, imr.EnvironmentName, entities.ResourceTypeManagedResource, imr.ManagedResourceRef.Name, PublishUpdate) + + return imr, nil +} + +func (d *domain) DeleteImportedManagedResource(ctx ResourceContext, importName string) error { + if err := d.canMutateResourcesInEnvironment(ctx); err != nil { + return errors.NewE(err) + } + + impMres, err := d.findImportedMRes(ctx, importName) + if err != nil { + return errors.NewE(err) + } + + if err := d.deleteSecret(ctx, impMres.SecretRef.Name); err != nil { + return errors.NewE(err) + } + + if _, err := d.importedMresRepo.PatchById(ctx, impMres.Id, repos.Document{fc.MarkedForDeletion: true}); err != nil { + return errors.NewE(err) + } + + d.resourceEventPublisher.PublishResourceEvent(ctx, entities.ResourceTypeManagedResource, impMres.ManagedResourceRef.Name, PublishDelete) + + return nil +} + +func (d *domain) findImportedMRes(ctx ResourceContext, importName string) (*entities.ImportedManagedResource, error) { + imr, err := d.importedMresRepo.FindOne(ctx, repos.Filter{ + fc.AccountName: ctx.AccountName, + fc.EnvironmentName: ctx.EnvironmentName, + fc.ImportedManagedResourceName: importName, + }) + if err != nil { + return nil, err + } + + if imr == nil { + return nil, errors.Newf("no imported managed resource found") + } + + return imr, nil +} + +func (d *domain) OnImportedManagedResourceDeleteMessage(ctx ConsoleContext, imrId repos.ID) error { + return d.importedMresRepo.DeleteById(ctx, imrId) +} + +func (d *domain) ListImportedManagedResources(ctx ConsoleContext, envName string, search map[string]repos.MatchFilter, pq repos.CursorPagination) (*repos.PaginatedRecord[*entities.ImportedManagedResource], error) { + if err := d.canPerformActionInAccount(ctx, iamT.ListManagedResources); err != nil { + return nil, errors.NewE(err) + } + + filters := d.mresRepo.MergeMatchFilters(repos.Filter{ + fc.AccountName: ctx.AccountName, + fc.EnvironmentName: envName, + }, search) + + pr, err := d.importedMresRepo.FindPaginated(ctx, filters, pq) + if err != nil { + return nil, errors.NewE(err) + } + return pr, nil +} + +func (d *domain) OnImportedManagedResourceUpdateMessage(ctx ConsoleContext, imrID repos.ID, status types.ResourceStatus, opts UpdateAndDeleteOpts) error { + imr, err := d.importedMresRepo.FindById(ctx, imrID) + if err != nil { + return errors.NewE(err) + } + + if imr == nil { + return errors.Newf("no imported managed resource found") + } + + patch := repos.Document{ + fc.SyncStatusState: func() t.SyncState { + if status == types.ResourceStatusDeleting { + return t.SyncStateDeletingAtAgent + } + return t.SyncStateUpdatedAtAgent + }(), + fc.SyncStatusRecordVersion: imr.RecordVersion, + fc.SyncStatusLastSyncedAt: opts.MessageTimestamp, + fc.SyncStatusError: nil, + } + + umres, err := d.importedMresRepo.PatchById(ctx, imr.Id, patch) + if err != nil { + return err + } + + d.resourceEventPublisher.PublishEnvironmentResourceEvent(ctx, umres.EnvironmentName, entities.ResourceTypeManagedResource, umres.ManagedResourceRef.Name, PublishUpdate) + return nil +} + +func (d *domain) GetImportedManagedResourceOutputKeys(ctx ResourceContext, name string) ([]string, error) { + imr, err := d.findImportedMRes(ctx, name) + if err != nil { + return nil, errors.NewE(err) + } + + mr, err := d.mresRepo.FindById(ctx, imr.ManagedResourceRef.ID) + if err != nil { + return nil, errors.NewE(err) + } + + if mr.SyncedOutputSecretRef == nil { + return nil, errors.Newf("waiting for managed resource output to be ready") + } + + results := make([]string, 0, len(mr.SyncedOutputSecretRef.Data)) + + for k := range mr.SyncedOutputSecretRef.Data { + results = append(results, k) + } + + return results, nil +} + +func (d *domain) GetImportedManagedResourceOutputKVs(ctx ResourceContext, keyrefs []ManagedResourceKeyRef) ([]*ManagedResourceKeyValueRef, error) { + uniqMres := make(map[string]struct{}) + for i := range keyrefs { + uniqMres[keyrefs[i].MresName] = struct{}{} + } + + uniqMresNames := make([]any, 0, len(uniqMres)) + for k := range uniqMres { + uniqMresNames = append(uniqMresNames, k) + } + + filters := d.importedMresRepo.MergeMatchFilters(repos.Filter{ + fc.AccountName: ctx.AccountName, + fc.EnvironmentName: ctx.EnvironmentName, + }, map[string]repos.MatchFilter{ + fc.ImportedManagedResourceName: { + MatchType: repos.MatchTypeArray, + Array: uniqMresNames, + }, + }) + + importedResources, err := d.importedMresRepo.Find(ctx, repos.Query{Filter: filters}) + if err != nil { + return nil, errors.NewE(err) + } + + importNameMap := make(map[string]string, len(importedResources)) + for i := range importedResources { + importNameMap[importedResources[i].Name] = importedResources[i].ManagedResourceRef.Name + } + + mresIDs := make([]any, 0, len(importedResources)) + for i := range importedResources { + mresIDs = append(mresIDs, importedResources[i].ManagedResourceRef.ID) + } + + mresFilter := d.mresRepo.MergeMatchFilters(repos.Filter{}, map[string]repos.MatchFilter{ + fc.Id: { + MatchType: repos.MatchTypeArray, + Array: mresIDs, + }, + }) + + mresSecrets, err := d.mresRepo.Find(ctx, repos.Query{Filter: mresFilter}) + if err != nil { + return nil, errors.NewE(err) + } + + results := make([]*ManagedResourceKeyValueRef, 0, len(mresSecrets)) + + data := make(map[string]map[string]string) + + for i := range mresSecrets { + m := make(map[string]string, len(mresSecrets[i].SyncedOutputSecretRef.Data)) + for k, v := range mresSecrets[i].SyncedOutputSecretRef.Data { + m[k] = string(v) + } + + for k, v := range mresSecrets[i].SyncedOutputSecretRef.StringData { + m[k] = v + } + + data[mresSecrets[i].Name] = m + } + + for i := range keyrefs { + results = append(results, &ManagedResourceKeyValueRef{ + MresName: keyrefs[i].MresName, + Key: keyrefs[i].Key, + Value: data[importNameMap[keyrefs[i].MresName]][keyrefs[i].Key], + }) + } + + return results, nil +} diff --git a/apps/console/internal/domain/mres.go b/apps/console/internal/domain/mres.go index 6bd4f86c6..dd7732760 100644 --- a/apps/console/internal/domain/mres.go +++ b/apps/console/internal/domain/mres.go @@ -2,6 +2,7 @@ package domain import ( "fmt" + "time" "github.com/kloudlite/api/apps/console/internal/entities" fc "github.com/kloudlite/api/apps/console/internal/entities/field-constants" @@ -25,11 +26,11 @@ func (d *domain) ListManagedResources(ctx ConsoleContext, search map[string]repo return nil, errors.NewE(err) } - filters := repos.Filter{ + filters := d.mresRepo.MergeMatchFilters(repos.Filter{ fields.AccountName: ctx.AccountName, - } + }, search) - return d.mresRepo.FindPaginated(ctx, d.mresRepo.MergeMatchFilters(filters, search), pq) + return d.mresRepo.FindPaginated(ctx, filters, pq) } func (d *domain) listImportedMres(ctx ConsoleContext, mresName string) ([]*entities.ManagedResource, error) { @@ -60,24 +61,6 @@ func (d *domain) findMRes(ctx ManagedResourceContext, name string) (*entities.Ma return mres, nil } -func (d *domain) findImportedMRes(ctx ResourceContext, name string) (*entities.ManagedResource, error) { - impMres, err := d.mresRepo.FindOne( - ctx, - repos.Filter{ - fields.AccountName: ctx.AccountName, - fields.EnvironmentName: ctx.EnvironmentName, - fc.ManagedResourceMresRef: name, - }, - ) - if err != nil { - return nil, errors.NewE(err) - } - if impMres == nil { - return nil, errors.Newf("no imported managed resource with name (%s) found", name) - } - return impMres, nil -} - func (d *domain) GetManagedResource(ctx ManagedResourceContext, name string) (*entities.ManagedResource, error) { if err := d.canPerformActionInAccount(ctx.ConsoleContext, iamT.GetManagedResource); err != nil { return nil, errors.NewE(err) @@ -86,12 +69,13 @@ func (d *domain) GetManagedResource(ctx ManagedResourceContext, name string) (*e return d.findMRes(ctx, name) } -// func (d *domain) GetImportedManagedResource(ctx ResourceContext, name string) (*entities.ManagedResource, error) { -// if err := d.canReadResourcesInEnvironment(ctx); err != nil { -// return nil, errors.NewE(err) -// } -// return d.findImportedMRes(ctx, name) -// } +func (d *domain) GetManagedResourceByID(ctx ConsoleContext, id repos.ID) (*entities.ManagedResource, error) { + if err := d.canPerformActionInAccount(ctx, iamT.GetManagedResource); err != nil { + return nil, errors.NewE(err) + } + + return d.mresRepo.FindById(ctx, id) +} // GetManagedResourceOutputKVs implements Domain. func (d *domain) GetManagedResourceOutputKVs(ctx ManagedResourceContext, keyrefs []ManagedResourceKeyRef) ([]*ManagedResourceKeyValueRef, error) { @@ -147,13 +131,6 @@ func (d *domain) GetManagedResourceOutputKVs(ctx ManagedResourceContext, keyrefs // GetManagedResourceOutputKeys implements Domain. func (d *domain) GetManagedResourceOutputKeys(ctx ManagedResourceContext, name string) ([]string, error) { - // filters, err := ctx.MresDBFilters() - // if err != nil { - // return nil, errors.NewE(err) - // } - // - // filters.Add(fields.MetadataName, name) - mresSecret, err := d.findMRes(ctx, name) if err != nil { return nil, errors.NewE(err) @@ -173,6 +150,52 @@ func (d *domain) GetManagedResourceOutputKeys(ctx ManagedResourceContext, name s } // mutations +func (d *domain) CreateRootManagedResource(ctx ConsoleContext, accountNamespace string, mres *entities.ManagedResource) (*entities.ManagedResource, error) { + if err := d.canPerformActionInAccount(ctx, iamT.CreateManagedResource); err != nil { + return nil, errors.NewE(err) + } + + mres.SyncStatus = t.SyncStatus{ + SyncScheduledAt: time.Now(), + LastSyncedAt: time.Now(), + Action: t.SyncActionApply, + RecordVersion: 1, + State: t.SyncStateUpdatedAtAgent, + Error: nil, + } + + if mres.SyncedOutputSecretRef == nil { + return nil, errors.Newf("managed resource (%s), not ready yet, please try again", mres.Name) + } + + secret := *mres.SyncedOutputSecretRef + secret.Namespace = accountNamespace + + if _, err := d.secretRepo.Upsert(ctx, repos.Filter{ + fc.AccountName: ctx.AccountName, + fc.MetadataName: secret.Name, + fc.MetadataNamespace: secret.Namespace, + }, &entities.Secret{ + Secret: secret, + AccountName: ctx.AccountName, + ResourceMetadata: common.ResourceMetadata{ + DisplayName: fmt.Sprintf("root credentials (%s)", mres.ManagedServiceName), + CreatedBy: mres.CreatedBy, + LastUpdatedBy: mres.LastUpdatedBy, + }, + SyncStatus: mres.SyncStatus, + IsReadOnly: true, + }); err != nil { + return nil, errors.NewE(err) + } + + return d.mresRepo.Upsert(ctx, repos.Filter{ + fields.AccountName: ctx.AccountName, + fc.ManagedResourceManagedServiceName: mres.ManagedServiceName, + fc.MetadataName: mres.Name, + fc.ClusterName: mres.ClusterName, + }, mres) +} func (d *domain) CreateManagedResource(ctx ManagedResourceContext, mres entities.ManagedResource) (*entities.ManagedResource, error) { if err := d.canPerformActionInAccount(ctx.ConsoleContext, iamT.CreateManagedResource); err != nil { @@ -226,59 +249,6 @@ func (d *domain) CreateManagedResource(ctx ManagedResourceContext, mres entities return d.createAndApplyManagedResource(ctx, msvcOut.ClusterName, &mres) } -func (d *domain) ImportManagedResource(ctx ManagedResourceContext, mresName string) (*entities.ManagedResource, error) { - exMres, err := d.findMRes(ManagedResourceContext{ - ConsoleContext: ctx.ConsoleContext, - ManagedServiceName: ctx.ManagedServiceName, - EnvironmentName: nil, - }, mresName) - if err != nil { - return nil, errors.NewE(err) - } - - impMres, err := d.mresRepo.FindOne( - ctx, - repos.Filter{ - fields.AccountName: ctx.AccountName, - fields.EnvironmentName: ctx.EnvironmentName, - fc.ManagedResourceMresRef: mresName, - }, - ) - if err != nil { - return nil, errors.NewE(err) - } - - if impMres != nil { - return nil, errors.Newf("managed resource with name (%s) has been already imported", mresName) - } - - nmres := &entities.ManagedResource{ - ManagedResource: exMres.ManagedResource, - AccountName: ctx.AccountName, - EnvironmentName: *ctx.EnvironmentName, - ManagedServiceName: exMres.ManagedServiceName, - ClusterName: exMres.ClusterName, - SyncedOutputSecretRef: exMres.SyncedOutputSecretRef, - ResourceMetadata: common.ResourceMetadata{ - DisplayName: exMres.DisplayName, - CreatedBy: common.CreatedOrUpdatedBy{ - UserId: ctx.UserId, - UserName: ctx.UserName, - UserEmail: ctx.UserEmail, - }, - LastUpdatedBy: common.CreatedOrUpdatedBy{ - UserId: ctx.UserId, - UserName: ctx.UserName, - UserEmail: ctx.UserEmail, - }, - }, - IsImported: true, - MresRef: mresName, - } - - return d.importAndApplyManagedResourceSecret(ctx.ConsoleContext, *ctx.EnvironmentName, nmres) -} - func genMresResourceName(envName string, mresName string) string { return fmt.Sprintf("env-%s-%s", envName, mresName) } @@ -300,7 +270,7 @@ func (d *domain) createAndApplyManagedResource(ctx ManagedResourceContext, clust return nil, errors.NewE(err) } - d.resourceEventPublisher.PublishConsoleEvent(ctx.ConsoleContext, entities.ResourceTypeManagedResource, m.Name, PublishAdd) + d.resourceEventPublisher.PublishClusterManagedServiceEvent(ctx.ConsoleContext, m.ManagedServiceName, entities.ResourceTypeManagedResource, m.Name, PublishAdd) if err := d.applyK8sResourceOnCluster(ctx, clusterName, &m.ManagedResource, m.RecordVersion); err != nil { return m, errors.NewE(err) @@ -318,6 +288,10 @@ func (d *domain) importAndApplyManagedResourceSecret(ctx ConsoleContext, envName } ann := mres.SyncedOutputSecretRef.GetAnnotations() + if ann == nil { + ann = make(map[string]string, len(types.SecretWatchingAnnotation)) + } + for k, v := range types.SecretWatchingAnnotation { ann[k] = v } @@ -327,7 +301,7 @@ func (d *domain) importAndApplyManagedResourceSecret(ctx ConsoleContext, envName return nil, errors.NewE(err) } - d.resourceEventPublisher.PublishConsoleEvent(ctx, entities.ResourceTypeManagedResource, nImpMres.Name, PublishAdd) + d.resourceEventPublisher.PublishEnvironmentResourceEvent(ctx, envName, entities.ResourceTypeManagedResource, nImpMres.Name, PublishAdd) s, err := d.secretRepo.Create(ctx, &entities.Secret{ Secret: corev1.Secret{ @@ -345,7 +319,7 @@ func (d *domain) importAndApplyManagedResourceSecret(ctx ConsoleContext, envName AccountName: mres.AccountName, EnvironmentName: mres.EnvironmentName, ResourceMetadata: mres.ResourceMetadata, - SyncStatus: t.GenSyncStatus(t.SyncActionApply, 0), + SyncStatus: mres.SyncStatus, IsReadOnly: true, }) if err != nil { @@ -412,7 +386,7 @@ func (d *domain) UpdateManagedResource(ctx ManagedResourceContext, mres entities return nil, errors.NewE(err) } - d.resourceEventPublisher.PublishConsoleEvent(ctx.ConsoleContext, entities.ResourceTypeManagedResource, upMres.Name, PublishUpdate) + d.resourceEventPublisher.PublishClusterManagedServiceEvent(ctx.ConsoleContext, upMres.ManagedServiceName, entities.ResourceTypeManagedResource, upMres.Name, PublishUpdate) if err := d.applyK8sResourceOnCluster(ctx, upMres.ClusterName, &upMres.ManagedResource, upMres.RecordVersion); err != nil { return upMres, errors.NewE(err) @@ -439,7 +413,7 @@ func (d *domain) DeleteManagedResource(ctx ManagedResourceContext, name string) if err != nil { return errors.NewE(err) } - d.resourceEventPublisher.PublishConsoleEvent(ctx.ConsoleContext, entities.ResourceTypeManagedResource, umres.Name, PublishUpdate) + d.resourceEventPublisher.PublishClusterManagedServiceEvent(ctx.ConsoleContext, umres.ManagedServiceName, entities.ResourceTypeManagedResource, umres.Name, PublishUpdate) if err := d.deleteK8sResourceOfCluster(ctx, umres.ClusterName, &umres.ManagedResource); err != nil { if errors.Is(err, ErrNoClusterAttached) { return d.mresRepo.DeleteById(ctx, umres.Id) @@ -448,56 +422,6 @@ func (d *domain) DeleteManagedResource(ctx ManagedResourceContext, name string) } return nil } - -func (d *domain) DeleteImportedManagedResource(ctx ResourceContext, mresName string) error { - if err := d.canMutateResourcesInEnvironment(ctx); err != nil { - return errors.NewE(err) - } - - impMres, err := d.findImportedMRes(ctx, mresName) - if err != nil { - return errors.NewE(err) - } - - if impMres.SyncedOutputSecretRef == nil { - return errors.Newf("managed resource (%s), not ready yet, please try again", mresName) - } - - secret := corev1.Secret{ - TypeMeta: v1.TypeMeta{APIVersion: "v1", Kind: "Secret"}, - ObjectMeta: v1.ObjectMeta{ - Name: impMres.SyncedOutputSecretRef.Name, - Namespace: d.getEnvironmentTargetNamespace(impMres.EnvironmentName), - Labels: map[string]string{ - "kloudlite.io/mres.imported": "true", - }, - Annotations: impMres.SyncedOutputSecretRef.GetAnnotations(), - }, - Data: impMres.SyncedOutputSecretRef.Data, - } - - if err := d.deleteK8sResource(ctx, impMres.EnvironmentName, &secret); err != nil { - if errors.Is(err, ErrNoClusterAttached) { - return d.mresRepo.DeleteById(ctx, impMres.Id) - } - return errors.NewE(err) - } - - err = d.mresRepo.DeleteOne( - ctx, - repos.Filter{ - fields.AccountName: ctx.AccountName, - fields.EnvironmentName: ctx.EnvironmentName, - fc.ManagedResourceMresRef: mresName, - }, - ) - if err != nil { - return errors.NewE(err) - } - d.resourceEventPublisher.PublishConsoleEvent(ctx.ConsoleContext, entities.ResourceTypeManagedResource, mresName, PublishDelete) - return nil -} - func (d *domain) OnManagedResourceDeleteMessage(ctx ConsoleContext, msvcName string, mres entities.ManagedResource) error { err := d.mresRepo.DeleteOne( ctx, @@ -510,7 +434,7 @@ func (d *domain) OnManagedResourceDeleteMessage(ctx ConsoleContext, msvcName str if err != nil { return errors.NewE(err) } - d.resourceEventPublisher.PublishConsoleEvent(ctx, entities.ResourceTypeManagedResource, mres.Name, PublishDelete) + d.resourceEventPublisher.PublishClusterManagedServiceEvent(ctx, msvcName, entities.ResourceTypeManagedResource, mres.Name, PublishDelete) return nil } @@ -542,7 +466,7 @@ func (d *domain) OnManagedResourceUpdateMessage(ctx ConsoleContext, msvcName str return err } - d.resourceEventPublisher.PublishConsoleEvent(ctx, umres.GetResourceType(), umres.GetName(), PublishUpdate) + d.resourceEventPublisher.PublishClusterManagedServiceEvent(ctx, msvcName, umres.GetResourceType(), umres.GetName(), PublishUpdate) if mres.SyncedOutputSecretRef != nil { if mres.SyncedOutputSecretRef.Labels == nil { @@ -610,7 +534,7 @@ func (d *domain) OnManagedResourceApplyError(ctx ConsoleContext, errMsg string, if err != nil { return errors.NewE(err) } - d.resourceEventPublisher.PublishConsoleEvent(ctx, entities.ResourceTypeManagedResource, umres.Name, PublishDelete) + d.resourceEventPublisher.PublishClusterManagedServiceEvent(ctx, msvcName, entities.ResourceTypeManagedResource, umres.Name, PublishDelete) return errors.NewE(err) } diff --git a/apps/console/internal/domain/names.go b/apps/console/internal/domain/names.go index c8bf4d9bf..ff84c2539 100644 --- a/apps/console/internal/domain/names.go +++ b/apps/console/internal/domain/names.go @@ -40,29 +40,20 @@ func (d *domain) CheckNameAvailability(ctx context.Context, accountName string, } switch resType { - case entities.ResourceTypeVPNDevice: { return checkResourceName(ctx, repos.Filter{fields.AccountName: accountName, fields.MetadataName: name}, d.vpnDeviceRepo) } - - //case entities.ResourceTypeProject: - // { - // return checkResourceName(ctx, repos.Filter{fields.AccountName: accountName, fields.MetadataName: name}, d.projectRepo) - // } - - //case entities.ResourceTypeProjectManagedService: - // { - // if projectName == nil { - // return nil, errProjectRequired() - // } - // return checkResourceName(ctx, repos.Filter{fields.AccountName: accountName, fields.ProjectName: projectName, fields.MetadataName: name}, d.pmsRepo) - // } - // case entities.ResourceTypeEnvironment: { return checkResourceName(ctx, repos.Filter{fields.AccountName: accountName, fields.MetadataName: name}, d.environmentRepo) } + + case entities.ResourceTypeManagedResource: + { + return checkResourceName(ctx, repos.Filter{fields.AccountName: accountName, fields.MetadataName: name}, d.mresRepo) + } + default: { if environmentName == nil { @@ -86,8 +77,8 @@ func (d *domain) CheckNameAvailability(ctx context.Context, accountName string, return checkResourceName(ctx, filter, d.secretRepo) case entities.ResourceTypeRouter: return checkResourceName(ctx, filter, d.routerRepo) - case entities.ResourceTypeManagedResource: - return checkResourceName(ctx, filter, d.mresRepo) + case entities.ResourceTypeImportedManagedResource: + return checkResourceName(ctx, filter, d.importedMresRepo) case entities.ResourceTypeImagePullSecret: return checkResourceName(ctx, filter, d.pullSecretsRepo) default: diff --git a/apps/console/internal/domain/secret.go b/apps/console/internal/domain/secret.go index 336d46851..96358dc4e 100644 --- a/apps/console/internal/domain/secret.go +++ b/apps/console/internal/domain/secret.go @@ -10,6 +10,7 @@ import ( "github.com/kloudlite/api/pkg/repos" t "github.com/kloudlite/api/pkg/types" "github.com/kloudlite/operator/operators/resource-watcher/types" + corev1 "k8s.io/api/core/v1" ) func (d *domain) ListSecrets(ctx ResourceContext, search map[string]repos.MatchFilter, pq repos.CursorPagination) (*repos.PaginatedRecord[*entities.Secret], error) { @@ -18,7 +19,26 @@ func (d *domain) ListSecrets(ctx ResourceContext, search map[string]repos.MatchF } filters := ctx.DBFilters() - return d.secretRepo.FindPaginated(ctx, d.secretRepo.MergeMatchFilters(filters, search), pq) + pr, err := d.secretRepo.FindPaginated(ctx, d.secretRepo.MergeMatchFilters(filters, search), pq) + if err != nil { + return nil, errors.NewE(err) + } + + for i := range pr.Edges { + fromDataToStringData(&pr.Edges[i].Node.Secret) + } + + return pr, nil +} + +func fromDataToStringData(secret *corev1.Secret) { + if secret.StringData == nil { + secret.StringData = make(map[string]string, len(secret.Data)) + } + + for k, v := range secret.Data { + secret.StringData[k] = string(v) + } } func (d *domain) findSecret(ctx ResourceContext, name string) (*entities.Secret, error) { @@ -32,6 +52,8 @@ func (d *domain) findSecret(ctx ResourceContext, name string) (*entities.Secret, if xSecret == nil { return nil, errors.Newf("no secret with name (%s) found", name) } + + fromDataToStringData(&xSecret.Secret) return xSecret, nil } @@ -92,6 +114,10 @@ func (d *domain) GetSecretEntries(ctx ResourceContext, keyrefs []SecretKeyRef) ( } func (d *domain) CreateSecret(ctx ResourceContext, secret entities.Secret) (*entities.Secret, error) { + return d.createSecret(ctx, secret) +} + +func (d *domain) createSecret(ctx ResourceContext, secret entities.Secret) (*entities.Secret, error) { if err := d.canMutateResourcesInEnvironment(ctx); err != nil { return nil, errors.NewE(err) } @@ -198,6 +224,10 @@ func (d *domain) UpdateSecret(ctx ResourceContext, secret entities.Secret) (*ent } func (d *domain) DeleteSecret(ctx ResourceContext, name string) error { + return d.deleteSecret(ctx, name) +} + +func (d *domain) deleteSecret(ctx ResourceContext, name string) error { if err := d.canMutateResourcesInEnvironment(ctx); err != nil { return errors.NewE(err) } @@ -213,7 +243,7 @@ func (d *domain) DeleteSecret(ctx ResourceContext, name string) error { d.resourceEventPublisher.PublishResourceEvent(ctx, entities.ResourceTypeSecret, usecret.Name, PublishUpdate) - if err := d.deleteK8sResource(ctx, "", &usecret.Secret); err != nil { + if err := d.deleteK8sResource(ctx, usecret.EnvironmentName, &usecret.Secret); err != nil { if errors.Is(err, ErrNoClusterAttached) { return d.secretRepo.DeleteById(ctx, usecret.Id) } @@ -223,14 +253,34 @@ func (d *domain) DeleteSecret(ctx ResourceContext, name string) error { } func (d *domain) OnSecretDeleteMessage(ctx ResourceContext, secret entities.Secret) error { - err := d.secretRepo.DeleteOne( - ctx, - ctx.DBFilters().Add(fields.MetadataName, secret.Name), - ) + s, err := d.findSecret(ctx, secret.Name) if err != nil { return errors.NewE(err) } + // if _, err := d.MatchRecordVersion(secret.Annotations, s.RecordVersion); err != nil { + // return d.resyncK8sResource(ctx, s.EnvironmentName, s.SyncStatus.Action, &s.Secret, s.RecordVersion) + // } + + if s.For != nil { + switch s.For.ResourceType { + case entities.ResourceTypeImportedManagedResource: + { + if err := d.OnImportedManagedResourceDeleteMessage(ctx.ConsoleContext, s.For.RefId); err != nil { + return errors.NewE(err) + } + } + default: + { + d.logger.Warnf("unknown resource type %s", s.For.ResourceType) + } + } + } + + if err := d.secretRepo.DeleteOne(ctx, ctx.DBFilters().Add(fields.MetadataName, secret.Name)); err != nil { + return errors.NewE(err) + } + d.resourceEventPublisher.PublishResourceEvent(ctx, entities.ResourceTypeSecret, secret.Name, PublishDelete) return nil @@ -247,12 +297,24 @@ func (d *domain) OnSecretUpdateMessage(ctx ResourceContext, secretIn entities.Se return d.resyncK8sResource(ctx, xSecret.EnvironmentName, xSecret.SyncStatus.Action, &xSecret.Secret, xSecret.RecordVersion) } - usecret, err := d.secretRepo.PatchById( - ctx, - xSecret.Id, - common.PatchForSyncFromAgent(&secretIn, recordVersion, status, common.PatchOpts{ - MessageTimestamp: opts.MessageTimestamp, - })) + if xSecret.For != nil { + switch xSecret.For.ResourceType { + case entities.ResourceTypeImportedManagedResource: + { + if err := d.OnImportedManagedResourceUpdateMessage(ctx.ConsoleContext, xSecret.For.RefId, status, opts); err != nil { + return errors.NewE(err) + } + } + default: + { + d.logger.Warnf("unknown resource type %s", xSecret.For.ResourceType) + } + } + } + + usecret, err := d.secretRepo.PatchById(ctx, xSecret.Id, common.PatchForSyncFromAgent(&secretIn, recordVersion, status, common.PatchOpts{ + MessageTimestamp: opts.MessageTimestamp, + })) d.resourceEventPublisher.PublishResourceEvent(ctx, usecret.GetResourceType(), usecret.GetName(), PublishUpdate) diff --git a/apps/console/internal/entities/environment.go b/apps/console/internal/entities/environment.go index ed62e4df3..d558970b4 100644 --- a/apps/console/internal/entities/environment.go +++ b/apps/console/internal/entities/environment.go @@ -21,6 +21,7 @@ type Environment struct { IsArchived *bool `json:"isArchived,omitempty" graphql:"noinput"` common.ResourceMetadata `json:",inline"` + SyncStatus t.SyncStatus `json:"syncStatus" graphql:"noinput"` } diff --git a/apps/console/internal/entities/field-constants/generated_constants.go b/apps/console/internal/entities/field-constants/generated_constants.go index 8b9ee0081..c525fa14d 100644 --- a/apps/console/internal/entities/field-constants/generated_constants.go +++ b/apps/console/internal/entities/field-constants/generated_constants.go @@ -108,6 +108,18 @@ const ( ImagePullSecretRegistryUsername = "registryUsername" ) +// constant vars generated for struct ImportedManagedResource +const ( + ImportedManagedResourceManagedResourceRef = "managedResourceRef" + ImportedManagedResourceManagedResourceRefId = "managedResourceRef.id" + ImportedManagedResourceManagedResourceRefName = "managedResourceRef.name" + ImportedManagedResourceManagedResourceRefNamespace = "managedResourceRef.namespace" + ImportedManagedResourceName = "name" + ImportedManagedResourceSecretRef = "secretRef" + ImportedManagedResourceSecretRefName = "secretRef.name" + ImportedManagedResourceSecretRefNamespace = "secretRef.namespace" +) + // constant vars generated for struct ManagedResource const ( ManagedResourceEnabled = "enabled" @@ -155,6 +167,12 @@ const ( ManagedResourceSyncedOutputSecretRefType = "syncedOutputSecretRef.type" ) +// constant vars generated for struct ManagedResourceRef +const ( + ManagedResourceRefName = "name" + ManagedResourceRefNamespace = "namespace" +) + // constant vars generated for struct ResourceMapping const ( ResourceMappingBaseEntity = "BaseEntity" @@ -199,11 +217,24 @@ const ( // constant vars generated for struct Secret const ( - SecretData = "data" - SecretImmutable = "immutable" - SecretIsReadyOnly = "isReadyOnly" - SecretStringData = "stringData" - SecretType = "type" + SecretData = "data" + SecretFor = "for" + SecretForName = "for.name" + SecretForNamespace = "for.namespace" + SecretForRefId = "for.refId" + SecretForResourceType = "for.resourceType" + SecretImmutable = "immutable" + SecretIsReadyOnly = "isReadyOnly" + SecretStringData = "stringData" + SecretType = "type" +) + +// constant vars generated for struct SecretCreatedFor +const ( + SecretCreatedForName = "name" + SecretCreatedForNamespace = "namespace" + SecretCreatedForRefId = "refId" + SecretCreatedForResourceType = "resourceType" ) // constant vars generated for struct diff --git a/apps/console/internal/entities/imported-managed-resource.go b/apps/console/internal/entities/imported-managed-resource.go new file mode 100644 index 000000000..3c902b6d4 --- /dev/null +++ b/apps/console/internal/entities/imported-managed-resource.go @@ -0,0 +1,55 @@ +package entities + +import ( + fc "github.com/kloudlite/api/apps/console/internal/entities/field-constants" + "github.com/kloudlite/api/common" + "github.com/kloudlite/api/pkg/repos" + t "github.com/kloudlite/api/pkg/types" + ct "github.com/kloudlite/operator/apis/common-types" +) + +type ImportedManagedResource struct { + repos.BaseEntity `json:",inline" graphql:"noinput"` + + Name string `json:"name"` + + ManagedResourceRef `json:"managedResourceRef"` + + common.ResourceMetadata `json:",inline"` + + SecretRef ct.SecretRef `json:"secretRef"` + + AccountName string `json:"accountName" graphql:"noinput"` + EnvironmentName string `json:"environmentName"` + + SyncStatus t.SyncStatus `json:"syncStatus"` +} + +func (m *ImportedManagedResource) GetResourceType() ResourceType { + return ResourceTypeImportedManagedResource +} + +type ManagedResourceRef struct { + ID repos.ID `json:"id"` + Name string `json:"name"` + Namespace string `json:"namespace"` +} + +var ImportedManagedResourceIndexes = []repos.IndexField{ + { + Field: []repos.IndexKey{ + {Key: fc.Id, Value: repos.IndexAsc}, + }, + Unique: true, + }, + { + Field: []repos.IndexKey{ + {Key: fc.AccountName, Value: repos.IndexAsc}, + {Key: fc.EnvironmentName, Value: repos.IndexAsc}, + {Key: fc.ImportedManagedResourceName, Value: repos.IndexAsc}, + {Key: fc.ImportedManagedResourceSecretRefName, Value: repos.IndexAsc}, + {Key: fc.ImportedManagedResourceSecretRefNamespace, Value: repos.IndexAsc}, + }, + Unique: true, + }, +} diff --git a/apps/console/internal/entities/resource-mapping.go b/apps/console/internal/entities/resource-mapping.go index 82dec6968..1ec828aee 100644 --- a/apps/console/internal/entities/resource-mapping.go +++ b/apps/console/internal/entities/resource-mapping.go @@ -17,6 +17,7 @@ const ( ResourceTypeImagePullSecret ResourceType = "image_pull_secret" ResourceTypeRouter ResourceType = "router" ResourceTypeManagedResource ResourceType = "managed_resource" + ResourceTypeImportedManagedResource ResourceType = "imported_managed_resource" ResourceTypeVPNDevice ResourceType = "vpn_device" ) diff --git a/apps/console/internal/entities/secret.go b/apps/console/internal/entities/secret.go index e43e4ce8d..5bcb1fb2b 100644 --- a/apps/console/internal/entities/secret.go +++ b/apps/console/internal/entities/secret.go @@ -16,12 +16,23 @@ type Secret struct { AccountName string `json:"accountName" graphql:"noinput"` EnvironmentName string `json:"environmentName" graphql:"noinput"` + // For is the resource type and name of the resource that this secret is being created for in format // + // It is supposed to be nil for traditional secrets, and to be used by ImagePullSecrets / Imported Managed Resources + For *SecretCreatedFor `json:"for,omitempty" graphql:"noinput"` + common.ResourceMetadata `json:",inline"` SyncStatus t.SyncStatus `json:"syncStatus" graphql:"noinput"` IsReadOnly bool `json:"isReadyOnly" graphql:"noinput"` } +type SecretCreatedFor struct { + RefId repos.ID `json:"refId"` + ResourceType ResourceType `json:"resourceType"` + Name string `json:"name"` + Namespace string `json:"namespace"` +} + func (s *Secret) GetDisplayName() string { return s.ResourceMetadata.DisplayName } diff --git a/apps/console/internal/env/env.go b/apps/console/internal/env/env.go index 89160de64..5dc6cbfe8 100644 --- a/apps/console/internal/env/env.go +++ b/apps/console/internal/env/env.go @@ -23,7 +23,7 @@ type Env struct { IAMGrpcAddr string `env:"IAM_GRPC_ADDR" required:"true"` InfraGrpcAddr string `env:"INFRA_GRPC_ADDR" required:"true"` - DefaultProjectWorkspaceName string `env:"DEFAULT_PROJECT_WORKSPACE_NAME" required:"true"` + // DefaultProjectWorkspaceName string `env:"DEFAULT_PROJECT_WORKSPACE_NAME" required:"true"` PromHttpAddr string `env:"PROM_HTTP_ADDR" required:"true"` SessionKVBucket string `env:"SESSION_KV_BUCKET" required:"true"` diff --git a/apps/console/main.go b/apps/console/main.go index 454a54d48..4befedbde 100644 --- a/apps/console/main.go +++ b/apps/console/main.go @@ -23,6 +23,7 @@ func main() { flag.BoolVar(&isDev, "dev", false, "--dev") flag.Parse() + logger, err := logging.New(&logging.Options{Name: "console", Dev: isDev}) if err != nil { panic(err) diff --git a/apps/infra/internal/app/graph/generated/generated.go b/apps/infra/internal/app/graph/generated/generated.go index 7f8e4f7dd..39c5423ac 100644 --- a/apps/infra/internal/app/graph/generated/generated.go +++ b/apps/infra/internal/app/graph/generated/generated.go @@ -1376,7 +1376,7 @@ type ComplexityRoot struct { InfraListPVs func(childComplexity int, clusterName string, search *model.SearchPersistentVolumes, pq *repos.CursorPagination) int InfraListProviderSecrets func(childComplexity int, search *model.SearchProviderSecret, pagination *repos.CursorPagination) int InfraListVolumeAttachments func(childComplexity int, clusterName string, search *model.SearchVolumeAttachments, pq *repos.CursorPagination) int - InfratGetBYOKClusterSetupInstructions func(childComplexity int, name string) int + InfratGetBYOKClusterSetupInstructions func(childComplexity int, name string, onlyHelmValues *bool) int __resolve__service func(childComplexity int) int } @@ -1609,7 +1609,7 @@ type QueryResolver interface { InfraGetCluster(ctx context.Context, name string) (*entities.Cluster, error) InfraListBYOKClusters(ctx context.Context, search *model.SearchCluster, pagination *repos.CursorPagination) (*model.BYOKClusterPaginatedRecords, error) InfraGetBYOKCluster(ctx context.Context, name string) (*entities.BYOKCluster, error) - InfratGetBYOKClusterSetupInstructions(ctx context.Context, name string) ([]*model.BYOKSetupInstruction, error) + InfratGetBYOKClusterSetupInstructions(ctx context.Context, name string, onlyHelmValues *bool) ([]*model.BYOKSetupInstruction, error) InfraListGlobalVPNs(ctx context.Context, search *model.SearchGlobalVPNs, pagination *repos.CursorPagination) (*model.GlobalVPNPaginatedRecords, error) InfraGetGlobalVpn(ctx context.Context, name string) (*entities.GlobalVPN, error) InfraListGlobalVPNDevices(ctx context.Context, gvpn string, search *model.SearchGlobalVPNDevices, pagination *repos.CursorPagination) (*model.GlobalVPNDevicePaginatedRecords, error) @@ -7813,7 +7813,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.InfratGetBYOKClusterSetupInstructions(childComplexity, args["name"].(string)), true + return e.complexity.Query.InfratGetBYOKClusterSetupInstructions(childComplexity, args["name"].(string), args["onlyHelmValues"].(*bool)), true case "Query._service": if e.complexity.Query.__resolve__service == nil { @@ -8285,7 +8285,7 @@ type Query { # byok infra_listBYOKClusters(search: SearchCluster, pagination: CursorPaginationIn): BYOKClusterPaginatedRecords @isLoggedInAndVerified @hasAccount infra_getBYOKCluster(name: String!): BYOKCluster @isLoggedInAndVerified @hasAccount - infrat_getBYOKClusterSetupInstructions(name: String!): [BYOKSetupInstruction!] @isLoggedInAndVerified @hasAccount + infrat_getBYOKClusterSetupInstructions(name: String!, onlyHelmValues: Boolean): [BYOKSetupInstruction!] @isLoggedInAndVerified @hasAccount # global VPN infra_listGlobalVPNs(search: SearchGlobalVPNs, pagination: CursorPaginationIn): GlobalVPNPaginatedRecords @isLoggedInAndVerified @hasAccount @@ -11852,6 +11852,15 @@ func (ec *executionContext) field_Query_infrat_getBYOKClusterSetupInstructions_a } } args["name"] = arg0 + var arg1 *bool + if tmp, ok := rawArgs["onlyHelmValues"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("onlyHelmValues")) + arg1, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + if err != nil { + return nil, err + } + } + args["onlyHelmValues"] = arg1 return args, nil } @@ -50673,7 +50682,7 @@ func (ec *executionContext) _Query_infrat_getBYOKClusterSetupInstructions(ctx co resTmp, err := ec.ResolverMiddleware(ctx, 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.Query().InfratGetBYOKClusterSetupInstructions(rctx, fc.Args["name"].(string)) + return ec.resolvers.Query().InfratGetBYOKClusterSetupInstructions(rctx, fc.Args["name"].(string), fc.Args["onlyHelmValues"].(*bool)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsLoggedInAndVerified == nil { @@ -75845,7 +75854,7 @@ func (ec *executionContext) marshalNfederation__Scope2ᚕᚕstringᚄ(ctx contex return ret } -func (ec *executionContext) unmarshalOAny2interface(ctx context.Context, v interface{}) (any, error) { +func (ec *executionContext) unmarshalOAny2interface(ctx context.Context, v interface{}) (interface{}, error) { if v == nil { return nil, nil } @@ -75853,7 +75862,7 @@ func (ec *executionContext) unmarshalOAny2interface(ctx context.Context, v inter return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOAny2interface(ctx context.Context, sel ast.SelectionSet, v any) graphql.Marshaler { +func (ec *executionContext) marshalOAny2interface(ctx context.Context, sel ast.SelectionSet, v interface{}) graphql.Marshaler { if v == nil { return graphql.Null } diff --git a/apps/infra/internal/app/graph/schema.graphqls b/apps/infra/internal/app/graph/schema.graphqls index 7c3af587c..e686cb0c9 100644 --- a/apps/infra/internal/app/graph/schema.graphqls +++ b/apps/infra/internal/app/graph/schema.graphqls @@ -91,7 +91,7 @@ type Query { # byok infra_listBYOKClusters(search: SearchCluster, pagination: CursorPaginationIn): BYOKClusterPaginatedRecords @isLoggedInAndVerified @hasAccount infra_getBYOKCluster(name: String!): BYOKCluster @isLoggedInAndVerified @hasAccount - infrat_getBYOKClusterSetupInstructions(name: String!): [BYOKSetupInstruction!] @isLoggedInAndVerified @hasAccount + infrat_getBYOKClusterSetupInstructions(name: String!, onlyHelmValues: Boolean): [BYOKSetupInstruction!] @isLoggedInAndVerified @hasAccount # global VPN infra_listGlobalVPNs(search: SearchGlobalVPNs, pagination: CursorPaginationIn): GlobalVPNPaginatedRecords @isLoggedInAndVerified @hasAccount diff --git a/apps/infra/internal/app/graph/schema.resolvers.go b/apps/infra/internal/app/graph/schema.resolvers.go index d546ffd12..fe6481b67 100644 --- a/apps/infra/internal/app/graph/schema.resolvers.go +++ b/apps/infra/internal/app/graph/schema.resolvers.go @@ -505,13 +505,13 @@ func (r *queryResolver) InfraGetBYOKCluster(ctx context.Context, name string) (* } // InfratGetBYOKClusterSetupInstructions is the resolver for the infrat_getBYOKClusterSetupInstructions field. -func (r *queryResolver) InfratGetBYOKClusterSetupInstructions(ctx context.Context, name string) ([]*model.BYOKSetupInstruction, error) { +func (r *queryResolver) InfratGetBYOKClusterSetupInstructions(ctx context.Context, name string, onlyHelmValues *bool) ([]*model.BYOKSetupInstruction, error) { ictx, err := toInfraContext(ctx) if err != nil { return nil, errors.NewE(err) } - bcsi, err := r.Domain.GetBYOKClusterSetupInstructions(ictx, name) + bcsi, err := r.Domain.GetBYOKClusterSetupInstructions(ictx, name, fn.DefaultIfNil(onlyHelmValues,false)) if err != nil { return nil, err } diff --git a/apps/infra/internal/app/process-resource-updates.go b/apps/infra/internal/app/process-resource-updates.go index 7b4635689..8e30c10dd 100644 --- a/apps/infra/internal/app/process-resource-updates.go +++ b/apps/infra/internal/app/process-resource-updates.go @@ -247,9 +247,13 @@ func processResourceUpdates(consumer ReceiveResourceUpdatesConsumer, d domain.Do } if v, ok := su.Object[types.KeyClusterManagedSvcSecret]; ok { - if v2, ok := v.(*corev1.Secret); ok { - cmsvc.SyncedOutputSecretRef = v2 + v2, err := fn.JsonConvertP[corev1.Secret](v) + if err != nil { + mLogger.Infof("managed resource, invalid output secret received") + return errors.NewE(err) } + v2.SetManagedFields(nil) + cmsvc.SyncedOutputSecretRef = v2 } if resStatus == types.ResourceStatusDeleted { diff --git a/apps/infra/internal/domain/api.go b/apps/infra/internal/domain/api.go index 962dbd689..ee3883307 100644 --- a/apps/infra/internal/domain/api.go +++ b/apps/infra/internal/domain/api.go @@ -77,7 +77,7 @@ type Domain interface { UpdateBYOKCluster(ctx InfraContext, clusterName string, displayName string) (*entities.BYOKCluster, error) ListBYOKCluster(ctx InfraContext, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.BYOKCluster], error) GetBYOKCluster(ctx InfraContext, name string) (*entities.BYOKCluster, error) - GetBYOKClusterSetupInstructions(ctx InfraContext, name string) ([]BYOKSetupInstruction, error) + GetBYOKClusterSetupInstructions(ctx InfraContext, name string, onlyHelmValues bool) ([]BYOKSetupInstruction, error) DeleteBYOKCluster(ctx InfraContext, name string) error UpsertBYOKClusterKubeconfig(ctx InfraContext, clusterName string, kubeconfig []byte) error diff --git a/apps/infra/internal/domain/byok-clusters.go b/apps/infra/internal/domain/byok-clusters.go index be0cb87f9..cbcf58bf3 100644 --- a/apps/infra/internal/domain/byok-clusters.go +++ b/apps/infra/internal/domain/byok-clusters.go @@ -2,6 +2,7 @@ package domain import ( "encoding/base64" + "encoding/json" "fmt" iamT "github.com/kloudlite/api/apps/iam/types" @@ -172,29 +173,46 @@ type BYOKSetupInstruction struct { Command string `json:"command"` } -func (d *domain) GetBYOKClusterSetupInstructions(ctx InfraContext, name string) ([]BYOKSetupInstruction, error) { +func (d *domain) GetBYOKClusterSetupInstructions(ctx InfraContext, name string, onlyHelmValues bool) ([]BYOKSetupInstruction, error) { cluster, err := d.findBYOKCluster(ctx, name) if err != nil { return nil, err } + if onlyHelmValues { + b, err := json.Marshal(map[string]any{ + "crds-url": fmt.Sprintf("https://github.com/kloudlite/helm-charts/releases/download/%s/crds-all.yml", d.env.KloudliteRelease), + + "chart-repo": "https://kloudlite.github.io/helm-charts", + "chart-version": d.env.KloudliteRelease, + + "helm-values": map[string]any{ + "accountName": ctx.AccountName, + "clusterName": name, + "clusterToken": cluster.ClusterToken, + "messageOfficeGRPCAddr": d.env.MessageOfficeExternalGrpcAddr, + }, + }) + if err != nil { + return nil, err + } + + return []BYOKSetupInstruction{ + { + Title: "Helm Values", + Command: string(b), + }, + }, nil + } + return []BYOKSetupInstruction{ {Title: "Add Helm Repo", Command: "helm repo add kloudlite https://kloudlite.github.io/helm-charts"}, {Title: "Update Kloudlite Repo", Command: "helm repo update kloudlite"}, {Title: "Install kloudlite CRDs", Command: fmt.Sprintf("kubectl apply -f https://github.com/kloudlite/helm-charts/releases/download/%s/crds-all.yml --server-side", d.env.KloudliteRelease)}, - {Title: "Install Kloudlite Agent", Command: fmt.Sprintf(`helm upgrade --install kloudlite --namespace kloudlite --create-namespace kloudlite/kloudlite-agent --version %s --set accountName="%s" --set clusterName="%s" --set clusterToken="%s" --set messageOfficeGRPCAddr="%s" --set byok.enabled=true`, d.env.KloudliteRelease, ctx.AccountName, name, cluster.ClusterToken, d.env.MessageOfficeExternalGrpcAddr)}, + {Title: "Install Kloudlite Agent", Command: fmt.Sprintf(`helm upgrade --install kloudlite --namespace kloudlite --create-namespace kloudlite/kloudlite-agent --version %s --set accountName="%s" --set clusterName="%s" --set clusterToken="%s" --set messageOfficeGRPCAddr="%s"`, d.env.KloudliteRelease, ctx.AccountName, name, cluster.ClusterToken, d.env.MessageOfficeExternalGrpcAddr)}, }, nil } -func (d *domain) GetBYOKClusterSetupInstructions2(ctx InfraContext, name string) (*string, error) { - cluster, err := d.findBYOKCluster(ctx, name) - if err != nil { - return nil, err - } - - return fn.New(fmt.Sprintf(`helm upgrade --install kloudlite --namespace kloudlite --create-namespace kloudlite/kloudlite-agent --version %s --set accountName="%s" --set clusterName="%s" --set clusterToken="%s" --set messageOfficeGRPCAddr="%s" --set byok.enabled=true --set helmCharts.ingressNginx.enabled=true --set helmCharts.certManager.enabled=true`, d.env.KloudliteRelease, ctx.AccountName, name, cluster.ClusterToken, d.env.MessageOfficeExternalGrpcAddr)), nil -} - func (d *domain) DeleteBYOKCluster(ctx InfraContext, name string) error { if err := d.canPerformActionInAccount(ctx, iamT.DeleteCluster); err != nil { return errors.NewE(err) diff --git a/apps/infra/internal/domain/cluster-managed-service.go b/apps/infra/internal/domain/cluster-managed-service.go index 3cea9b450..6df0a1197 100644 --- a/apps/infra/internal/domain/cluster-managed-service.go +++ b/apps/infra/internal/domain/cluster-managed-service.go @@ -1,12 +1,15 @@ package domain import ( + "encoding/json" "fmt" + iamT "github.com/kloudlite/api/apps/iam/types" "github.com/kloudlite/api/apps/infra/internal/entities" fc "github.com/kloudlite/api/apps/infra/internal/entities/field-constants" "github.com/kloudlite/api/common" "github.com/kloudlite/api/common/fields" + "github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/console" "github.com/kloudlite/api/pkg/errors" "github.com/kloudlite/api/pkg/repos" t "github.com/kloudlite/api/pkg/types" @@ -129,7 +132,6 @@ func (d *domain) getClusterManagedServiceTargetNamespace(msvcName string) string } func (d *domain) CloneClusterManagedService(ctx InfraContext, args CloneManagedServiceArgs) (*entities.ClusterManagedService, error) { - if err := d.canPerformActionInAccount(ctx, iamT.CloneClusterManagedService); err != nil { return nil, errors.NewE(err) } @@ -261,6 +263,10 @@ func (d *domain) DeleteClusterManagedService(ctx InfraContext, name string) erro return errors.NewE(err) } + if ucmsvc.IsArchived != nil && *ucmsvc.IsArchived { + return d.clusterManagedServiceRepo.DeleteById(ctx, ucmsvc.Id) + } + d.resourceEventPublisher.PublishResourceEvent(ctx, ucmsvc.ClusterName, ResourceTypeClusterManagedService, ucmsvc.Name, PublishUpdate) return d.resDispatcher.DeleteFromTargetCluster(ctx, ucmsvc.ClusterName, &ucmsvc.ClusterManagedService) @@ -325,7 +331,34 @@ func (d *domain) OnClusterManagedServiceUpdateMessage(ctx InfraContext, clusterN } patch := repos.Document{ - fc.ClusterManagedServiceSpecTargetNamespace: service.Spec.TargetNamespace, + fc.ClusterManagedServiceSpecTargetNamespace: service.Spec.TargetNamespace, + fc.ClusterManagedServiceSyncedOutputSecretRef: service.SyncedOutputSecretRef, + } + + if service.SyncedOutputSecretRef != nil { + b, err := json.Marshal(service.SyncedOutputSecretRef) + if err != nil { + return errors.NewE(err) + } + accNs, err := d.getAccNamespace(ctx) + if err != nil { + return errors.NewE(err) + } + + d.consoleClient.CreateManagedResource(ctx, &console.CreateManagedResourceIn{ + UserId: string(ctx.UserId), + UserName: string(ctx.UserName), + UserEmail: string(ctx.UserEmail), + AccountName: ctx.AccountName, + ClusterName: xService.ClusterName, + MsvcName: xService.Name, + AccountNamespace: accNs, + MsvcTargetNamespace: xService.Spec.TargetNamespace, + MresName: "root-credentials", + MresType: "root-credentials", + OutputSecret: b, + MsvcApiVersion: xService.Spec.MSVCSpec.ServiceTemplate.APIVersion, + }) } ucmsvc, err := d.clusterManagedServiceRepo.PatchById(ctx, xService.Id, common.PatchForSyncFromAgent(&service, recordVersion, status, common.PatchOpts{ diff --git a/apps/infra/internal/domain/clusters.go b/apps/infra/internal/domain/clusters.go index c52c67638..d50612309 100644 --- a/apps/infra/internal/domain/clusters.go +++ b/apps/infra/internal/domain/clusters.go @@ -376,6 +376,10 @@ func (d *domain) CreateCluster(ctx InfraContext, cluster entities.Cluster) (*ent } func (d *domain) syncKloudliteGatewayDevice(ctx InfraContext, gvpnName string) error { + t := time.Now() + defer func() { + d.logger.Infof("syncKloudliteGatewayDevice took %.2fs", time.Since(t).Seconds()) + }() // 1. parse deployment template b, err := templates.Read(templates.GlobalVPNKloudliteDeviceTemplate) if err != nil { @@ -428,7 +432,6 @@ func (d *domain) syncKloudliteGatewayDevice(ctx InfraContext, gvpnName string) e } } - deviceSvcHosts := make([]string, 0, len(deviceHosts)) for k, v := range deviceHosts { deviceSvcHosts = append(deviceSvcHosts, fmt.Sprintf("%s=%s", k, v)) diff --git a/apps/infra/internal/domain/global-vpn-cluster-connection.go b/apps/infra/internal/domain/global-vpn-cluster-connection.go index b45c20b48..3c43d6105 100644 --- a/apps/infra/internal/domain/global-vpn-cluster-connection.go +++ b/apps/infra/internal/domain/global-vpn-cluster-connection.go @@ -416,21 +416,6 @@ func (d *domain) ensureGlobalVPNConnection(ctx InfraContext, clusterName string, } func (d *domain) applyGlobalVPNConnection(ctx InfraContext, gvpn *entities.GlobalVPNConnection) error { - // if err := d.resDispatcher.ApplyToTargetCluster(ctx, gvpn.ClusterName, &corev1.Secret{ - // TypeMeta: metav1.TypeMeta{ - // APIVersion: "v1", - // Kind: "Secret", - // }, - // ObjectMeta: metav1.ObjectMeta{ - // Name: gvpn.Spec.WgRef.Name, - // Namespace: gvpn.Spec.WgRef.Namespace, - // }, - // StringData: map[string]string{ - // "ip": gvpn.DeviceRef.IPAddr, - // }, - // }, 0); err != nil { - // return err - // } return d.resDispatcher.ApplyToTargetCluster(ctx, gvpn.ClusterName, &gvpn.Gateway, gvpn.RecordVersion) } diff --git a/apps/infra/internal/domain/global-vpn-devices.go b/apps/infra/internal/domain/global-vpn-devices.go index 817f40ba9..1cf65e0f4 100644 --- a/apps/infra/internal/domain/global-vpn-devices.go +++ b/apps/infra/internal/domain/global-vpn-devices.go @@ -19,7 +19,7 @@ import ( func (d *domain) claimNextFreeDeviceIP(ctx InfraContext, deviceName string, gvpnName string) (string, error) { var ipAddrFilter *repos.MatchFilter - offsetIdx := 0 + offsetIdx := 0 for { filter := repos.Filter{ fields.AccountName: ctx.AccountName, @@ -49,7 +49,7 @@ func (d *domain) claimNextFreeDeviceIP(ctx InfraContext, deviceName string, gvpn GlobalVPNName: gvpnName, IPAddr: ip, }); err != nil { - offsetIdx += 1 + offsetIdx += 1 continue } @@ -220,8 +220,25 @@ func (d *domain) createGlobalVPNDevice(ctx InfraContext, gvpnDevice entities.Glo func (d *domain) buildPeerFromGlobalVPNDevice(ctx InfraContext, gvpn *entities.GlobalVPN, device *entities.GlobalVPNDevice) *networkingv1.Peer { allowedIPs := []string{fmt.Sprintf("%s/32", device.IPAddr)} + // privateConns, err := d.gvpnConnRepo.Find(ctx, repos.Query{ + // Filter: repos.Filter{ + // fc.GlobalVPNConnectionGlobalVPNName: gvpn.Name, + // fc.GlobalVPNConnectionVisibilityMode: entities.ClusterVisibilityModePrivate, + // }, + // }) + // if err != nil { + // return nil + // } + + // privateCIDRs := make([]string, 0, len(privateConns)) + // for _, conn := range privateConns { + // privateCIDRs = append(privateCIDRs, conn.ClusterCIDR) + // } + if device.IPAddr == gvpn.KloudliteGatewayDevice.IPAddr { + // FIXME: this should not be used allowedIPs = append(allowedIPs, gvpn.NonClusterUseAllowedIPs...) + // allowedIPs = append(allowedIPs, privateCIDRs...) } return &networkingv1.Peer{ @@ -261,7 +278,7 @@ func (d *domain) buildPeersFromGlobalVPNDevices(ctx InfraContext, gvpn string) ( if devices[i].PublicEndpoint != nil { allowedIPs := []string{fmt.Sprintf("%s/32", devices[i].IPAddr)} - if devices[i].Name == gv.KloudliteGatewayDevice.Name { + if devices[i].Name == gv.KloudliteGatewayDevice.Name { allowedIPs = append(allowedIPs, gv.NonClusterUseAllowedIPs...) } diff --git a/apps/infra/internal/entities/field-constants/generated_constants.go b/apps/infra/internal/entities/field-constants/generated_constants.go index 2108f4366..449f13f16 100644 --- a/apps/infra/internal/entities/field-constants/generated_constants.go +++ b/apps/infra/internal/entities/field-constants/generated_constants.go @@ -262,7 +262,9 @@ const ( GlobalVPNConnectionSpecLoadBalancer = "spec.loadBalancer" GlobalVPNConnectionSpecLoadBalancerHosts = "spec.loadBalancer.hosts" GlobalVPNConnectionSpecLoadBalancerPort = "spec.loadBalancer.port" + GlobalVPNConnectionSpecNodePort = "spec.nodePort" GlobalVPNConnectionSpecPeers = "spec.peers" + GlobalVPNConnectionSpecServiceType = "spec.serviceType" GlobalVPNConnectionSpecSvcCIDR = "spec.svcCIDR" GlobalVPNConnectionSpecWireguardKeysRef = "spec.wireguardKeysRef" GlobalVPNConnectionSpecWireguardKeysRefName = "spec.wireguardKeysRef.name" diff --git a/go.mod b/go.mod index 113437762..9d7b38fb6 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/google/go-github/v43 v43.0.0 github.com/google/go-github/v45 v45.2.0 github.com/gorilla/websocket v1.5.0 - github.com/kloudlite/operator v0.0.0-20240617232957-4400479d6f98 + github.com/kloudlite/operator v0.0.0-20240710071747-9a61e7de9e93 github.com/matoous/go-nanoid/v2 v2.0.0 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.29.1 @@ -57,15 +57,22 @@ require ( ) require ( + github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect + github.com/charmbracelet/lipgloss v0.10.0 // indirect + github.com/charmbracelet/log v0.4.0 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect + github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b // indirect github.com/hashicorp/go-hclog v1.4.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect + github.com/muesli/reflow v0.3.0 // indirect + github.com/muesli/termenv v0.15.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/nats-io/nkeys v0.4.6 // indirect github.com/nats-io/nuid v1.0.1 // indirect diff --git a/go.sum b/go.sum index 50cdd4b80..79ee660d2 100644 --- a/go.sum +++ b/go.sum @@ -25,6 +25,8 @@ github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/aws/aws-sdk-go v1.50.10 h1:H3NQvqRUKG+9oysCKTIyylpkqfPA7MiBtzTnu/cIGqE= github.com/aws/aws-sdk-go v1.50.10/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= +github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -33,6 +35,10 @@ github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 h1:tXKVfhE7FcSkhkv0UwkLvPDeZ4k github.com/bradleyfalzon/ghinstallation/v2 v2.0.4/go.mod h1:B40qPqJxWE0jDZgOR1JmaMy+4AY1eBP+IByOvqyAKp0= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/charmbracelet/lipgloss v0.10.0 h1:KWeXFSexGcfahHX+54URiZGkBFazf70JNMtwg/AFW3s= +github.com/charmbracelet/lipgloss v0.10.0/go.mod h1:Wig9DSfvANsxqkRsqj6x87irdy123SR4dOXlKa91ciE= +github.com/charmbracelet/log v0.4.0 h1:G9bQAcx8rWA2T3pWvx7YtPTPwgqpk7D68BX21IRW8ZM= +github.com/charmbracelet/log v0.4.0/go.mod h1:63bXt/djrizTec0l11H20t8FDSvA4CRZJ1KH22MdptM= github.com/codingconcepts/env v0.0.0-20200821220118-a8fbf8d84482 h1:5/aEFreBh9hH/0G+33xtczJCvMaulqsm9nDuu2BZUEo= github.com/codingconcepts/env v0.0.0-20200821220118-a8fbf8d84482/go.mod h1:TM9ug+H/2cI3EjyIDr5xKCkFGyNE59URgH1wu5NyU8E= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= @@ -65,6 +71,8 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4 github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= +github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -167,8 +175,8 @@ github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLA github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/kloudlite/container-registry-authorizer v0.0.0-20231021122509-161dc30fde55 h1:YnZh3TL6AG4EfoInx1/L5zcPHd2QxgLKseJB1KtHjdQ= github.com/kloudlite/container-registry-authorizer v0.0.0-20231021122509-161dc30fde55/go.mod h1:GZj3wZmIw/qCciclRhgQTgmGiqe8wxoVzMXQjbOfnbc= -github.com/kloudlite/operator v0.0.0-20240617232957-4400479d6f98 h1:VoxHzclHl05X4L5gpoWuH3UKK54HVi+56GxzEtxMJOM= -github.com/kloudlite/operator v0.0.0-20240617232957-4400479d6f98/go.mod h1:2g+g0QGvfFgRXMDZhoUAG4s5XoOyfyi1o9m0wCfhM2Q= +github.com/kloudlite/operator v0.0.0-20240710071747-9a61e7de9e93 h1:vbF6PPTjgmtE5pNHKdZmTMmjfC4njjGW1EO8m7Njx1w= +github.com/kloudlite/operator v0.0.0-20240710071747-9a61e7de9e93/go.mod h1:c6FiZvYztvr92/UcIUvQurp3oWMrrEK7deAriHckTPw= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -176,6 +184,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= +github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/matoous/go-nanoid v1.5.0/go.mod h1:zyD2a71IubI24efhpvkJz+ZwfwagzgSO6UNiFsZKN7U= @@ -190,6 +200,7 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= @@ -209,6 +220,10 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= +github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= +github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= +github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/nats-io/nats.go v1.31.0 h1:/WFBHEc/dOKBF6qf1TZhrdEfTmOZ5JzdJ+Y3m6Y/p7E= @@ -238,6 +253,7 @@ github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lne github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= +github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= diff --git a/grpc-interfaces/console.proto b/grpc-interfaces/console.proto index 85045fb7c..abe46d7b9 100644 --- a/grpc-interfaces/console.proto +++ b/grpc-interfaces/console.proto @@ -4,6 +4,7 @@ option go_package = "kloudlite.io/rpc/console"; service Console { rpc ArchiveEnvironmentsForCluster(ArchiveEnvironmentsForClusterIn) returns (ArchiveEnvironmentsForClusterOut); + rpc CreateManagedResource(CreateManagedResourceIn) returns (CreateManagedResourceOut); } message ArchiveEnvironmentsForClusterIn { @@ -19,3 +20,26 @@ message ArchiveEnvironmentsForClusterOut { bool archived = 1; } +message CreateManagedResourceIn { + string userId = 1; + string userName = 2; + string userEmail = 3; + + string accountName = 4; + string clusterName = 5; + + string msvcName = 6; + string accountNamespace = 7; + string msvcTargetNamespace = 8; + + string mresName = 9; + + string mresType = 10; + bytes outputSecret = 11; + + string msvcApiVersion = 12; +} + +message CreateManagedResourceOut { + bool ok = 1; +} diff --git a/grpc-interfaces/kloudlite.io/rpc/console/console.pb.go b/grpc-interfaces/kloudlite.io/rpc/console/console.pb.go index fab611dc4..443b49539 100644 --- a/grpc-interfaces/kloudlite.io/rpc/console/console.pb.go +++ b/grpc-interfaces/kloudlite.io/rpc/console/console.pb.go @@ -146,6 +146,188 @@ func (x *ArchiveEnvironmentsForClusterOut) GetArchived() bool { return false } +type CreateManagedResourceIn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + UserName string `protobuf:"bytes,2,opt,name=userName,proto3" json:"userName,omitempty"` + UserEmail string `protobuf:"bytes,3,opt,name=userEmail,proto3" json:"userEmail,omitempty"` + AccountName string `protobuf:"bytes,4,opt,name=accountName,proto3" json:"accountName,omitempty"` + ClusterName string `protobuf:"bytes,5,opt,name=clusterName,proto3" json:"clusterName,omitempty"` + MsvcName string `protobuf:"bytes,6,opt,name=msvcName,proto3" json:"msvcName,omitempty"` + AccountNamespace string `protobuf:"bytes,7,opt,name=accountNamespace,proto3" json:"accountNamespace,omitempty"` + MsvcTargetNamespace string `protobuf:"bytes,8,opt,name=msvcTargetNamespace,proto3" json:"msvcTargetNamespace,omitempty"` + MresName string `protobuf:"bytes,9,opt,name=mresName,proto3" json:"mresName,omitempty"` + MresType string `protobuf:"bytes,10,opt,name=mresType,proto3" json:"mresType,omitempty"` + OutputSecret []byte `protobuf:"bytes,11,opt,name=outputSecret,proto3" json:"outputSecret,omitempty"` + MsvcApiVersion string `protobuf:"bytes,12,opt,name=msvcApiVersion,proto3" json:"msvcApiVersion,omitempty"` +} + +func (x *CreateManagedResourceIn) Reset() { + *x = CreateManagedResourceIn{} + if protoimpl.UnsafeEnabled { + mi := &file_console_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateManagedResourceIn) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateManagedResourceIn) ProtoMessage() {} + +func (x *CreateManagedResourceIn) ProtoReflect() protoreflect.Message { + mi := &file_console_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateManagedResourceIn.ProtoReflect.Descriptor instead. +func (*CreateManagedResourceIn) Descriptor() ([]byte, []int) { + return file_console_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateManagedResourceIn) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *CreateManagedResourceIn) GetUserName() string { + if x != nil { + return x.UserName + } + return "" +} + +func (x *CreateManagedResourceIn) GetUserEmail() string { + if x != nil { + return x.UserEmail + } + return "" +} + +func (x *CreateManagedResourceIn) GetAccountName() string { + if x != nil { + return x.AccountName + } + return "" +} + +func (x *CreateManagedResourceIn) GetClusterName() string { + if x != nil { + return x.ClusterName + } + return "" +} + +func (x *CreateManagedResourceIn) GetMsvcName() string { + if x != nil { + return x.MsvcName + } + return "" +} + +func (x *CreateManagedResourceIn) GetAccountNamespace() string { + if x != nil { + return x.AccountNamespace + } + return "" +} + +func (x *CreateManagedResourceIn) GetMsvcTargetNamespace() string { + if x != nil { + return x.MsvcTargetNamespace + } + return "" +} + +func (x *CreateManagedResourceIn) GetMresName() string { + if x != nil { + return x.MresName + } + return "" +} + +func (x *CreateManagedResourceIn) GetMresType() string { + if x != nil { + return x.MresType + } + return "" +} + +func (x *CreateManagedResourceIn) GetOutputSecret() []byte { + if x != nil { + return x.OutputSecret + } + return nil +} + +func (x *CreateManagedResourceIn) GetMsvcApiVersion() string { + if x != nil { + return x.MsvcApiVersion + } + return "" +} + +type CreateManagedResourceOut struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` +} + +func (x *CreateManagedResourceOut) Reset() { + *x = CreateManagedResourceOut{} + if protoimpl.UnsafeEnabled { + mi := &file_console_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateManagedResourceOut) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateManagedResourceOut) ProtoMessage() {} + +func (x *CreateManagedResourceOut) ProtoReflect() protoreflect.Message { + mi := &file_console_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateManagedResourceOut.ProtoReflect.Descriptor instead. +func (*CreateManagedResourceOut) Descriptor() ([]byte, []int) { + return file_console_proto_rawDescGZIP(), []int{3} +} + +func (x *CreateManagedResourceOut) GetOk() bool { + if x != nil { + return x.Ok + } + return false +} + var File_console_proto protoreflect.FileDescriptor var file_console_proto_rawDesc = []byte{ @@ -165,16 +347,51 @@ var file_console_proto_rawDesc = []byte{ 0x68, 0x69, 0x76, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x46, 0x6f, 0x72, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x32, 0x6f, 0x0a, 0x07, 0x43, 0x6f, 0x6e, - 0x73, 0x6f, 0x6c, 0x65, 0x12, 0x64, 0x0a, 0x1d, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x45, - 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x46, 0x6f, 0x72, 0x43, 0x6c, - 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x20, 0x2e, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x45, - 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x46, 0x6f, 0x72, 0x43, 0x6c, - 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x1a, 0x21, 0x2e, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, - 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x46, 0x6f, 0x72, - 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x42, 0x1a, 0x5a, 0x18, 0x6b, 0x6c, - 0x6f, 0x75, 0x64, 0x6c, 0x69, 0x74, 0x65, 0x2e, 0x69, 0x6f, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x63, - 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x22, 0xad, 0x03, 0x0a, 0x17, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x49, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, + 0x08, 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x73, 0x65, + 0x72, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x73, + 0x65, 0x72, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, + 0x73, 0x76, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, + 0x73, 0x76, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x10, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x12, 0x30, 0x0a, 0x13, 0x6d, 0x73, 0x76, 0x63, 0x54, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x13, 0x6d, 0x73, 0x76, 0x63, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x72, 0x65, 0x73, 0x4e, 0x61, 0x6d, + 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x72, 0x65, 0x73, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x72, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x72, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, + 0x0c, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, + 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x6d, 0x73, 0x76, 0x63, 0x41, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6d, 0x73, 0x76, 0x63, 0x41, + 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x2a, 0x0a, 0x18, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x4f, 0x75, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x32, 0xbd, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, + 0x65, 0x12, 0x64, 0x0a, 0x1d, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x45, 0x6e, 0x76, 0x69, + 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x46, 0x6f, 0x72, 0x43, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x12, 0x20, 0x2e, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x45, 0x6e, 0x76, 0x69, + 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x46, 0x6f, 0x72, 0x43, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x49, 0x6e, 0x1a, 0x21, 0x2e, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x45, 0x6e, + 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x46, 0x6f, 0x72, 0x43, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x12, 0x4c, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x12, 0x18, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x1a, 0x19, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x4f, 0x75, 0x74, 0x42, 0x1a, 0x5a, 0x18, 0x6b, 0x6c, 0x6f, 0x75, 0x64, 0x6c, 0x69, + 0x74, 0x65, 0x2e, 0x69, 0x6f, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, + 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -189,16 +406,20 @@ func file_console_proto_rawDescGZIP() []byte { return file_console_proto_rawDescData } -var file_console_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_console_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_console_proto_goTypes = []interface{}{ (*ArchiveEnvironmentsForClusterIn)(nil), // 0: ArchiveEnvironmentsForClusterIn (*ArchiveEnvironmentsForClusterOut)(nil), // 1: ArchiveEnvironmentsForClusterOut + (*CreateManagedResourceIn)(nil), // 2: CreateManagedResourceIn + (*CreateManagedResourceOut)(nil), // 3: CreateManagedResourceOut } var file_console_proto_depIdxs = []int32{ 0, // 0: Console.ArchiveEnvironmentsForCluster:input_type -> ArchiveEnvironmentsForClusterIn - 1, // 1: Console.ArchiveEnvironmentsForCluster:output_type -> ArchiveEnvironmentsForClusterOut - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type + 2, // 1: Console.CreateManagedResource:input_type -> CreateManagedResourceIn + 1, // 2: Console.ArchiveEnvironmentsForCluster:output_type -> ArchiveEnvironmentsForClusterOut + 3, // 3: Console.CreateManagedResource:output_type -> CreateManagedResourceOut + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -234,6 +455,30 @@ func file_console_proto_init() { return nil } } + file_console_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateManagedResourceIn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_console_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateManagedResourceOut); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -241,7 +486,7 @@ func file_console_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_console_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/grpc-interfaces/kloudlite.io/rpc/console/console_grpc.pb.go b/grpc-interfaces/kloudlite.io/rpc/console/console_grpc.pb.go index 6cbe7e45d..1d6762757 100644 --- a/grpc-interfaces/kloudlite.io/rpc/console/console_grpc.pb.go +++ b/grpc-interfaces/kloudlite.io/rpc/console/console_grpc.pb.go @@ -20,6 +20,7 @@ const _ = grpc.SupportPackageIsVersion7 const ( Console_ArchiveEnvironmentsForCluster_FullMethodName = "/Console/ArchiveEnvironmentsForCluster" + Console_CreateManagedResource_FullMethodName = "/Console/CreateManagedResource" ) // ConsoleClient is the client API for Console service. @@ -27,6 +28,7 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type ConsoleClient interface { ArchiveEnvironmentsForCluster(ctx context.Context, in *ArchiveEnvironmentsForClusterIn, opts ...grpc.CallOption) (*ArchiveEnvironmentsForClusterOut, error) + CreateManagedResource(ctx context.Context, in *CreateManagedResourceIn, opts ...grpc.CallOption) (*CreateManagedResourceOut, error) } type consoleClient struct { @@ -46,11 +48,21 @@ func (c *consoleClient) ArchiveEnvironmentsForCluster(ctx context.Context, in *A return out, nil } +func (c *consoleClient) CreateManagedResource(ctx context.Context, in *CreateManagedResourceIn, opts ...grpc.CallOption) (*CreateManagedResourceOut, error) { + out := new(CreateManagedResourceOut) + err := c.cc.Invoke(ctx, Console_CreateManagedResource_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ConsoleServer is the server API for Console service. // All implementations must embed UnimplementedConsoleServer // for forward compatibility type ConsoleServer interface { ArchiveEnvironmentsForCluster(context.Context, *ArchiveEnvironmentsForClusterIn) (*ArchiveEnvironmentsForClusterOut, error) + CreateManagedResource(context.Context, *CreateManagedResourceIn) (*CreateManagedResourceOut, error) mustEmbedUnimplementedConsoleServer() } @@ -61,6 +73,9 @@ type UnimplementedConsoleServer struct { func (UnimplementedConsoleServer) ArchiveEnvironmentsForCluster(context.Context, *ArchiveEnvironmentsForClusterIn) (*ArchiveEnvironmentsForClusterOut, error) { return nil, status.Errorf(codes.Unimplemented, "method ArchiveEnvironmentsForCluster not implemented") } +func (UnimplementedConsoleServer) CreateManagedResource(context.Context, *CreateManagedResourceIn) (*CreateManagedResourceOut, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateManagedResource not implemented") +} func (UnimplementedConsoleServer) mustEmbedUnimplementedConsoleServer() {} // UnsafeConsoleServer may be embedded to opt out of forward compatibility for this service. @@ -92,6 +107,24 @@ func _Console_ArchiveEnvironmentsForCluster_Handler(srv interface{}, ctx context return interceptor(ctx, in, info, handler) } +func _Console_CreateManagedResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateManagedResourceIn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ConsoleServer).CreateManagedResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Console_CreateManagedResource_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ConsoleServer).CreateManagedResource(ctx, req.(*CreateManagedResourceIn)) + } + return interceptor(ctx, in, info, handler) +} + // Console_ServiceDesc is the grpc.ServiceDesc for Console service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -103,6 +136,10 @@ var Console_ServiceDesc = grpc.ServiceDesc{ MethodName: "ArchiveEnvironmentsForCluster", Handler: _Console_ArchiveEnvironmentsForCluster_Handler, }, + { + MethodName: "CreateManagedResource", + Handler: _Console_CreateManagedResource_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "console.proto",