github.com/pluralsh/plural-cli@v0.9.5/pkg/api/models.go (about)

     1  package api
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/pluralsh/gqlclient"
     7  )
     8  
     9  type PageInfo struct {
    10  	HasNextPage bool
    11  	EndCursor   string
    12  }
    13  
    14  type Publisher struct {
    15  	Id   string
    16  	Name string
    17  }
    18  
    19  type Repository struct {
    20  	Id          string
    21  	Name        string
    22  	Description string
    23  	Icon        string
    24  	DarkIcon    string
    25  	Notes       string
    26  	Publisher   *Publisher
    27  	Recipes     []*Recipe
    28  }
    29  
    30  type Chart struct {
    31  	Id            string
    32  	Name          string
    33  	Description   string
    34  	LatestVersion string
    35  	Dependencies  *Dependencies
    36  }
    37  
    38  type ChartInstallation struct {
    39  	Id           string
    40  	Chart        *Chart
    41  	Version      *Version
    42  	Installation *Installation
    43  }
    44  
    45  type Tag struct {
    46  	Tag string
    47  }
    48  
    49  type Version struct {
    50  	Id             string
    51  	Version        string
    52  	Readme         string
    53  	Helm           map[string]interface{}
    54  	Package        string
    55  	ValuesTemplate string
    56  	TemplateType   gqlclient.TemplateType
    57  	Crds           []Crd
    58  	Dependencies   *Dependencies
    59  	InsertedAt     string
    60  }
    61  
    62  type Terraform struct {
    63  	Id             string
    64  	Name           string
    65  	Description    string
    66  	ValuesTemplate string
    67  	Dependencies   *Dependencies
    68  	Package        string
    69  }
    70  
    71  type Dependencies struct {
    72  	Dependencies    []*Dependency
    73  	Providers       []string
    74  	Wirings         *Wirings
    75  	Secrets         []string
    76  	Application     bool
    77  	Wait            bool
    78  	ProviderWirings map[string]interface{}
    79  	Outputs         map[string]interface{}
    80  	ProviderVsn     string
    81  	CliVsn          string
    82  }
    83  
    84  type Dependency struct {
    85  	Type string
    86  	Repo string
    87  	Name string
    88  }
    89  
    90  type Wirings struct {
    91  	Terraform map[string]string
    92  	Helm      map[string]string
    93  }
    94  
    95  type TerraformInstallation struct {
    96  	Id           string
    97  	Installation *Installation
    98  	Terraform    *Terraform
    99  	Version      *Version
   100  }
   101  
   102  type OAuthConfiguration struct {
   103  	Issuer                string
   104  	AuthorizationEndpoint string
   105  	TokenEndpoint         string
   106  	JwksUri               string
   107  	UserinfoEndpoint      string
   108  }
   109  
   110  type OIDCProvider struct {
   111  	Id            string
   112  	ClientId      string
   113  	ClientSecret  string
   114  	RedirectUris  []string
   115  	Bindings      []*ProviderBinding
   116  	Configuration *OAuthConfiguration
   117  }
   118  
   119  type Installation struct {
   120  	Id           string
   121  	Repository   *Repository
   122  	User         *User
   123  	OIDCProvider *OIDCProvider `json:"oidcProvider"`
   124  	LicenseKey   string
   125  	Context      map[string]interface{}
   126  	AcmeKeyId    string
   127  	AcmeSecret   string
   128  }
   129  
   130  type CloudShell struct {
   131  	Id     string
   132  	AesKey string `json:"aesKey"`
   133  	GitUrl string `json:"gitUrl"`
   134  }
   135  
   136  type RepositoryEdge struct {
   137  	Node *Repository
   138  }
   139  
   140  type InstallationEdge struct {
   141  	Node *Installation
   142  }
   143  
   144  type ChartEdge struct {
   145  	Node *Chart
   146  }
   147  
   148  type TerraformEdge struct {
   149  	Node *Terraform
   150  }
   151  
   152  type VersionEdge struct {
   153  	Node *Version
   154  }
   155  
   156  type ChartInstallationEdge struct {
   157  	Node *ChartInstallation
   158  }
   159  
   160  type TerraformInstallationEdge struct {
   161  	Node *TerraformInstallation
   162  }
   163  
   164  type Token struct {
   165  	Token string
   166  }
   167  
   168  type Webhook struct {
   169  	Id     string
   170  	Url    string
   171  	Secret string
   172  }
   173  
   174  type Recipe struct {
   175  	Id                 string
   176  	Name               string
   177  	Provider           string
   178  	Description        string
   179  	Primary            bool
   180  	Restricted         bool
   181  	Tests              []*RecipeTest
   182  	Repository         *Repository
   183  	RecipeSections     []*RecipeSection
   184  	OidcSettings       *OIDCSettings `yaml:"oidcSettings" json:"oidcSettings"`
   185  	RecipeDependencies []*Recipe     `yaml:"recipeDependencies" json:"recipeDependencies"`
   186  }
   187  
   188  type Stack struct {
   189  	Id          string
   190  	Name        string
   191  	Provider    string
   192  	Featured    bool
   193  	Description string
   194  	Bundles     []*Recipe
   195  }
   196  
   197  type RecipeTest struct {
   198  	Name    string
   199  	Type    string
   200  	Message string
   201  	Args    []*TestArgument
   202  }
   203  
   204  type TestArgument struct {
   205  	Name string
   206  	Repo string
   207  	Key  string
   208  }
   209  
   210  type OIDCSettings struct {
   211  	DomainKey  string   `yaml:"domainKey"`
   212  	UriFormat  string   `yaml:"uriFormat"`
   213  	UriFormats []string `yaml:"uriFormats"`
   214  	AuthMethod string   `yaml:"authMethod"`
   215  	Subdomain  bool     `yaml:"subdomain"`
   216  }
   217  
   218  type RecipeSection struct {
   219  	Id            string
   220  	Repository    *Repository
   221  	RecipeItems   []*RecipeItem
   222  	Configuration []*ConfigurationItem
   223  }
   224  
   225  type RecipeItem struct {
   226  	Id            string
   227  	Terraform     *Terraform
   228  	Chart         *Chart
   229  	Configuration []*ConfigurationItem
   230  }
   231  
   232  type Condition struct {
   233  	Field     string
   234  	Operation string
   235  	Value     string
   236  }
   237  
   238  type Validation struct {
   239  	Type    string
   240  	Regex   string
   241  	Message string
   242  }
   243  
   244  type ConfigurationItem struct {
   245  	Name          string
   246  	Default       string
   247  	Documentation string
   248  	Type          string
   249  	Placeholder   string
   250  	FunctionName  string `json:"functionName" yaml:"functionName"`
   251  	Optional      bool
   252  	Condition     *Condition
   253  	Validation    *Validation
   254  }
   255  
   256  type Artifact struct {
   257  	Id       string
   258  	Name     string
   259  	Readme   string
   260  	Blob     string
   261  	Sha      string
   262  	Platform string
   263  	Arch     string
   264  	Filesize int
   265  }
   266  
   267  type Crd struct {
   268  	Id   string
   269  	Name string
   270  	Blob string
   271  }
   272  
   273  type ChartName struct {
   274  	Repo  string
   275  	Chart string
   276  }
   277  
   278  type Upgrade struct {
   279  	Id string
   280  }
   281  
   282  type User struct {
   283  	Id    string
   284  	Email string
   285  	Name  string
   286  }
   287  
   288  type Group struct {
   289  	Id   string
   290  	Name string
   291  }
   292  
   293  type ProviderBinding struct {
   294  	User  *User
   295  	Group *Group
   296  }
   297  
   298  type PublicKey struct {
   299  	Id      string
   300  	Content string
   301  	User    *User
   302  }
   303  
   304  type PublicKeyEdge struct {
   305  	Node *PublicKey
   306  }
   307  
   308  type EabCredential struct {
   309  	Id       string
   310  	KeyId    string
   311  	HmacKey  string
   312  	Cluster  string
   313  	Provider string
   314  }
   315  
   316  type DnsDomain struct {
   317  	Id   string
   318  	Name string
   319  }
   320  
   321  type ApplyLock struct {
   322  	Id   string
   323  	Lock string
   324  }
   325  
   326  type ScaffoldFile struct {
   327  	Path    string
   328  	Content string
   329  }
   330  
   331  type KeyBackup struct {
   332  	Name         string
   333  	Digest       string
   334  	Repositories []string
   335  	Value        string
   336  	InsertedAt   string
   337  }
   338  
   339  type Cluster struct {
   340  	Id          string
   341  	Name        string
   342  	Provider    string
   343  	UpgradeInfo []*UpgradeInfo
   344  	Source      string
   345  	GitUrl      string
   346  	Owner       *User
   347  }
   348  
   349  type UpgradeInfo struct {
   350  	Count        int64
   351  	Installation *Installation
   352  }
   353  
   354  type ChatMessage struct {
   355  	Name    string
   356  	Content string
   357  	Role    string
   358  }
   359  
   360  const CrdFragment = `
   361  	fragment CrdFragment on Crd {
   362  		id
   363  		name
   364  		blob
   365  	}
   366  `
   367  
   368  const DependenciesFragment = `
   369  	fragment DependenciesFragment on Dependencies {
   370  		dependencies {
   371  			type
   372  			name
   373  			repo
   374  		}
   375  		wait
   376  		application
   377  		providers
   378  		secrets
   379  		wirings { terraform helm }
   380  		providerWirings
   381  		outputs
   382  		providerVsn
   383  	}
   384  `
   385  
   386  var VersionFragment = fmt.Sprintf(`
   387  	fragment VersionFragment on Version {
   388  		id
   389  		readme
   390  		version
   391  		valuesTemplate
   392  		package
   393  		crds { ...CrdFragment }
   394  		dependencies { ...DependenciesFragment }
   395  	}
   396  	%s
   397  `, CrdFragment)
   398  
   399  var TerraformFragment = fmt.Sprintf(`
   400  	fragment TerraformFragment on Terraform {
   401  		id
   402  		name
   403  		package
   404  		description
   405  		dependencies { ...DependenciesFragment }
   406  		valuesTemplate
   407  	}
   408  	%s
   409  `, DependenciesFragment)
   410  
   411  var TerraformInstallationFragment = fmt.Sprintf(`
   412  	fragment TerraformInstallationFragment on TerraformInstallation {
   413  		id
   414  		terraform { ...TerraformFragment }
   415  		version { ...VersionFragment }
   416  	}
   417  	%s
   418  	%s
   419  `, TerraformFragment, VersionFragment)
   420  
   421  const ArtifactFragment = `
   422  	fragment ArtifactFragment on Artifact {
   423  		id
   424  		name
   425  		readme
   426  		platform
   427  		arch
   428  		blob
   429  		sha
   430  		filesize
   431  	}
   432  `