diff --git a/client.go b/client.go index a5896a6..eab6e72 100644 --- a/client.go +++ b/client.go @@ -116,6 +116,7 @@ type ConsoleClient interface { GetProject(ctx context.Context, id *string, name *string, interceptors ...clientv2.RequestInterceptor) (*GetProject, error) CreateProject(ctx context.Context, attributes ProjectAttributes, interceptors ...clientv2.RequestInterceptor) (*CreateProject, error) UpdateProject(ctx context.Context, id string, attributes ProjectAttributes, interceptors ...clientv2.RequestInterceptor) (*UpdateProject, error) + DeleteProject(ctx context.Context, id string, interceptors ...clientv2.RequestInterceptor) (*DeleteProject, error) CreateProviderCredential(ctx context.Context, attributes ProviderCredentialAttributes, name string, interceptors ...clientv2.RequestInterceptor) (*CreateProviderCredential, error) DeleteProviderCredential(ctx context.Context, id string, interceptors ...clientv2.RequestInterceptor) (*DeleteProviderCredential, error) ListProviders(ctx context.Context, interceptors ...clientv2.RequestInterceptor) (*ListProviders, error) @@ -12088,6 +12089,17 @@ func (t *UpdateProject) GetUpdateProject() *ProjectFragment { return t.UpdateProject } +type DeleteProject struct { + DeleteProject *ProjectFragment "json:\"deleteProject,omitempty\" graphql:\"deleteProject\"" +} + +func (t *DeleteProject) GetDeleteProject() *ProjectFragment { + if t == nil { + t = &DeleteProject{} + } + return t.DeleteProject +} + type CreateProviderCredential struct { CreateProviderCredential *ProviderCredentialFragment "json:\"createProviderCredential,omitempty\" graphql:\"createProviderCredential\"" } @@ -20669,6 +20681,63 @@ func (c *Client) UpdateProject(ctx context.Context, id string, attributes Projec return &res, nil } +const DeleteProjectDocument = `mutation DeleteProject ($id: ID!) { + deleteProject(id: $id) { + ... ProjectFragment + } +} +fragment ProjectFragment on Project { + id + insertedAt + updatedAt + name + default + description + readBindings { + ... PolicyBindingFragment + } + writeBindings { + ... PolicyBindingFragment + } +} +fragment PolicyBindingFragment on PolicyBinding { + id + group { + ... GroupFragment + } + user { + ... UserFragment + } +} +fragment GroupFragment on Group { + id + name + description +} +fragment UserFragment on User { + name + id + email +} +` + +func (c *Client) DeleteProject(ctx context.Context, id string, interceptors ...clientv2.RequestInterceptor) (*DeleteProject, error) { + vars := map[string]interface{}{ + "id": id, + } + + var res DeleteProject + if err := c.Client.Post(ctx, "DeleteProject", DeleteProjectDocument, &res, vars, interceptors...); err != nil { + if c.Client.ParseDataWhenErrors { + return &res, err + } + + return nil, err + } + + return &res, nil +} + const CreateProviderCredentialDocument = `mutation CreateProviderCredential ($attributes: ProviderCredentialAttributes!, $name: String!) { createProviderCredential(attributes: $attributes, name: $name) { ... ProviderCredentialFragment @@ -24568,6 +24637,7 @@ var DocumentOperationNames = map[string]string{ GetProjectDocument: "GetProject", CreateProjectDocument: "CreateProject", UpdateProjectDocument: "UpdateProject", + DeleteProjectDocument: "DeleteProject", CreateProviderCredentialDocument: "CreateProviderCredential", DeleteProviderCredentialDocument: "DeleteProviderCredential", ListProvidersDocument: "ListProviders", diff --git a/graph/project.graphql b/graph/project.graphql index a1e3b0f..73f0a38 100644 --- a/graph/project.graphql +++ b/graph/project.graphql @@ -45,3 +45,9 @@ mutation UpdateProject($id: ID!, $attributes: ProjectAttributes!) { ...ProjectFragment } } + +mutation DeleteProject($id: ID!) { + deleteProject(id: $id) { + ...ProjectFragment + } +} \ No newline at end of file diff --git a/models_gen.go b/models_gen.go index 834fe0a..aad5caf 100644 --- a/models_gen.go +++ b/models_gen.go @@ -1777,7 +1777,9 @@ type InfrastructureStack struct { // the subdirectory you want to run the stack's commands w/in Workdir *string `json:"workdir,omitempty"` // whether you want Plural to manage the state of this stack - ManageState *bool `json:"manageState,omitempty"` + ManageState *bool `json:"manageState,omitempty"` + // Arbitrary variables to add to a stack run + Variables *string `json:"variables,omitempty"` Runs *StackRunConnection `json:"runs,omitempty"` PullRequests *PullRequestConnection `json:"pullRequests,omitempty"` // files bound to a run of this stack @@ -3927,6 +3929,8 @@ type ServiceDeployment struct { ReadBindings []*PolicyBinding `json:"readBindings,omitempty"` // write policy of this service WriteBindings []*PolicyBinding `json:"writeBindings,omitempty"` + // the service that owns this service in a service-of-services setup + Parent *ServiceDeployment `json:"parent,omitempty"` // a list of errors generated by the deployment operator Errors []*ServiceError `json:"errors,omitempty"` // the cluster this service is deployed into @@ -3970,6 +3974,7 @@ type ServiceDeploymentAttributes struct { Git *GitRefAttributes `json:"git,omitempty"` Helm *HelmConfigAttributes `json:"helm,omitempty"` Kustomize *KustomizeAttributes `json:"kustomize,omitempty"` + ParentID *string `json:"parentId,omitempty"` Configuration []*ConfigAttributes `json:"configuration,omitempty"` Dependencies []*ServiceDependencyAttributes `json:"dependencies,omitempty"` ReadBindings []*PolicyBindingAttributes `json:"readBindings,omitempty"` @@ -4100,6 +4105,7 @@ type ServiceUpdateAttributes struct { Helm *HelmConfigAttributes `json:"helm,omitempty"` Configuration []*ConfigAttributes `json:"configuration,omitempty"` Kustomize *KustomizeAttributes `json:"kustomize,omitempty"` + ParentID *string `json:"parentId,omitempty"` Dependencies []*ServiceDependencyAttributes `json:"dependencies,omitempty"` ReadBindings []*PolicyBindingAttributes `json:"readBindings,omitempty"` WriteBindings []*PolicyBindingAttributes `json:"writeBindings,omitempty"` @@ -4172,7 +4178,9 @@ type StackAttributes struct { // the id of a stack definition to use DefinitionID *string `json:"definitionId,omitempty"` // a cron to spawn runs for this stack - Cron *StackCronAttributes `json:"cron,omitempty"` + Cron *StackCronAttributes `json:"cron,omitempty"` + // arbitrary variables to pass into the stack + Variables *string `json:"variables,omitempty"` ReadBindings []*PolicyBindingAttributes `json:"readBindings,omitempty"` WriteBindings []*PolicyBindingAttributes `json:"writeBindings,omitempty"` Tags []*TagAttributes `json:"tags,omitempty"` @@ -4316,8 +4324,10 @@ type StackRun struct { // the subdirectory you want to run the stack's commands w/in Workdir *string `json:"workdir,omitempty"` // whether you want Plural to manage the state of this stack - ManageState *bool `json:"manageState,omitempty"` - StateUrls *StateUrls `json:"stateUrls,omitempty"` + ManageState *bool `json:"manageState,omitempty"` + // Arbitrary variables to add to a stack run + Variables *string `json:"variables,omitempty"` + StateUrls *StateUrls `json:"stateUrls,omitempty"` // the kubernetes job for this run (useful for debugging if issues arise) Job *Job `json:"job,omitempty"` // temporary plural creds usable for terraform authentication diff --git a/schema/schema.graphql b/schema/schema.graphql index 97d493a..7ce327a 100644 --- a/schema/schema.graphql +++ b/schema/schema.graphql @@ -769,6 +769,8 @@ type RootMutationType { updateProject(id: ID!, attributes: ProjectAttributes!): Project + deleteProject(id: ID!): Project + "a reusable mutation for updating rbac settings on core services" updateRbac(rbac: RbacAttributes!, serviceId: ID, clusterId: ID, providerId: ID, pipelineId: ID, stackId: ID): Boolean } @@ -1095,6 +1097,9 @@ input StackAttributes { "a cron to spawn runs for this stack" cron: StackCronAttributes + "arbitrary variables to pass into the stack" + variables: Json + readBindings: [PolicyBindingAttributes] writeBindings: [PolicyBindingAttributes] @@ -1284,6 +1289,9 @@ type InfrastructureStack { "whether you want Plural to manage the state of this stack" manageState: Boolean + "Arbitrary variables to add to a stack run" + variables: Json + runs(after: String, first: Int, before: String, last: Int, pullRequestId: ID): StackRunConnection pullRequests(after: String, first: Int, before: String, last: Int): PullRequestConnection @@ -1430,6 +1438,9 @@ type StackRun { "whether you want Plural to manage the state of this stack" manageState: Boolean + "Arbitrary variables to add to a stack run" + variables: Json + stateUrls: StateUrls "the kubernetes job for this run (useful for debugging if issues arise)" @@ -2725,6 +2736,8 @@ input ServiceDeploymentAttributes { kustomize: KustomizeAttributes + parentId: ID + configuration: [ConfigAttributes] dependencies: [ServiceDependencyAttributes] @@ -2806,6 +2819,8 @@ input ServiceUpdateAttributes { kustomize: KustomizeAttributes + parentId: ID + dependencies: [ServiceDependencyAttributes] readBindings: [PolicyBindingAttributes] @@ -2953,6 +2968,9 @@ type ServiceDeployment { "write policy of this service" writeBindings: [PolicyBinding] + "the service that owns this service in a service-of-services setup" + parent: ServiceDeployment + "a list of errors generated by the deployment operator" errors: [ServiceError]