From 4210ccfe7370e4e006cfa46a4726fdf49c1d3744 Mon Sep 17 00:00:00 2001 From: michaeljguarino Date: Mon, 3 Apr 2023 10:57:41 -0400 Subject: [PATCH] Update client (#32) --- client.go | 606 +++++++++++++++++++++++++------------------------- models_gen.go | 49 ++++ 2 files changed, 352 insertions(+), 303 deletions(-) diff --git a/client.go b/client.go index f204e0a..5b29927 100644 --- a/client.go +++ b/client.go @@ -1211,20 +1211,6 @@ const GetPackageInstallationsDocument = `query GetPackageInstallations ($id: ID! } } } -fragment VersionFragment on Version { - id - readme - version - valuesTemplate - templateType - package - crds { - ... CrdFragment - } - dependencies { - ... DependenciesFragment - } -} fragment CrdFragment on Crd { id name @@ -1292,6 +1278,20 @@ fragment DependenciesFragment on Dependencies { outputs providerVsn } +fragment VersionFragment on Version { + id + readme + version + valuesTemplate + templateType + package + crds { + ... CrdFragment + } + dependencies { + ... DependenciesFragment + } +} ` func (c *Client) GetPackageInstallations(ctx context.Context, id string, httpRequestOptions ...client.HTTPRequestOption) (*GetPackageInstallations, error) { @@ -1425,20 +1425,6 @@ const ClusterInfoDocument = `query ClusterInfo ($id: ID!) { } } } -fragment RepositoryFragment on Repository { - id - name - notes - icon - darkIcon - description - publisher { - name - } - recipes { - name - } -} fragment ClusterFragment on Cluster { id name @@ -1454,6 +1440,20 @@ fragment UserFragment on User { name email } +fragment RepositoryFragment on Repository { + id + name + notes + icon + darkIcon + description + publisher { + name + } + recipes { + name + } +} ` func (c *Client) ClusterInfo(ctx context.Context, id string, httpRequestOptions ...client.HTTPRequestOption) (*ClusterInfo, error) { @@ -1695,20 +1695,6 @@ const GetInstallationByIDDocument = `query GetInstallationById ($id: ID) { ... InstallationFragment } } -fragment RepositoryFragment on Repository { - id - name - notes - icon - darkIcon - description - publisher { - name - } - recipes { - name - } -} fragment OIDCProvider on OidcProvider { id clientId @@ -1745,6 +1731,20 @@ fragment InstallationFragment on Installation { ... OIDCProvider } } +fragment RepositoryFragment on Repository { + id + name + notes + icon + darkIcon + description + publisher { + name + } + recipes { + name + } +} ` func (c *Client) GetInstallationByID(ctx context.Context, id *string, httpRequestOptions ...client.HTTPRequestOption) (*GetInstallationByID, error) { @@ -1897,6 +1897,49 @@ const GetRecipeDocument = `query GetRecipe ($repo: String, $name: String) { } } } +fragment RecipeFragment on Recipe { + id + name + description + restricted + provider + tests { + type + name + message + args { + name + repo + key + } + } + repository { + id + name + } + oidcSettings { + uriFormat + uriFormats + authMethod + domainKey + subdomain + } + recipeSections { + ... RecipeSectionFragment + } +} +fragment RecipeSectionFragment on RecipeSection { + index + repository { + ... RepositoryFragment + } + recipeItems { + ... RecipeItemFragment + } + configuration { + ... RecipeConfigurationFragment + } +} fragment RepositoryFragment on Repository { id name @@ -1983,49 +2026,6 @@ fragment RecipeConfigurationFragment on RecipeConfiguration { message } } -fragment RecipeFragment on Recipe { - id - name - description - restricted - provider - tests { - type - name - message - args { - name - repo - key - } - } - repository { - id - name - } - oidcSettings { - uriFormat - uriFormats - authMethod - domainKey - subdomain - } - recipeSections { - ... RecipeSectionFragment - } -} -fragment RecipeSectionFragment on RecipeSection { - index - repository { - ... RepositoryFragment - } - recipeItems { - ... RecipeItemFragment - } - configuration { - ... RecipeConfigurationFragment - } -} ` func (c *Client) GetRecipe(ctx context.Context, repo *string, name *string, httpRequestOptions ...client.HTTPRequestOption) (*GetRecipe, error) { @@ -2050,50 +2050,6 @@ const GetRecipeByIDDocument = `query GetRecipeByID ($id: ID) { } } } -fragment DependenciesFragment on Dependencies { - dependencies { - type - name - repo - optional - version - } - breaking - instructions { - instructions - script - } - wait - application - providers - secrets - wirings { - terraform - helm - } - providerWirings - outputs - providerVsn -} -fragment RecipeConfigurationFragment on RecipeConfiguration { - name - type - default - documentation - optional - placeholder - functionName - condition { - field - operation - value - } - validation { - type - regex - message - } -} fragment RecipeFragment on Recipe { id name @@ -2179,6 +2135,50 @@ fragment TerraformFragment on Terraform { } valuesTemplate } +fragment DependenciesFragment on Dependencies { + dependencies { + type + name + repo + optional + version + } + breaking + instructions { + instructions + script + } + wait + application + providers + secrets + wirings { + terraform + helm + } + providerWirings + outputs + providerVsn +} +fragment RecipeConfigurationFragment on RecipeConfiguration { + name + type + default + documentation + optional + placeholder + functionName + condition { + field + operation + value + } + validation { + type + regex + message + } +} ` func (c *Client) GetRecipeByID(ctx context.Context, id *string, httpRequestOptions ...client.HTTPRequestOption) (*GetRecipeByID, error) { @@ -2203,6 +2203,31 @@ const ListRecipesDocument = `query ListRecipes ($repo: String, $provider: Provid } } } +fragment DependenciesFragment on Dependencies { + dependencies { + type + name + repo + optional + version + } + breaking + instructions { + instructions + script + } + wait + application + providers + secrets + wirings { + terraform + helm + } + providerWirings + outputs + providerVsn +} fragment RecipeConfigurationFragment on RecipeConfiguration { name type @@ -2307,31 +2332,6 @@ fragment TerraformFragment on Terraform { } valuesTemplate } -fragment DependenciesFragment on Dependencies { - dependencies { - type - name - repo - optional - version - } - breaking - instructions { - instructions - script - } - wait - application - providers - secrets - wirings { - terraform - helm - } - providerWirings - outputs - providerVsn -} ` func (c *Client) ListRecipes(ctx context.Context, repo *string, provider *Provider, httpRequestOptions ...client.HTTPRequestOption) (*ListRecipes, error) { @@ -2555,51 +2555,16 @@ func (c *Client) CreateStack(ctx context.Context, attributes StackAttributes, ht } var res CreateStack - if err := c.Client.Post(ctx, "CreateStack", CreateStackDocument, &res, vars, httpRequestOptions...); err != nil { - return nil, err - } - - return &res, nil -} - -const GetStackDocument = `query GetStack ($name: String!, $provider: Provider!) { - stack(name: $name, provider: $provider) { - ... StackFragment - } -} -fragment StackFragment on Stack { - id - name - featured - description - bundles { - ... RecipeFragment - } -} -fragment RecipeSectionFragment on RecipeSection { - index - repository { - ... RepositoryFragment - } - recipeItems { - ... RecipeItemFragment - } - configuration { - ... RecipeConfigurationFragment - } -} -fragment RepositoryFragment on Repository { - id - name - notes - icon - darkIcon - description - publisher { - name + if err := c.Client.Post(ctx, "CreateStack", CreateStackDocument, &res, vars, httpRequestOptions...); err != nil { + return nil, err } - recipes { - name + + return &res, nil +} + +const GetStackDocument = `query GetStack ($name: String!, $provider: Provider!) { + stack(name: $name, provider: $provider) { + ... StackFragment } } fragment ChartFragment on Chart { @@ -2608,49 +2573,6 @@ fragment ChartFragment on Chart { description latestVersion } -fragment RecipeFragment on Recipe { - id - name - description - restricted - provider - tests { - type - name - message - args { - name - repo - key - } - } - repository { - id - name - } - oidcSettings { - uriFormat - uriFormats - authMethod - domainKey - subdomain - } - recipeSections { - ... RecipeSectionFragment - } -} -fragment RecipeItemFragment on RecipeItem { - id - chart { - ... ChartFragment - } - terraform { - ... TerraformFragment - } - configuration { - ... RecipeConfigurationFragment - } -} fragment TerraformFragment on Terraform { id name @@ -2705,6 +2627,84 @@ fragment RecipeConfigurationFragment on RecipeConfiguration { message } } +fragment RecipeFragment on Recipe { + id + name + description + restricted + provider + tests { + type + name + message + args { + name + repo + key + } + } + repository { + id + name + } + oidcSettings { + uriFormat + uriFormats + authMethod + domainKey + subdomain + } + recipeSections { + ... RecipeSectionFragment + } +} +fragment RepositoryFragment on Repository { + id + name + notes + icon + darkIcon + description + publisher { + name + } + recipes { + name + } +} +fragment RecipeItemFragment on RecipeItem { + id + chart { + ... ChartFragment + } + terraform { + ... TerraformFragment + } + configuration { + ... RecipeConfigurationFragment + } +} +fragment StackFragment on Stack { + id + name + featured + description + bundles { + ... RecipeFragment + } +} +fragment RecipeSectionFragment on RecipeSection { + index + repository { + ... RepositoryFragment + } + recipeItems { + ... RecipeItemFragment + } + configuration { + ... RecipeConfigurationFragment + } +} ` func (c *Client) GetStack(ctx context.Context, name string, provider Provider, httpRequestOptions ...client.HTTPRequestOption) (*GetStack, error) { @@ -2739,27 +2739,48 @@ fragment StackFragment on Stack { ... RecipeFragment } } -fragment RecipeSectionFragment on RecipeSection { - index - repository { - ... RepositoryFragment +fragment RecipeItemFragment on RecipeItem { + id + chart { + ... ChartFragment } - recipeItems { - ... RecipeItemFragment + terraform { + ... TerraformFragment } configuration { ... RecipeConfigurationFragment } } -fragment TerraformFragment on Terraform { +fragment ChartFragment on Chart { id name - package description + latestVersion +} +fragment DependenciesFragment on Dependencies { dependencies { - ... DependenciesFragment + type + name + repo + optional + version } - valuesTemplate + breaking + instructions { + instructions + script + } + wait + application + providers + secrets + wirings { + terraform + helm + } + providerWirings + outputs + providerVsn } fragment RecipeConfigurationFragment on RecipeConfiguration { name @@ -2811,6 +2832,18 @@ fragment RecipeFragment on Recipe { ... RecipeSectionFragment } } +fragment RecipeSectionFragment on RecipeSection { + index + repository { + ... RepositoryFragment + } + recipeItems { + ... RecipeItemFragment + } + configuration { + ... RecipeConfigurationFragment + } +} fragment RepositoryFragment on Repository { id name @@ -2825,48 +2858,15 @@ fragment RepositoryFragment on Repository { name } } -fragment RecipeItemFragment on RecipeItem { - id - chart { - ... ChartFragment - } - terraform { - ... TerraformFragment - } - configuration { - ... RecipeConfigurationFragment - } -} -fragment ChartFragment on Chart { +fragment TerraformFragment on Terraform { id name + package description - latestVersion -} -fragment DependenciesFragment on Dependencies { dependencies { - type - name - repo - optional - version - } - breaking - instructions { - instructions - script - } - wait - application - providers - secrets - wirings { - terraform - helm + ... DependenciesFragment } - providerWirings - outputs - providerVsn + valuesTemplate } ` @@ -3388,16 +3388,6 @@ const UploadTerraformDocument = `mutation UploadTerraform ($repoName: String!, $ ... TerraformFragment } } -fragment TerraformFragment on Terraform { - id - name - package - description - dependencies { - ... DependenciesFragment - } - valuesTemplate -} fragment DependenciesFragment on Dependencies { dependencies { type @@ -3423,6 +3413,16 @@ fragment DependenciesFragment on Dependencies { outputs providerVsn } +fragment TerraformFragment on Terraform { + id + name + package + description + dependencies { + ... DependenciesFragment + } + valuesTemplate +} ` func (c *Client) UploadTerraform(ctx context.Context, repoName string, name string, uploadOrURL string, httpRequestOptions ...client.HTTPRequestOption) (*UploadTerraform, error) { @@ -3640,11 +3640,6 @@ const ListKeysDocument = `query ListKeys ($emails: [String]) { } } } -fragment UserFragment on User { - id - name - email -} fragment PublicKeyFragment on PublicKey { id content @@ -3652,6 +3647,11 @@ fragment PublicKeyFragment on PublicKey { ... UserFragment } } +fragment UserFragment on User { + id + name + email +} ` func (c *Client) ListKeys(ctx context.Context, emails []*string, httpRequestOptions ...client.HTTPRequestOption) (*ListKeys, error) { diff --git a/models_gen.go b/models_gen.go index 19624a4..a0d693d 100644 --- a/models_gen.go +++ b/models_gen.go @@ -1866,6 +1866,8 @@ type Repository struct { Readme *string `json:"readme"` // The recipes used to install the application. Recipes []*Recipe `json:"recipes"` + // release status of the repository + ReleaseStatus *ReleaseStatus `json:"releaseStatus"` // A map of secrets of the application. Secrets map[string]interface{} `json:"secrets"` // The tags of the application. @@ -1911,6 +1913,8 @@ type RepositoryAttributes struct { Private *bool `json:"private,omitempty"` // The application's README. Readme *string `json:"readme,omitempty"` + // release status of the repository + ReleaseStatus *ReleaseStatus `json:"releaseStatus,omitempty"` // A YAML object of secrets. Secrets *string `json:"secrets,omitempty"` // The application's tags. @@ -2441,6 +2445,7 @@ type User struct { EmailConfirmBy *string `json:"emailConfirmBy"` EmailConfirmed *bool `json:"emailConfirmed"` HasInstallations *bool `json:"hasInstallations"` + HasShell *bool `json:"hasShell"` ID string `json:"id"` ImpersonationPolicy *ImpersonationPolicy `json:"impersonationPolicy"` InsertedAt *string `json:"insertedAt"` @@ -4028,6 +4033,50 @@ func (e RecipeItemType) MarshalGQL(w io.Writer) { fmt.Fprint(w, strconv.Quote(e.String())) } +// The release status of a repository, defaults to ALPHA, GA if it is ready for general consumption +type ReleaseStatus string + +const ( + ReleaseStatusAlpha ReleaseStatus = "ALPHA" + ReleaseStatusBeta ReleaseStatus = "BETA" + ReleaseStatusGa ReleaseStatus = "GA" +) + +var AllReleaseStatus = []ReleaseStatus{ + ReleaseStatusAlpha, + ReleaseStatusBeta, + ReleaseStatusGa, +} + +func (e ReleaseStatus) IsValid() bool { + switch e { + case ReleaseStatusAlpha, ReleaseStatusBeta, ReleaseStatusGa: + return true + } + return false +} + +func (e ReleaseStatus) String() string { + return string(e) +} + +func (e *ReleaseStatus) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = ReleaseStatus(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid ReleaseStatus", str) + } + return nil +} + +func (e ReleaseStatus) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + type ResetTokenType string const (