From ab2f9630f5c55737e2aa35fb190d5409eced45e5 Mon Sep 17 00:00:00 2001 From: Lukasz Zajaczkowski Date: Mon, 18 Sep 2023 16:56:50 +0200 Subject: [PATCH] add content --- .gitignore | 22 +- .gqlgenc.yml | 23 + .releaserc | 8 + LICENSE | 201 ++++ Makefile | 8 + README.md | 10 + client.go | 217 ++++ example/main.go | 47 + go.mod | 32 + go.sum | 85 ++ graph/deployment.graphql | 19 + hack/gen-api-client.sh | 10 + hack/lib.sh | 37 + models_gen.go | 2465 ++++++++++++++++++++++++++++++++++++++ pkg/utils/arrays.go | 25 + pkg/utils/maps.go | 12 + pkg/utils/strings.go | 14 + renovate.json | 34 + schema/schema.graphql | 1969 ++++++++++++++++++++++++++++++ tools/tools.go | 8 + uploadfiles.go | 71 ++ 21 files changed, 5296 insertions(+), 21 deletions(-) create mode 100644 .gqlgenc.yml create mode 100644 .releaserc create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 client.go create mode 100644 example/main.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 graph/deployment.graphql create mode 100755 hack/gen-api-client.sh create mode 100644 hack/lib.sh create mode 100644 models_gen.go create mode 100644 pkg/utils/arrays.go create mode 100644 pkg/utils/maps.go create mode 100644 pkg/utils/strings.go create mode 100644 renovate.json create mode 100644 schema/schema.graphql create mode 100644 tools/tools.go create mode 100644 uploadfiles.go diff --git a/.gitignore b/.gitignore index 3b735ec..62c8935 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1 @@ -# If you prefer the allow list template instead of the deny list, see community template: -# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore -# -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Dependency directories (remove the comment below to include it) -# vendor/ - -# Go workspace file -go.work +.idea/ \ No newline at end of file diff --git a/.gqlgenc.yml b/.gqlgenc.yml new file mode 100644 index 0000000..137fe87 --- /dev/null +++ b/.gqlgenc.yml @@ -0,0 +1,23 @@ +generate: + client: true +model: + package: gqlclient + filename: models_gen.go # https://github.com/99designs/gqlgen/tree/master/plugin/modelgen +client: + package: gqlclient + filename: client.go # Where should any generated client go? +models: + Int: + model: github.com/99designs/gqlgen/graphql.Int64 + Date: + model: github.com/99designs/gqlgen/graphql.Time + ID: + model: github.com/99designs/gqlgen/graphql.ID + String: + model: github.com/99designs/gqlgen/graphql.String + UploadOrUrl: + model: github.com/99designs/gqlgen/graphql.String +schema: + - "schema/*.graphql" +query: + - "graph/*.graphql" # Where are all the query files located? diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..ce57810 --- /dev/null +++ b/.releaserc @@ -0,0 +1,8 @@ +{ + "branches": ["main"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/github", + "@semantic-release/release-notes-generator" + ] +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..400a545 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +generate-in-container: ## resync client with current graph endpoint + hack/gen-api-client.sh + +update-schema: ## download schema from plural + curl -L https://raw.githubusercontent.com/pluralsh/console/master/schema/schema.graphql --output schema/schema.graphql + +generate: ##update-schema + go run github.com/Yamashou/gqlgenc diff --git a/README.md b/README.md new file mode 100644 index 0000000..2eb8685 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# gqlclient +Plural Console GraphQL client + +## How to use + +Execute the following command + +``` +$ hack/gen-api-client +``` diff --git a/client.go b/client.go new file mode 100644 index 0000000..1a7d7eb --- /dev/null +++ b/client.go @@ -0,0 +1,217 @@ +// Code generated by github.com/Yamashou/gqlgenc, DO NOT EDIT. + +package gqlclient + +import ( + "context" + "net/http" + + "github.com/Yamashou/gqlgenc/client" +) + +type Client struct { + Client *client.Client +} + +func NewClient(cli *http.Client, baseURL string, options ...client.HTTPRequestOption) *Client { + return &Client{Client: client.NewClient(cli, baseURL, options...)} +} + +type RootQueryType struct { + Configuration *ConsoleConfiguration "json:\"configuration\" graphql:\"configuration\"" + ExternalToken *string "json:\"externalToken\" graphql:\"externalToken\"" + Builds *BuildConnection "json:\"builds\" graphql:\"builds\"" + Build *Build "json:\"build\" graphql:\"build\"" + BuildInfo *BuildInfo "json:\"buildInfo\" graphql:\"buildInfo\"" + Users *UserConnection "json:\"users\" graphql:\"users\"" + LoginInfo *LoginInfo "json:\"loginInfo\" graphql:\"loginInfo\"" + Me *User "json:\"me\" graphql:\"me\"" + Invite *Invite "json:\"invite\" graphql:\"invite\"" + Groups *GroupConnection "json:\"groups\" graphql:\"groups\"" + GroupMembers *GroupMemberConnection "json:\"groupMembers\" graphql:\"groupMembers\"" + Role *Role "json:\"role\" graphql:\"role\"" + Roles *RoleConnection "json:\"roles\" graphql:\"roles\"" + Notifications *NotificationConnection "json:\"notifications\" graphql:\"notifications\"" + TemporaryToken *string "json:\"temporaryToken\" graphql:\"temporaryToken\"" + AccessTokens *AccessTokenConnection "json:\"accessTokens\" graphql:\"accessTokens\"" + AccessToken *AccessToken "json:\"accessToken\" graphql:\"accessToken\"" + Dashboards []*Dashboard "json:\"dashboards\" graphql:\"dashboards\"" + Dashboard *Dashboard "json:\"dashboard\" graphql:\"dashboard\"" + Metric []*MetricResponse "json:\"metric\" graphql:\"metric\"" + Logs []*LogStream "json:\"logs\" graphql:\"logs\"" + ScalingRecommendation *VerticalPodAutoscaler "json:\"scalingRecommendation\" graphql:\"scalingRecommendation\"" + ConfigMap *ConfigMap "json:\"configMap\" graphql:\"configMap\"" + Secret *Secret "json:\"secret\" graphql:\"secret\"" + ConfigMaps []*ConfigMap "json:\"configMaps\" graphql:\"configMaps\"" + Secrets []*Secret "json:\"secrets\" graphql:\"secrets\"" + Service *Service "json:\"service\" graphql:\"service\"" + ClusterInfo *ClusterInfo "json:\"clusterInfo\" graphql:\"clusterInfo\"" + Deployment *Deployment "json:\"deployment\" graphql:\"deployment\"" + StatefulSet *StatefulSet "json:\"statefulSet\" graphql:\"statefulSet\"" + Ingress *Ingress "json:\"ingress\" graphql:\"ingress\"" + Nodes []*Node "json:\"nodes\" graphql:\"nodes\"" + Node *Node "json:\"node\" graphql:\"node\"" + CronJob *CronJob "json:\"cronJob\" graphql:\"cronJob\"" + Job *Job "json:\"job\" graphql:\"job\"" + Certificate *Certificate "json:\"certificate\" graphql:\"certificate\"" + Pod *Pod "json:\"pod\" graphql:\"pod\"" + Pods *PodConnection "json:\"pods\" graphql:\"pods\"" + WireguardPeers []*WireguardPeer "json:\"wireguardPeers\" graphql:\"wireguardPeers\"" + MyWireguardPeers []*WireguardPeer "json:\"myWireguardPeers\" graphql:\"myWireguardPeers\"" + WireguardPeer *WireguardPeer "json:\"wireguardPeer\" graphql:\"wireguardPeer\"" + CachedPods []*Pod "json:\"cachedPods\" graphql:\"cachedPods\"" + Namespaces []*Namespace "json:\"namespaces\" graphql:\"namespaces\"" + LogFilters []*LogFilter "json:\"logFilters\" graphql:\"logFilters\"" + NodeMetrics []*NodeMetric "json:\"nodeMetrics\" graphql:\"nodeMetrics\"" + NodeMetric *NodeMetric "json:\"nodeMetric\" graphql:\"nodeMetric\"" + ConfigurationOverlays []*ConfigurationOverlay "json:\"configurationOverlays\" graphql:\"configurationOverlays\"" + Audits *AuditConnection "json:\"audits\" graphql:\"audits\"" + AuditMetrics []*AuditMetric "json:\"auditMetrics\" graphql:\"auditMetrics\"" + Ai *string "json:\"ai\" graphql:\"ai\"" + Account *Account "json:\"account\" graphql:\"account\"" + Installations *InstallationConnection "json:\"installations\" graphql:\"installations\"" + Applications []*Application "json:\"applications\" graphql:\"applications\"" + Application *Application "json:\"application\" graphql:\"application\"" + Repository *Repository "json:\"repository\" graphql:\"repository\"" + Repositories *RepositoryConnection "json:\"repositories\" graphql:\"repositories\"" + Recipes *RecipeConnection "json:\"recipes\" graphql:\"recipes\"" + Context []*RepositoryContext "json:\"context\" graphql:\"context\"" + PluralContext *PluralContext "json:\"pluralContext\" graphql:\"pluralContext\"" + Recipe *Recipe "json:\"recipe\" graphql:\"recipe\"" + Stack *Stack "json:\"stack\" graphql:\"stack\"" + SMTP *SMTP "json:\"smtp\" graphql:\"smtp\"" + UpgradePolicies []*UpgradePolicy "json:\"upgradePolicies\" graphql:\"upgradePolicies\"" + Runbook *Runbook "json:\"runbook\" graphql:\"runbook\"" + Runbooks []*Runbook "json:\"runbooks\" graphql:\"runbooks\"" + Webhooks *WebhookConnection "json:\"webhooks\" graphql:\"webhooks\"" + PostgresDatabases []*Postgresql "json:\"postgresDatabases\" graphql:\"postgresDatabases\"" + PostgresDatabase *Postgresql "json:\"postgresDatabase\" graphql:\"postgresDatabase\"" + GitRepositories *GitRepositoryConnection "json:\"gitRepositories\" graphql:\"gitRepositories\"" + Clusters *ClusterConnection "json:\"clusters\" graphql:\"clusters\"" + ClusterProviders *ClusterProviderConnection "json:\"clusterProviders\" graphql:\"clusterProviders\"" + Cluster *Cluster "json:\"cluster\" graphql:\"cluster\"" + ClusterProvider *ClusterProvider "json:\"clusterProvider\" graphql:\"clusterProvider\"" + ServiceDeployments *ServiceDeploymentConnection "json:\"serviceDeployments\" graphql:\"serviceDeployments\"" + ServiceDeployment *ServiceDeployment "json:\"serviceDeployment\" graphql:\"serviceDeployment\"" + ClusterServices []*ServiceDeployment "json:\"clusterServices\" graphql:\"clusterServices\"" + DeploymentSettings *DeploymentSettings "json:\"deploymentSettings\" graphql:\"deploymentSettings\"" +} +type RootMutationType struct { + CreateBuild *Build "json:\"createBuild\" graphql:\"createBuild\"" + RestartBuild *Build "json:\"restartBuild\" graphql:\"restartBuild\"" + CancelBuild *Build "json:\"cancelBuild\" graphql:\"cancelBuild\"" + ApproveBuild *Build "json:\"approveBuild\" graphql:\"approveBuild\"" + SignIn *User "json:\"signIn\" graphql:\"signIn\"" + LoginLink *User "json:\"loginLink\" graphql:\"loginLink\"" + ReadNotifications *User "json:\"readNotifications\" graphql:\"readNotifications\"" + Signup *User "json:\"signup\" graphql:\"signup\"" + OauthCallback *User "json:\"oauthCallback\" graphql:\"oauthCallback\"" + CreateInvite *Invite "json:\"createInvite\" graphql:\"createInvite\"" + UpdateUser *User "json:\"updateUser\" graphql:\"updateUser\"" + DeleteUser *User "json:\"deleteUser\" graphql:\"deleteUser\"" + MarkRead *User "json:\"markRead\" graphql:\"markRead\"" + CreateGroup *Group "json:\"createGroup\" graphql:\"createGroup\"" + DeleteGroup *Group "json:\"deleteGroup\" graphql:\"deleteGroup\"" + UpdateGroup *Group "json:\"updateGroup\" graphql:\"updateGroup\"" + CreateGroupMember *GroupMember "json:\"createGroupMember\" graphql:\"createGroupMember\"" + DeleteGroupMember *GroupMember "json:\"deleteGroupMember\" graphql:\"deleteGroupMember\"" + CreateRole *Role "json:\"createRole\" graphql:\"createRole\"" + UpdateRole *Role "json:\"updateRole\" graphql:\"updateRole\"" + DeleteRole *Role "json:\"deleteRole\" graphql:\"deleteRole\"" + CreateAccessToken *AccessToken "json:\"createAccessToken\" graphql:\"createAccessToken\"" + DeleteAccessToken *AccessToken "json:\"deleteAccessToken\" graphql:\"deleteAccessToken\"" + DeleteCertificate *bool "json:\"deleteCertificate\" graphql:\"deleteCertificate\"" + DeletePod *Pod "json:\"deletePod\" graphql:\"deletePod\"" + DeleteJob *Job "json:\"deleteJob\" graphql:\"deleteJob\"" + DeleteNode *Node "json:\"deleteNode\" graphql:\"deleteNode\"" + OverlayConfiguration *Build "json:\"overlayConfiguration\" graphql:\"overlayConfiguration\"" + CreatePeer *WireguardPeer "json:\"createPeer\" graphql:\"createPeer\"" + DeletePeer *bool "json:\"deletePeer\" graphql:\"deletePeer\"" + InstallRecipe *Build "json:\"installRecipe\" graphql:\"installRecipe\"" + InstallStack *Build "json:\"installStack\" graphql:\"installStack\"" + UpdateSMTP *SMTP "json:\"updateSmtp\" graphql:\"updateSmtp\"" + UpdateConfiguration *Configuration "json:\"updateConfiguration\" graphql:\"updateConfiguration\"" + CreateUpgradePolicy *UpgradePolicy "json:\"createUpgradePolicy\" graphql:\"createUpgradePolicy\"" + DeleteUpgradePolicy *UpgradePolicy "json:\"deleteUpgradePolicy\" graphql:\"deleteUpgradePolicy\"" + ExecuteRunbook *RunbookActionResponse "json:\"executeRunbook\" graphql:\"executeRunbook\"" + CreateWebhook *Webhook "json:\"createWebhook\" graphql:\"createWebhook\"" + DeleteWebhook *Webhook "json:\"deleteWebhook\" graphql:\"deleteWebhook\"" + RestorePostgres *Postgresql "json:\"restorePostgres\" graphql:\"restorePostgres\"" + CreateGitRepository *GitRepository "json:\"createGitRepository\" graphql:\"createGitRepository\"" + CreateCluster *Cluster "json:\"createCluster\" graphql:\"createCluster\"" + UpdateCluster *Cluster "json:\"updateCluster\" graphql:\"updateCluster\"" + DeleteCluster *Cluster "json:\"deleteCluster\" graphql:\"deleteCluster\"" + CreateClusterProvider *ClusterProvider "json:\"createClusterProvider\" graphql:\"createClusterProvider\"" + UpdateClusterProvider *ClusterProvider "json:\"updateClusterProvider\" graphql:\"updateClusterProvider\"" + CreateServiceDeployment *ServiceDeployment "json:\"createServiceDeployment\" graphql:\"createServiceDeployment\"" + UpdateServiceDeployment *ServiceDeployment "json:\"updateServiceDeployment\" graphql:\"updateServiceDeployment\"" + DeleteServiceDeployment *ServiceDeployment "json:\"deleteServiceDeployment\" graphql:\"deleteServiceDeployment\"" + UpdateServiceComponents *ServiceDeployment "json:\"updateServiceComponents\" graphql:\"updateServiceComponents\"" + UpdateRbac *bool "json:\"updateRbac\" graphql:\"updateRbac\"" + UpdateDeploymentSettings *DeploymentSettings "json:\"updateDeploymentSettings\" graphql:\"updateDeploymentSettings\"" +} +type SrvDeployment struct { + ID string "json:\"id\" graphql:\"id\"" + Name string "json:\"name\" graphql:\"name\"" + Namespace string "json:\"namespace\" graphql:\"namespace\"" + Version string "json:\"version\" graphql:\"version\"" +} +type CreateServiceDeployment struct { + CreateServiceDeployment *SrvDeployment "json:\"createServiceDeployment\" graphql:\"createServiceDeployment\"" +} +type DeleteServiceDeployment struct { + DeleteServiceDeployment *SrvDeployment "json:\"deleteServiceDeployment\" graphql:\"deleteServiceDeployment\"" +} + +const CreateServiceDeploymentDocument = `mutation CreateServiceDeployment ($clusterId: ID!, $attributes: ServiceDeploymentAttributes!) { + createServiceDeployment(clusterId: $clusterId, attributes: $attributes) { + ... SrvDeployment + } +} +fragment SrvDeployment on ServiceDeployment { + id + name + namespace + version +} +` + +func (c *Client) CreateServiceDeployment(ctx context.Context, clusterID string, attributes ServiceDeploymentAttributes, httpRequestOptions ...client.HTTPRequestOption) (*CreateServiceDeployment, error) { + vars := map[string]interface{}{ + "clusterId": clusterID, + "attributes": attributes, + } + + var res CreateServiceDeployment + if err := c.Client.Post(ctx, "CreateServiceDeployment", CreateServiceDeploymentDocument, &res, vars, httpRequestOptions...); err != nil { + return nil, err + } + + return &res, nil +} + +const DeleteServiceDeploymentDocument = `mutation DeleteServiceDeployment ($id: ID!) { + deleteServiceDeployment(id: $id) { + ... SrvDeployment + } +} +fragment SrvDeployment on ServiceDeployment { + id + name + namespace + version +} +` + +func (c *Client) DeleteServiceDeployment(ctx context.Context, id string, httpRequestOptions ...client.HTTPRequestOption) (*DeleteServiceDeployment, error) { + vars := map[string]interface{}{ + "id": id, + } + + var res DeleteServiceDeployment + if err := c.Client.Post(ctx, "DeleteServiceDeployment", DeleteServiceDeploymentDocument, &res, vars, httpRequestOptions...); err != nil { + return nil, err + } + + return &res, nil +} diff --git a/example/main.go b/example/main.go new file mode 100644 index 0000000..a3b171e --- /dev/null +++ b/example/main.go @@ -0,0 +1,47 @@ +package main + +import ( + "context" + "fmt" + "net/http" + "os" + + "github.com/pluralsh/gqlclient" +) + +type authedTransport struct { + key string + wrapped http.RoundTripper +} + +func (t *authedTransport) RoundTrip(req *http.Request) (*http.Response, error) { + req.Header.Set("Authorization", "Bearer "+t.key) + return t.wrapped.RoundTrip(req) +} + +func main() { + var err error + defer func() { + if err != nil { + fmt.Println(err) + os.Exit(1) + } + }() + + key := "PASTE YOUR KEY HERE FROM https://app.plural.sh/profile/tokens" + + httpClient := http.Client{ + Transport: &authedTransport{ + key: key, + wrapped: http.DefaultTransport, + }, + } + graphqlClient := gqlclient.NewClient(&httpClient, "https://app.plural.sh/gql") + + meResp, err := graphqlClient.Me(context.Background()) + if err != nil { + return + } + fmt.Println("you are", meResp.Me) + +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..03c69fa --- /dev/null +++ b/go.mod @@ -0,0 +1,32 @@ +module github.com/pluralsh/gqlclient-console + +go 1.18 + +require ( + github.com/Yamashou/gqlgenc v0.14.0 + github.com/schollz/progressbar/v3 v3.8.6 +) + +require ( + github.com/agnivade/levenshtein v1.1.1 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/urfave/cli/v2 v2.25.0 // indirect + github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect + golang.org/x/mod v0.9.0 // indirect + golang.org/x/text v0.8.0 // indirect + golang.org/x/tools v0.7.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) + +require ( + github.com/99designs/gqlgen v0.17.26 + github.com/mattn/go-runewidth v0.0.13 // indirect + github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect + github.com/rivo/uniseg v0.2.0 // indirect + github.com/vektah/gqlparser/v2 v2.5.1 // indirect + golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..71023dd --- /dev/null +++ b/go.sum @@ -0,0 +1,85 @@ +github.com/99designs/gqlgen v0.17.26 h1:fxgSTbPf1G30uWAWSoHd+9gSNMagmP04k58ThJ1/ikQ= +github.com/99designs/gqlgen v0.17.26/go.mod h1:i4rEatMrzzu6RXaHydq1nmEPZkb3bKQsnxNRHS4DQB4= +github.com/Yamashou/gqlgenc v0.14.0 h1:KVzUuVQKfl4Phm5Cw4yeFThDAxZoIBR9XLoK/4O1O6U= +github.com/Yamashou/gqlgenc v0.14.0/go.mod h1:+z+FRCtGrNmgTxweAUiCodOmQJLTCNtnRNAqhewf1Q8= +github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= +github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8= +github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= +github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g= +github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/hashicorp/golang-lru/v2 v2.0.1 h1:5pv5N1lT1fjLg2VQ5KWc7kmucp2x/kvFOnxuVTqZ6x4= +github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= +github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= +github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/schollz/progressbar/v3 v3.8.6 h1:QruMUdzZ1TbEP++S1m73OqRJk20ON11m6Wqv4EoGg8c= +github.com/schollz/progressbar/v3 v3.8.6/go.mod h1:W5IEwbJecncFGBvuEh4A7HT1nZZ6WNIL2i3qbnI0WKY= +github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/urfave/cli/v2 v2.25.0 h1:ykdZKuQey2zq0yin/l7JOm9Mh+pg72ngYMeB0ABn6q8= +github.com/urfave/cli/v2 v2.25.0/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc= +github.com/vektah/gqlparser/v2 v2.5.1 h1:ZGu+bquAY23jsxDRcYpWjttRZrUz07LbiY77gUOHcr4= +github.com/vektah/gqlparser/v2 v2.5.1/go.mod h1:mPgqFBu/woKTVYWyNk8cO3kh4S/f4aRFZrvOnp3hmCs= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 h1:71vQrMauZZhcTVK6KdYM+rklehEEwb3E+ZhaE5jrPrE= +golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= +golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/graph/deployment.graphql b/graph/deployment.graphql new file mode 100644 index 0000000..de0de5f --- /dev/null +++ b/graph/deployment.graphql @@ -0,0 +1,19 @@ +mutation CreateServiceDeployment($clusterId: ID!, $attributes: ServiceDeploymentAttributes!) { + createServiceDeployment(clusterId: $clusterId, attributes: $attributes) { + ...SrvDeployment + } +} + +mutation DeleteServiceDeployment($id: ID!) { + deleteServiceDeployment(id: $id) { + ...SrvDeployment + } +} + + +fragment SrvDeployment on ServiceDeployment { + id + name + namespace + version +} \ No newline at end of file diff --git a/hack/gen-api-client.sh b/hack/gen-api-client.sh new file mode 100755 index 0000000..9828919 --- /dev/null +++ b/hack/gen-api-client.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -euo pipefail + +cd $(dirname $0)/.. + +source hack/lib.sh + +CONTAINERIZE_IMAGE=golang:1.19 containerize ./hack/gen-api-client.sh +go run github.com/Yamashou/gqlgenc@v0.14.0 diff --git a/hack/lib.sh b/hack/lib.sh new file mode 100644 index 0000000..a9f4a08 --- /dev/null +++ b/hack/lib.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +echodate() { + # do not use -Is to keep this compatible with macOS + echo "[$(date +%Y-%m-%dT%H:%M:%S%:z)]" "$@" +} + +containerize() { + local cmd="$1" + local image="${CONTAINERIZE_IMAGE:-golang:1.18.4}" + local gocache="${CONTAINERIZE_GOCACHE:-/tmp/.gocache}" + local gomodcache="${CONTAINERIZE_GOMODCACHE:-/tmp/.gomodcache}" + local skip="${NO_CONTAINERIZE:-}" + + # short-circuit containerize when in some cases it needs to be avoided + [ -n "$skip" ] && return + + if ! [ -f /.dockerenv ]; then + echodate "Running $cmd in a Docker container using $image..." + mkdir -p "$gocache" + mkdir -p "$gomodcache" + + exec docker run \ + -v "$PWD":/go/src/pluralsh/gqlclient \ + -v "$gocache":"$gocache" \ + -v "$gomodcache":"$gomodcache" \ + -w /go/src/pluralsh/gqlclient \ + -e "GOCACHE=$gocache" \ + -e "GOMODCACHE=$gomodcache" \ + -u "$(id -u):$(id -g)" \ + --entrypoint="$cmd" \ + --rm \ + $image $@ + + exit $? + fi +} diff --git a/models_gen.go b/models_gen.go new file mode 100644 index 0000000..90d88ca --- /dev/null +++ b/models_gen.go @@ -0,0 +1,2465 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package gqlclient + +import ( + "fmt" + "io" + "strconv" +) + +// supported kubernetes objects fetchable in runbooks +type KubernetesData interface { + IsKubernetesData() +} + +type AccessToken struct { + ID *string `json:"id"` + Token *string `json:"token"` + Audits *AccessTokenAuditConnection `json:"audits"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type AccessTokenAudit struct { + ID *string `json:"id"` + IP *string `json:"ip"` + Timestamp *string `json:"timestamp"` + Count *int64 `json:"count"` + City *string `json:"city"` + Country *string `json:"country"` + Latitude *string `json:"latitude"` + Longitude *string `json:"longitude"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type AccessTokenAuditConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*AccessTokenAuditEdge `json:"edges"` +} + +type AccessTokenAuditEdge struct { + Node *AccessTokenAudit `json:"node"` + Cursor *string `json:"cursor"` +} + +type AccessTokenConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*AccessTokenEdge `json:"edges"` +} + +type AccessTokenEdge struct { + Node *AccessToken `json:"node"` + Cursor *string `json:"cursor"` +} + +type Account struct { + DelinquentAt *string `json:"delinquentAt"` + GrandfatheredUntil *string `json:"grandfatheredUntil"` + AvailableFeatures *AvailableFeatures `json:"availableFeatures"` + Subscription *PluralSubscription `json:"subscription"` +} + +type Application struct { + Name string `json:"name"` + Spec ApplicationSpec `json:"spec"` + Status ApplicationStatus `json:"status"` + Cost *CostAnalysis `json:"cost"` + License *License `json:"license"` + Configuration *Configuration `json:"configuration"` + Info *string `json:"info"` +} + +type ApplicationDelta struct { + Delta *Delta `json:"delta"` + Payload *Application `json:"payload"` +} + +type ApplicationDescriptor struct { + Type string `json:"type"` + Version string `json:"version"` + Description *string `json:"description"` + Icons []*string `json:"icons"` + Links []*ApplicationLink `json:"links"` +} + +type ApplicationInfoItem struct { + Type *string `json:"type"` + Name *string `json:"name"` + Value *string `json:"value"` +} + +type ApplicationLink struct { + URL *string `json:"url"` + Description *string `json:"description"` +} + +type ApplicationSpec struct { + Descriptor ApplicationDescriptor `json:"descriptor"` + Components []*Component `json:"components"` + Info []*ApplicationInfoItem `json:"info"` +} + +type ApplicationStatus struct { + Components []*StatusComponent `json:"components"` + Conditions []*StatusCondition `json:"conditions"` + ComponentsReady string `json:"componentsReady"` +} + +type Audit struct { + ID string `json:"id"` + Action AuditAction `json:"action"` + Type AuditType `json:"type"` + Repository *string `json:"repository"` + IP *string `json:"ip"` + City *string `json:"city"` + Country *string `json:"country"` + Latitude *string `json:"latitude"` + Longitude *string `json:"longitude"` + Actor *User `json:"actor"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type AuditConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*AuditEdge `json:"edges"` +} + +type AuditEdge struct { + Node *Audit `json:"node"` + Cursor *string `json:"cursor"` +} + +type AuditMetric struct { + Country *string `json:"country"` + Count *int64 `json:"count"` +} + +type AvailableFeatures struct { + Vpn *bool `json:"vpn"` + Audits *bool `json:"audits"` + UserManagement *bool `json:"userManagement"` + DatabaseManagement *bool `json:"databaseManagement"` +} + +type AwsCloud struct { + LaunchTemplateID *string `json:"launchTemplateId"` +} + +type AwsCloudAttributes struct { + LaunchTemplateID *string `json:"launchTemplateId,omitempty"` +} + +type AwsSettingsAttributes struct { + AccessKeyID string `json:"accessKeyId"` + SecretAccessKey string `json:"secretAccessKey"` +} + +type BindingAttributes struct { + ID *string `json:"id,omitempty"` + UserID *string `json:"userId,omitempty"` + GroupID *string `json:"groupId,omitempty"` +} + +type Build struct { + ID string `json:"id"` + Repository string `json:"repository"` + Type BuildType `json:"type"` + Status Status `json:"status"` + Message *string `json:"message"` + CompletedAt *string `json:"completedAt"` + Sha *string `json:"sha"` + Commands *CommandConnection `json:"commands"` + Creator *User `json:"creator"` + Approver *User `json:"approver"` + Changelogs []*Changelog `json:"changelogs"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type BuildAttributes struct { + Repository string `json:"repository"` + Type *BuildType `json:"type,omitempty"` + Message *string `json:"message,omitempty"` +} + +type BuildConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*BuildEdge `json:"edges"` +} + +type BuildDelta struct { + Delta *Delta `json:"delta"` + Payload *Build `json:"payload"` +} + +type BuildEdge struct { + Node *Build `json:"node"` + Cursor *string `json:"cursor"` +} + +type BuildInfo struct { + All *int64 `json:"all"` + Failed *int64 `json:"failed"` + Queued *int64 `json:"queued"` + Running *int64 `json:"running"` + Successful *int64 `json:"successful"` +} + +type Certificate struct { + Metadata Metadata `json:"metadata"` + Status CertificateStatus `json:"status"` + Spec CertificateSpec `json:"spec"` + Raw string `json:"raw"` + Events []*Event `json:"events"` +} + +type CertificateSpec struct { + DNSNames []*string `json:"dnsNames"` + SecretName string `json:"secretName"` + IssuerRef *IssuerRef `json:"issuerRef"` +} + +type CertificateStatus struct { + Conditions []*StatusCondition `json:"conditions"` + NotAfter *string `json:"notAfter"` + NotBefore *string `json:"notBefore"` + RenewalTime *string `json:"renewalTime"` +} + +type Changelog struct { + ID string `json:"id"` + Repo string `json:"repo"` + Tool string `json:"tool"` + Content *string `json:"content"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type CloneAttributes struct { + S3AccessKeyID *string `json:"s3AccessKeyId,omitempty"` + S3SecretAccessKey *string `json:"s3SecretAccessKey,omitempty"` + S3WalPath *string `json:"s3WalPath,omitempty"` + S3Endpoint *string `json:"s3Endpoint,omitempty"` + UID *string `json:"uid,omitempty"` +} + +type CloudProviderSettingsAttributes struct { + Aws *AwsSettingsAttributes `json:"aws,omitempty"` + Gcp *GcpSettingsAttributes `json:"gcp,omitempty"` +} + +type CloudSettings struct { + Aws *AwsCloud `json:"aws"` +} + +type CloudSettingsAttributes struct { + Aws *AwsCloudAttributes `json:"aws,omitempty"` +} + +type Cluster struct { + ID string `json:"id"` + Name string `json:"name"` + Version string `json:"version"` + DeletedAt *string `json:"deletedAt"` + ReadBindings []*PolicyBinding `json:"readBindings"` + WriteBindings []*PolicyBinding `json:"writeBindings"` + NodePools []*NodePool `json:"nodePools"` + Provider *ClusterProvider `json:"provider"` + Service *Service `json:"service"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type ClusterAttributes struct { + Name string `json:"name"` + ProviderID *string `json:"providerId,omitempty"` + Version string `json:"version"` + NodePools []*NodePoolAttributes `json:"nodePools,omitempty"` + ReadBindings []*PolicyBindingAttributes `json:"readBindings,omitempty"` + WriteBindings []*PolicyBindingAttributes `json:"writeBindings,omitempty"` +} + +type ClusterConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*ClusterEdge `json:"edges"` +} + +type ClusterEdge struct { + Node *Cluster `json:"node"` + Cursor *string `json:"cursor"` +} + +type ClusterInfo struct { + GitCommit *string `json:"gitCommit"` + GitVersion *string `json:"gitVersion"` + Platform *string `json:"platform"` + Version *string `json:"version"` +} + +type ClusterProvider struct { + ID string `json:"id"` + Name string `json:"name"` + Namespace string `json:"namespace"` + Cloud string `json:"cloud"` + Git GitRef `json:"git"` + Repository *GitRepository `json:"repository"` + Service *Service `json:"service"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type ClusterProviderAttributes struct { + Name string `json:"name"` + Namespace *string `json:"namespace,omitempty"` + Cloud *string `json:"cloud,omitempty"` + CloudSettings *CloudProviderSettingsAttributes `json:"cloudSettings,omitempty"` +} + +type ClusterProviderConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*ClusterProviderEdge `json:"edges"` +} + +type ClusterProviderEdge struct { + Node *ClusterProvider `json:"node"` + Cursor *string `json:"cursor"` +} + +type ClusterProviderUpdateAttributes struct { + CloudSettings *CloudProviderSettingsAttributes `json:"cloudSettings,omitempty"` +} + +type ClusterUpdateAttributes struct { + Version string `json:"version"` + NodePools []*NodePoolAttributes `json:"nodePools,omitempty"` + ReadBindings []*PolicyBindingAttributes `json:"readBindings,omitempty"` + WriteBindings []*PolicyBindingAttributes `json:"writeBindings,omitempty"` +} + +type Command struct { + ID string `json:"id"` + Command string `json:"command"` + ExitCode *int64 `json:"exitCode"` + Stdout *string `json:"stdout"` + CompletedAt *string `json:"completedAt"` + Build *Build `json:"build"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type CommandConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*CommandEdge `json:"edges"` +} + +type CommandDelta struct { + Delta *Delta `json:"delta"` + Payload *Command `json:"payload"` +} + +type CommandEdge struct { + Node *Command `json:"node"` + Cursor *string `json:"cursor"` +} + +type Component struct { + Group string `json:"group"` + Kind string `json:"kind"` +} + +type ComponentAttributes struct { + State *ComponentState `json:"state,omitempty"` + Synced bool `json:"synced"` + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Namespace string `json:"namespace"` + Name string `json:"name"` +} + +type ConfigAttributes struct { + Name string `json:"name"` + Value string `json:"value"` +} + +type ConfigMap struct { + Metadata Metadata `json:"metadata"` + Data map[string]interface{} `json:"data"` + Raw string `json:"raw"` +} + +type Configuration struct { + Terraform *string `json:"terraform"` + Helm *string `json:"helm"` +} + +type ConfigurationAction struct { + Updates []*PathUpdate `json:"updates"` +} + +type ConfigurationCondition struct { + Field *string `json:"field"` + Value *string `json:"value"` + Operation *string `json:"operation"` +} + +type ConfigurationItem struct { + Name *string `json:"name"` + Type *string `json:"type"` + Placeholder *string `json:"placeholder"` + Documentation *string `json:"documentation"` + Default *string `json:"default"` + Optional *bool `json:"optional"` + Condition *ConfigurationCondition `json:"condition"` + Validation *ConfigurationValidation `json:"validation"` +} + +type ConfigurationOverlay struct { + Metadata Metadata `json:"metadata"` + Spec ConfigurationOverlaySpec `json:"spec"` +} + +type ConfigurationOverlaySpec struct { + Name *string `json:"name"` + Folder *string `json:"folder"` + Subfolder *string `json:"subfolder"` + Documentation *string `json:"documentation"` + Updates []*OverlayUpdate `json:"updates"` + InputType *string `json:"inputType"` + InputValues []*string `json:"inputValues"` +} + +type ConfigurationValidation struct { + Type *string `json:"type"` + Regex *string `json:"regex"` + Message *string `json:"message"` +} + +type ConsoleConfiguration struct { + GitCommit *string `json:"gitCommit"` + IsDemoProject *bool `json:"isDemoProject"` + IsSandbox *bool `json:"isSandbox"` + PluralLogin *bool `json:"pluralLogin"` + VpnEnabled *bool `json:"vpnEnabled"` + Features *AvailableFeatures `json:"features"` + Manifest *PluralManifest `json:"manifest"` + GitStatus *GitStatus `json:"gitStatus"` +} + +type Container struct { + Image *string `json:"image"` + Name *string `json:"name"` + Ports []*Port `json:"ports"` + Resources *Resources `json:"resources"` +} + +type ContainerRecommendation struct { + Name *string `json:"name"` + ContainerName *string `json:"containerName"` + Target *ContainerResources `json:"target"` + LowerBound *ContainerResources `json:"lowerBound"` + UpperBound *ContainerResources `json:"upperBound"` + UncappedTarget *ContainerResources `json:"uncappedTarget"` +} + +type ContainerResources struct { + CPU *string `json:"cpu"` + Memory *string `json:"memory"` +} + +type ContainerState struct { + Running *RunningState `json:"running"` + Terminated *TerminatedState `json:"terminated"` + Waiting *WaitingState `json:"waiting"` +} + +type ContainerStatus struct { + RestartCount *int64 `json:"restartCount"` + Ready *bool `json:"ready"` + Name *string `json:"name"` + Image *string `json:"image"` + State *ContainerState `json:"state"` +} + +type ContextAttributes struct { + Buckets []*string `json:"buckets,omitempty"` + Domain []*string `json:"domain,omitempty"` + Configuration map[string]interface{} `json:"configuration"` + Protect []*string `json:"protect,omitempty"` +} + +type CostAnalysis struct { + Minutes *float64 `json:"minutes"` + CPUCost *float64 `json:"cpuCost"` + CPUEfficiency *float64 `json:"cpuEfficiency"` + Efficiency *float64 `json:"efficiency"` + GpuCost *float64 `json:"gpuCost"` + NetworkCost *float64 `json:"networkCost"` + PvCost *float64 `json:"pvCost"` + RAMCost *float64 `json:"ramCost"` + RAMEfficiency *float64 `json:"ramEfficiency"` + TotalCost *float64 `json:"totalCost"` + SharedCost *float64 `json:"sharedCost"` +} + +type CronJob struct { + Metadata Metadata `json:"metadata"` + Status CronStatus `json:"status"` + Spec CronSpec `json:"spec"` + Raw string `json:"raw"` + Events []*Event `json:"events"` + Jobs []*Job `json:"jobs"` +} + +type CronSpec struct { + Schedule string `json:"schedule"` + Suspend *bool `json:"suspend"` + ConcurrencyPolicy *string `json:"concurrencyPolicy"` +} + +type CronStatus struct { + Active []*JobReference `json:"active"` + LastScheduleTime *string `json:"lastScheduleTime"` +} + +type CrossVersionResourceTarget struct { + APIVersion *string `json:"apiVersion"` + Kind *string `json:"kind"` + Name *string `json:"name"` +} + +type Dashboard struct { + ID string `json:"id"` + Spec DashboardSpec `json:"spec"` +} + +type DashboardGraph struct { + Name string `json:"name"` + Queries []*DashboardMetric `json:"queries"` + Format *string `json:"format"` +} + +type DashboardLabel struct { + Name string `json:"name"` + Values []*string `json:"values"` +} + +type DashboardMetric struct { + Legend *string `json:"legend"` + Query *string `json:"query"` + Results []*MetricResult `json:"results"` +} + +type DashboardSpec struct { + Name *string `json:"name"` + Description *string `json:"description"` + Timeslices []*string `json:"timeslices"` + Labels []*DashboardLabel `json:"labels"` + Graphs []*DashboardGraph `json:"graphs"` +} + +type DatabaseVolume struct { + Size *string `json:"size"` +} + +type Deployment struct { + Metadata Metadata `json:"metadata"` + Status DeploymentStatus `json:"status"` + Spec DeploymentSpec `json:"spec"` + Pods []*Pod `json:"pods"` + Raw string `json:"raw"` + Events []*Event `json:"events"` +} + +func (Deployment) IsKubernetesData() {} + +type DeploymentSettings struct { + ID string `json:"id"` + Name string `json:"name"` + ArtifactRepository *GitRepository `json:"artifactRepository"` + DeployerRepository *GitRepository `json:"deployerRepository"` + ReadBindings []*PolicyBinding `json:"readBindings"` + WriteBindings []*PolicyBinding `json:"writeBindings"` + GitBindings []*PolicyBinding `json:"gitBindings"` + CreateBindings []*PolicyBinding `json:"createBindings"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type DeploymentSettingsAttributes struct { + ArtifactRepositoryID *string `json:"artifactRepositoryId,omitempty"` + DeployerRepositoryID *string `json:"deployerRepositoryId,omitempty"` + ReadBindings []*PolicyBindingAttributes `json:"readBindings,omitempty"` + WriteBindings []*PolicyBindingAttributes `json:"writeBindings,omitempty"` + GitBindings []*PolicyBindingAttributes `json:"gitBindings,omitempty"` + CreateBindings []*PolicyBindingAttributes `json:"createBindings,omitempty"` +} + +type DeploymentSpec struct { + Replicas *int64 `json:"replicas"` + Strategy *DeploymentStrategy `json:"strategy"` +} + +type DeploymentStatus struct { + AvailableReplicas *int64 `json:"availableReplicas"` + Replicas *int64 `json:"replicas"` + ReadyReplicas *int64 `json:"readyReplicas"` + UnavailableReplicas *int64 `json:"unavailableReplicas"` +} + +type DeploymentStrategy struct { + Type *string `json:"type"` + RollingUpdate *RollingUpdate `json:"rollingUpdate"` +} + +type Event struct { + Action *string `json:"action"` + Count *int64 `json:"count"` + EventTime *string `json:"eventTime"` + LastTimestamp *string `json:"lastTimestamp"` + Message *string `json:"message"` + Reason *string `json:"reason"` + Type *string `json:"type"` +} + +type FileContent struct { + Path *string `json:"path"` + Content *string `json:"content"` +} + +type GcpSettingsAttributes struct { + ApplicationCredentials string `json:"applicationCredentials"` +} + +type GitAttributes struct { + URL string `json:"url"` + PrivateKey *string `json:"privateKey,omitempty"` + Passphrase *string `json:"passphrase,omitempty"` + Username *string `json:"username,omitempty"` + Password *string `json:"password,omitempty"` +} + +type GitRef struct { + Ref string `json:"ref"` + Folder string `json:"folder"` +} + +type GitRefAttributes struct { + Ref string `json:"ref"` + Folder string `json:"folder"` +} + +type GitRepository struct { + ID string `json:"id"` + URL string `json:"url"` + AuthMethod *AuthMethod `json:"authMethod"` + Health *GitHealth `json:"health"` + PulledAt *string `json:"pulledAt"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type GitRepositoryConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*GitRepositoryEdge `json:"edges"` +} + +type GitRepositoryEdge struct { + Node *GitRepository `json:"node"` + Cursor *string `json:"cursor"` +} + +type GitStatus struct { + Cloned *bool `json:"cloned"` + Output *string `json:"output"` +} + +type Group struct { + ID string `json:"id"` + Name string `json:"name"` + Description *string `json:"description"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type GroupAttributes struct { + Name string `json:"name"` + Description *string `json:"description,omitempty"` +} + +type GroupConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*GroupEdge `json:"edges"` +} + +type GroupEdge struct { + Node *Group `json:"node"` + Cursor *string `json:"cursor"` +} + +type GroupMember struct { + ID string `json:"id"` + User *User `json:"user"` + Group *Group `json:"group"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type GroupMemberConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*GroupMemberEdge `json:"edges"` +} + +type GroupMemberEdge struct { + Node *GroupMember `json:"node"` + Cursor *string `json:"cursor"` +} + +type HTTPIngressRule struct { + Paths []*IngressPath `json:"paths"` +} + +type Ingress struct { + Metadata Metadata `json:"metadata"` + Status ServiceStatus `json:"status"` + Spec IngressSpec `json:"spec"` + Certificates []*Certificate `json:"certificates"` + Raw string `json:"raw"` + Events []*Event `json:"events"` +} + +type IngressBackend struct { + ServiceName *string `json:"serviceName"` + ServicePort *string `json:"servicePort"` +} + +type IngressPath struct { + Backend *IngressBackend `json:"backend"` + Path *string `json:"path"` +} + +type IngressRule struct { + Host *string `json:"host"` + HTTP *HTTPIngressRule `json:"http"` +} + +type IngressSpec struct { + Rules []*IngressRule `json:"rules"` + TLS []*IngressTLS `json:"tls"` +} + +type IngressTLS struct { + Hosts []*string `json:"hosts"` +} + +type Installation struct { + ID string `json:"id"` + Repository *Repository `json:"repository"` +} + +type InstallationConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*InstallationEdge `json:"edges"` +} + +type InstallationEdge struct { + Node *Installation `json:"node"` + Cursor *string `json:"cursor"` +} + +type Invite struct { + SecureID string `json:"secureId"` + Email *string `json:"email"` +} + +type InviteAttributes struct { + Email *string `json:"email,omitempty"` +} + +type IssuerRef struct { + Group *string `json:"group"` + Kind *string `json:"kind"` + Name *string `json:"name"` +} + +type Job struct { + Metadata Metadata `json:"metadata"` + Status JobStatus `json:"status"` + Spec JobSpec `json:"spec"` + Raw string `json:"raw"` + Events []*Event `json:"events"` + Pods []*Pod `json:"pods"` +} + +type JobReference struct { + Name string `json:"name"` + Namespace string `json:"namespace"` +} + +type JobSpec struct { + BackoffLimit *int64 `json:"backoffLimit"` + Parallelism *int64 `json:"parallelism"` + ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds"` +} + +type JobStatus struct { + Active *int64 `json:"active"` + CompletionTime *string `json:"completionTime"` + StartTime *string `json:"startTime"` + Succeeded *int64 `json:"succeeded"` + Failed *int64 `json:"failed"` +} + +type KubernetesDatasource struct { + Resource string `json:"resource"` + Name string `json:"name"` +} + +type LabelInput struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +type LabelPair struct { + Name *string `json:"name"` + Value *string `json:"value"` +} + +type License struct { + Metadata Metadata `json:"metadata"` + Spec LicenseSpec `json:"spec"` + Status *LicenseStatus `json:"status"` +} + +type LicenseFeature struct { + Name string `json:"name"` + Description *string `json:"description"` +} + +type LicenseSpec struct { + SecretRef SecretKeySelector `json:"secretRef"` +} + +type LicenseStatus struct { + Plan *string `json:"plan"` + Free *bool `json:"free"` + Features []*LicenseFeature `json:"features"` + Limits map[string]interface{} `json:"limits"` + Secrets map[string]interface{} `json:"secrets"` +} + +type LoadBalancerIngressStatus struct { + Hostname *string `json:"hostname"` + IP *string `json:"ip"` +} + +type LoadBalancerStatus struct { + Ingress []*LoadBalancerIngressStatus `json:"ingress"` +} + +type LogFilter struct { + Metadata Metadata `json:"metadata"` + Spec LogFilterSpec `json:"spec"` +} + +type LogFilterSpec struct { + Name *string `json:"name"` + Description *string `json:"description"` + Query *string `json:"query"` + Labels []*LogLabel `json:"labels"` +} + +type LogLabel struct { + Name *string `json:"name"` + Value *string `json:"value"` +} + +type LogStream struct { + Stream map[string]interface{} `json:"stream"` + Values []*MetricResult `json:"values"` +} + +type LoginInfo struct { + OidcURI *string `json:"oidcUri"` +} + +type ManifestNetwork struct { + PluralDNS *bool `json:"pluralDns"` + Subdomain *string `json:"subdomain"` +} + +type Metadata struct { + Labels []*LabelPair `json:"labels"` + Annotations []*LabelPair `json:"annotations"` + Name string `json:"name"` + Namespace *string `json:"namespace"` + CreationTimestamp *string `json:"creationTimestamp"` +} + +type MetricResponse struct { + Metric map[string]interface{} `json:"metric"` + Values []*MetricResult `json:"values"` +} + +type MetricResult struct { + Timestamp *int64 `json:"timestamp"` + Value *string `json:"value"` +} + +type Namespace struct { + Status NamespaceStatus `json:"status"` + Spec NamespaceSpec `json:"spec"` + Metadata Metadata `json:"metadata"` + Raw string `json:"raw"` + Events []*Event `json:"events"` +} + +type NamespaceSpec struct { + Finalizers []*string `json:"finalizers"` +} + +type NamespaceStatus struct { + Phase *string `json:"phase"` +} + +type Node struct { + Status NodeStatus `json:"status"` + Spec NodeSpec `json:"spec"` + Metadata Metadata `json:"metadata"` + Raw string `json:"raw"` + Pods []*Pod `json:"pods"` + Events []*Event `json:"events"` +} + +type NodeCondition struct { + Message *string `json:"message"` + Reason *string `json:"reason"` + Status *string `json:"status"` + Type *string `json:"type"` +} + +type NodeMetric struct { + Metadata Metadata `json:"metadata"` + Timestamp *string `json:"timestamp"` + Window *string `json:"window"` + Usage *NodeUsage `json:"usage"` +} + +type NodePool struct { + ID string `json:"id"` + Name string `json:"name"` + MinSize int64 `json:"minSize"` + MaxSize int64 `json:"maxSize"` + InstanceType string `json:"instanceType"` + Labels map[string]interface{} `json:"labels"` + Taints []*Taint `json:"taints"` + CloudSettings *CloudSettings `json:"cloudSettings"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type NodePoolAttributes struct { + Name string `json:"name"` + MinSize int64 `json:"minSize"` + MaxSize int64 `json:"maxSize"` + InstanceType string `json:"instanceType"` + Labels map[string]interface{} `json:"labels,omitempty"` + Taints []*TaintAttributes `json:"taints,omitempty"` + CloudSettings *CloudSettingsAttributes `json:"cloudSettings,omitempty"` +} + +type NodeSpec struct { + PodCidr *string `json:"podCidr"` + ProviderID *string `json:"providerId"` + Unschedulable *bool `json:"unschedulable"` +} + +type NodeStatus struct { + Allocatable map[string]interface{} `json:"allocatable"` + Capacity map[string]interface{} `json:"capacity"` + Phase *string `json:"phase"` + Conditions []*NodeCondition `json:"conditions"` +} + +type NodeUsage struct { + CPU *string `json:"cpu"` + Memory *string `json:"memory"` +} + +type Notification struct { + ID string `json:"id"` + Title string `json:"title"` + Description *string `json:"description"` + Fingerprint string `json:"fingerprint"` + Status *NotificationStatus `json:"status"` + Labels map[string]interface{} `json:"labels"` + Annotations map[string]interface{} `json:"annotations"` + Repository string `json:"repository"` + SeenAt *string `json:"seenAt"` + Severity *Severity `json:"severity"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type NotificationConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*NotificationEdge `json:"edges"` +} + +type NotificationDelta struct { + Delta *Delta `json:"delta"` + Payload *Notification `json:"payload"` +} + +type NotificationEdge struct { + Node *Notification `json:"node"` + Cursor *string `json:"cursor"` +} + +type OverlayUpdate struct { + Path []*string `json:"path"` +} + +type PageInfo struct { + // When paginating backwards, are there more items? + HasPreviousPage bool `json:"hasPreviousPage"` + // When paginating forwards, are there more items? + HasNextPage bool `json:"hasNextPage"` + // When paginating backwards, the cursor to continue. + StartCursor *string `json:"startCursor"` + // When paginating forwards, the cursor to continue. + EndCursor *string `json:"endCursor"` +} + +type PathUpdate struct { + Path []*string `json:"path"` + ValueFrom string `json:"valueFrom"` +} + +type Plan struct { + ID *string `json:"id"` + Name *string `json:"name"` + Period *string `json:"period"` +} + +type PluralContext struct { + Buckets []*string `json:"buckets"` + Domains []*string `json:"domains"` + Configuration map[string]interface{} `json:"configuration"` +} + +type PluralManifest struct { + Network *ManifestNetwork `json:"network"` + BucketPrefix *string `json:"bucketPrefix"` + Cluster *string `json:"cluster"` +} + +type PluralSubscription struct { + ID *string `json:"id"` + Plan *Plan `json:"plan"` +} + +type Pod struct { + Status PodStatus `json:"status"` + Spec PodSpec `json:"spec"` + Metadata Metadata `json:"metadata"` + Raw string `json:"raw"` + Events []*Event `json:"events"` +} + +type PodCondition struct { + LastProbeTime *string `json:"lastProbeTime"` + LastTransitionTime *string `json:"lastTransitionTime"` + Message *string `json:"message"` + Reason *string `json:"reason"` + Status *string `json:"status"` + Type *string `json:"type"` +} + +type PodConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*PodEdge `json:"edges"` +} + +type PodDelta struct { + Delta *Delta `json:"delta"` + Payload *Pod `json:"payload"` +} + +type PodEdge struct { + Node *Pod `json:"node"` + Cursor *string `json:"cursor"` +} + +type PodSpec struct { + ServiceAccountName *string `json:"serviceAccountName"` + NodeName *string `json:"nodeName"` + Containers []*Container `json:"containers"` + InitContainers []*Container `json:"initContainers"` +} + +type PodStatus struct { + Message *string `json:"message"` + Phase *string `json:"phase"` + HostIP *string `json:"hostIp"` + PodIP *string `json:"podIp"` + Reason *string `json:"reason"` + Conditions []*PodCondition `json:"conditions"` + ContainerStatuses []*ContainerStatus `json:"containerStatuses"` + InitContainerStatuses []*ContainerStatus `json:"initContainerStatuses"` +} + +type PolicyBinding struct { + ID *string `json:"id"` + User *User `json:"user"` + Group *Group `json:"group"` +} + +type PolicyBindingAttributes struct { + ID *string `json:"id,omitempty"` + UserID *string `json:"userId,omitempty"` + GroupID *string `json:"groupId,omitempty"` +} + +type Port struct { + HostPort *int64 `json:"hostPort"` + ContainerPort *int64 `json:"containerPort"` + Protocol *string `json:"protocol"` +} + +type PostgresInstance struct { + UID string `json:"uid"` +} + +type PostgresSettings struct { + Version *string `json:"version"` +} + +type Postgresql struct { + Metadata Metadata `json:"metadata"` + Spec PostgresqlSpec `json:"spec"` + Status *PostgresqlStatus `json:"status"` + Instances []*PostgresInstance `json:"instances"` +} + +type PostgresqlSpec struct { + TeamID *string `json:"teamId"` + Users map[string]interface{} `json:"users"` + Resources *Resources `json:"resources"` + Postgresql *PostgresSettings `json:"postgresql"` + NumberOfInstances *int64 `json:"numberOfInstances"` + Databases map[string]interface{} `json:"databases"` + Volume *DatabaseVolume `json:"volume"` + Pods []*Pod `json:"pods"` +} + +type PostgresqlStatus struct { + ClusterStatus *string `json:"clusterStatus"` +} + +type PrometheusDatasource struct { + Query string `json:"query"` + Format *string `json:"format"` + Legend *string `json:"legend"` +} + +type RbacAttributes struct { + ReadBindings []*PolicyBindingAttributes `json:"readBindings,omitempty"` + WriteBindings []*PolicyBindingAttributes `json:"writeBindings,omitempty"` +} + +type Recipe struct { + ID string `json:"id"` + Name string `json:"name"` + Description *string `json:"description"` + Provider *string `json:"provider"` + Restricted *bool `json:"restricted"` + RecipeSections []*RecipeSection `json:"recipeSections"` + OidcEnabled *bool `json:"oidcEnabled"` +} + +type RecipeConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*RecipeEdge `json:"edges"` +} + +type RecipeEdge struct { + Node *Recipe `json:"node"` + Cursor *string `json:"cursor"` +} + +type RecipeItem struct { + ID string `json:"id"` + Configuration []*ConfigurationItem `json:"configuration"` +} + +type RecipeSection struct { + ID string `json:"id"` + Repository *Repository `json:"repository"` + RecipeItems []*RecipeItem `json:"recipeItems"` + Configuration []*ConfigurationItem `json:"configuration"` +} + +type Recommendation struct { + ContainerRecommendations []*ContainerRecommendation `json:"containerRecommendations"` +} + +type Repository struct { + ID string `json:"id"` + Name string `json:"name"` + Description *string `json:"description"` + Icon *string `json:"icon"` + Docs []*FileContent `json:"docs"` + Configuration *Configuration `json:"configuration"` + GrafanaDNS *string `json:"grafanaDns"` +} + +type RepositoryConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*RepositoryEdge `json:"edges"` +} + +type RepositoryContext struct { + Repository string `json:"repository"` + Context map[string]interface{} `json:"context"` +} + +type RepositoryEdge struct { + Node *Repository `json:"node"` + Cursor *string `json:"cursor"` +} + +type ResourceSpec struct { + CPU *string `json:"cpu"` + Memory *string `json:"memory"` +} + +type Resources struct { + Limits *ResourceSpec `json:"limits"` + Requests *ResourceSpec `json:"requests"` +} + +type Revision struct { + ID string `json:"id"` + Version string `json:"version"` + Git GitRef `json:"git"` + Sha *string `json:"sha"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type RevisionConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*RevisionEdge `json:"edges"` +} + +type RevisionEdge struct { + Node *Revision `json:"node"` + Cursor *string `json:"cursor"` +} + +type Role struct { + ID string `json:"id"` + Name string `json:"name"` + Description *string `json:"description"` + Repositories []*string `json:"repositories"` + Permissions []*Permission `json:"permissions"` + RoleBindings []*RoleBinding `json:"roleBindings"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type RoleAttributes struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Repositories []*string `json:"repositories,omitempty"` + RoleBindings []*BindingAttributes `json:"roleBindings,omitempty"` + Permissions []*Permission `json:"permissions,omitempty"` +} + +type RoleBinding struct { + ID string `json:"id"` + User *User `json:"user"` + Group *Group `json:"group"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type RoleConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*RoleEdge `json:"edges"` +} + +type RoleEdge struct { + Node *Role `json:"node"` + Cursor *string `json:"cursor"` +} + +type RollingUpdate struct { + MaxSurge *int64 `json:"maxSurge"` + MaxUnavailable *int64 `json:"maxUnavailable"` +} + +type Runbook struct { + Name string `json:"name"` + Spec RunbookSpec `json:"spec"` + Status *RunbookStatus `json:"status"` + Data []*RunbookData `json:"data"` + Executions *RunbookExecutionConnection `json:"executions"` +} + +type RunbookAction struct { + Name string `json:"name"` + Type string `json:"type"` + Configuration *ConfigurationAction `json:"configuration"` +} + +type RunbookActionInput struct { + Action string `json:"action"` + Context map[string]interface{} `json:"context"` +} + +type RunbookActionResponse struct { + RedirectTo *string `json:"redirectTo"` +} + +type RunbookAlertStatus struct { + Name string `json:"name"` + StartsAt *string `json:"startsAt"` + Fingerprint *string `json:"fingerprint"` + Annotations map[string]interface{} `json:"annotations"` + Labels map[string]interface{} `json:"labels"` +} + +type RunbookContext struct { + TimeseriesStart *int64 `json:"timeseriesStart,omitempty"` + TimeseriesStep *string `json:"timeseriesStep,omitempty"` +} + +type RunbookData struct { + Name string `json:"name"` + Source *RunbookDatasource `json:"source"` + Kubernetes KubernetesData `json:"kubernetes"` + Prometheus []*MetricResponse `json:"prometheus"` + Nodes []*Node `json:"nodes"` +} + +type RunbookDatasource struct { + Name string `json:"name"` + Type string `json:"type"` + Prometheus *PrometheusDatasource `json:"prometheus"` + Kubernetes *KubernetesDatasource `json:"kubernetes"` +} + +type RunbookExecution struct { + ID string `json:"id"` + Name string `json:"name"` + Namespace string `json:"namespace"` + Context map[string]interface{} `json:"context"` + User *User `json:"user"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type RunbookExecutionConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*RunbookExecutionEdge `json:"edges"` +} + +type RunbookExecutionEdge struct { + Node *RunbookExecution `json:"node"` + Cursor *string `json:"cursor"` +} + +type RunbookSpec struct { + Name string `json:"name"` + Description *string `json:"description"` + Display map[string]interface{} `json:"display"` + Datasources []*RunbookDatasource `json:"datasources"` + Actions []*RunbookAction `json:"actions"` +} + +type RunbookStatus struct { + Alerts []*RunbookAlertStatus `json:"alerts"` +} + +type RunningState struct { + StartedAt *string `json:"startedAt"` +} + +type Secret struct { + Metadata Metadata `json:"metadata"` + Type *string `json:"type"` + Data map[string]interface{} `json:"data"` +} + +type SecretKeySelector struct { + Name string `json:"name"` + Key *string `json:"key"` +} + +type Service struct { + Metadata Metadata `json:"metadata"` + Status ServiceStatus `json:"status"` + Spec ServiceSpec `json:"spec"` + Pods []*Pod `json:"pods"` + Raw string `json:"raw"` + Events []*Event `json:"events"` +} + +type ServiceComponent struct { + ID string `json:"id"` + State *ComponentState `json:"state"` + Synced bool `json:"synced"` + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Namespace string `json:"namespace"` + Name string `json:"name"` +} + +type ServiceConfiguration struct { + Name string `json:"name"` + Value string `json:"value"` +} + +type ServiceDeployment struct { + ID string `json:"id"` + Name string `json:"name"` + Namespace string `json:"namespace"` + Version string `json:"version"` + Git GitRef `json:"git"` + Sha *string `json:"sha"` + Tarball *string `json:"tarball"` + DeletedAt *string `json:"deletedAt"` + Repository *GitRepository `json:"repository"` + ReadBindings []*PolicyBinding `json:"readBindings"` + WriteBindings []*PolicyBinding `json:"writeBindings"` + Configuration []*ServiceConfiguration `json:"configuration"` + Components []*ServiceComponent `json:"components"` + Revisions *RevisionConnection `json:"revisions"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type ServiceDeploymentAttributes struct { + Name string `json:"name"` + Namespace string `json:"namespace"` + Version *string `json:"version,omitempty"` + RepositoryID string `json:"repositoryId"` + Git GitRefAttributes `json:"git"` + Configuration []*ConfigAttributes `json:"configuration,omitempty"` + ReadBindings []*PolicyBindingAttributes `json:"readBindings,omitempty"` + WriteBindings []*PolicyBindingAttributes `json:"writeBindings,omitempty"` +} + +type ServiceDeploymentConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*ServiceDeploymentEdge `json:"edges"` +} + +type ServiceDeploymentEdge struct { + Node *ServiceDeployment `json:"node"` + Cursor *string `json:"cursor"` +} + +type ServicePort struct { + Name *string `json:"name"` + Protocol *string `json:"protocol"` + Port *int64 `json:"port"` + TargetPort *string `json:"targetPort"` +} + +type ServiceSpec struct { + Type *string `json:"type"` + ClusterIP *string `json:"clusterIp"` + Selector map[string]interface{} `json:"selector"` + Ports []*ServicePort `json:"ports"` +} + +type ServiceStatus struct { + LoadBalancer *LoadBalancerStatus `json:"loadBalancer"` +} + +type ServiceUpdateAttributes struct { + Version *string `json:"version,omitempty"` + Git GitRefAttributes `json:"git"` + Configuration []*ConfigAttributes `json:"configuration,omitempty"` +} + +type SMTP struct { + Server *string `json:"server"` + Port *int64 `json:"port"` + Password *string `json:"password"` + Sender *string `json:"sender"` + User *string `json:"user"` +} + +type SMTPInput struct { + Server *string `json:"server,omitempty"` + Port *int64 `json:"port,omitempty"` + Password *string `json:"password,omitempty"` + Sender *string `json:"sender,omitempty"` + User *string `json:"user,omitempty"` +} + +type Stack struct { + ID string `json:"id"` + Name string `json:"name"` + Bundles []*Recipe `json:"bundles"` + Sections []*RecipeSection `json:"sections"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type StatefulSet struct { + Metadata Metadata `json:"metadata"` + Status StatefulSetStatus `json:"status"` + Spec StatefulSetSpec `json:"spec"` + Pods []*Pod `json:"pods"` + Raw string `json:"raw"` + Events []*Event `json:"events"` +} + +func (StatefulSet) IsKubernetesData() {} + +type StatefulSetSpec struct { + Replicas *int64 `json:"replicas"` + ServiceName *string `json:"serviceName"` +} + +type StatefulSetStatus struct { + CurrentReplicas *int64 `json:"currentReplicas"` + Replicas *int64 `json:"replicas"` + ReadyReplicas *int64 `json:"readyReplicas"` + UpdatedReplicas *int64 `json:"updatedReplicas"` +} + +type StatusComponent struct { + Group *string `json:"group"` + Kind string `json:"kind"` + Name string `json:"name"` + Status string `json:"status"` +} + +type StatusCondition struct { + Message string `json:"message"` + Reason string `json:"reason"` + Status string `json:"status"` + Type string `json:"type"` +} + +type Taint struct { + Key string `json:"key"` + Value string `json:"value"` + Effect string `json:"effect"` +} + +type TaintAttributes struct { + Key string `json:"key"` + Value string `json:"value"` + Effect string `json:"effect"` +} + +type TerminatedState struct { + ExitCode *int64 `json:"exitCode"` + FinishedAt *string `json:"finishedAt"` + StartedAt *string `json:"startedAt"` + Message *string `json:"message"` + Reason *string `json:"reason"` +} + +type UpgradePolicy struct { + ID string `json:"id"` + Name string `json:"name"` + Description *string `json:"description"` + Repositories []*string `json:"repositories"` + Type UpgradePolicyType `json:"type"` + Target string `json:"target"` + Weight *int64 `json:"weight"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type UpgradePolicyAttributes struct { + Name string `json:"name"` + Description *string `json:"description,omitempty"` + Target string `json:"target"` + Type UpgradePolicyType `json:"type"` + Repositories []*string `json:"repositories,omitempty"` + Weight *int64 `json:"weight,omitempty"` +} + +type User struct { + ID string `json:"id"` + Name string `json:"name"` + Email string `json:"email"` + DeletedAt *string `json:"deletedAt"` + Profile *string `json:"profile"` + PluralID *string `json:"pluralId"` + Roles *UserRoles `json:"roles"` + ReadTimestamp *string `json:"readTimestamp"` + BuildTimestamp *string `json:"buildTimestamp"` + BoundRoles []*Role `json:"boundRoles"` + Jwt *string `json:"jwt"` + UnreadNotifications *int64 `json:"unreadNotifications"` + BackgroundColor *string `json:"backgroundColor"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type UserAttributes struct { + Name *string `json:"name,omitempty"` + Email *string `json:"email,omitempty"` + Password *string `json:"password,omitempty"` + Roles *UserRoleAttributes `json:"roles,omitempty"` +} + +type UserConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*UserEdge `json:"edges"` +} + +type UserEdge struct { + Node *User `json:"node"` + Cursor *string `json:"cursor"` +} + +type UserRoleAttributes struct { + Admin *bool `json:"admin,omitempty"` +} + +type UserRoles struct { + Admin *bool `json:"admin"` +} + +type VerticalPodAutoscaler struct { + Metadata Metadata `json:"metadata"` + Spec VerticalPodAutoscalerSpec `json:"spec"` + Status *VerticalPodAutoscalerStatus `json:"status"` +} + +type VerticalPodAutoscalerSpec struct { + TargetRef CrossVersionResourceTarget `json:"targetRef"` + UpdatePolicy VerticalPodAutoscalerUpdatePolicy `json:"updatePolicy"` +} + +type VerticalPodAutoscalerStatus struct { + Recommendation *Recommendation `json:"recommendation"` +} + +type VerticalPodAutoscalerUpdatePolicy struct { + UpdateMode *string `json:"updateMode"` +} + +type WaitingState struct { + Message *string `json:"message"` + Reason *string `json:"reason"` +} + +type Webhook struct { + ID string `json:"id"` + URL string `json:"url"` + Health WebhookHealth `json:"health"` + Type WebhookType `json:"type"` + InsertedAt *string `json:"insertedAt"` + UpdatedAt *string `json:"updatedAt"` +} + +type WebhookAttributes struct { + URL string `json:"url"` +} + +type WebhookConnection struct { + PageInfo PageInfo `json:"pageInfo"` + Edges []*WebhookEdge `json:"edges"` +} + +type WebhookEdge struct { + Node *Webhook `json:"node"` + Cursor *string `json:"cursor"` +} + +type WireguardPeer struct { + Metadata Metadata `json:"metadata"` + Status *WireguardPeerStatus `json:"status"` + Spec WireguardPeerSpec `json:"spec"` + Config *string `json:"config"` + User *User `json:"user"` + Raw string `json:"raw"` +} + +type WireguardPeerSpec struct { + WireguardRef *string `json:"wireguardRef"` + Address *string `json:"address"` + PublicKey *string `json:"publicKey"` +} + +type WireguardPeerStatus struct { + Ready *bool `json:"ready"` + Conditions []*StatusCondition `json:"conditions"` +} + +type AuditAction string + +const ( + AuditActionCreate AuditAction = "CREATE" + AuditActionUpdate AuditAction = "UPDATE" + AuditActionDelete AuditAction = "DELETE" + AuditActionApprove AuditAction = "APPROVE" + AuditActionCancel AuditAction = "CANCEL" +) + +var AllAuditAction = []AuditAction{ + AuditActionCreate, + AuditActionUpdate, + AuditActionDelete, + AuditActionApprove, + AuditActionCancel, +} + +func (e AuditAction) IsValid() bool { + switch e { + case AuditActionCreate, AuditActionUpdate, AuditActionDelete, AuditActionApprove, AuditActionCancel: + return true + } + return false +} + +func (e AuditAction) String() string { + return string(e) +} + +func (e *AuditAction) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = AuditAction(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid AuditAction", str) + } + return nil +} + +func (e AuditAction) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type AuditType string + +const ( + AuditTypeBuild AuditType = "BUILD" + AuditTypePod AuditType = "POD" + AuditTypeConfiguration AuditType = "CONFIGURATION" + AuditTypeUser AuditType = "USER" + AuditTypeGroup AuditType = "GROUP" + AuditTypeRole AuditType = "ROLE" + AuditTypeGroupMember AuditType = "GROUP_MEMBER" + AuditTypePolicy AuditType = "POLICY" + AuditTypeTempToken AuditType = "TEMP_TOKEN" + AuditTypeService AuditType = "SERVICE" + AuditTypeCluster AuditType = "CLUSTER" + AuditTypeClusterProvider AuditType = "CLUSTER_PROVIDER" + AuditTypeGitRepository AuditType = "GIT_REPOSITORY" + AuditTypeDeploymentSettings AuditType = "DEPLOYMENT_SETTINGS" +) + +var AllAuditType = []AuditType{ + AuditTypeBuild, + AuditTypePod, + AuditTypeConfiguration, + AuditTypeUser, + AuditTypeGroup, + AuditTypeRole, + AuditTypeGroupMember, + AuditTypePolicy, + AuditTypeTempToken, + AuditTypeService, + AuditTypeCluster, + AuditTypeClusterProvider, + AuditTypeGitRepository, + AuditTypeDeploymentSettings, +} + +func (e AuditType) IsValid() bool { + switch e { + case AuditTypeBuild, AuditTypePod, AuditTypeConfiguration, AuditTypeUser, AuditTypeGroup, AuditTypeRole, AuditTypeGroupMember, AuditTypePolicy, AuditTypeTempToken, AuditTypeService, AuditTypeCluster, AuditTypeClusterProvider, AuditTypeGitRepository, AuditTypeDeploymentSettings: + return true + } + return false +} + +func (e AuditType) String() string { + return string(e) +} + +func (e *AuditType) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = AuditType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid AuditType", str) + } + return nil +} + +func (e AuditType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type AuthMethod string + +const ( + AuthMethodBasic AuthMethod = "BASIC" + AuthMethodSSH AuthMethod = "SSH" +) + +var AllAuthMethod = []AuthMethod{ + AuthMethodBasic, + AuthMethodSSH, +} + +func (e AuthMethod) IsValid() bool { + switch e { + case AuthMethodBasic, AuthMethodSSH: + return true + } + return false +} + +func (e AuthMethod) String() string { + return string(e) +} + +func (e *AuthMethod) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = AuthMethod(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid AuthMethod", str) + } + return nil +} + +func (e AuthMethod) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type AutoscalingTarget string + +const ( + AutoscalingTargetStatefulset AutoscalingTarget = "STATEFULSET" + AutoscalingTargetDeployment AutoscalingTarget = "DEPLOYMENT" +) + +var AllAutoscalingTarget = []AutoscalingTarget{ + AutoscalingTargetStatefulset, + AutoscalingTargetDeployment, +} + +func (e AutoscalingTarget) IsValid() bool { + switch e { + case AutoscalingTargetStatefulset, AutoscalingTargetDeployment: + return true + } + return false +} + +func (e AutoscalingTarget) String() string { + return string(e) +} + +func (e *AutoscalingTarget) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = AutoscalingTarget(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid AutoscalingTarget", str) + } + return nil +} + +func (e AutoscalingTarget) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type BuildType string + +const ( + BuildTypeDeploy BuildType = "DEPLOY" + BuildTypeBounce BuildType = "BOUNCE" + BuildTypeApproval BuildType = "APPROVAL" + BuildTypeInstall BuildType = "INSTALL" + BuildTypeDestroy BuildType = "DESTROY" + BuildTypeDedicated BuildType = "DEDICATED" + BuildTypeConfig BuildType = "CONFIG" +) + +var AllBuildType = []BuildType{ + BuildTypeDeploy, + BuildTypeBounce, + BuildTypeApproval, + BuildTypeInstall, + BuildTypeDestroy, + BuildTypeDedicated, + BuildTypeConfig, +} + +func (e BuildType) IsValid() bool { + switch e { + case BuildTypeDeploy, BuildTypeBounce, BuildTypeApproval, BuildTypeInstall, BuildTypeDestroy, BuildTypeDedicated, BuildTypeConfig: + return true + } + return false +} + +func (e BuildType) String() string { + return string(e) +} + +func (e *BuildType) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = BuildType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid BuildType", str) + } + return nil +} + +func (e BuildType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type ComponentState string + +const ( + ComponentStateRunning ComponentState = "RUNNING" + ComponentStatePending ComponentState = "PENDING" + ComponentStateFailed ComponentState = "FAILED" +) + +var AllComponentState = []ComponentState{ + ComponentStateRunning, + ComponentStatePending, + ComponentStateFailed, +} + +func (e ComponentState) IsValid() bool { + switch e { + case ComponentStateRunning, ComponentStatePending, ComponentStateFailed: + return true + } + return false +} + +func (e ComponentState) String() string { + return string(e) +} + +func (e *ComponentState) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = ComponentState(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid ComponentState", str) + } + return nil +} + +func (e ComponentState) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type Delta string + +const ( + DeltaCreate Delta = "CREATE" + DeltaUpdate Delta = "UPDATE" + DeltaDelete Delta = "DELETE" +) + +var AllDelta = []Delta{ + DeltaCreate, + DeltaUpdate, + DeltaDelete, +} + +func (e Delta) IsValid() bool { + switch e { + case DeltaCreate, DeltaUpdate, DeltaDelete: + return true + } + return false +} + +func (e Delta) String() string { + return string(e) +} + +func (e *Delta) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = Delta(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid Delta", str) + } + return nil +} + +func (e Delta) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type GitHealth string + +const ( + GitHealthPullable GitHealth = "PULLABLE" + GitHealthFailed GitHealth = "FAILED" +) + +var AllGitHealth = []GitHealth{ + GitHealthPullable, + GitHealthFailed, +} + +func (e GitHealth) IsValid() bool { + switch e { + case GitHealthPullable, GitHealthFailed: + return true + } + return false +} + +func (e GitHealth) String() string { + return string(e) +} + +func (e *GitHealth) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = GitHealth(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid GitHealth", str) + } + return nil +} + +func (e GitHealth) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type NotificationStatus string + +const ( + NotificationStatusFiring NotificationStatus = "FIRING" + NotificationStatusResolved NotificationStatus = "RESOLVED" +) + +var AllNotificationStatus = []NotificationStatus{ + NotificationStatusFiring, + NotificationStatusResolved, +} + +func (e NotificationStatus) IsValid() bool { + switch e { + case NotificationStatusFiring, NotificationStatusResolved: + return true + } + return false +} + +func (e NotificationStatus) String() string { + return string(e) +} + +func (e *NotificationStatus) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = NotificationStatus(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid NotificationStatus", str) + } + return nil +} + +func (e NotificationStatus) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type Permission string + +const ( + PermissionRead Permission = "READ" + PermissionConfigure Permission = "CONFIGURE" + PermissionDeploy Permission = "DEPLOY" + PermissionOperate Permission = "OPERATE" +) + +var AllPermission = []Permission{ + PermissionRead, + PermissionConfigure, + PermissionDeploy, + PermissionOperate, +} + +func (e Permission) IsValid() bool { + switch e { + case PermissionRead, PermissionConfigure, PermissionDeploy, PermissionOperate: + return true + } + return false +} + +func (e Permission) String() string { + return string(e) +} + +func (e *Permission) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = Permission(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid Permission", str) + } + return nil +} + +func (e Permission) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type ReadType string + +const ( + ReadTypeNotification ReadType = "NOTIFICATION" + ReadTypeBuild ReadType = "BUILD" +) + +var AllReadType = []ReadType{ + ReadTypeNotification, + ReadTypeBuild, +} + +func (e ReadType) IsValid() bool { + switch e { + case ReadTypeNotification, ReadTypeBuild: + return true + } + return false +} + +func (e ReadType) String() string { + return string(e) +} + +func (e *ReadType) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = ReadType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid ReadType", str) + } + return nil +} + +func (e ReadType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type Severity string + +const ( + SeverityNone Severity = "NONE" + SeverityLow Severity = "LOW" + SeverityMedium Severity = "MEDIUM" + SeverityHigh Severity = "HIGH" + SeverityCritical Severity = "CRITICAL" +) + +var AllSeverity = []Severity{ + SeverityNone, + SeverityLow, + SeverityMedium, + SeverityHigh, + SeverityCritical, +} + +func (e Severity) IsValid() bool { + switch e { + case SeverityNone, SeverityLow, SeverityMedium, SeverityHigh, SeverityCritical: + return true + } + return false +} + +func (e Severity) String() string { + return string(e) +} + +func (e *Severity) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = Severity(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid Severity", str) + } + return nil +} + +func (e Severity) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type Status string + +const ( + StatusQueued Status = "QUEUED" + StatusRunning Status = "RUNNING" + StatusSuccessful Status = "SUCCESSFUL" + StatusFailed Status = "FAILED" + StatusCancelled Status = "CANCELLED" + StatusPending Status = "PENDING" +) + +var AllStatus = []Status{ + StatusQueued, + StatusRunning, + StatusSuccessful, + StatusFailed, + StatusCancelled, + StatusPending, +} + +func (e Status) IsValid() bool { + switch e { + case StatusQueued, StatusRunning, StatusSuccessful, StatusFailed, StatusCancelled, StatusPending: + return true + } + return false +} + +func (e Status) String() string { + return string(e) +} + +func (e *Status) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = Status(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid Status", str) + } + return nil +} + +func (e Status) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type Tool string + +const ( + ToolHelm Tool = "HELM" + ToolTerraform Tool = "TERRAFORM" +) + +var AllTool = []Tool{ + ToolHelm, + ToolTerraform, +} + +func (e Tool) IsValid() bool { + switch e { + case ToolHelm, ToolTerraform: + return true + } + return false +} + +func (e Tool) String() string { + return string(e) +} + +func (e *Tool) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = Tool(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid Tool", str) + } + return nil +} + +func (e Tool) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type UpgradePolicyType string + +const ( + UpgradePolicyTypeDeploy UpgradePolicyType = "DEPLOY" + UpgradePolicyTypeApproval UpgradePolicyType = "APPROVAL" + UpgradePolicyTypeIgnore UpgradePolicyType = "IGNORE" +) + +var AllUpgradePolicyType = []UpgradePolicyType{ + UpgradePolicyTypeDeploy, + UpgradePolicyTypeApproval, + UpgradePolicyTypeIgnore, +} + +func (e UpgradePolicyType) IsValid() bool { + switch e { + case UpgradePolicyTypeDeploy, UpgradePolicyTypeApproval, UpgradePolicyTypeIgnore: + return true + } + return false +} + +func (e UpgradePolicyType) String() string { + return string(e) +} + +func (e *UpgradePolicyType) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = UpgradePolicyType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid UpgradePolicyType", str) + } + return nil +} + +func (e UpgradePolicyType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type WebhookHealth string + +const ( + WebhookHealthHealthy WebhookHealth = "HEALTHY" + WebhookHealthUnhealthy WebhookHealth = "UNHEALTHY" +) + +var AllWebhookHealth = []WebhookHealth{ + WebhookHealthHealthy, + WebhookHealthUnhealthy, +} + +func (e WebhookHealth) IsValid() bool { + switch e { + case WebhookHealthHealthy, WebhookHealthUnhealthy: + return true + } + return false +} + +func (e WebhookHealth) String() string { + return string(e) +} + +func (e *WebhookHealth) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = WebhookHealth(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid WebhookHealth", str) + } + return nil +} + +func (e WebhookHealth) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type WebhookType string + +const ( + WebhookTypePiazza WebhookType = "PIAZZA" + WebhookTypeSLACk WebhookType = "SLACK" +) + +var AllWebhookType = []WebhookType{ + WebhookTypePiazza, + WebhookTypeSLACk, +} + +func (e WebhookType) IsValid() bool { + switch e { + case WebhookTypePiazza, WebhookTypeSLACk: + return true + } + return false +} + +func (e WebhookType) String() string { + return string(e) +} + +func (e *WebhookType) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = WebhookType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid WebhookType", str) + } + return nil +} + +func (e WebhookType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} diff --git a/pkg/utils/arrays.go b/pkg/utils/arrays.go new file mode 100644 index 0000000..a96f669 --- /dev/null +++ b/pkg/utils/arrays.go @@ -0,0 +1,25 @@ +package utils + +func ConvertStringArrayPointer(inputs []*string) []string { + if inputs == nil { + return []string{} + } + + res := make([]string, len(inputs)) + for i, input := range inputs { + res[i] = *input + } + return res +} + +func ToStringArrayPtr(input []string) []*string { + if input == nil { + return []*string{} + } + + res := make([]*string, len(input)) + for i := range input { + res[i] = &input[i] + } + return res +} diff --git a/pkg/utils/maps.go b/pkg/utils/maps.go new file mode 100644 index 0000000..eea5123 --- /dev/null +++ b/pkg/utils/maps.go @@ -0,0 +1,12 @@ +package utils + +func ConvertMapInterfaceToString(input map[string]interface{}) map[string]string { + if input == nil { + return nil + } + res := make(map[string]string) + for k, v := range input { + res[k] = ToString(v) + } + return res +} diff --git a/pkg/utils/strings.go b/pkg/utils/strings.go new file mode 100644 index 0000000..bdca89d --- /dev/null +++ b/pkg/utils/strings.go @@ -0,0 +1,14 @@ +package utils + +import "fmt" + +func ToString(val interface{}) string { + return fmt.Sprintf("%v", val) +} + +func ConvertStringPointer(in *string) string { + if in != nil { + return *in + } + return "" +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..a8ea9fd --- /dev/null +++ b/renovate.json @@ -0,0 +1,34 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:base", + ":dependencyDashboard", + ":prHourlyLimit4", + ":prConcurrentLimit20" + ], + "packageRules": [ + { + "matchDatasources": [ + "docker" + ], + "matchUpdateTypes": [ + "major" + ], + "enabled": true + }, + { + "description": "Disable major update k8s client-go", + "matchPackagePatterns": [ + "^k8s.io/client-go" + ], + "matchUpdateTypes": [ + "major" + ], + "enabled": false + } + ], + "labels": [ + "dependencies" + ], + "separateMinorPatch": true +} diff --git a/schema/schema.graphql b/schema/schema.graphql new file mode 100644 index 0000000..56c9dbc --- /dev/null +++ b/schema/schema.graphql @@ -0,0 +1,1969 @@ +schema { + query: RootQueryType + mutation: RootMutationType + subscription: RootSubscriptionType +} + +type PageInfo { + "When paginating backwards, are there more items?" + hasPreviousPage: Boolean! + + "When paginating forwards, are there more items?" + hasNextPage: Boolean! + + "When paginating backwards, the cursor to continue." + startCursor: String + + "When paginating forwards, the cursor to continue." + endCursor: String +} + +type RunbookAction { + name: String! + type: String! + configuration: ConfigurationAction +} + +enum AuditAction { + CREATE + UPDATE + DELETE + APPROVE + CANCEL +} + +type AccessTokenConnection { + pageInfo: PageInfo! + edges: [AccessTokenEdge] +} + +type RevisionConnection { + pageInfo: PageInfo! + edges: [RevisionEdge] +} + +type RecipeSection { + id: ID! + repository: Repository + recipeItems: [RecipeItem] + configuration: [ConfigurationItem] +} + +type StatusCondition { + message: String! + reason: String! + status: String! + type: String! +} + +type UserConnection { + pageInfo: PageInfo! + edges: [UserEdge] +} + +type Plan { + id: ID + name: String + period: String +} + +type Application { + name: String! + spec: ApplicationSpec! + status: ApplicationStatus! + cost: CostAnalysis + license: License + configuration: Configuration + info: String +} + +type ConfigurationAction { + updates: [PathUpdate] +} + +type NotificationConnection { + pageInfo: PageInfo! + edges: [NotificationEdge] +} + +type RecipeItem { + id: ID! + configuration: [ConfigurationItem] +} + +type DashboardLabel { + name: String! + values: [String] +} + +type Changelog { + id: ID! + repo: String! + tool: String! + content: String + insertedAt: DateTime + updatedAt: DateTime +} + +type OverlayUpdate { + path: [String] +} + +type PostgresInstance { + uid: String! +} + +type RoleEdge { + node: Role + cursor: String +} + +type GroupEdge { + node: Group + cursor: String +} + +type InstallationEdge { + node: Installation + cursor: String +} + +type WebhookEdge { + node: Webhook + cursor: String +} + +type NodeUsage { + cpu: String + memory: String +} + +type RepositoryEdge { + node: Repository + cursor: String +} + +type ClusterEdge { + node: Cluster + cursor: String +} + +type FileContent { + path: String + content: String +} + +type ServiceDeployment { + id: ID! + name: String! + namespace: String! + version: String! + git: GitRef! + sha: String + tarball: String + deletedAt: DateTime + repository: GitRepository + readBindings: [PolicyBinding] + writeBindings: [PolicyBinding] + configuration: [ServiceConfiguration] + components: [ServiceComponent] + revisions(after: String, first: Int, before: String, last: Int): RevisionConnection + insertedAt: DateTime + updatedAt: DateTime +} + +type ServiceComponent { + id: ID! + state: ComponentState + synced: Boolean! + group: String! + version: String! + kind: String! + namespace: String! + name: String! +} + +enum AuthMethod { + BASIC + SSH +} + +enum AutoscalingTarget { + STATEFULSET + DEPLOYMENT +} + +type StatusComponent { + group: String + kind: String! + name: String! + status: String! +} + +input SmtpInput { + server: String + port: Int + password: String + sender: String + user: String +} + +type StatefulSet { + metadata: Metadata! + status: StatefulSetStatus! + spec: StatefulSetSpec! + pods: [Pod] + raw: String! + events: [Event] +} + +type Account { + delinquentAt: DateTime + grandfatheredUntil: DateTime + availableFeatures: AvailableFeatures + subscription: PluralSubscription +} + +type MetricResult { + timestamp: Int + value: String +} + +type Component { + group: String! + kind: String! +} + +input CloudSettingsAttributes { + aws: AwsCloudAttributes +} + +type DeploymentSpec { + replicas: Int + strategy: DeploymentStrategy +} + +input RbacAttributes { + readBindings: [PolicyBindingAttributes] + writeBindings: [PolicyBindingAttributes] +} + +input GitRefAttributes { + ref: String! + folder: String! +} + +type ConfigurationOverlaySpec { + name: String + folder: String + subfolder: String + documentation: String + updates: [OverlayUpdate] + inputType: String + inputValues: [String] +} + +type LoadBalancerStatus { + ingress: [LoadBalancerIngressStatus] +} + +type ContainerStatus { + restartCount: Int + ready: Boolean + name: String + image: String + state: ContainerState +} + +input ServiceDeploymentAttributes { + name: String! + namespace: String! + version: String + repositoryId: ID! + git: GitRefAttributes! + configuration: [ConfigAttributes] + readBindings: [PolicyBindingAttributes] + writeBindings: [PolicyBindingAttributes] +} + +input ConfigAttributes { + name: String! + value: String! +} + +input ContextAttributes { + buckets: [String] + domain: [String] + configuration: Map! + protect: [String] +} + +type IngressTls { + hosts: [String] +} + +input TaintAttributes { + key: String! + value: String! + effect: String! +} + +type PostgresqlSpec { + teamId: String + users: Map + resources: Resources + postgresql: PostgresSettings + numberOfInstances: Int + databases: Map + volume: DatabaseVolume + pods: [Pod] +} + +type NodeStatus { + allocatable: Map + capacity: Map + phase: String + conditions: [NodeCondition] +} + +type IngressSpec { + rules: [IngressRule] + tls: [IngressTls] +} + +type DeploymentStatus { + availableReplicas: Int + replicas: Int + readyReplicas: Int + unavailableReplicas: Int +} + +input InviteAttributes { + email: String +} + +input BindingAttributes { + id: ID + userId: ID + groupId: ID +} + +input BuildAttributes { + repository: String! + type: BuildType + message: String +} + +input DeploymentSettingsAttributes { + artifactRepositoryId: ID + deployerRepositoryId: ID + readBindings: [PolicyBindingAttributes] + writeBindings: [PolicyBindingAttributes] + gitBindings: [PolicyBindingAttributes] + createBindings: [PolicyBindingAttributes] +} + +type CronJob { + metadata: Metadata! + status: CronStatus! + spec: CronSpec! + raw: String! + events: [Event] + jobs: [Job] +} + +type ClusterProvider { + id: ID! + name: String! + namespace: String! + cloud: String! + git: GitRef! + repository: GitRepository + service: Service + insertedAt: DateTime + updatedAt: DateTime +} + +type PodDelta { + delta: Delta + payload: Pod +} + +"supported kubernetes objects fetchable in runbooks" +union KubernetesData = Deployment | StatefulSet + +type Smtp { + server: String + port: Int + password: String + sender: String + user: String +} + +type LoginInfo { + oidcUri: String +} + +type ClusterInfo { + gitCommit: String + gitVersion: String + platform: String + version: String +} + +type ServiceConfiguration { + name: String! + value: String! +} + +type RootSubscriptionType { + applicationDelta: ApplicationDelta + podDelta: PodDelta + buildDelta(buildId: ID): BuildDelta + commandDelta(buildId: ID!): CommandDelta + notificationDelta: NotificationDelta +} + +type ClusterConnection { + pageInfo: PageInfo! + edges: [ClusterEdge] +} + +type RepositoryConnection { + pageInfo: PageInfo! + edges: [RepositoryEdge] +} + +type WebhookConnection { + pageInfo: PageInfo! + edges: [WebhookEdge] +} + +type ConfigurationValidation { + type: String + regex: String + message: String +} + +type InstallationConnection { + pageInfo: PageInfo! + edges: [InstallationEdge] +} + +type PodCondition { + lastProbeTime: String + lastTransitionTime: String + message: String + reason: String + status: String + type: String +} + +type GroupConnection { + pageInfo: PageInfo! + edges: [GroupEdge] +} + +type RoleConnection { + pageInfo: PageInfo! + edges: [RoleEdge] +} + +type RunbookExecution { + id: ID! + name: String! + namespace: String! + context: Map! + user: User + insertedAt: DateTime + updatedAt: DateTime +} + +type ConfigurationItem { + name: String + type: String + placeholder: String + documentation: String + default: String + optional: Boolean + condition: ConfigurationCondition + validation: ConfigurationValidation +} + +type LogStream { + stream: Map + values: [MetricResult] +} + +type ApplicationInfoItem { + type: String + name: String + value: String +} + +type LogLabel { + name: String + value: String +} + +type ManifestNetwork { + pluralDns: Boolean + subdomain: String +} + +type Webhook { + id: ID! + url: String! + health: WebhookHealth! + type: WebhookType! + insertedAt: DateTime + updatedAt: DateTime +} + +type Runbook { + name: String! + spec: RunbookSpec! + status: RunbookStatus + data(context: RunbookContext): [RunbookData] + executions(after: String, first: Int, before: String, last: Int): RunbookExecutionConnection +} + +enum Severity { + NONE + LOW + MEDIUM + HIGH + CRITICAL +} + +type Repository { + id: ID! + name: String! + description: String + icon: String + docs: [FileContent] + configuration: Configuration + grafanaDns: String +} + +type DeploymentStrategy { + type: String + rollingUpdate: RollingUpdate +} + +type DashboardGraph { + name: String! + queries: [DashboardMetric] + format: String +} + +type IngressPath { + backend: IngressBackend + path: String +} + +type PolicyBinding { + id: ID + user: User + group: Group +} + +type LicenseFeature { + name: String! + description: String +} + +type ClusterProviderEdge { + node: ClusterProvider + cursor: String +} + +type IngressRule { + host: String + http: HttpIngressRule +} + +type Service { + metadata: Metadata! + status: ServiceStatus! + spec: ServiceSpec! + pods: [Pod] + raw: String! + events: [Event] +} + +type License { + metadata: Metadata! + spec: LicenseSpec! + status: LicenseStatus +} + +type Node { + status: NodeStatus! + spec: NodeSpec! + metadata: Metadata! + raw: String! + pods: [Pod] + events: [Event] +} + +type Invite { + secureId: String! + email: String +} + +type PodEdge { + node: Pod + cursor: String +} + +type PrometheusDatasource { + query: String! + format: String + legend: String +} + +type Recipe { + id: ID! + name: String! + description: String + provider: String + restricted: Boolean + recipeSections: [RecipeSection] + oidcEnabled: Boolean +} + +enum BuildType { + DEPLOY + BOUNCE + APPROVAL + INSTALL + DESTROY + DEDICATED + CONFIG +} + +type AuditEdge { + node: Audit + cursor: String +} + +type KubernetesDatasource { + resource: String! + name: String! +} + +type RunbookActionResponse { + redirectTo: String +} + +type Role { + id: ID! + name: String! + description: String + repositories: [String] + permissions: [Permission] + roleBindings: [RoleBinding] + insertedAt: DateTime + updatedAt: DateTime +} + +type CrossVersionResourceTarget { + apiVersion: String + kind: String + name: String +} + +type PluralManifest { + network: ManifestNetwork + bucketPrefix: String + cluster: String +} + +input RunbookContext { + timeseriesStart: Int + timeseriesStep: String +} + +type ServicePort { + name: String + protocol: String + port: Int + targetPort: String +} + +type Deployment { + metadata: Metadata! + status: DeploymentStatus! + spec: DeploymentSpec! + pods: [Pod] + raw: String! + events: [Event] +} + +type AccessTokenAudit { + id: ID + ip: String + timestamp: DateTime + count: Int + city: String + country: String + latitude: String + longitude: String + insertedAt: DateTime + updatedAt: DateTime +} + +type Build { + id: ID! + repository: String! + type: BuildType! + status: Status! + message: String + completedAt: DateTime + sha: String + commands(after: String, first: Int, before: String, last: Int): CommandConnection + creator: User + approver: User + changelogs: [Changelog] + insertedAt: DateTime + updatedAt: DateTime +} + +type Command { + id: ID! + command: String! + exitCode: Int + stdout: String + completedAt: DateTime + build: Build + insertedAt: DateTime + updatedAt: DateTime +} + +type CostAnalysis { + minutes: Float + cpuCost: Float + cpuEfficiency: Float + efficiency: Float + gpuCost: Float + networkCost: Float + pvCost: Float + ramCost: Float + ramEfficiency: Float + totalCost: Float + sharedCost: Float +} + +type ApplicationSpec { + descriptor: ApplicationDescriptor! + components: [Component] + info: [ApplicationInfoItem] +} + +type AvailableFeatures { + vpn: Boolean + audits: Boolean + userManagement: Boolean + databaseManagement: Boolean +} + +type DashboardMetric { + legend: String + query: String + results: [MetricResult] +} + +type NodeSpec { + podCidr: String + providerId: String + unschedulable: Boolean +} + +type LicenseSpec { + secretRef: SecretKeySelector! +} + +input UserAttributes { + name: String + email: String + password: String + roles: UserRoleAttributes +} + +type VerticalPodAutoscalerSpec { + targetRef: CrossVersionResourceTarget! + updatePolicy: VerticalPodAutoscalerUpdatePolicy! +} + +type ContainerResources { + cpu: String + memory: String +} + +type CertificateStatus { + conditions: [StatusCondition] + notAfter: String + notBefore: String + renewalTime: String +} + +type CertificateSpec { + dnsNames: [String] + secretName: String! + issuerRef: IssuerRef +} + +type JobSpec { + backoffLimit: Int + parallelism: Int + activeDeadlineSeconds: Int +} + +input NodePoolAttributes { + name: String! + minSize: Int! + maxSize: Int! + instanceType: String! + labels: Map + taints: [TaintAttributes] + cloudSettings: CloudSettingsAttributes +} + +type RunbookStatus { + alerts: [RunbookAlertStatus] +} + +type NamespaceStatus { + phase: String +} + +type PodStatus { + message: String + phase: String + hostIp: String + podIp: String + reason: String + conditions: [PodCondition] + containerStatuses: [ContainerStatus] + initContainerStatuses: [ContainerStatus] +} + +type GitStatus { + cloned: Boolean + output: String +} + +type CronSpec { + schedule: String! + suspend: Boolean + concurrencyPolicy: String +} + +type Cluster { + id: ID! + name: String! + version: String! + deletedAt: DateTime + readBindings: [PolicyBinding] + writeBindings: [PolicyBinding] + nodePools: [NodePool] + provider: ClusterProvider + service: Service + insertedAt: DateTime + updatedAt: DateTime +} + +type WireguardPeer { + metadata: Metadata! + status: WireguardPeerStatus + spec: WireguardPeerSpec! + config: String + user: User + raw: String! +} + +type Container { + image: String + name: String + ports: [Port] + resources: Resources +} + +type GroupMember { + id: ID! + user: User + group: Group + insertedAt: DateTime + updatedAt: DateTime +} + +type ApplicationDescriptor { + type: String! + version: String! + description: String + icons: [String] + links: [ApplicationLink] +} + +enum Delta { + CREATE + UPDATE + DELETE +} + +type ApplicationDelta { + delta: Delta + payload: Application +} + +type RootMutationType { + createBuild(attributes: BuildAttributes!): Build + restartBuild(id: ID!): Build + cancelBuild(id: ID!): Build + approveBuild(id: ID!): Build + signIn(email: String!, password: String!): User + loginLink(key: String!): User + readNotifications: User + signup(inviteId: String!, attributes: UserAttributes!): User + oauthCallback(code: String!, redirect: String): User + createInvite(attributes: InviteAttributes!): Invite + updateUser(id: ID, attributes: UserAttributes!): User + deleteUser(id: ID!): User + markRead(type: ReadType): User + createGroup(attributes: GroupAttributes!): Group + deleteGroup(groupId: ID!): Group + updateGroup(groupId: ID!, attributes: GroupAttributes!): Group + createGroupMember(groupId: ID!, userId: ID!): GroupMember + deleteGroupMember(groupId: ID!, userId: ID!): GroupMember + createRole(attributes: RoleAttributes!): Role + updateRole(id: ID!, attributes: RoleAttributes!): Role + deleteRole(id: ID!): Role + createAccessToken: AccessToken + deleteAccessToken(token: String!): AccessToken + deleteCertificate(name: String!, namespace: String!): Boolean + deletePod(namespace: String!, name: String!): Pod + deleteJob(namespace: String!, name: String!): Job + deleteNode(name: String!): Node + overlayConfiguration(namespace: String!, context: Map!): Build + createPeer(userId: ID, email: String, name: String!): WireguardPeer + deletePeer(name: String!): Boolean + installRecipe(id: ID!, context: Map!, oidc: Boolean): Build + installStack(name: String!, context: ContextAttributes!, oidc: Boolean): Build + updateSmtp(smtp: SmtpInput!): Smtp + updateConfiguration(repository: String!, content: String!, tool: Tool, message: String): Configuration + createUpgradePolicy(attributes: UpgradePolicyAttributes!): UpgradePolicy + deleteUpgradePolicy(id: ID!): UpgradePolicy + executeRunbook(namespace: String!, name: String!, input: RunbookActionInput!): RunbookActionResponse + createWebhook(attributes: WebhookAttributes!): Webhook + deleteWebhook(id: ID!): Webhook + restorePostgres(namespace: String!, name: String!, timestamp: DateTime!, clone: CloneAttributes): Postgresql + createGitRepository(attributes: GitAttributes!): GitRepository + createCluster(attributes: ClusterAttributes!): Cluster + updateCluster(id: ID!, attributes: ClusterUpdateAttributes!): Cluster + deleteCluster(id: ID!): Cluster + createClusterProvider(attributes: ClusterProviderAttributes!): ClusterProvider + updateClusterProvider(id: ID!, attributes: ClusterProviderUpdateAttributes!): ClusterProvider + createServiceDeployment(clusterId: ID!, attributes: ServiceDeploymentAttributes!): ServiceDeployment + updateServiceDeployment(id: ID!, attributes: ServiceUpdateAttributes!): ServiceDeployment + deleteServiceDeployment(id: ID!): ServiceDeployment + updateServiceComponents(id: ID!, components: [ComponentAttributes]): ServiceDeployment + updateRbac(rbac: RbacAttributes!, serviceId: ID, clusterId: ID, providerId: ID): Boolean + updateDeploymentSettings(attributes: DeploymentSettingsAttributes!): DeploymentSettings +} + +type PodConnection { + pageInfo: PageInfo! + edges: [PodEdge] +} + +type AccessToken { + id: ID + token: String + audits(after: String, first: Int, before: String, last: Int): AccessTokenAuditConnection + insertedAt: DateTime + updatedAt: DateTime +} + +type Revision { + id: ID! + version: String! + git: GitRef! + sha: String + insertedAt: DateTime + updatedAt: DateTime +} + +type Installation { + id: ID! + repository: Repository +} + +type Configuration { + terraform: String + helm: String +} + +type ClusterProviderConnection { + pageInfo: PageInfo! + edges: [ClusterProviderEdge] +} + +type Notification { + id: ID! + title: String! + description: String + fingerprint: String! + status: NotificationStatus + labels: Map + annotations: Map + repository: String! + seenAt: DateTime + severity: Severity + insertedAt: DateTime + updatedAt: DateTime +} + +type AuditConnection { + pageInfo: PageInfo! + edges: [AuditEdge] +} + +type ConfigurationCondition { + field: String + value: String + operation: String +} + +type Recommendation { + containerRecommendations: [ContainerRecommendation] +} + +type Postgresql { + metadata: Metadata! + spec: PostgresqlSpec! + status: PostgresqlStatus + instances: [PostgresInstance] +} + +enum Tool { + HELM + TERRAFORM +} + +type ApplicationLink { + url: String + description: String +} + +type Stack { + id: ID! + name: String! + bundles: [Recipe] + sections: [RecipeSection] + insertedAt: DateTime + updatedAt: DateTime +} + +type UpgradePolicy { + id: ID! + name: String! + description: String + repositories: [String] + type: UpgradePolicyType! + target: String! + weight: Int + insertedAt: DateTime + updatedAt: DateTime +} + +type RootQueryType { + configuration: ConsoleConfiguration + externalToken: String + builds(after: String, first: Int, before: String, last: Int): BuildConnection + build(id: ID!): Build + buildInfo: BuildInfo + users(after: String, first: Int, before: String, last: Int, q: String): UserConnection + loginInfo(redirect: String): LoginInfo + me: User + invite(id: String!): Invite + groups(after: String, first: Int, before: String, last: Int, q: String): GroupConnection + groupMembers(after: String, first: Int, before: String, last: Int, groupId: ID!): GroupMemberConnection + role: Role + roles(after: String, first: Int, before: String, last: Int, q: String): RoleConnection + notifications(after: String, first: Int, before: String, last: Int, all: Boolean): NotificationConnection + temporaryToken: String + accessTokens(after: String, first: Int, before: String, last: Int): AccessTokenConnection + accessToken(id: ID!): AccessToken + dashboards(repo: String!): [Dashboard] + dashboard(repo: String!, name: String!, step: String, offset: Int, labels: [LabelInput]): Dashboard + metric(query: String!, offset: Int, step: String): [MetricResponse] + logs(query: String!, start: Long, end: Long, limit: Int!): [LogStream] + scalingRecommendation(kind: AutoscalingTarget!, namespace: String!, name: String!): VerticalPodAutoscaler + configMap(namespace: String!, name: String!): ConfigMap + secret(namespace: String!, name: String!): Secret + configMaps(namespace: String!): [ConfigMap] + secrets(namespace: String!): [Secret] + service(namespace: String!, name: String!): Service + clusterInfo: ClusterInfo + deployment(namespace: String!, name: String!): Deployment + statefulSet(namespace: String!, name: String!): StatefulSet + ingress(namespace: String!, name: String!): Ingress + nodes: [Node] + node(name: String!): Node + cronJob(namespace: String!, name: String!): CronJob + job(namespace: String!, name: String!): Job + certificate(namespace: String!, name: String!): Certificate + pod(namespace: String!, name: String!): Pod + pods(after: String, first: Int, before: String, last: Int, namespaces: [String]): PodConnection + wireguardPeers: [WireguardPeer] + myWireguardPeers: [WireguardPeer] + wireguardPeer(name: String!): WireguardPeer + cachedPods(namespaces: [String]): [Pod] + namespaces: [Namespace] + logFilters(namespace: String!): [LogFilter] + nodeMetrics: [NodeMetric] + nodeMetric(name: String!): NodeMetric + configurationOverlays(namespace: String!): [ConfigurationOverlay] + audits(after: String, first: Int, before: String, last: Int, repo: String): AuditConnection + auditMetrics: [AuditMetric] + ai(prompt: String!): String + account: Account + installations(after: String, first: Int, before: String, last: Int): InstallationConnection + applications: [Application] + application(name: String!): Application + repository(name: String!): Repository + repositories(after: String, first: Int, before: String, last: Int, query: String!): RepositoryConnection + recipes(after: String, first: Int, before: String, last: Int, id: ID!): RecipeConnection + context: [RepositoryContext] + pluralContext: PluralContext + recipe(id: ID!): Recipe + stack(name: String!): Stack + smtp: Smtp + upgradePolicies: [UpgradePolicy] + runbook(namespace: String!, name: String!): Runbook + runbooks(namespace: String!, pinned: Boolean): [Runbook] + webhooks(after: String, first: Int, before: String, last: Int): WebhookConnection + postgresDatabases: [Postgresql] + postgresDatabase(namespace: String!, name: String!): Postgresql + gitRepositories(after: String, first: Int, before: String, last: Int): GitRepositoryConnection + clusters(after: String, first: Int, before: String, last: Int): ClusterConnection + clusterProviders(after: String, first: Int, before: String, last: Int): ClusterProviderConnection + cluster(id: ID): Cluster + clusterProvider(id: ID!): ClusterProvider + serviceDeployments(after: String, first: Int, before: String, last: Int, clusterId: ID): ServiceDeploymentConnection + serviceDeployment(id: ID!): ServiceDeployment + clusterServices: [ServiceDeployment] + deploymentSettings: DeploymentSettings +} + +type RoleBinding { + id: ID! + user: User + group: Group + insertedAt: DateTime + updatedAt: DateTime +} + +type GitRef { + ref: String! + folder: String! +} + +type IssuerRef { + group: String + kind: String + name: String +} + +type Namespace { + status: NamespaceStatus! + spec: NamespaceSpec! + metadata: Metadata! + raw: String! + events: [Event] +} + +type GitRepositoryEdge { + node: GitRepository + cursor: String +} + +enum AuditType { + BUILD + POD + CONFIGURATION + USER + GROUP + ROLE + GROUP_MEMBER + POLICY + TEMP_TOKEN + SERVICE + CLUSTER + CLUSTER_PROVIDER + GIT_REPOSITORY + DEPLOYMENT_SETTINGS +} + +type MetricResponse { + metric: Map + values: [MetricResult] +} + +enum ReadType { + NOTIFICATION + BUILD +} + +type BuildEdge { + node: Build + cursor: String +} + +type RecipeEdge { + node: Recipe + cursor: String +} + +enum ComponentState { + RUNNING + PENDING + FAILED +} + +type RunningState { + startedAt: String +} + +type WaitingState { + message: String + reason: String +} + +""" +The `DateTime` scalar type represents a date and time in the UTC +timezone. The DateTime appears in a JSON response as an ISO8601 formatted +string, including UTC timezone ("Z"). The parsed date and time string will +be converted to UTC if there is an offset. +""" +scalar DateTime + +type GroupMemberEdge { + node: GroupMember + cursor: String +} + +type RunbookDatasource { + name: String! + type: String! + prometheus: PrometheusDatasource + kubernetes: KubernetesDatasource +} + +type JobReference { + name: String! + namespace: String! +} + +type CommandEdge { + node: Command + cursor: String +} + +type AccessTokenAuditEdge { + node: AccessTokenAudit + cursor: String +} + +type RunbookExecutionEdge { + node: RunbookExecution + cursor: String +} + +type ServiceDeploymentEdge { + node: ServiceDeployment + cursor: String +} + +type PluralContext { + buckets: [String] + domains: [String] + configuration: Map! +} + +type Port { + hostPort: Int + containerPort: Int + protocol: String +} + +type Taint { + key: String! + value: String! + effect: String! +} + +type AwsCloud { + launchTemplateId: String +} + +type IngressBackend { + serviceName: String + servicePort: String +} + +type Pod { + status: PodStatus! + spec: PodSpec! + metadata: Metadata! + raw: String! + events: [Event] +} + +type Event { + action: String + count: Int + eventTime: String + lastTimestamp: String + message: String + reason: String + type: String +} + +input PolicyBindingAttributes { + id: ID + userId: ID + groupId: ID +} + +type ApplicationStatus { + components: [StatusComponent] + conditions: [StatusCondition] + componentsReady: String! +} + +type DeploymentSettings { + id: ID! + name: String! + artifactRepository: GitRepository + deployerRepository: GitRepository + readBindings: [PolicyBinding] + writeBindings: [PolicyBinding] + gitBindings: [PolicyBinding] + createBindings: [PolicyBinding] + insertedAt: DateTime + updatedAt: DateTime +} + +input ClusterAttributes { + name: String! + providerId: ID + version: String! + nodePools: [NodePoolAttributes] + readBindings: [PolicyBindingAttributes] + writeBindings: [PolicyBindingAttributes] +} + +type CloudSettings { + aws: AwsCloud +} + +type PostgresSettings { + version: String +} + +type RunbookSpec { + name: String! + description: String + display: Map + datasources: [RunbookDatasource] + actions: [RunbookAction] +} + +type Ingress { + metadata: Metadata! + status: ServiceStatus! + spec: IngressSpec! + certificates: [Certificate] + raw: String! + events: [Event] +} + +input UserRoleAttributes { + admin: Boolean +} + +input AwsCloudAttributes { + launchTemplateId: String +} + +input GitAttributes { + url: String! + privateKey: String + passphrase: String + username: String + password: String +} + +type DashboardSpec { + name: String + description: String + timeslices: [String] + labels: [DashboardLabel] + graphs: [DashboardGraph] +} + +input ComponentAttributes { + state: ComponentState + synced: Boolean! + group: String! + version: String! + kind: String! + namespace: String! + name: String! +} + +input ClusterUpdateAttributes { + version: String! + nodePools: [NodePoolAttributes] + readBindings: [PolicyBindingAttributes] + writeBindings: [PolicyBindingAttributes] +} + +input CloudProviderSettingsAttributes { + aws: AwsSettingsAttributes + gcp: GcpSettingsAttributes +} + +input AwsSettingsAttributes { + accessKeyId: String! + secretAccessKey: String! +} + +input GcpSettingsAttributes { + applicationCredentials: String! +} + +input UpgradePolicyAttributes { + name: String! + description: String + target: String! + type: UpgradePolicyType! + repositories: [String] + weight: Int +} + +type AuditMetric { + country: String + count: Int +} + +type LicenseStatus { + plan: String + free: Boolean + features: [LicenseFeature] + limits: Map + secrets: Map +} + +input ServiceUpdateAttributes { + version: String + git: GitRefAttributes! + configuration: [ConfigAttributes] +} + +input CloneAttributes { + s3AccessKeyId: String + s3SecretAccessKey: String + s3WalPath: String + s3Endpoint: String + uid: String +} + +input WebhookAttributes { + url: String! +} + +input GroupAttributes { + name: String! + description: String +} + +input RoleAttributes { + name: String + description: String + repositories: [String] + roleBindings: [BindingAttributes] + permissions: [Permission] +} + +type LogFilter { + metadata: Metadata! + spec: LogFilterSpec! +} + +type Job { + metadata: Metadata! + status: JobStatus! + spec: JobSpec! + raw: String! + events: [Event] + pods: [Pod] +} + +type Metadata { + labels: [LabelPair] + annotations: [LabelPair] + name: String! + namespace: String + creationTimestamp: String +} + +type BuildInfo { + all: Int + failed: Int + queued: Int + running: Int + successful: Int +} + +type NodeCondition { + message: String + reason: String + status: String + type: String +} + +type GroupMemberConnection { + pageInfo: PageInfo! + edges: [GroupMemberEdge] +} + +type ContainerRecommendation { + name: String + containerName: String + target: ContainerResources + lowerBound: ContainerResources + upperBound: ContainerResources + uncappedTarget: ContainerResources +} + +type ServiceDeploymentConnection { + pageInfo: PageInfo! + edges: [ServiceDeploymentEdge] +} + +type GitRepositoryConnection { + pageInfo: PageInfo! + edges: [GitRepositoryEdge] +} + +enum Permission { + READ + CONFIGURE + DEPLOY + OPERATE +} + +type RunbookExecutionConnection { + pageInfo: PageInfo! + edges: [RunbookExecutionEdge] +} + +type PluralSubscription { + id: ID + plan: Plan +} + +type AccessTokenAuditConnection { + pageInfo: PageInfo! + edges: [AccessTokenAuditEdge] +} + +type ConsoleConfiguration { + gitCommit: String + isDemoProject: Boolean + isSandbox: Boolean + pluralLogin: Boolean + vpnEnabled: Boolean + features: AvailableFeatures + manifest: PluralManifest + gitStatus: GitStatus +} + +type CommandConnection { + pageInfo: PageInfo! + edges: [CommandEdge] +} + +type RecipeConnection { + pageInfo: PageInfo! + edges: [RecipeEdge] +} + +type BuildConnection { + pageInfo: PageInfo! + edges: [BuildEdge] +} + +type NodePool { + id: ID! + name: String! + minSize: Int! + maxSize: Int! + instanceType: String! + labels: Map + taints: [Taint] + cloudSettings: CloudSettings + insertedAt: DateTime + updatedAt: DateTime +} + +type VerticalPodAutoscalerUpdatePolicy { + updateMode: String +} + +type ConfigurationOverlay { + metadata: Metadata! + spec: ConfigurationOverlaySpec! +} + +type GitRepository { + id: ID! + url: String! + authMethod: AuthMethod + health: GitHealth + pulledAt: DateTime + insertedAt: DateTime + updatedAt: DateTime +} + +enum GitHealth { + PULLABLE + FAILED +} + +enum WebhookHealth { + HEALTHY + UNHEALTHY +} + +scalar Long + +enum UpgradePolicyType { + DEPLOY + APPROVAL + IGNORE +} + +type RevisionEdge { + node: Revision + cursor: String +} + +type DatabaseVolume { + size: String +} + +enum WebhookType { + PIAZZA + SLACK +} + +type Certificate { + metadata: Metadata! + status: CertificateStatus! + spec: CertificateSpec! + raw: String! + events: [Event] +} + +type AccessTokenEdge { + node: AccessToken + cursor: String +} + +type RollingUpdate { + maxSurge: Int + maxUnavailable: Int +} + +type NotificationEdge { + node: Notification + cursor: String +} + +type HttpIngressRule { + paths: [IngressPath] +} + +type TerminatedState { + exitCode: Int + finishedAt: String + startedAt: String + message: String + reason: String +} + +type PathUpdate { + path: [String] + valueFrom: String! +} + +type UserEdge { + node: User + cursor: String +} + +type ContainerState { + running: RunningState + terminated: TerminatedState + waiting: WaitingState +} + +type RepositoryContext { + repository: String! + context: Map +} + +type Audit { + id: ID! + action: AuditAction! + type: AuditType! + repository: String + ip: String + city: String + country: String + latitude: String + longitude: String + actor: User + insertedAt: DateTime + updatedAt: DateTime +} + +input LabelInput { + name: String + value: String +} + +input RunbookActionInput { + action: String! + context: Map! +} + +type Secret { + metadata: Metadata! + type: String + data: Map! +} + +type Dashboard { + id: String! + spec: DashboardSpec! +} + +type LoadBalancerIngressStatus { + hostname: String + ip: String +} + +type PostgresqlStatus { + clusterStatus: String +} + +type VerticalPodAutoscalerStatus { + recommendation: Recommendation +} + +type Resources { + limits: ResourceSpec + requests: ResourceSpec +} + +enum NotificationStatus { + FIRING + RESOLVED +} + +type UserRoles { + admin: Boolean +} + +type WireguardPeerStatus { + ready: Boolean + conditions: [StatusCondition] +} + +type WireguardPeerSpec { + wireguardRef: String + address: String + publicKey: String +} + +type PodSpec { + serviceAccountName: String + nodeName: String + containers: [Container] + initContainers: [Container] +} + +enum Status { + QUEUED + RUNNING + SUCCESSFUL + FAILED + CANCELLED + PENDING +} + +input ClusterProviderAttributes { + name: String! + namespace: String + cloud: String + cloudSettings: CloudProviderSettingsAttributes +} + +input ClusterProviderUpdateAttributes { + cloudSettings: CloudProviderSettingsAttributes +} + +type RunbookAlertStatus { + name: String! + startsAt: String + fingerprint: String + annotations: Map + labels: Map +} + +type NamespaceSpec { + finalizers: [String] +} + +type CronStatus { + active: [JobReference] + lastScheduleTime: String +} + +type ServiceStatus { + loadBalancer: LoadBalancerStatus +} + +type StatefulSetStatus { + currentReplicas: Int + replicas: Int + readyReplicas: Int + updatedReplicas: Int +} + +type StatefulSetSpec { + replicas: Int + serviceName: String +} + +type ResourceSpec { + cpu: String + memory: String +} + +type JobStatus { + active: Int + completionTime: String + startTime: String + succeeded: Int + failed: Int +} + +type LogFilterSpec { + name: String + description: String + query: String + labels: [LogLabel] +} + +type NodeMetric { + metadata: Metadata! + timestamp: String + window: String + usage: NodeUsage +} + +type ServiceSpec { + type: String + clusterIp: String + selector: Map + ports: [ServicePort] +} + +type VerticalPodAutoscaler { + metadata: Metadata! + spec: VerticalPodAutoscalerSpec! + status: VerticalPodAutoscalerStatus +} + +type SecretKeySelector { + name: String! + key: String +} + +type User { + id: ID! + name: String! + email: String! + deletedAt: DateTime + profile: String + pluralId: String + roles: UserRoles + readTimestamp: DateTime + buildTimestamp: DateTime + boundRoles: [Role] + jwt: String + unreadNotifications: Int + backgroundColor: String + insertedAt: DateTime + updatedAt: DateTime +} + +type LabelPair { + name: String + value: String +} + +type RunbookData { + name: String! + source: RunbookDatasource + kubernetes: KubernetesData + prometheus: [MetricResponse] + nodes: [Node] +} + +type BuildDelta { + delta: Delta + payload: Build +} + +type CommandDelta { + delta: Delta + payload: Command +} + +type NotificationDelta { + delta: Delta + payload: Notification +} + +type ConfigMap { + metadata: Metadata! + data: Map! + raw: String! +} + +type Group { + id: ID! + name: String! + description: String + insertedAt: DateTime + updatedAt: DateTime +} + +scalar Map diff --git a/tools/tools.go b/tools/tools.go new file mode 100644 index 0000000..4c3fee5 --- /dev/null +++ b/tools/tools.go @@ -0,0 +1,8 @@ +//go:build tools + +package tools + +import ( + _ "github.com/99designs/gqlgen" + _ "github.com/Yamashou/gqlgenc" +) diff --git a/uploadfiles.go b/uploadfiles.go new file mode 100644 index 0000000..e83fa25 --- /dev/null +++ b/uploadfiles.go @@ -0,0 +1,71 @@ +package gqlclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "mime/multipart" + "net/http" + + "github.com/Yamashou/gqlgenc/client" + "github.com/schollz/progressbar/v3" +) + +// Upload File represents a file to upload. +type Upload struct { + Field string + Name string + R io.Reader +} + +func WithFiles(files []Upload) func(req *http.Request) { + return func(req *http.Request) { + bd := client.Request{} + err := json.NewDecoder(req.Body).Decode(&bd) + if err != nil { + fmt.Printf("decode body %v", err) + } + bodyBuf := &bytes.Buffer{} + bodyWriter := multipart.NewWriter(bodyBuf) + + if err := bodyWriter.WriteField("query", bd.Query); err != nil { + fmt.Printf("write query field %v", err) + } + + var variablesBuf bytes.Buffer + if len(bd.Variables) > 0 { + variablesField, err := bodyWriter.CreateFormField("variables") + if err != nil { + fmt.Printf("create variables field %v", err) + } + if err := json.NewEncoder(io.MultiWriter(variablesField, &variablesBuf)).Encode(bd.Variables); err != nil { + fmt.Printf("encode variables %v", err) + } + } + + for _, f := range files { + part, err := bodyWriter.CreateFormFile(f.Field, f.Name) + if err != nil { + fmt.Printf("create form file %v", err) + } + + if _, err := io.Copy(part, f.R); err != nil { + fmt.Printf("preparing file %v", err) + } + } + bodyWriter.Close() + + bar := progressbar.DefaultBytes( + int64(bodyBuf.Len()), + "upload progress", + ) + reader := progressbar.NewReader(bodyBuf, bar) + defer reader.Close() + + req.ContentLength = int64(bodyBuf.Len()) + req.Body = &reader + req.Header.Set("Accept", "application/json; charset=utf-8") + req.Header.Set("Content-Type", bodyWriter.FormDataContentType()) + } +}