diff --git a/cli/cliui/parameter.go b/cli/cliui/parameter.go index 28e0c08e785ce..f82f00e8a87ff 100644 --- a/cli/cliui/parameter.go +++ b/cli/cliui/parameter.go @@ -10,7 +10,7 @@ import ( "github.com/coder/coder/codersdk" ) -func ParameterSchema(cmd *cobra.Command, parameterSchema codersdk.ParameterSchema) (string, error) { +func DeprecatedParameterSchema(cmd *cobra.Command, parameterSchema codersdk.DeprecatedParameterSchema) (string, error) { _, _ = fmt.Fprintln(cmd.OutOrStdout(), Styles.Bold.Render("var."+parameterSchema.Name)) if parameterSchema.Description != "" { _, _ = fmt.Fprintln(cmd.OutOrStdout(), " "+strings.TrimSpace(strings.Join(strings.Split(parameterSchema.Description, "\n"), "\n "))+"\n") diff --git a/cli/create.go b/cli/create.go index 854ba78565c51..357aab0df3107 100644 --- a/cli/create.go +++ b/cli/create.go @@ -122,10 +122,10 @@ func create() *cobra.Command { } parameters, err := prepWorkspaceBuild(cmd, client, prepWorkspaceBuildArgs{ - Template: template, - ExistingParams: []codersdk.Parameter{}, - ParameterFile: parameterFile, - NewWorkspaceName: workspaceName, + Template: template, + ExistingDeprecatedParams: []codersdk.DeprecatedParameter{}, + ParameterFile: parameterFile, + NewWorkspaceName: workspaceName, }) if err != nil { return err @@ -140,11 +140,11 @@ func create() *cobra.Command { } workspace, err := client.CreateWorkspace(cmd.Context(), organization.ID, codersdk.Me, codersdk.CreateWorkspaceRequest{ - TemplateID: template.ID, - Name: workspaceName, - AutostartSchedule: schedSpec, - TTLMillis: ptr.Ref(stopAfter.Milliseconds()), - ParameterValues: parameters, + TemplateID: template.ID, + Name: workspaceName, + AutostartSchedule: schedSpec, + TTLMillis: ptr.Ref(stopAfter.Milliseconds()), + DeprecatedParameterValues: parameters, }) if err != nil { return err @@ -169,21 +169,22 @@ func create() *cobra.Command { } type prepWorkspaceBuildArgs struct { - Template codersdk.Template - ExistingParams []codersdk.Parameter - ParameterFile string - NewWorkspaceName string + Template codersdk.Template + ExistingParams []codersdk.WorkspaceBuildParameter + ExistingDeprecatedParams []codersdk.DeprecatedParameter + ParameterFile string + NewWorkspaceName string } // prepWorkspaceBuild will ensure a workspace build will succeed on the latest template version. // Any missing params will be prompted to the user. -func prepWorkspaceBuild(cmd *cobra.Command, client *codersdk.Client, args prepWorkspaceBuildArgs) ([]codersdk.CreateParameterRequest, error) { +func prepWorkspaceBuild(cmd *cobra.Command, client *codersdk.Client, args prepWorkspaceBuildArgs) ([]codersdk.DeprecatedCreateParameterRequest, error) { ctx := cmd.Context() templateVersion, err := client.TemplateVersion(ctx, args.Template.ActiveVersionID) if err != nil { return nil, err } - parameterSchemas, err := client.TemplateVersionSchema(ctx, templateVersion.ID) + deprecatedParameterSchemas, err := client.DeprecatedTemplateVersionSchema(ctx, templateVersion.ID) if err != nil { return nil, err } @@ -200,9 +201,9 @@ func prepWorkspaceBuild(cmd *cobra.Command, client *codersdk.Client, args prepWo } } disclaimerPrinted := false - parameters := make([]codersdk.CreateParameterRequest, 0) -PromptParamLoop: - for _, parameterSchema := range parameterSchemas { + deprecatedParameters := make([]codersdk.DeprecatedCreateParameterRequest, 0) +PromptDeprecatedParamLoop: + for _, parameterSchema := range deprecatedParameterSchemas { if !parameterSchema.AllowOverrideSource { continue } @@ -213,24 +214,24 @@ PromptParamLoop: // Param file is all or nothing if !useParamFile { - for _, e := range args.ExistingParams { + for _, e := range args.ExistingDeprecatedParams { if e.Name == parameterSchema.Name { // If the param already exists, we do not need to prompt it again. // The workspace scope will reuse params for each build. - continue PromptParamLoop + continue PromptDeprecatedParamLoop } } } - parameterValue, err := getParameterValueFromMapOrInput(cmd, parameterMapFromFile, parameterSchema) + parameterValue, err := getDeprecatedParameterValueFromMapOrInput(cmd, parameterMapFromFile, parameterSchema) if err != nil { return nil, err } - parameters = append(parameters, codersdk.CreateParameterRequest{ + deprecatedParameters = append(deprecatedParameters, codersdk.DeprecatedCreateParameterRequest{ Name: parameterSchema.Name, SourceValue: parameterValue, - SourceScheme: codersdk.ParameterSourceSchemeData, + SourceScheme: codersdk.DeprecatedParameterSourceSchemeData, DestinationScheme: parameterSchema.DefaultDestinationScheme, }) } @@ -239,7 +240,7 @@ PromptParamLoop: // Run a dry-run with the given parameters to check correctness dryRun, err := client.CreateTemplateVersionDryRun(cmd.Context(), templateVersion.ID, codersdk.CreateTemplateVersionDryRunRequest{ WorkspaceName: args.NewWorkspaceName, - ParameterValues: parameters, + ParameterValues: deprecatedParameters, }) if err != nil { return nil, xerrors.Errorf("begin workspace dry-run: %w", err) @@ -279,5 +280,5 @@ PromptParamLoop: return nil, err } - return parameters, nil + return deprecatedParameters, nil } diff --git a/cli/create_test.go b/cli/create_test.go index ce5f922258158..f209e74289ff8 100644 --- a/cli/create_test.go +++ b/cli/create_test.go @@ -257,9 +257,9 @@ func TestCreate(t *testing.T) { client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: []*proto.Parse_Response{{ - Type: &proto.Parse_Response_Complete{ - Complete: &proto.Parse_Complete{ + Parse: []*proto.DeprecatedParse_Response{{ + Type: &proto.DeprecatedParse_Response_Complete{ + Complete: &proto.DeprecatedParse_Complete{ ParameterSchemas: echo.ParameterSuccess, }, }, @@ -297,35 +297,29 @@ func TestCreate(t *testing.T) { }) } -func createTestParseResponseWithDefault(defaultValue string) []*proto.Parse_Response { - return []*proto.Parse_Response{{ - Type: &proto.Parse_Response_Complete{ - Complete: &proto.Parse_Complete{ - ParameterSchemas: []*proto.ParameterSchema{ +func createTestParseResponseWithDefault(defaultValue string) []*proto.DeprecatedParse_Response { + return []*proto.DeprecatedParse_Response{{ + Type: &proto.DeprecatedParse_Response_Complete{ + Complete: &proto.DeprecatedParse_Complete{ + ParameterSchemas: []*proto.DeprecatedParameterSchema{ { AllowOverrideSource: true, Name: "region", Description: "description 1", - DefaultSource: &proto.ParameterSource{ - Scheme: proto.ParameterSource_DATA, + DefaultSource: &proto.DeprecatedParameterSource{ + Scheme: proto.DeprecatedParameterSource_DATA, Value: defaultValue, }, - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, }, { AllowOverrideSource: true, Name: "username", Description: "description 2", - DefaultSource: &proto.ParameterSource{ - Scheme: proto.ParameterSource_DATA, + DefaultSource: &proto.DeprecatedParameterSource{ + Scheme: proto.DeprecatedParameterSource_DATA, // No default value Value: "", }, - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, }, }, }, diff --git a/cli/parameter.go b/cli/parameter.go index 904148ae13005..685f33a51ab82 100644 --- a/cli/parameter.go +++ b/cli/parameter.go @@ -38,7 +38,7 @@ func createParameterMapFromFile(parameterFile string) (map[string]string, error) // Returns a parameter value from a given map, if the map exists, else takes input from the user. // Throws an error if the map exists but does not include a value for the parameter. -func getParameterValueFromMapOrInput(cmd *cobra.Command, parameterMap map[string]string, parameterSchema codersdk.ParameterSchema) (string, error) { +func getDeprecatedParameterValueFromMapOrInput(cmd *cobra.Command, parameterMap map[string]string, parameterSchema codersdk.DeprecatedParameterSchema) (string, error) { var parameterValue string if parameterMap != nil { var ok bool @@ -48,7 +48,7 @@ func getParameterValueFromMapOrInput(cmd *cobra.Command, parameterMap map[string } } else { var err error - parameterValue, err = cliui.ParameterSchema(cmd, parameterSchema) + parameterValue, err = cliui.DeprecatedParameterSchema(cmd, parameterSchema) if err != nil { return "", err } diff --git a/cli/parameterslist.go b/cli/parameterslist.go index 3978df26a850f..180502cd87ceb 100644 --- a/cli/parameterslist.go +++ b/cli/parameterslist.go @@ -33,21 +33,21 @@ func parameterList() *cobra.Command { } var scopeID uuid.UUID - switch codersdk.ParameterScope(scope) { - case codersdk.ParameterWorkspace: + switch codersdk.DeprecatedParameterScope(scope) { + case codersdk.DeprecatedParameterWorkspace: workspace, err := namedWorkspace(cmd, client, name) if err != nil { return err } scopeID = workspace.ID - case codersdk.ParameterTemplate: + case codersdk.DeprecatedParameterTemplate: template, err := client.TemplateByName(cmd.Context(), organization.ID, name) if err != nil { return xerrors.Errorf("get workspace template: %w", err) } scopeID = template.ID - case codersdk.ParameterImportJob, "template_version": - scope = string(codersdk.ParameterImportJob) + case codersdk.DeprecatedParameterImportJob, "template_version": + scope = string(codersdk.DeprecatedParameterImportJob) scopeID, err = uuid.Parse(name) if err != nil { return xerrors.Errorf("%q must be a uuid for this scope type", name) @@ -61,12 +61,12 @@ func parameterList() *cobra.Command { } default: - return xerrors.Errorf("%q is an unsupported scope, use %v", scope, []codersdk.ParameterScope{ - codersdk.ParameterWorkspace, codersdk.ParameterTemplate, codersdk.ParameterImportJob, + return xerrors.Errorf("%q is an unsupported scope, use %v", scope, []codersdk.DeprecatedParameterScope{ + codersdk.DeprecatedParameterWorkspace, codersdk.DeprecatedParameterTemplate, codersdk.DeprecatedParameterImportJob, }) } - params, err := client.Parameters(cmd.Context(), codersdk.ParameterScope(scope), scopeID) + params, err := client.DeprecatedParameters(cmd.Context(), codersdk.DeprecatedParameterScope(scope), scopeID) if err != nil { return xerrors.Errorf("fetch params: %w", err) } diff --git a/cli/templatecreate.go b/cli/templatecreate.go index 8c8ce9e034610..4dbec82ecbaea 100644 --- a/cli/templatecreate.go +++ b/cli/templatecreate.go @@ -165,7 +165,7 @@ type createValidTemplateVersionArgs struct { ProvisionerTags map[string]string } -func createValidTemplateVersion(cmd *cobra.Command, args createValidTemplateVersionArgs, parameters ...codersdk.CreateParameterRequest) (*codersdk.TemplateVersion, []codersdk.CreateParameterRequest, error) { +func createValidTemplateVersion(cmd *cobra.Command, args createValidTemplateVersionArgs, parameters ...codersdk.DeprecatedCreateParameterRequest) (*codersdk.TemplateVersion, []codersdk.DeprecatedCreateParameterRequest, error) { client := args.Client req := codersdk.CreateTemplateVersionRequest{ @@ -205,11 +205,11 @@ func createValidTemplateVersion(cmd *cobra.Command, args createValidTemplateVers if err != nil { return nil, nil, err } - parameterSchemas, err := client.TemplateVersionSchema(cmd.Context(), version.ID) + parameterSchemas, err := client.DeprecatedTemplateVersionSchema(cmd.Context(), version.ID) if err != nil { return nil, nil, err } - parameterValues, err := client.TemplateVersionParameters(cmd.Context(), version.ID) + parameterValues, err := client.DeprecatedTemplateVersionParameters(cmd.Context(), version.ID) if err != nil { return nil, nil, err } @@ -217,7 +217,7 @@ func createValidTemplateVersion(cmd *cobra.Command, args createValidTemplateVers // lastParameterValues are pulled from the current active template version if // templateID is provided. This allows pulling params from the last // version instead of prompting if we are updating template versions. - lastParameterValues := make(map[string]codersdk.Parameter) + lastParameterValues := make(map[string]codersdk.DeprecatedParameter) if args.ReuseParameters && args.Template != nil { activeVersion, err := client.TemplateVersion(cmd.Context(), args.Template.ActiveVersionID) if err != nil { @@ -225,7 +225,7 @@ func createValidTemplateVersion(cmd *cobra.Command, args createValidTemplateVers } // We don't want to compute the params, we only want to copy from this scope - values, err := client.Parameters(cmd.Context(), codersdk.ParameterImportJob, activeVersion.Job.ID) + values, err := client.DeprecatedParameters(cmd.Context(), codersdk.DeprecatedParameterImportJob, activeVersion.Job.ID) if err != nil { return nil, nil, xerrors.Errorf("Fetch previous version parameters: %w", err) } @@ -235,7 +235,7 @@ func createValidTemplateVersion(cmd *cobra.Command, args createValidTemplateVers } if provisionerd.IsMissingParameterError(version.Job.Error) { - valuesBySchemaID := map[string]codersdk.ComputedParameter{} + valuesBySchemaID := map[string]codersdk.DeprecatedComputedParameter{} for _, parameterValue := range parameterValues { valuesBySchemaID[parameterValue.SchemaID.String()] = parameterValue } @@ -252,7 +252,7 @@ func createValidTemplateVersion(cmd *cobra.Command, args createValidTemplateVers // pulled params come from the last template version pulled := make([]string, 0) - missingSchemas := make([]codersdk.ParameterSchema, 0) + missingSchemas := make([]codersdk.DeprecatedParameterSchema, 0) for _, parameterSchema := range parameterSchemas { _, ok := valuesBySchemaID[parameterSchema.ID.String()] if ok { @@ -265,7 +265,7 @@ func createValidTemplateVersion(cmd *cobra.Command, args createValidTemplateVers if inherit, ok := lastParameterValues[parameterSchema.Name]; ok && !fileOk { // If the value is not in the param file, and can be pulled from the last template version, // then don't mark it as missing. - parameters = append(parameters, codersdk.CreateParameterRequest{ + parameters = append(parameters, codersdk.DeprecatedCreateParameterRequest{ CloneID: inherit.ID, }) pulled = append(pulled, fmt.Sprintf("%q", parameterSchema.Name)) @@ -282,14 +282,14 @@ func createValidTemplateVersion(cmd *cobra.Command, args createValidTemplateVers _, _ = fmt.Fprint(cmd.OutOrStdout(), "\r\n") for _, parameterSchema := range missingSchemas { - parameterValue, err := getParameterValueFromMapOrInput(cmd, parameterMapFromFile, parameterSchema) + parameterValue, err := getDeprecatedParameterValueFromMapOrInput(cmd, parameterMapFromFile, parameterSchema) if err != nil { return nil, nil, err } - parameters = append(parameters, codersdk.CreateParameterRequest{ + parameters = append(parameters, codersdk.DeprecatedCreateParameterRequest{ Name: parameterSchema.Name, SourceValue: parameterValue, - SourceScheme: codersdk.ParameterSourceSchemeData, + SourceScheme: codersdk.DeprecatedParameterSourceSchemeData, DestinationScheme: parameterSchema.DefaultDestinationScheme, }) _, _ = fmt.Fprintln(cmd.OutOrStdout()) diff --git a/cli/templatecreate_test.go b/cli/templatecreate_test.go index c19cbe8f0318d..184fdaa47c223 100644 --- a/cli/templatecreate_test.go +++ b/cli/templatecreate_test.go @@ -257,17 +257,14 @@ func TestTemplateCreate(t *testing.T) { }) } -func createTestParseResponse() []*proto.Parse_Response { - return []*proto.Parse_Response{{ - Type: &proto.Parse_Response_Complete{ - Complete: &proto.Parse_Complete{ - ParameterSchemas: []*proto.ParameterSchema{{ +func createTestParseResponse() []*proto.DeprecatedParse_Response { + return []*proto.DeprecatedParse_Response{{ + Type: &proto.DeprecatedParse_Response_Complete{ + Complete: &proto.DeprecatedParse_Complete{ + ParameterSchemas: []*proto.DeprecatedParameterSchema{{ AllowOverrideSource: true, Name: "region", Description: "description", - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, }}, }, }, diff --git a/cli/templatepull_test.go b/cli/templatepull_test.go index 0ae1fc740a43a..d9ef1c3691906 100644 --- a/cli/templatepull_test.go +++ b/cli/templatepull_test.go @@ -131,9 +131,9 @@ func TestTemplatePull(t *testing.T) { // a template version source. func genTemplateVersionSource() *echo.Responses { return &echo.Responses{ - Parse: []*proto.Parse_Response{ + Parse: []*proto.DeprecatedParse_Response{ { - Type: &proto.Parse_Response_Log{ + Type: &proto.DeprecatedParse_Response_Log{ Log: &proto.Log{ Output: uuid.NewString(), }, @@ -141,8 +141,8 @@ func genTemplateVersionSource() *echo.Responses { }, { - Type: &proto.Parse_Response_Complete{ - Complete: &proto.Parse_Complete{}, + Type: &proto.DeprecatedParse_Response_Complete{ + Complete: &proto.DeprecatedParse_Complete{}, }, }, }, diff --git a/cli/templatepush_test.go b/cli/templatepush_test.go index 4aa7867c0df8b..23808b321ed1a 100644 --- a/cli/templatepush_test.go +++ b/cli/templatepush_test.go @@ -210,7 +210,7 @@ func TestTemplatePush(t *testing.T) { }) } -func latestTemplateVersion(t *testing.T, client *codersdk.Client, templateID uuid.UUID) (codersdk.TemplateVersion, []codersdk.Parameter) { +func latestTemplateVersion(t *testing.T, client *codersdk.Client, templateID uuid.UUID) (codersdk.TemplateVersion, []codersdk.DeprecatedParameter) { t.Helper() ctx := context.Background() @@ -218,7 +218,7 @@ func latestTemplateVersion(t *testing.T, client *codersdk.Client, templateID uui require.NoError(t, err) tv, err := client.TemplateVersion(ctx, newTemplate.ActiveVersionID) require.NoError(t, err) - params, err := client.Parameters(ctx, codersdk.ParameterImportJob, tv.Job.ID) + params, err := client.DeprecatedParameters(ctx, codersdk.DeprecatedParameterImportJob, tv.Job.ID) require.NoError(t, err) return tv, params diff --git a/cli/update.go b/cli/update.go index d419cac9389c4..563b2af0cbb9b 100644 --- a/cli/update.go +++ b/cli/update.go @@ -38,28 +38,28 @@ func update() *cobra.Command { return nil } - var existingParams []codersdk.Parameter + var existingParams []codersdk.DeprecatedParameter if !alwaysPrompt { - existingParams, err = client.Parameters(cmd.Context(), codersdk.ParameterWorkspace, workspace.ID) + existingParams, err = client.DeprecatedParameters(cmd.Context(), codersdk.DeprecatedParameterWorkspace, workspace.ID) if err != nil { return nil } } parameters, err := prepWorkspaceBuild(cmd, client, prepWorkspaceBuildArgs{ - Template: template, - ExistingParams: existingParams, - ParameterFile: parameterFile, - NewWorkspaceName: workspace.Name, + Template: template, + ExistingDeprecatedParams: existingParams, + ParameterFile: parameterFile, + NewWorkspaceName: workspace.Name, }) if err != nil { return nil } build, err := client.CreateWorkspaceBuild(cmd.Context(), workspace.ID, codersdk.CreateWorkspaceBuildRequest{ - TemplateVersionID: template.ActiveVersionID, - Transition: workspace.LatestBuild.Transition, - ParameterValues: parameters, + TemplateVersionID: template.ActiveVersionID, + Transition: workspace.LatestBuild.Transition, + DeprecatedParameterValues: parameters, }) if err != nil { return err diff --git a/coderd/coderd.go b/coderd/coderd.go index 60103ea8a72b1..5fd7742f9fd04 100644 --- a/coderd/coderd.go +++ b/coderd/coderd.go @@ -362,12 +362,12 @@ func New(options *Options) *API { }) }) }) - r.Route("/parameters/{scope}/{id}", func(r chi.Router) { + r.Route("/deprecated-parameters/{scope}/{id}", func(r chi.Router) { r.Use(apiKeyMiddleware) - r.Post("/", api.postParameter) - r.Get("/", api.parameters) + r.Post("/", api.deprecatedPostParameter) + r.Get("/", api.deprecatedParameters) r.Route("/{name}", func(r chi.Router) { - r.Delete("/", api.deleteParameter) + r.Delete("/", api.deprecatedDeleteParameter) }) }) r.Route("/templates/{template}", func(r chi.Router) { @@ -393,8 +393,9 @@ func New(options *Options) *API { r.Get("/", api.templateVersion) r.Patch("/cancel", api.patchCancelTemplateVersion) - r.Get("/schema", api.templateVersionSchema) r.Get("/parameters", api.templateVersionParameters) + r.Get("/deprecated-schema", api.deprecatedTemplateVersionSchema) + r.Get("/deprecated-parameters", api.deprecatedTemplateVersionParameters) r.Get("/resources", api.templateVersionResources) r.Get("/logs", api.templateVersionLogs) r.Route("/dry-run", func(r chi.Router) { diff --git a/coderd/coderdtest/authorize.go b/coderd/coderdtest/authorize.go index 6e22df4b249bd..2650e987e1b3b 100644 --- a/coderd/coderdtest/authorize.go +++ b/coderd/coderdtest/authorize.go @@ -177,11 +177,15 @@ func AGPLRoutes(a *AuthTester) (map[string]string, map[string]RouteCheck) { AssertAction: rbac.ActionRead, AssertObject: rbac.ResourceTemplate.InOrg(a.Template.OrganizationID), }, + "GET:/api/v2/templateversions/{templateversion}/deprecated-parameters": { + AssertAction: rbac.ActionRead, + AssertObject: rbac.ResourceTemplate.InOrg(a.Template.OrganizationID), + }, "GET:/api/v2/templateversions/{templateversion}/resources": { AssertAction: rbac.ActionRead, AssertObject: rbac.ResourceTemplate.InOrg(a.Template.OrganizationID), }, - "GET:/api/v2/templateversions/{templateversion}/schema": { + "GET:/api/v2/templateversions/{templateversion}/deprecated-schema": { AssertAction: rbac.ActionRead, AssertObject: rbac.ResourceTemplate.InOrg(a.Template.OrganizationID), }, @@ -206,15 +210,16 @@ func AGPLRoutes(a *AuthTester) (map[string]string, map[string]RouteCheck) { AssertAction: rbac.ActionRead, AssertObject: rbac.ResourceTemplate.InOrg(a.Version.OrganizationID), }, - "POST:/api/v2/parameters/{scope}/{id}": { + + "POST:/api/v2/deprecated-parameters/{scope}/{id}": { AssertAction: rbac.ActionUpdate, AssertObject: rbac.ResourceTemplate, }, - "GET:/api/v2/parameters/{scope}/{id}": { + "GET:/api/v2/deprecated-parameters/{scope}/{id}": { AssertAction: rbac.ActionRead, AssertObject: rbac.ResourceTemplate, }, - "DELETE:/api/v2/parameters/{scope}/{id}/{name}": { + "DELETE:/api/v2/deprecated-parameters/{scope}/{id}/{name}": { AssertAction: rbac.ActionUpdate, AssertObject: rbac.ResourceTemplate, }, @@ -302,7 +307,7 @@ type AuthTester struct { WorkspaceResource codersdk.WorkspaceResource File codersdk.UploadResponse TemplateVersionDryRun codersdk.ProvisionerJob - TemplateParam codersdk.Parameter + TemplateParam codersdk.DeprecatedParameter URLParams map[string]string } @@ -349,15 +354,15 @@ func NewAuthTester(ctx context.Context, t *testing.T, client *codersdk.Client, a workspace, err = client.Workspace(ctx, workspace.ID) require.NoError(t, err, "workspace resources") templateVersionDryRun, err := client.CreateTemplateVersionDryRun(ctx, version.ID, codersdk.CreateTemplateVersionDryRunRequest{ - ParameterValues: []codersdk.CreateParameterRequest{}, + ParameterValues: []codersdk.DeprecatedCreateParameterRequest{}, }) require.NoError(t, err, "template version dry-run") - templateParam, err := client.CreateParameter(ctx, codersdk.ParameterTemplate, template.ID, codersdk.CreateParameterRequest{ + templateParam, err := client.DeprecatedCreateParameter(ctx, codersdk.DeprecatedParameterTemplate, template.ID, codersdk.DeprecatedCreateParameterRequest{ Name: "test-param", SourceValue: "hello world", - SourceScheme: codersdk.ParameterSourceSchemeData, - DestinationScheme: codersdk.ParameterDestinationSchemeProvisionerVariable, + SourceScheme: codersdk.DeprecatedParameterSourceSchemeData, + DestinationScheme: codersdk.DeprecatedParameterDestinationSchemeProvisionerVariable, }) require.NoError(t, err, "create template param") urlParameters := map[string]string{ diff --git a/coderd/database/databasefake/databasefake.go b/coderd/database/databasefake/databasefake.go index a91e2d1962980..09686081a6ed5 100644 --- a/coderd/database/databasefake/databasefake.go +++ b/coderd/database/databasefake/databasefake.go @@ -57,8 +57,10 @@ func New() database.Store { workspaceResourceMetadata: make([]database.WorkspaceResourceMetadatum, 0), provisionerJobs: make([]database.ProvisionerJob, 0), templateVersions: make([]database.TemplateVersion, 0), + templateVersionParameters: make([]database.TemplateVersionParameter, 0), templates: make([]database.Template, 0), workspaceBuilds: make([]database.WorkspaceBuild, 0), + workspaceBuildParameters: make([]database.WorkspaceBuildParameter, 0), workspaceApps: make([]database.WorkspaceApp, 0), workspaces: make([]database.Workspace, 0), licenses: make([]database.License, 0), @@ -111,10 +113,12 @@ type data struct { provisionerJobs []database.ProvisionerJob replicas []database.Replica templateVersions []database.TemplateVersion + templateVersionParameters []database.TemplateVersionParameter templates []database.Template workspaceAgents []database.WorkspaceAgent workspaceApps []database.WorkspaceApp workspaceBuilds []database.WorkspaceBuild + workspaceBuildParameters []database.WorkspaceBuildParameter workspaceResourceMetadata []database.WorkspaceResourceMetadatum workspaceResources []database.WorkspaceResource workspaces []database.Workspace @@ -1364,6 +1368,20 @@ func (q *fakeQuerier) GetWorkspaceBuildByWorkspaceIDAndBuildNumber(_ context.Con return database.WorkspaceBuild{}, sql.ErrNoRows } +func (q *fakeQuerier) GetWorkspaceBuildParameters(ctx context.Context, workspaceBuildID uuid.UUID) ([]database.WorkspaceBuildParameter, error) { + q.mutex.RLock() + defer q.mutex.RUnlock() + + params := make([]database.WorkspaceBuildParameter, 0) + for _, param := range params { + if param.WorkspaceBuildID != workspaceBuildID { + continue + } + params = append(params, param) + } + return params, nil +} + func (q *fakeQuerier) GetWorkspaceBuildsCreatedAfter(_ context.Context, after time.Time) ([]database.WorkspaceBuild, error) { q.mutex.RLock() defer q.mutex.RUnlock() @@ -1655,6 +1673,20 @@ func (q *fakeQuerier) GetTemplateVersionByTemplateIDAndName(_ context.Context, a return database.TemplateVersion{}, sql.ErrNoRows } +func (q *fakeQuerier) GetTemplateVersionParameters(_ context.Context, templateVersionID uuid.UUID) ([]database.TemplateVersionParameter, error) { + q.mutex.RLock() + defer q.mutex.RUnlock() + + parameters := make([]database.TemplateVersionParameter, 0) + for _, param := range q.templateVersionParameters { + if param.TemplateVersionID != templateVersionID { + continue + } + parameters = append(parameters, param) + } + return parameters, nil +} + func (q *fakeQuerier) GetTemplateVersionByOrganizationAndName(_ context.Context, arg database.GetTemplateVersionByOrganizationAndNameParams) (database.TemplateVersion, error) { q.mutex.RLock() defer q.mutex.RUnlock() @@ -2363,6 +2395,27 @@ func (q *fakeQuerier) InsertTemplateVersion(_ context.Context, arg database.Inse return version, nil } +func (q *fakeQuerier) InsertTemplateVersionParameter(ctx context.Context, arg database.InsertTemplateVersionParameterParams) (database.TemplateVersionParameter, error) { + q.mutex.Lock() + defer q.mutex.Unlock() + + param := database.TemplateVersionParameter{ + TemplateVersionID: arg.TemplateVersionID, + Name: arg.Name, + Description: arg.Description, + Type: arg.Type, + Mutable: arg.Mutable, + DefaultValue: arg.DefaultValue, + Icon: arg.Icon, + Options: arg.Options, + ValidationRegex: arg.ValidationRegex, + ValidationMin: arg.ValidationMin, + ValidationMax: arg.ValidationMax, + } + q.templateVersionParameters = append(q.templateVersionParameters, param) + return param, nil +} + func (q *fakeQuerier) InsertProvisionerJobLogs(_ context.Context, arg database.InsertProvisionerJobLogsParams) ([]database.ProvisionerJobLog, error) { q.mutex.Lock() defer q.mutex.Unlock() @@ -2676,6 +2729,20 @@ func (q *fakeQuerier) InsertWorkspaceBuild(_ context.Context, arg database.Inser return workspaceBuild, nil } +func (q *fakeQuerier) InsertWorkspaceBuildParameters(ctx context.Context, arg database.InsertWorkspaceBuildParametersParams) error { + q.mutex.Lock() + defer q.mutex.Unlock() + + for index, name := range arg.Name { + q.workspaceBuildParameters = append(q.workspaceBuildParameters, database.WorkspaceBuildParameter{ + WorkspaceBuildID: arg.WorkspaceBuildID, + Name: name, + Value: arg.Value[index], + }) + } + return nil +} + func (q *fakeQuerier) InsertWorkspaceApp(_ context.Context, arg database.InsertWorkspaceAppParams) (database.WorkspaceApp, error) { q.mutex.Lock() defer q.mutex.Unlock() diff --git a/coderd/database/dump.sql b/coderd/database/dump.sql index c598280397c4d..e7d1e7df04dc2 100644 --- a/coderd/database/dump.sql +++ b/coderd/database/dump.sql @@ -331,6 +331,20 @@ CREATE TABLE site_configs ( value character varying(8192) NOT NULL ); +CREATE TABLE template_version_parameters ( + template_version_id uuid NOT NULL, + name text NOT NULL, + description text NOT NULL, + type text NOT NULL, + mutable boolean NOT NULL, + default_value text NOT NULL, + icon text NOT NULL, + options jsonb DEFAULT '[]'::jsonb NOT NULL, + validation_regex text NOT NULL, + validation_min integer NOT NULL, + validation_max integer NOT NULL +); + CREATE TABLE template_versions ( id uuid NOT NULL, template_id uuid, @@ -442,6 +456,12 @@ CREATE TABLE workspace_apps ( slug text NOT NULL ); +CREATE TABLE workspace_build_parameters ( + workspace_build_id uuid NOT NULL, + name text NOT NULL, + value text NOT NULL +); + CREATE TABLE workspace_builds ( id uuid NOT NULL, created_at timestamp with time zone NOT NULL, @@ -565,6 +585,9 @@ ALTER TABLE ONLY provisioner_jobs ALTER TABLE ONLY site_configs ADD CONSTRAINT site_configs_key_key UNIQUE (key); +ALTER TABLE ONLY template_version_parameters + ADD CONSTRAINT template_version_parameters_template_version_id_name_key UNIQUE (template_version_id, name); + ALTER TABLE ONLY template_versions ADD CONSTRAINT template_versions_pkey PRIMARY KEY (id); @@ -589,6 +612,9 @@ ALTER TABLE ONLY workspace_apps ALTER TABLE ONLY workspace_apps ADD CONSTRAINT workspace_apps_pkey PRIMARY KEY (id); +ALTER TABLE ONLY workspace_build_parameters + ADD CONSTRAINT workspace_build_parameters_workspace_build_id_name_key UNIQUE (workspace_build_id, name); + ALTER TABLE ONLY workspace_builds ADD CONSTRAINT workspace_builds_job_id_key UNIQUE (job_id); @@ -677,6 +703,9 @@ ALTER TABLE ONLY provisioner_job_logs ALTER TABLE ONLY provisioner_jobs ADD CONSTRAINT provisioner_jobs_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE; +ALTER TABLE ONLY template_version_parameters + ADD CONSTRAINT template_version_parameters_template_version_id_fkey FOREIGN KEY (template_version_id) REFERENCES template_versions(id) ON DELETE CASCADE; + ALTER TABLE ONLY template_versions ADD CONSTRAINT template_versions_created_by_fkey FOREIGN KEY (created_by) REFERENCES users(id) ON DELETE RESTRICT; @@ -701,6 +730,9 @@ ALTER TABLE ONLY workspace_agents ALTER TABLE ONLY workspace_apps ADD CONSTRAINT workspace_apps_agent_id_fkey FOREIGN KEY (agent_id) REFERENCES workspace_agents(id) ON DELETE CASCADE; +ALTER TABLE ONLY workspace_build_parameters + ADD CONSTRAINT workspace_build_parameters_workspace_build_id_fkey FOREIGN KEY (workspace_build_id) REFERENCES workspace_builds(id) ON DELETE CASCADE; + ALTER TABLE ONLY workspace_builds ADD CONSTRAINT workspace_builds_job_id_fkey FOREIGN KEY (job_id) REFERENCES provisioner_jobs(id) ON DELETE CASCADE; diff --git a/coderd/database/migrations/000084_parameters.down.sql b/coderd/database/migrations/000084_parameters.down.sql new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/coderd/database/migrations/000084_parameters.up.sql b/coderd/database/migrations/000084_parameters.up.sql new file mode 100644 index 0000000000000..8bb1555cb2a14 --- /dev/null +++ b/coderd/database/migrations/000084_parameters.up.sql @@ -0,0 +1,21 @@ +CREATE TABLE template_version_parameters ( + template_version_id uuid not null references template_versions (id) on delete cascade, + name text not null, + description text not null, + type text not null, + mutable boolean not null, + default_value text not null, + icon text not null, + options jsonb not null default '[]'::jsonb, + validation_regex text not null, + validation_min integer not null, + validation_max integer not null, + unique (template_version_id, name) +); + +CREATE TABLE workspace_build_parameters ( + workspace_build_id uuid not null references workspace_builds (id) on delete cascade, + name text not null, + value text not null, + unique (workspace_build_id, name) +); diff --git a/coderd/database/models.go b/coderd/database/models.go index 38ddb1a4b7b53..7bb07d261340b 100644 --- a/coderd/database/models.go +++ b/coderd/database/models.go @@ -612,6 +612,20 @@ type TemplateVersion struct { CreatedBy uuid.UUID `db:"created_by" json:"created_by"` } +type TemplateVersionParameter struct { + TemplateVersionID uuid.UUID `db:"template_version_id" json:"template_version_id"` + Name string `db:"name" json:"name"` + Description string `db:"description" json:"description"` + Type string `db:"type" json:"type"` + Mutable bool `db:"mutable" json:"mutable"` + DefaultValue string `db:"default_value" json:"default_value"` + Icon string `db:"icon" json:"icon"` + Options json.RawMessage `db:"options" json:"options"` + ValidationRegex string `db:"validation_regex" json:"validation_regex"` + ValidationMin int32 `db:"validation_min" json:"validation_min"` + ValidationMax int32 `db:"validation_max" json:"validation_max"` +} + type User struct { ID uuid.UUID `db:"id" json:"id"` Email string `db:"email" json:"email"` @@ -712,6 +726,12 @@ type WorkspaceBuild struct { DailyCost int32 `db:"daily_cost" json:"daily_cost"` } +type WorkspaceBuildParameter struct { + WorkspaceBuildID uuid.UUID `db:"workspace_build_id" json:"workspace_build_id"` + Name string `db:"name" json:"name"` + Value string `db:"value" json:"value"` +} + type WorkspaceResource struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` diff --git a/coderd/database/querier.go b/coderd/database/querier.go index 2f03e2533e45e..5d0b0a162d5fd 100644 --- a/coderd/database/querier.go +++ b/coderd/database/querier.go @@ -82,6 +82,7 @@ type sqlcQuerier interface { GetTemplateVersionByJobID(ctx context.Context, jobID uuid.UUID) (TemplateVersion, error) GetTemplateVersionByOrganizationAndName(ctx context.Context, arg GetTemplateVersionByOrganizationAndNameParams) (TemplateVersion, error) GetTemplateVersionByTemplateIDAndName(ctx context.Context, arg GetTemplateVersionByTemplateIDAndNameParams) (TemplateVersion, error) + GetTemplateVersionParameters(ctx context.Context, templateVersionID uuid.UUID) ([]TemplateVersionParameter, error) GetTemplateVersionsByIDs(ctx context.Context, ids []uuid.UUID) ([]TemplateVersion, error) GetTemplateVersionsByTemplateID(ctx context.Context, arg GetTemplateVersionsByTemplateIDParams) ([]TemplateVersion, error) GetTemplateVersionsCreatedAfter(ctx context.Context, createdAt time.Time) ([]TemplateVersion, error) @@ -111,6 +112,7 @@ type sqlcQuerier interface { GetWorkspaceBuildByID(ctx context.Context, id uuid.UUID) (WorkspaceBuild, error) GetWorkspaceBuildByJobID(ctx context.Context, jobID uuid.UUID) (WorkspaceBuild, error) GetWorkspaceBuildByWorkspaceIDAndBuildNumber(ctx context.Context, arg GetWorkspaceBuildByWorkspaceIDAndBuildNumberParams) (WorkspaceBuild, error) + GetWorkspaceBuildParameters(ctx context.Context, workspaceBuildID uuid.UUID) ([]WorkspaceBuildParameter, error) GetWorkspaceBuildsByWorkspaceID(ctx context.Context, arg GetWorkspaceBuildsByWorkspaceIDParams) ([]WorkspaceBuild, error) GetWorkspaceBuildsCreatedAfter(ctx context.Context, createdAt time.Time) ([]WorkspaceBuild, error) GetWorkspaceByAgentID(ctx context.Context, agentID uuid.UUID) (Workspace, error) @@ -151,12 +153,14 @@ type sqlcQuerier interface { InsertReplica(ctx context.Context, arg InsertReplicaParams) (Replica, error) InsertTemplate(ctx context.Context, arg InsertTemplateParams) (Template, error) InsertTemplateVersion(ctx context.Context, arg InsertTemplateVersionParams) (TemplateVersion, error) + InsertTemplateVersionParameter(ctx context.Context, arg InsertTemplateVersionParameterParams) (TemplateVersionParameter, error) InsertUser(ctx context.Context, arg InsertUserParams) (User, error) InsertUserLink(ctx context.Context, arg InsertUserLinkParams) (UserLink, error) InsertWorkspace(ctx context.Context, arg InsertWorkspaceParams) (Workspace, error) InsertWorkspaceAgent(ctx context.Context, arg InsertWorkspaceAgentParams) (WorkspaceAgent, error) InsertWorkspaceApp(ctx context.Context, arg InsertWorkspaceAppParams) (WorkspaceApp, error) InsertWorkspaceBuild(ctx context.Context, arg InsertWorkspaceBuildParams) (WorkspaceBuild, error) + InsertWorkspaceBuildParameters(ctx context.Context, arg InsertWorkspaceBuildParametersParams) error InsertWorkspaceResource(ctx context.Context, arg InsertWorkspaceResourceParams) (WorkspaceResource, error) InsertWorkspaceResourceMetadata(ctx context.Context, arg InsertWorkspaceResourceMetadataParams) (WorkspaceResourceMetadatum, error) ParameterValue(ctx context.Context, id uuid.UUID) (ParameterValue, error) diff --git a/coderd/database/queries.sql.go b/coderd/database/queries.sql.go index e7b5459c9c48d..101fbc6c5ef66 100644 --- a/coderd/database/queries.sql.go +++ b/coderd/database/queries.sql.go @@ -613,6 +613,410 @@ func (q *sqlQuerier) InsertAuditLog(ctx context.Context, arg InsertAuditLogParam return i, err } +const getParameterSchemasByJobID = `-- name: GetParameterSchemasByJobID :many +SELECT + id, created_at, job_id, name, description, default_source_scheme, default_source_value, allow_override_source, default_destination_scheme, allow_override_destination, default_refresh, redisplay_value, validation_error, validation_condition, validation_type_system, validation_value_type, index +FROM + parameter_schemas +WHERE + job_id = $1 +ORDER BY + index +` + +func (q *sqlQuerier) GetParameterSchemasByJobID(ctx context.Context, jobID uuid.UUID) ([]ParameterSchema, error) { + rows, err := q.db.QueryContext(ctx, getParameterSchemasByJobID, jobID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ParameterSchema + for rows.Next() { + var i ParameterSchema + if err := rows.Scan( + &i.ID, + &i.CreatedAt, + &i.JobID, + &i.Name, + &i.Description, + &i.DefaultSourceScheme, + &i.DefaultSourceValue, + &i.AllowOverrideSource, + &i.DefaultDestinationScheme, + &i.AllowOverrideDestination, + &i.DefaultRefresh, + &i.RedisplayValue, + &i.ValidationError, + &i.ValidationCondition, + &i.ValidationTypeSystem, + &i.ValidationValueType, + &i.Index, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getParameterSchemasCreatedAfter = `-- name: GetParameterSchemasCreatedAfter :many +SELECT id, created_at, job_id, name, description, default_source_scheme, default_source_value, allow_override_source, default_destination_scheme, allow_override_destination, default_refresh, redisplay_value, validation_error, validation_condition, validation_type_system, validation_value_type, index FROM parameter_schemas WHERE created_at > $1 +` + +func (q *sqlQuerier) GetParameterSchemasCreatedAfter(ctx context.Context, createdAt time.Time) ([]ParameterSchema, error) { + rows, err := q.db.QueryContext(ctx, getParameterSchemasCreatedAfter, createdAt) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ParameterSchema + for rows.Next() { + var i ParameterSchema + if err := rows.Scan( + &i.ID, + &i.CreatedAt, + &i.JobID, + &i.Name, + &i.Description, + &i.DefaultSourceScheme, + &i.DefaultSourceValue, + &i.AllowOverrideSource, + &i.DefaultDestinationScheme, + &i.AllowOverrideDestination, + &i.DefaultRefresh, + &i.RedisplayValue, + &i.ValidationError, + &i.ValidationCondition, + &i.ValidationTypeSystem, + &i.ValidationValueType, + &i.Index, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const insertParameterSchema = `-- name: InsertParameterSchema :one +INSERT INTO + parameter_schemas ( + id, + created_at, + job_id, + "name", + description, + default_source_scheme, + default_source_value, + allow_override_source, + default_destination_scheme, + allow_override_destination, + default_refresh, + redisplay_value, + validation_error, + validation_condition, + validation_type_system, + validation_value_type, + index + ) +VALUES + ( + $1, + $2, + $3, + $4, + $5, + $6, + $7, + $8, + $9, + $10, + $11, + $12, + $13, + $14, + $15, + $16, + $17 + ) RETURNING id, created_at, job_id, name, description, default_source_scheme, default_source_value, allow_override_source, default_destination_scheme, allow_override_destination, default_refresh, redisplay_value, validation_error, validation_condition, validation_type_system, validation_value_type, index +` + +type InsertParameterSchemaParams struct { + ID uuid.UUID `db:"id" json:"id"` + CreatedAt time.Time `db:"created_at" json:"created_at"` + JobID uuid.UUID `db:"job_id" json:"job_id"` + Name string `db:"name" json:"name"` + Description string `db:"description" json:"description"` + DefaultSourceScheme ParameterSourceScheme `db:"default_source_scheme" json:"default_source_scheme"` + DefaultSourceValue string `db:"default_source_value" json:"default_source_value"` + AllowOverrideSource bool `db:"allow_override_source" json:"allow_override_source"` + DefaultDestinationScheme ParameterDestinationScheme `db:"default_destination_scheme" json:"default_destination_scheme"` + AllowOverrideDestination bool `db:"allow_override_destination" json:"allow_override_destination"` + DefaultRefresh string `db:"default_refresh" json:"default_refresh"` + RedisplayValue bool `db:"redisplay_value" json:"redisplay_value"` + ValidationError string `db:"validation_error" json:"validation_error"` + ValidationCondition string `db:"validation_condition" json:"validation_condition"` + ValidationTypeSystem ParameterTypeSystem `db:"validation_type_system" json:"validation_type_system"` + ValidationValueType string `db:"validation_value_type" json:"validation_value_type"` + Index int32 `db:"index" json:"index"` +} + +func (q *sqlQuerier) InsertParameterSchema(ctx context.Context, arg InsertParameterSchemaParams) (ParameterSchema, error) { + row := q.db.QueryRowContext(ctx, insertParameterSchema, + arg.ID, + arg.CreatedAt, + arg.JobID, + arg.Name, + arg.Description, + arg.DefaultSourceScheme, + arg.DefaultSourceValue, + arg.AllowOverrideSource, + arg.DefaultDestinationScheme, + arg.AllowOverrideDestination, + arg.DefaultRefresh, + arg.RedisplayValue, + arg.ValidationError, + arg.ValidationCondition, + arg.ValidationTypeSystem, + arg.ValidationValueType, + arg.Index, + ) + var i ParameterSchema + err := row.Scan( + &i.ID, + &i.CreatedAt, + &i.JobID, + &i.Name, + &i.Description, + &i.DefaultSourceScheme, + &i.DefaultSourceValue, + &i.AllowOverrideSource, + &i.DefaultDestinationScheme, + &i.AllowOverrideDestination, + &i.DefaultRefresh, + &i.RedisplayValue, + &i.ValidationError, + &i.ValidationCondition, + &i.ValidationTypeSystem, + &i.ValidationValueType, + &i.Index, + ) + return i, err +} + +const deleteParameterValueByID = `-- name: DeleteParameterValueByID :exec +DELETE FROM + parameter_values +WHERE + id = $1 +` + +func (q *sqlQuerier) DeleteParameterValueByID(ctx context.Context, id uuid.UUID) error { + _, err := q.db.ExecContext(ctx, deleteParameterValueByID, id) + return err +} + +const getParameterValueByScopeAndName = `-- name: GetParameterValueByScopeAndName :one +SELECT + id, created_at, updated_at, scope, scope_id, name, source_scheme, source_value, destination_scheme +FROM + parameter_values +WHERE + scope = $1 + AND scope_id = $2 + AND NAME = $3 +LIMIT + 1 +` + +type GetParameterValueByScopeAndNameParams struct { + Scope ParameterScope `db:"scope" json:"scope"` + ScopeID uuid.UUID `db:"scope_id" json:"scope_id"` + Name string `db:"name" json:"name"` +} + +func (q *sqlQuerier) GetParameterValueByScopeAndName(ctx context.Context, arg GetParameterValueByScopeAndNameParams) (ParameterValue, error) { + row := q.db.QueryRowContext(ctx, getParameterValueByScopeAndName, arg.Scope, arg.ScopeID, arg.Name) + var i ParameterValue + err := row.Scan( + &i.ID, + &i.CreatedAt, + &i.UpdatedAt, + &i.Scope, + &i.ScopeID, + &i.Name, + &i.SourceScheme, + &i.SourceValue, + &i.DestinationScheme, + ) + return i, err +} + +const insertParameterValue = `-- name: InsertParameterValue :one +INSERT INTO + parameter_values ( + id, + "name", + created_at, + updated_at, + scope, + scope_id, + source_scheme, + source_value, + destination_scheme + ) +VALUES + ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING id, created_at, updated_at, scope, scope_id, name, source_scheme, source_value, destination_scheme +` + +type InsertParameterValueParams struct { + ID uuid.UUID `db:"id" json:"id"` + Name string `db:"name" json:"name"` + CreatedAt time.Time `db:"created_at" json:"created_at"` + UpdatedAt time.Time `db:"updated_at" json:"updated_at"` + Scope ParameterScope `db:"scope" json:"scope"` + ScopeID uuid.UUID `db:"scope_id" json:"scope_id"` + SourceScheme ParameterSourceScheme `db:"source_scheme" json:"source_scheme"` + SourceValue string `db:"source_value" json:"source_value"` + DestinationScheme ParameterDestinationScheme `db:"destination_scheme" json:"destination_scheme"` +} + +func (q *sqlQuerier) InsertParameterValue(ctx context.Context, arg InsertParameterValueParams) (ParameterValue, error) { + row := q.db.QueryRowContext(ctx, insertParameterValue, + arg.ID, + arg.Name, + arg.CreatedAt, + arg.UpdatedAt, + arg.Scope, + arg.ScopeID, + arg.SourceScheme, + arg.SourceValue, + arg.DestinationScheme, + ) + var i ParameterValue + err := row.Scan( + &i.ID, + &i.CreatedAt, + &i.UpdatedAt, + &i.Scope, + &i.ScopeID, + &i.Name, + &i.SourceScheme, + &i.SourceValue, + &i.DestinationScheme, + ) + return i, err +} + +const parameterValue = `-- name: ParameterValue :one +SELECT id, created_at, updated_at, scope, scope_id, name, source_scheme, source_value, destination_scheme FROM + parameter_values +WHERE + id = $1 +` + +func (q *sqlQuerier) ParameterValue(ctx context.Context, id uuid.UUID) (ParameterValue, error) { + row := q.db.QueryRowContext(ctx, parameterValue, id) + var i ParameterValue + err := row.Scan( + &i.ID, + &i.CreatedAt, + &i.UpdatedAt, + &i.Scope, + &i.ScopeID, + &i.Name, + &i.SourceScheme, + &i.SourceValue, + &i.DestinationScheme, + ) + return i, err +} + +const parameterValues = `-- name: ParameterValues :many +SELECT + id, created_at, updated_at, scope, scope_id, name, source_scheme, source_value, destination_scheme +FROM + parameter_values +WHERE + CASE + WHEN cardinality($1 :: parameter_scope[]) > 0 THEN + scope = ANY($1 :: parameter_scope[]) + ELSE true + END + AND CASE + WHEN cardinality($2 :: uuid[]) > 0 THEN + scope_id = ANY($2 :: uuid[]) + ELSE true + END + AND CASE + WHEN cardinality($3 :: uuid[]) > 0 THEN + id = ANY($3 :: uuid[]) + ELSE true + END + AND CASE + WHEN cardinality($4 :: text[]) > 0 THEN + "name" = ANY($4 :: text[]) + ELSE true + END +` + +type ParameterValuesParams struct { + Scopes []ParameterScope `db:"scopes" json:"scopes"` + ScopeIds []uuid.UUID `db:"scope_ids" json:"scope_ids"` + IDs []uuid.UUID `db:"ids" json:"ids"` + Names []string `db:"names" json:"names"` +} + +func (q *sqlQuerier) ParameterValues(ctx context.Context, arg ParameterValuesParams) ([]ParameterValue, error) { + rows, err := q.db.QueryContext(ctx, parameterValues, + pq.Array(arg.Scopes), + pq.Array(arg.ScopeIds), + pq.Array(arg.IDs), + pq.Array(arg.Names), + ) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ParameterValue + for rows.Next() { + var i ParameterValue + if err := rows.Scan( + &i.ID, + &i.CreatedAt, + &i.UpdatedAt, + &i.Scope, + &i.ScopeID, + &i.Name, + &i.SourceScheme, + &i.SourceValue, + &i.DestinationScheme, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const getFileByHashAndCreator = `-- name: GetFileByHashAndCreator :one SELECT hash, created_at, created_by, mimetype, data, id @@ -937,244 +1341,54 @@ func (q *sqlQuerier) DeleteGroupByID(ctx context.Context, id uuid.UUID) error { _, err := q.db.ExecContext(ctx, deleteGroupByID, id) return err } - -const deleteGroupMember = `-- name: DeleteGroupMember :exec -DELETE FROM - group_members -WHERE - user_id = $1 -` - -func (q *sqlQuerier) DeleteGroupMember(ctx context.Context, userID uuid.UUID) error { - _, err := q.db.ExecContext(ctx, deleteGroupMember, userID) - return err -} - -const getAllOrganizationMembers = `-- name: GetAllOrganizationMembers :many -SELECT - users.id, users.email, users.username, users.hashed_password, users.created_at, users.updated_at, users.status, users.rbac_roles, users.login_type, users.avatar_url, users.deleted, users.last_seen_at -FROM - users -JOIN - organization_members -ON - users.id = organization_members.user_id -WHERE - organization_members.organization_id = $1 -` - -func (q *sqlQuerier) GetAllOrganizationMembers(ctx context.Context, organizationID uuid.UUID) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAllOrganizationMembers, organizationID) - if err != nil { - return nil, err - } - defer rows.Close() - var items []User - for rows.Next() { - var i User - if err := rows.Scan( - &i.ID, - &i.Email, - &i.Username, - &i.HashedPassword, - &i.CreatedAt, - &i.UpdatedAt, - &i.Status, - &i.RBACRoles, - &i.LoginType, - &i.AvatarURL, - &i.Deleted, - &i.LastSeenAt, - ); err != nil { - return nil, err - } - items = append(items, i) - } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - -const getGroupByID = `-- name: GetGroupByID :one -SELECT - id, name, organization_id, avatar_url, quota_allowance -FROM - groups -WHERE - id = $1 -LIMIT - 1 -` - -func (q *sqlQuerier) GetGroupByID(ctx context.Context, id uuid.UUID) (Group, error) { - row := q.db.QueryRowContext(ctx, getGroupByID, id) - var i Group - err := row.Scan( - &i.ID, - &i.Name, - &i.OrganizationID, - &i.AvatarURL, - &i.QuotaAllowance, - ) - return i, err -} - -const getGroupByOrgAndName = `-- name: GetGroupByOrgAndName :one -SELECT - id, name, organization_id, avatar_url, quota_allowance -FROM - groups -WHERE - organization_id = $1 -AND - name = $2 -LIMIT - 1 -` - -type GetGroupByOrgAndNameParams struct { - OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` - Name string `db:"name" json:"name"` -} - -func (q *sqlQuerier) GetGroupByOrgAndName(ctx context.Context, arg GetGroupByOrgAndNameParams) (Group, error) { - row := q.db.QueryRowContext(ctx, getGroupByOrgAndName, arg.OrganizationID, arg.Name) - var i Group - err := row.Scan( - &i.ID, - &i.Name, - &i.OrganizationID, - &i.AvatarURL, - &i.QuotaAllowance, - ) - return i, err -} - -const getGroupMembers = `-- name: GetGroupMembers :many -SELECT - users.id, users.email, users.username, users.hashed_password, users.created_at, users.updated_at, users.status, users.rbac_roles, users.login_type, users.avatar_url, users.deleted, users.last_seen_at -FROM - users -JOIN - group_members -ON - users.id = group_members.user_id -WHERE - group_members.group_id = $1 -AND - users.status = 'active' -AND - users.deleted = 'false' -` - -func (q *sqlQuerier) GetGroupMembers(ctx context.Context, groupID uuid.UUID) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getGroupMembers, groupID) - if err != nil { - return nil, err - } - defer rows.Close() - var items []User - for rows.Next() { - var i User - if err := rows.Scan( - &i.ID, - &i.Email, - &i.Username, - &i.HashedPassword, - &i.CreatedAt, - &i.UpdatedAt, - &i.Status, - &i.RBACRoles, - &i.LoginType, - &i.AvatarURL, - &i.Deleted, - &i.LastSeenAt, - ); err != nil { - return nil, err - } - items = append(items, i) - } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - -const getGroupsByOrganizationID = `-- name: GetGroupsByOrganizationID :many -SELECT - id, name, organization_id, avatar_url, quota_allowance -FROM - groups + +const deleteGroupMember = `-- name: DeleteGroupMember :exec +DELETE FROM + group_members WHERE - organization_id = $1 -AND - id != $1 + user_id = $1 ` -func (q *sqlQuerier) GetGroupsByOrganizationID(ctx context.Context, organizationID uuid.UUID) ([]Group, error) { - rows, err := q.db.QueryContext(ctx, getGroupsByOrganizationID, organizationID) - if err != nil { - return nil, err - } - defer rows.Close() - var items []Group - for rows.Next() { - var i Group - if err := rows.Scan( - &i.ID, - &i.Name, - &i.OrganizationID, - &i.AvatarURL, - &i.QuotaAllowance, - ); err != nil { - return nil, err - } - items = append(items, i) - } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil +func (q *sqlQuerier) DeleteGroupMember(ctx context.Context, userID uuid.UUID) error { + _, err := q.db.ExecContext(ctx, deleteGroupMember, userID) + return err } -const getUserGroups = `-- name: GetUserGroups :many +const getAllOrganizationMembers = `-- name: GetAllOrganizationMembers :many SELECT - groups.id, groups.name, groups.organization_id, groups.avatar_url, groups.quota_allowance + users.id, users.email, users.username, users.hashed_password, users.created_at, users.updated_at, users.status, users.rbac_roles, users.login_type, users.avatar_url, users.deleted, users.last_seen_at FROM - groups + users JOIN - group_members + organization_members ON - groups.id = group_members.group_id + users.id = organization_members.user_id WHERE - group_members.user_id = $1 + organization_members.organization_id = $1 ` -func (q *sqlQuerier) GetUserGroups(ctx context.Context, userID uuid.UUID) ([]Group, error) { - rows, err := q.db.QueryContext(ctx, getUserGroups, userID) +func (q *sqlQuerier) GetAllOrganizationMembers(ctx context.Context, organizationID uuid.UUID) ([]User, error) { + rows, err := q.db.QueryContext(ctx, getAllOrganizationMembers, organizationID) if err != nil { return nil, err } defer rows.Close() - var items []Group + var items []User for rows.Next() { - var i Group + var i User if err := rows.Scan( &i.ID, - &i.Name, - &i.OrganizationID, + &i.Email, + &i.Username, + &i.HashedPassword, + &i.CreatedAt, + &i.UpdatedAt, + &i.Status, + &i.RBACRoles, + &i.LoginType, &i.AvatarURL, - &i.QuotaAllowance, + &i.Deleted, + &i.LastSeenAt, ); err != nil { return nil, err } @@ -1189,60 +1403,19 @@ func (q *sqlQuerier) GetUserGroups(ctx context.Context, userID uuid.UUID) ([]Gro return items, nil } -const insertAllUsersGroup = `-- name: InsertAllUsersGroup :one -INSERT INTO groups ( - id, - name, - organization_id -) -VALUES - ( $1, 'Everyone', $1) RETURNING id, name, organization_id, avatar_url, quota_allowance -` - -// We use the organization_id as the id -// for simplicity since all users is -// every member of the org. -func (q *sqlQuerier) InsertAllUsersGroup(ctx context.Context, organizationID uuid.UUID) (Group, error) { - row := q.db.QueryRowContext(ctx, insertAllUsersGroup, organizationID) - var i Group - err := row.Scan( - &i.ID, - &i.Name, - &i.OrganizationID, - &i.AvatarURL, - &i.QuotaAllowance, - ) - return i, err -} - -const insertGroup = `-- name: InsertGroup :one -INSERT INTO groups ( - id, - name, - organization_id, - avatar_url, - quota_allowance -) -VALUES - ( $1, $2, $3, $4, $5) RETURNING id, name, organization_id, avatar_url, quota_allowance +const getGroupByID = `-- name: GetGroupByID :one +SELECT + id, name, organization_id, avatar_url, quota_allowance +FROM + groups +WHERE + id = $1 +LIMIT + 1 ` -type InsertGroupParams struct { - ID uuid.UUID `db:"id" json:"id"` - Name string `db:"name" json:"name"` - OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` - AvatarURL string `db:"avatar_url" json:"avatar_url"` - QuotaAllowance int32 `db:"quota_allowance" json:"quota_allowance"` -} - -func (q *sqlQuerier) InsertGroup(ctx context.Context, arg InsertGroupParams) (Group, error) { - row := q.db.QueryRowContext(ctx, insertGroup, - arg.ID, - arg.Name, - arg.OrganizationID, - arg.AvatarURL, - arg.QuotaAllowance, - ) +func (q *sqlQuerier) GetGroupByID(ctx context.Context, id uuid.UUID) (Group, error) { + row := q.db.QueryRowContext(ctx, getGroupByID, id) var i Group err := row.Scan( &i.ID, @@ -1254,50 +1427,26 @@ func (q *sqlQuerier) InsertGroup(ctx context.Context, arg InsertGroupParams) (Gr return i, err } -const insertGroupMember = `-- name: InsertGroupMember :exec -INSERT INTO group_members ( - user_id, - group_id -) -VALUES ( $1, $2) -` - -type InsertGroupMemberParams struct { - UserID uuid.UUID `db:"user_id" json:"user_id"` - GroupID uuid.UUID `db:"group_id" json:"group_id"` -} - -func (q *sqlQuerier) InsertGroupMember(ctx context.Context, arg InsertGroupMemberParams) error { - _, err := q.db.ExecContext(ctx, insertGroupMember, arg.UserID, arg.GroupID) - return err -} - -const updateGroupByID = `-- name: UpdateGroupByID :one -UPDATE +const getGroupByOrgAndName = `-- name: GetGroupByOrgAndName :one +SELECT + id, name, organization_id, avatar_url, quota_allowance +FROM groups -SET - name = $1, - avatar_url = $2, - quota_allowance = $3 WHERE - id = $4 -RETURNING id, name, organization_id, avatar_url, quota_allowance + organization_id = $1 +AND + name = $2 +LIMIT + 1 ` -type UpdateGroupByIDParams struct { +type GetGroupByOrgAndNameParams struct { + OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` Name string `db:"name" json:"name"` - AvatarURL string `db:"avatar_url" json:"avatar_url"` - QuotaAllowance int32 `db:"quota_allowance" json:"quota_allowance"` - ID uuid.UUID `db:"id" json:"id"` } -func (q *sqlQuerier) UpdateGroupByID(ctx context.Context, arg UpdateGroupByIDParams) (Group, error) { - row := q.db.QueryRowContext(ctx, updateGroupByID, - arg.Name, - arg.AvatarURL, - arg.QuotaAllowance, - arg.ID, - ) +func (q *sqlQuerier) GetGroupByOrgAndName(ctx context.Context, arg GetGroupByOrgAndNameParams) (Group, error) { + row := q.db.QueryRowContext(ctx, getGroupByOrgAndName, arg.OrganizationID, arg.Name) var i Group err := row.Scan( &i.ID, @@ -1309,76 +1458,45 @@ func (q *sqlQuerier) UpdateGroupByID(ctx context.Context, arg UpdateGroupByIDPar return i, err } -const deleteLicense = `-- name: DeleteLicense :one -DELETE -FROM licenses -WHERE id = $1 -RETURNING id -` - -func (q *sqlQuerier) DeleteLicense(ctx context.Context, id int32) (int32, error) { - row := q.db.QueryRowContext(ctx, deleteLicense, id) - err := row.Scan(&id) - return id, err -} - -const getLicenses = `-- name: GetLicenses :many -SELECT id, uploaded_at, jwt, exp, uuid -FROM licenses -ORDER BY (id) -` - -func (q *sqlQuerier) GetLicenses(ctx context.Context) ([]License, error) { - rows, err := q.db.QueryContext(ctx, getLicenses) - if err != nil { - return nil, err - } - defer rows.Close() - var items []License - for rows.Next() { - var i License - if err := rows.Scan( - &i.ID, - &i.UploadedAt, - &i.JWT, - &i.Exp, - &i.Uuid, - ); err != nil { - return nil, err - } - items = append(items, i) - } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - -const getUnexpiredLicenses = `-- name: GetUnexpiredLicenses :many -SELECT id, uploaded_at, jwt, exp, uuid -FROM licenses -WHERE exp > NOW() -ORDER BY (id) +const getGroupMembers = `-- name: GetGroupMembers :many +SELECT + users.id, users.email, users.username, users.hashed_password, users.created_at, users.updated_at, users.status, users.rbac_roles, users.login_type, users.avatar_url, users.deleted, users.last_seen_at +FROM + users +JOIN + group_members +ON + users.id = group_members.user_id +WHERE + group_members.group_id = $1 +AND + users.status = 'active' +AND + users.deleted = 'false' ` -func (q *sqlQuerier) GetUnexpiredLicenses(ctx context.Context) ([]License, error) { - rows, err := q.db.QueryContext(ctx, getUnexpiredLicenses) +func (q *sqlQuerier) GetGroupMembers(ctx context.Context, groupID uuid.UUID) ([]User, error) { + rows, err := q.db.QueryContext(ctx, getGroupMembers, groupID) if err != nil { return nil, err } defer rows.Close() - var items []License + var items []User for rows.Next() { - var i License + var i User if err := rows.Scan( &i.ID, - &i.UploadedAt, - &i.JWT, - &i.Exp, - &i.Uuid, + &i.Email, + &i.Username, + &i.HashedPassword, + &i.CreatedAt, + &i.UpdatedAt, + &i.Status, + &i.RBACRoles, + &i.LoginType, + &i.AvatarURL, + &i.Deleted, + &i.LastSeenAt, ); err != nil { return nil, err } @@ -1393,69 +1511,33 @@ func (q *sqlQuerier) GetUnexpiredLicenses(ctx context.Context) ([]License, error return items, nil } -const insertLicense = `-- name: InsertLicense :one -INSERT INTO - licenses ( - uploaded_at, - jwt, - exp, - uuid -) -VALUES - ($1, $2, $3, $4) RETURNING id, uploaded_at, jwt, exp, uuid -` - -type InsertLicenseParams struct { - UploadedAt time.Time `db:"uploaded_at" json:"uploaded_at"` - JWT string `db:"jwt" json:"jwt"` - Exp time.Time `db:"exp" json:"exp"` - Uuid uuid.NullUUID `db:"uuid" json:"uuid"` -} - -func (q *sqlQuerier) InsertLicense(ctx context.Context, arg InsertLicenseParams) (License, error) { - row := q.db.QueryRowContext(ctx, insertLicense, - arg.UploadedAt, - arg.JWT, - arg.Exp, - arg.Uuid, - ) - var i License - err := row.Scan( - &i.ID, - &i.UploadedAt, - &i.JWT, - &i.Exp, - &i.Uuid, - ) - return i, err -} - -const getOrganizationIDsByMemberIDs = `-- name: GetOrganizationIDsByMemberIDs :many +const getGroupsByOrganizationID = `-- name: GetGroupsByOrganizationID :many SELECT - user_id, array_agg(organization_id) :: uuid [ ] AS "organization_IDs" + id, name, organization_id, avatar_url, quota_allowance FROM - organization_members + groups WHERE - user_id = ANY($1 :: uuid [ ]) -GROUP BY - user_id + organization_id = $1 +AND + id != $1 ` -type GetOrganizationIDsByMemberIDsRow struct { - UserID uuid.UUID `db:"user_id" json:"user_id"` - OrganizationIDs []uuid.UUID `db:"organization_IDs" json:"organization_IDs"` -} - -func (q *sqlQuerier) GetOrganizationIDsByMemberIDs(ctx context.Context, ids []uuid.UUID) ([]GetOrganizationIDsByMemberIDsRow, error) { - rows, err := q.db.QueryContext(ctx, getOrganizationIDsByMemberIDs, pq.Array(ids)) +func (q *sqlQuerier) GetGroupsByOrganizationID(ctx context.Context, organizationID uuid.UUID) ([]Group, error) { + rows, err := q.db.QueryContext(ctx, getGroupsByOrganizationID, organizationID) if err != nil { return nil, err } defer rows.Close() - var items []GetOrganizationIDsByMemberIDsRow + var items []Group for rows.Next() { - var i GetOrganizationIDsByMemberIDsRow - if err := rows.Scan(&i.UserID, pq.Array(&i.OrganizationIDs)); err != nil { + var i Group + if err := rows.Scan( + &i.ID, + &i.Name, + &i.OrganizationID, + &i.AvatarURL, + &i.QuotaAllowance, + ); err != nil { return nil, err } items = append(items, i) @@ -1469,60 +1551,34 @@ func (q *sqlQuerier) GetOrganizationIDsByMemberIDs(ctx context.Context, ids []uu return items, nil } -const getOrganizationMemberByUserID = `-- name: GetOrganizationMemberByUserID :one -SELECT - user_id, organization_id, created_at, updated_at, roles -FROM - organization_members -WHERE - organization_id = $1 - AND user_id = $2 -LIMIT - 1 -` - -type GetOrganizationMemberByUserIDParams struct { - OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` - UserID uuid.UUID `db:"user_id" json:"user_id"` -} - -func (q *sqlQuerier) GetOrganizationMemberByUserID(ctx context.Context, arg GetOrganizationMemberByUserIDParams) (OrganizationMember, error) { - row := q.db.QueryRowContext(ctx, getOrganizationMemberByUserID, arg.OrganizationID, arg.UserID) - var i OrganizationMember - err := row.Scan( - &i.UserID, - &i.OrganizationID, - &i.CreatedAt, - &i.UpdatedAt, - pq.Array(&i.Roles), - ) - return i, err -} - -const getOrganizationMembershipsByUserID = `-- name: GetOrganizationMembershipsByUserID :many +const getUserGroups = `-- name: GetUserGroups :many SELECT - user_id, organization_id, created_at, updated_at, roles + groups.id, groups.name, groups.organization_id, groups.avatar_url, groups.quota_allowance FROM - organization_members + groups +JOIN + group_members +ON + groups.id = group_members.group_id WHERE - user_id = $1 + group_members.user_id = $1 ` -func (q *sqlQuerier) GetOrganizationMembershipsByUserID(ctx context.Context, userID uuid.UUID) ([]OrganizationMember, error) { - rows, err := q.db.QueryContext(ctx, getOrganizationMembershipsByUserID, userID) +func (q *sqlQuerier) GetUserGroups(ctx context.Context, userID uuid.UUID) ([]Group, error) { + rows, err := q.db.QueryContext(ctx, getUserGroups, userID) if err != nil { return nil, err } defer rows.Close() - var items []OrganizationMember + var items []Group for rows.Next() { - var i OrganizationMember + var i Group if err := rows.Scan( - &i.UserID, + &i.ID, + &i.Name, &i.OrganizationID, - &i.CreatedAt, - &i.UpdatedAt, - pq.Array(&i.Roles), + &i.AvatarURL, + &i.QuotaAllowance, ); err != nil { return nil, err } @@ -1537,145 +1593,160 @@ func (q *sqlQuerier) GetOrganizationMembershipsByUserID(ctx context.Context, use return items, nil } -const insertOrganizationMember = `-- name: InsertOrganizationMember :one -INSERT INTO - organization_members ( - organization_id, - user_id, - created_at, - updated_at, - roles - ) +const insertAllUsersGroup = `-- name: InsertAllUsersGroup :one +INSERT INTO groups ( + id, + name, + organization_id +) VALUES - ($1, $2, $3, $4, $5) RETURNING user_id, organization_id, created_at, updated_at, roles + ( $1, 'Everyone', $1) RETURNING id, name, organization_id, avatar_url, quota_allowance ` -type InsertOrganizationMemberParams struct { - OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` - UserID uuid.UUID `db:"user_id" json:"user_id"` - CreatedAt time.Time `db:"created_at" json:"created_at"` - UpdatedAt time.Time `db:"updated_at" json:"updated_at"` - Roles []string `db:"roles" json:"roles"` -} - -func (q *sqlQuerier) InsertOrganizationMember(ctx context.Context, arg InsertOrganizationMemberParams) (OrganizationMember, error) { - row := q.db.QueryRowContext(ctx, insertOrganizationMember, - arg.OrganizationID, - arg.UserID, - arg.CreatedAt, - arg.UpdatedAt, - pq.Array(arg.Roles), - ) - var i OrganizationMember +// We use the organization_id as the id +// for simplicity since all users is +// every member of the org. +func (q *sqlQuerier) InsertAllUsersGroup(ctx context.Context, organizationID uuid.UUID) (Group, error) { + row := q.db.QueryRowContext(ctx, insertAllUsersGroup, organizationID) + var i Group err := row.Scan( - &i.UserID, + &i.ID, + &i.Name, &i.OrganizationID, - &i.CreatedAt, - &i.UpdatedAt, - pq.Array(&i.Roles), + &i.AvatarURL, + &i.QuotaAllowance, ) return i, err } -const updateMemberRoles = `-- name: UpdateMemberRoles :one -UPDATE - organization_members -SET - -- Remove all duplicates from the roles. - roles = ARRAY(SELECT DISTINCT UNNEST($1 :: text[])) -WHERE - user_id = $2 - AND organization_id = $3 -RETURNING user_id, organization_id, created_at, updated_at, roles +const insertGroup = `-- name: InsertGroup :one +INSERT INTO groups ( + id, + name, + organization_id, + avatar_url, + quota_allowance +) +VALUES + ( $1, $2, $3, $4, $5) RETURNING id, name, organization_id, avatar_url, quota_allowance ` -type UpdateMemberRolesParams struct { - GrantedRoles []string `db:"granted_roles" json:"granted_roles"` - UserID uuid.UUID `db:"user_id" json:"user_id"` - OrgID uuid.UUID `db:"org_id" json:"org_id"` -} - -func (q *sqlQuerier) UpdateMemberRoles(ctx context.Context, arg UpdateMemberRolesParams) (OrganizationMember, error) { - row := q.db.QueryRowContext(ctx, updateMemberRoles, pq.Array(arg.GrantedRoles), arg.UserID, arg.OrgID) - var i OrganizationMember - err := row.Scan( - &i.UserID, - &i.OrganizationID, - &i.CreatedAt, - &i.UpdatedAt, - pq.Array(&i.Roles), - ) - return i, err +type InsertGroupParams struct { + ID uuid.UUID `db:"id" json:"id"` + Name string `db:"name" json:"name"` + OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` + AvatarURL string `db:"avatar_url" json:"avatar_url"` + QuotaAllowance int32 `db:"quota_allowance" json:"quota_allowance"` } -const getOrganizationByID = `-- name: GetOrganizationByID :one -SELECT - id, name, description, created_at, updated_at -FROM - organizations -WHERE - id = $1 -` - -func (q *sqlQuerier) GetOrganizationByID(ctx context.Context, id uuid.UUID) (Organization, error) { - row := q.db.QueryRowContext(ctx, getOrganizationByID, id) - var i Organization +func (q *sqlQuerier) InsertGroup(ctx context.Context, arg InsertGroupParams) (Group, error) { + row := q.db.QueryRowContext(ctx, insertGroup, + arg.ID, + arg.Name, + arg.OrganizationID, + arg.AvatarURL, + arg.QuotaAllowance, + ) + var i Group err := row.Scan( &i.ID, &i.Name, - &i.Description, - &i.CreatedAt, - &i.UpdatedAt, + &i.OrganizationID, + &i.AvatarURL, + &i.QuotaAllowance, ) return i, err } -const getOrganizationByName = `-- name: GetOrganizationByName :one -SELECT - id, name, description, created_at, updated_at -FROM - organizations +const insertGroupMember = `-- name: InsertGroupMember :exec +INSERT INTO group_members ( + user_id, + group_id +) +VALUES ( $1, $2) +` + +type InsertGroupMemberParams struct { + UserID uuid.UUID `db:"user_id" json:"user_id"` + GroupID uuid.UUID `db:"group_id" json:"group_id"` +} + +func (q *sqlQuerier) InsertGroupMember(ctx context.Context, arg InsertGroupMemberParams) error { + _, err := q.db.ExecContext(ctx, insertGroupMember, arg.UserID, arg.GroupID) + return err +} + +const updateGroupByID = `-- name: UpdateGroupByID :one +UPDATE + groups +SET + name = $1, + avatar_url = $2, + quota_allowance = $3 WHERE - LOWER("name") = LOWER($1) -LIMIT - 1 + id = $4 +RETURNING id, name, organization_id, avatar_url, quota_allowance ` -func (q *sqlQuerier) GetOrganizationByName(ctx context.Context, name string) (Organization, error) { - row := q.db.QueryRowContext(ctx, getOrganizationByName, name) - var i Organization +type UpdateGroupByIDParams struct { + Name string `db:"name" json:"name"` + AvatarURL string `db:"avatar_url" json:"avatar_url"` + QuotaAllowance int32 `db:"quota_allowance" json:"quota_allowance"` + ID uuid.UUID `db:"id" json:"id"` +} + +func (q *sqlQuerier) UpdateGroupByID(ctx context.Context, arg UpdateGroupByIDParams) (Group, error) { + row := q.db.QueryRowContext(ctx, updateGroupByID, + arg.Name, + arg.AvatarURL, + arg.QuotaAllowance, + arg.ID, + ) + var i Group err := row.Scan( &i.ID, &i.Name, - &i.Description, - &i.CreatedAt, - &i.UpdatedAt, + &i.OrganizationID, + &i.AvatarURL, + &i.QuotaAllowance, ) return i, err } -const getOrganizations = `-- name: GetOrganizations :many -SELECT - id, name, description, created_at, updated_at -FROM - organizations +const deleteLicense = `-- name: DeleteLicense :one +DELETE +FROM licenses +WHERE id = $1 +RETURNING id ` -func (q *sqlQuerier) GetOrganizations(ctx context.Context) ([]Organization, error) { - rows, err := q.db.QueryContext(ctx, getOrganizations) +func (q *sqlQuerier) DeleteLicense(ctx context.Context, id int32) (int32, error) { + row := q.db.QueryRowContext(ctx, deleteLicense, id) + err := row.Scan(&id) + return id, err +} + +const getLicenses = `-- name: GetLicenses :many +SELECT id, uploaded_at, jwt, exp, uuid +FROM licenses +ORDER BY (id) +` + +func (q *sqlQuerier) GetLicenses(ctx context.Context) ([]License, error) { + rows, err := q.db.QueryContext(ctx, getLicenses) if err != nil { return nil, err } defer rows.Close() - var items []Organization + var items []License for rows.Next() { - var i Organization + var i License if err := rows.Scan( &i.ID, - &i.Name, - &i.Description, - &i.CreatedAt, - &i.UpdatedAt, + &i.UploadedAt, + &i.JWT, + &i.Exp, + &i.Uuid, ); err != nil { return nil, err } @@ -1690,37 +1761,28 @@ func (q *sqlQuerier) GetOrganizations(ctx context.Context) ([]Organization, erro return items, nil } -const getOrganizationsByUserID = `-- name: GetOrganizationsByUserID :many -SELECT - id, name, description, created_at, updated_at -FROM - organizations -WHERE - id = ( - SELECT - organization_id - FROM - organization_members - WHERE - user_id = $1 - ) +const getUnexpiredLicenses = `-- name: GetUnexpiredLicenses :many +SELECT id, uploaded_at, jwt, exp, uuid +FROM licenses +WHERE exp > NOW() +ORDER BY (id) ` -func (q *sqlQuerier) GetOrganizationsByUserID(ctx context.Context, userID uuid.UUID) ([]Organization, error) { - rows, err := q.db.QueryContext(ctx, getOrganizationsByUserID, userID) +func (q *sqlQuerier) GetUnexpiredLicenses(ctx context.Context) ([]License, error) { + rows, err := q.db.QueryContext(ctx, getUnexpiredLicenses) if err != nil { return nil, err } defer rows.Close() - var items []Organization + var items []License for rows.Next() { - var i Organization + var i License if err := rows.Scan( &i.ID, - &i.Name, - &i.Description, - &i.CreatedAt, - &i.UpdatedAt, + &i.UploadedAt, + &i.JWT, + &i.Exp, + &i.Uuid, ); err != nil { return nil, err } @@ -1735,79 +1797,69 @@ func (q *sqlQuerier) GetOrganizationsByUserID(ctx context.Context, userID uuid.U return items, nil } -const insertOrganization = `-- name: InsertOrganization :one +const insertLicense = `-- name: InsertLicense :one INSERT INTO - organizations (id, "name", description, created_at, updated_at) + licenses ( + uploaded_at, + jwt, + exp, + uuid +) VALUES - ($1, $2, $3, $4, $5) RETURNING id, name, description, created_at, updated_at + ($1, $2, $3, $4) RETURNING id, uploaded_at, jwt, exp, uuid ` -type InsertOrganizationParams struct { - ID uuid.UUID `db:"id" json:"id"` - Name string `db:"name" json:"name"` - Description string `db:"description" json:"description"` - CreatedAt time.Time `db:"created_at" json:"created_at"` - UpdatedAt time.Time `db:"updated_at" json:"updated_at"` +type InsertLicenseParams struct { + UploadedAt time.Time `db:"uploaded_at" json:"uploaded_at"` + JWT string `db:"jwt" json:"jwt"` + Exp time.Time `db:"exp" json:"exp"` + Uuid uuid.NullUUID `db:"uuid" json:"uuid"` } -func (q *sqlQuerier) InsertOrganization(ctx context.Context, arg InsertOrganizationParams) (Organization, error) { - row := q.db.QueryRowContext(ctx, insertOrganization, - arg.ID, - arg.Name, - arg.Description, - arg.CreatedAt, - arg.UpdatedAt, +func (q *sqlQuerier) InsertLicense(ctx context.Context, arg InsertLicenseParams) (License, error) { + row := q.db.QueryRowContext(ctx, insertLicense, + arg.UploadedAt, + arg.JWT, + arg.Exp, + arg.Uuid, ) - var i Organization + var i License err := row.Scan( &i.ID, - &i.Name, - &i.Description, - &i.CreatedAt, - &i.UpdatedAt, + &i.UploadedAt, + &i.JWT, + &i.Exp, + &i.Uuid, ) return i, err } -const getParameterSchemasByJobID = `-- name: GetParameterSchemasByJobID :many +const getOrganizationIDsByMemberIDs = `-- name: GetOrganizationIDsByMemberIDs :many SELECT - id, created_at, job_id, name, description, default_source_scheme, default_source_value, allow_override_source, default_destination_scheme, allow_override_destination, default_refresh, redisplay_value, validation_error, validation_condition, validation_type_system, validation_value_type, index + user_id, array_agg(organization_id) :: uuid [ ] AS "organization_IDs" FROM - parameter_schemas + organization_members WHERE - job_id = $1 -ORDER BY - index + user_id = ANY($1 :: uuid [ ]) +GROUP BY + user_id ` -func (q *sqlQuerier) GetParameterSchemasByJobID(ctx context.Context, jobID uuid.UUID) ([]ParameterSchema, error) { - rows, err := q.db.QueryContext(ctx, getParameterSchemasByJobID, jobID) +type GetOrganizationIDsByMemberIDsRow struct { + UserID uuid.UUID `db:"user_id" json:"user_id"` + OrganizationIDs []uuid.UUID `db:"organization_IDs" json:"organization_IDs"` +} + +func (q *sqlQuerier) GetOrganizationIDsByMemberIDs(ctx context.Context, ids []uuid.UUID) ([]GetOrganizationIDsByMemberIDsRow, error) { + rows, err := q.db.QueryContext(ctx, getOrganizationIDsByMemberIDs, pq.Array(ids)) if err != nil { return nil, err } defer rows.Close() - var items []ParameterSchema + var items []GetOrganizationIDsByMemberIDsRow for rows.Next() { - var i ParameterSchema - if err := rows.Scan( - &i.ID, - &i.CreatedAt, - &i.JobID, - &i.Name, - &i.Description, - &i.DefaultSourceScheme, - &i.DefaultSourceValue, - &i.AllowOverrideSource, - &i.DefaultDestinationScheme, - &i.AllowOverrideDestination, - &i.DefaultRefresh, - &i.RedisplayValue, - &i.ValidationError, - &i.ValidationCondition, - &i.ValidationTypeSystem, - &i.ValidationValueType, - &i.Index, - ); err != nil { + var i GetOrganizationIDsByMemberIDsRow + if err := rows.Scan(&i.UserID, pq.Array(&i.OrganizationIDs)); err != nil { return nil, err } items = append(items, i) @@ -1821,37 +1873,60 @@ func (q *sqlQuerier) GetParameterSchemasByJobID(ctx context.Context, jobID uuid. return items, nil } -const getParameterSchemasCreatedAfter = `-- name: GetParameterSchemasCreatedAfter :many -SELECT id, created_at, job_id, name, description, default_source_scheme, default_source_value, allow_override_source, default_destination_scheme, allow_override_destination, default_refresh, redisplay_value, validation_error, validation_condition, validation_type_system, validation_value_type, index FROM parameter_schemas WHERE created_at > $1 +const getOrganizationMemberByUserID = `-- name: GetOrganizationMemberByUserID :one +SELECT + user_id, organization_id, created_at, updated_at, roles +FROM + organization_members +WHERE + organization_id = $1 + AND user_id = $2 +LIMIT + 1 +` + +type GetOrganizationMemberByUserIDParams struct { + OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` + UserID uuid.UUID `db:"user_id" json:"user_id"` +} + +func (q *sqlQuerier) GetOrganizationMemberByUserID(ctx context.Context, arg GetOrganizationMemberByUserIDParams) (OrganizationMember, error) { + row := q.db.QueryRowContext(ctx, getOrganizationMemberByUserID, arg.OrganizationID, arg.UserID) + var i OrganizationMember + err := row.Scan( + &i.UserID, + &i.OrganizationID, + &i.CreatedAt, + &i.UpdatedAt, + pq.Array(&i.Roles), + ) + return i, err +} + +const getOrganizationMembershipsByUserID = `-- name: GetOrganizationMembershipsByUserID :many +SELECT + user_id, organization_id, created_at, updated_at, roles +FROM + organization_members +WHERE + user_id = $1 ` -func (q *sqlQuerier) GetParameterSchemasCreatedAfter(ctx context.Context, createdAt time.Time) ([]ParameterSchema, error) { - rows, err := q.db.QueryContext(ctx, getParameterSchemasCreatedAfter, createdAt) +func (q *sqlQuerier) GetOrganizationMembershipsByUserID(ctx context.Context, userID uuid.UUID) ([]OrganizationMember, error) { + rows, err := q.db.QueryContext(ctx, getOrganizationMembershipsByUserID, userID) if err != nil { return nil, err } defer rows.Close() - var items []ParameterSchema + var items []OrganizationMember for rows.Next() { - var i ParameterSchema + var i OrganizationMember if err := rows.Scan( - &i.ID, + &i.UserID, + &i.OrganizationID, &i.CreatedAt, - &i.JobID, - &i.Name, - &i.Description, - &i.DefaultSourceScheme, - &i.DefaultSourceValue, - &i.AllowOverrideSource, - &i.DefaultDestinationScheme, - &i.AllowOverrideDestination, - &i.DefaultRefresh, - &i.RedisplayValue, - &i.ValidationError, - &i.ValidationCondition, - &i.ValidationTypeSystem, - &i.ValidationValueType, - &i.Index, + &i.UpdatedAt, + pq.Array(&i.Roles), ); err != nil { return nil, err } @@ -1866,299 +1941,190 @@ func (q *sqlQuerier) GetParameterSchemasCreatedAfter(ctx context.Context, create return items, nil } -const insertParameterSchema = `-- name: InsertParameterSchema :one +const insertOrganizationMember = `-- name: InsertOrganizationMember :one INSERT INTO - parameter_schemas ( - id, + organization_members ( + organization_id, + user_id, created_at, - job_id, - "name", - description, - default_source_scheme, - default_source_value, - allow_override_source, - default_destination_scheme, - allow_override_destination, - default_refresh, - redisplay_value, - validation_error, - validation_condition, - validation_type_system, - validation_value_type, - index + updated_at, + roles ) VALUES - ( - $1, - $2, - $3, - $4, - $5, - $6, - $7, - $8, - $9, - $10, - $11, - $12, - $13, - $14, - $15, - $16, - $17 - ) RETURNING id, created_at, job_id, name, description, default_source_scheme, default_source_value, allow_override_source, default_destination_scheme, allow_override_destination, default_refresh, redisplay_value, validation_error, validation_condition, validation_type_system, validation_value_type, index + ($1, $2, $3, $4, $5) RETURNING user_id, organization_id, created_at, updated_at, roles ` -type InsertParameterSchemaParams struct { - ID uuid.UUID `db:"id" json:"id"` - CreatedAt time.Time `db:"created_at" json:"created_at"` - JobID uuid.UUID `db:"job_id" json:"job_id"` - Name string `db:"name" json:"name"` - Description string `db:"description" json:"description"` - DefaultSourceScheme ParameterSourceScheme `db:"default_source_scheme" json:"default_source_scheme"` - DefaultSourceValue string `db:"default_source_value" json:"default_source_value"` - AllowOverrideSource bool `db:"allow_override_source" json:"allow_override_source"` - DefaultDestinationScheme ParameterDestinationScheme `db:"default_destination_scheme" json:"default_destination_scheme"` - AllowOverrideDestination bool `db:"allow_override_destination" json:"allow_override_destination"` - DefaultRefresh string `db:"default_refresh" json:"default_refresh"` - RedisplayValue bool `db:"redisplay_value" json:"redisplay_value"` - ValidationError string `db:"validation_error" json:"validation_error"` - ValidationCondition string `db:"validation_condition" json:"validation_condition"` - ValidationTypeSystem ParameterTypeSystem `db:"validation_type_system" json:"validation_type_system"` - ValidationValueType string `db:"validation_value_type" json:"validation_value_type"` - Index int32 `db:"index" json:"index"` +type InsertOrganizationMemberParams struct { + OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` + UserID uuid.UUID `db:"user_id" json:"user_id"` + CreatedAt time.Time `db:"created_at" json:"created_at"` + UpdatedAt time.Time `db:"updated_at" json:"updated_at"` + Roles []string `db:"roles" json:"roles"` } -func (q *sqlQuerier) InsertParameterSchema(ctx context.Context, arg InsertParameterSchemaParams) (ParameterSchema, error) { - row := q.db.QueryRowContext(ctx, insertParameterSchema, - arg.ID, +func (q *sqlQuerier) InsertOrganizationMember(ctx context.Context, arg InsertOrganizationMemberParams) (OrganizationMember, error) { + row := q.db.QueryRowContext(ctx, insertOrganizationMember, + arg.OrganizationID, + arg.UserID, arg.CreatedAt, - arg.JobID, - arg.Name, - arg.Description, - arg.DefaultSourceScheme, - arg.DefaultSourceValue, - arg.AllowOverrideSource, - arg.DefaultDestinationScheme, - arg.AllowOverrideDestination, - arg.DefaultRefresh, - arg.RedisplayValue, - arg.ValidationError, - arg.ValidationCondition, - arg.ValidationTypeSystem, - arg.ValidationValueType, - arg.Index, + arg.UpdatedAt, + pq.Array(arg.Roles), ) - var i ParameterSchema + var i OrganizationMember err := row.Scan( - &i.ID, + &i.UserID, + &i.OrganizationID, &i.CreatedAt, - &i.JobID, - &i.Name, - &i.Description, - &i.DefaultSourceScheme, - &i.DefaultSourceValue, - &i.AllowOverrideSource, - &i.DefaultDestinationScheme, - &i.AllowOverrideDestination, - &i.DefaultRefresh, - &i.RedisplayValue, - &i.ValidationError, - &i.ValidationCondition, - &i.ValidationTypeSystem, - &i.ValidationValueType, - &i.Index, + &i.UpdatedAt, + pq.Array(&i.Roles), ) return i, err } -const deleteParameterValueByID = `-- name: DeleteParameterValueByID :exec -DELETE FROM - parameter_values -WHERE - id = $1 -` - -func (q *sqlQuerier) DeleteParameterValueByID(ctx context.Context, id uuid.UUID) error { - _, err := q.db.ExecContext(ctx, deleteParameterValueByID, id) - return err -} - -const getParameterValueByScopeAndName = `-- name: GetParameterValueByScopeAndName :one -SELECT - id, created_at, updated_at, scope, scope_id, name, source_scheme, source_value, destination_scheme -FROM - parameter_values +const updateMemberRoles = `-- name: UpdateMemberRoles :one +UPDATE + organization_members +SET + -- Remove all duplicates from the roles. + roles = ARRAY(SELECT DISTINCT UNNEST($1 :: text[])) WHERE - scope = $1 - AND scope_id = $2 - AND NAME = $3 -LIMIT - 1 + user_id = $2 + AND organization_id = $3 +RETURNING user_id, organization_id, created_at, updated_at, roles ` -type GetParameterValueByScopeAndNameParams struct { - Scope ParameterScope `db:"scope" json:"scope"` - ScopeID uuid.UUID `db:"scope_id" json:"scope_id"` - Name string `db:"name" json:"name"` +type UpdateMemberRolesParams struct { + GrantedRoles []string `db:"granted_roles" json:"granted_roles"` + UserID uuid.UUID `db:"user_id" json:"user_id"` + OrgID uuid.UUID `db:"org_id" json:"org_id"` } -func (q *sqlQuerier) GetParameterValueByScopeAndName(ctx context.Context, arg GetParameterValueByScopeAndNameParams) (ParameterValue, error) { - row := q.db.QueryRowContext(ctx, getParameterValueByScopeAndName, arg.Scope, arg.ScopeID, arg.Name) - var i ParameterValue +func (q *sqlQuerier) UpdateMemberRoles(ctx context.Context, arg UpdateMemberRolesParams) (OrganizationMember, error) { + row := q.db.QueryRowContext(ctx, updateMemberRoles, pq.Array(arg.GrantedRoles), arg.UserID, arg.OrgID) + var i OrganizationMember err := row.Scan( - &i.ID, + &i.UserID, + &i.OrganizationID, &i.CreatedAt, &i.UpdatedAt, - &i.Scope, - &i.ScopeID, - &i.Name, - &i.SourceScheme, - &i.SourceValue, - &i.DestinationScheme, - ) - return i, err -} - -const insertParameterValue = `-- name: InsertParameterValue :one -INSERT INTO - parameter_values ( - id, - "name", - created_at, - updated_at, - scope, - scope_id, - source_scheme, - source_value, - destination_scheme - ) -VALUES - ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING id, created_at, updated_at, scope, scope_id, name, source_scheme, source_value, destination_scheme -` - -type InsertParameterValueParams struct { - ID uuid.UUID `db:"id" json:"id"` - Name string `db:"name" json:"name"` - CreatedAt time.Time `db:"created_at" json:"created_at"` - UpdatedAt time.Time `db:"updated_at" json:"updated_at"` - Scope ParameterScope `db:"scope" json:"scope"` - ScopeID uuid.UUID `db:"scope_id" json:"scope_id"` - SourceScheme ParameterSourceScheme `db:"source_scheme" json:"source_scheme"` - SourceValue string `db:"source_value" json:"source_value"` - DestinationScheme ParameterDestinationScheme `db:"destination_scheme" json:"destination_scheme"` -} - -func (q *sqlQuerier) InsertParameterValue(ctx context.Context, arg InsertParameterValueParams) (ParameterValue, error) { - row := q.db.QueryRowContext(ctx, insertParameterValue, - arg.ID, - arg.Name, - arg.CreatedAt, - arg.UpdatedAt, - arg.Scope, - arg.ScopeID, - arg.SourceScheme, - arg.SourceValue, - arg.DestinationScheme, + pq.Array(&i.Roles), ) - var i ParameterValue + return i, err +} + +const getOrganizationByID = `-- name: GetOrganizationByID :one +SELECT + id, name, description, created_at, updated_at +FROM + organizations +WHERE + id = $1 +` + +func (q *sqlQuerier) GetOrganizationByID(ctx context.Context, id uuid.UUID) (Organization, error) { + row := q.db.QueryRowContext(ctx, getOrganizationByID, id) + var i Organization err := row.Scan( &i.ID, + &i.Name, + &i.Description, &i.CreatedAt, &i.UpdatedAt, - &i.Scope, - &i.ScopeID, - &i.Name, - &i.SourceScheme, - &i.SourceValue, - &i.DestinationScheme, ) return i, err } -const parameterValue = `-- name: ParameterValue :one -SELECT id, created_at, updated_at, scope, scope_id, name, source_scheme, source_value, destination_scheme FROM - parameter_values +const getOrganizationByName = `-- name: GetOrganizationByName :one +SELECT + id, name, description, created_at, updated_at +FROM + organizations WHERE - id = $1 + LOWER("name") = LOWER($1) +LIMIT + 1 ` -func (q *sqlQuerier) ParameterValue(ctx context.Context, id uuid.UUID) (ParameterValue, error) { - row := q.db.QueryRowContext(ctx, parameterValue, id) - var i ParameterValue +func (q *sqlQuerier) GetOrganizationByName(ctx context.Context, name string) (Organization, error) { + row := q.db.QueryRowContext(ctx, getOrganizationByName, name) + var i Organization err := row.Scan( &i.ID, + &i.Name, + &i.Description, &i.CreatedAt, &i.UpdatedAt, - &i.Scope, - &i.ScopeID, - &i.Name, - &i.SourceScheme, - &i.SourceValue, - &i.DestinationScheme, ) return i, err } -const parameterValues = `-- name: ParameterValues :many +const getOrganizations = `-- name: GetOrganizations :many SELECT - id, created_at, updated_at, scope, scope_id, name, source_scheme, source_value, destination_scheme + id, name, description, created_at, updated_at FROM - parameter_values -WHERE - CASE - WHEN cardinality($1 :: parameter_scope[]) > 0 THEN - scope = ANY($1 :: parameter_scope[]) - ELSE true - END - AND CASE - WHEN cardinality($2 :: uuid[]) > 0 THEN - scope_id = ANY($2 :: uuid[]) - ELSE true - END - AND CASE - WHEN cardinality($3 :: uuid[]) > 0 THEN - id = ANY($3 :: uuid[]) - ELSE true - END - AND CASE - WHEN cardinality($4 :: text[]) > 0 THEN - "name" = ANY($4 :: text[]) - ELSE true - END + organizations ` -type ParameterValuesParams struct { - Scopes []ParameterScope `db:"scopes" json:"scopes"` - ScopeIds []uuid.UUID `db:"scope_ids" json:"scope_ids"` - IDs []uuid.UUID `db:"ids" json:"ids"` - Names []string `db:"names" json:"names"` +func (q *sqlQuerier) GetOrganizations(ctx context.Context) ([]Organization, error) { + rows, err := q.db.QueryContext(ctx, getOrganizations) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Organization + for rows.Next() { + var i Organization + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Description, + &i.CreatedAt, + &i.UpdatedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil } -func (q *sqlQuerier) ParameterValues(ctx context.Context, arg ParameterValuesParams) ([]ParameterValue, error) { - rows, err := q.db.QueryContext(ctx, parameterValues, - pq.Array(arg.Scopes), - pq.Array(arg.ScopeIds), - pq.Array(arg.IDs), - pq.Array(arg.Names), +const getOrganizationsByUserID = `-- name: GetOrganizationsByUserID :many +SELECT + id, name, description, created_at, updated_at +FROM + organizations +WHERE + id = ( + SELECT + organization_id + FROM + organization_members + WHERE + user_id = $1 ) +` + +func (q *sqlQuerier) GetOrganizationsByUserID(ctx context.Context, userID uuid.UUID) ([]Organization, error) { + rows, err := q.db.QueryContext(ctx, getOrganizationsByUserID, userID) if err != nil { return nil, err } defer rows.Close() - var items []ParameterValue + var items []Organization for rows.Next() { - var i ParameterValue + var i Organization if err := rows.Scan( &i.ID, + &i.Name, + &i.Description, &i.CreatedAt, &i.UpdatedAt, - &i.Scope, - &i.ScopeID, - &i.Name, - &i.SourceScheme, - &i.SourceValue, - &i.DestinationScheme, ); err != nil { return nil, err } @@ -2173,6 +2139,40 @@ func (q *sqlQuerier) ParameterValues(ctx context.Context, arg ParameterValuesPar return items, nil } +const insertOrganization = `-- name: InsertOrganization :one +INSERT INTO + organizations (id, "name", description, created_at, updated_at) +VALUES + ($1, $2, $3, $4, $5) RETURNING id, name, description, created_at, updated_at +` + +type InsertOrganizationParams struct { + ID uuid.UUID `db:"id" json:"id"` + Name string `db:"name" json:"name"` + Description string `db:"description" json:"description"` + CreatedAt time.Time `db:"created_at" json:"created_at"` + UpdatedAt time.Time `db:"updated_at" json:"updated_at"` +} + +func (q *sqlQuerier) InsertOrganization(ctx context.Context, arg InsertOrganizationParams) (Organization, error) { + row := q.db.QueryRowContext(ctx, insertOrganization, + arg.ID, + arg.Name, + arg.Description, + arg.CreatedAt, + arg.UpdatedAt, + ) + var i Organization + err := row.Scan( + &i.ID, + &i.Name, + &i.Description, + &i.CreatedAt, + &i.UpdatedAt, + ) + return i, err +} + const getProvisionerDaemonByID = `-- name: GetProvisionerDaemonByID :one SELECT id, created_at, updated_at, name, provisioners, replica_id, tags @@ -2988,6 +2988,121 @@ func (q *sqlQuerier) InsertDeploymentID(ctx context.Context, value string) error return err } +const getTemplateVersionParameters = `-- name: GetTemplateVersionParameters :many +SELECT template_version_id, name, description, type, mutable, default_value, icon, options, validation_regex, validation_min, validation_max FROM template_version_parameters WHERE template_version_id = $1 +` + +func (q *sqlQuerier) GetTemplateVersionParameters(ctx context.Context, templateVersionID uuid.UUID) ([]TemplateVersionParameter, error) { + rows, err := q.db.QueryContext(ctx, getTemplateVersionParameters, templateVersionID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TemplateVersionParameter + for rows.Next() { + var i TemplateVersionParameter + if err := rows.Scan( + &i.TemplateVersionID, + &i.Name, + &i.Description, + &i.Type, + &i.Mutable, + &i.DefaultValue, + &i.Icon, + &i.Options, + &i.ValidationRegex, + &i.ValidationMin, + &i.ValidationMax, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const insertTemplateVersionParameter = `-- name: InsertTemplateVersionParameter :one +INSERT INTO + template_version_parameters ( + template_version_id, + name, + description, + type, + mutable, + default_value, + icon, + options, + validation_regex, + validation_min, + validation_max + ) +VALUES + ( + $1, + $2, + $3, + $4, + $5, + $6, + $7, + $8, + $9, + $10, + $11 + ) RETURNING template_version_id, name, description, type, mutable, default_value, icon, options, validation_regex, validation_min, validation_max +` + +type InsertTemplateVersionParameterParams struct { + TemplateVersionID uuid.UUID `db:"template_version_id" json:"template_version_id"` + Name string `db:"name" json:"name"` + Description string `db:"description" json:"description"` + Type string `db:"type" json:"type"` + Mutable bool `db:"mutable" json:"mutable"` + DefaultValue string `db:"default_value" json:"default_value"` + Icon string `db:"icon" json:"icon"` + Options json.RawMessage `db:"options" json:"options"` + ValidationRegex string `db:"validation_regex" json:"validation_regex"` + ValidationMin int32 `db:"validation_min" json:"validation_min"` + ValidationMax int32 `db:"validation_max" json:"validation_max"` +} + +func (q *sqlQuerier) InsertTemplateVersionParameter(ctx context.Context, arg InsertTemplateVersionParameterParams) (TemplateVersionParameter, error) { + row := q.db.QueryRowContext(ctx, insertTemplateVersionParameter, + arg.TemplateVersionID, + arg.Name, + arg.Description, + arg.Type, + arg.Mutable, + arg.DefaultValue, + arg.Icon, + arg.Options, + arg.ValidationRegex, + arg.ValidationMin, + arg.ValidationMax, + ) + var i TemplateVersionParameter + err := row.Scan( + &i.TemplateVersionID, + &i.Name, + &i.Description, + &i.Type, + &i.Mutable, + &i.DefaultValue, + &i.Icon, + &i.Options, + &i.ValidationRegex, + &i.ValidationMin, + &i.ValidationMax, + ) + return i, err +} + const getTemplateAverageBuildTime = `-- name: GetTemplateAverageBuildTime :one WITH build_times AS ( SELECT @@ -5793,6 +5908,59 @@ func (q *sqlQuerier) UpdateWorkspaceBuildCostByID(ctx context.Context, arg Updat return i, err } +const getWorkspaceBuildParameters = `-- name: GetWorkspaceBuildParameters :many +SELECT + workspace_build_id, name, value +FROM + workspace_build_parameters +WHERE + workspace_build_id = $1 +` + +func (q *sqlQuerier) GetWorkspaceBuildParameters(ctx context.Context, workspaceBuildID uuid.UUID) ([]WorkspaceBuildParameter, error) { + rows, err := q.db.QueryContext(ctx, getWorkspaceBuildParameters, workspaceBuildID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []WorkspaceBuildParameter + for rows.Next() { + var i WorkspaceBuildParameter + if err := rows.Scan(&i.WorkspaceBuildID, &i.Name, &i.Value); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const insertWorkspaceBuildParameters = `-- name: InsertWorkspaceBuildParameters :exec +INSERT INTO + workspace_build_parameters (workspace_build_id, name, value) +SELECT + $1 :: uuid AS workspace_build_id, + unnest($2 :: text[]) AS name, + unnest($3 :: text[]) AS value +RETURNING workspace_build_id, name, value +` + +type InsertWorkspaceBuildParametersParams struct { + WorkspaceBuildID uuid.UUID `db:"workspace_build_id" json:"workspace_build_id"` + Name []string `db:"name" json:"name"` + Value []string `db:"value" json:"value"` +} + +func (q *sqlQuerier) InsertWorkspaceBuildParameters(ctx context.Context, arg InsertWorkspaceBuildParametersParams) error { + _, err := q.db.ExecContext(ctx, insertWorkspaceBuildParameters, arg.WorkspaceBuildID, pq.Array(arg.Name), pq.Array(arg.Value)) + return err +} + const getWorkspaceResourceByID = `-- name: GetWorkspaceResourceByID :one SELECT id, created_at, job_id, transition, type, name, hide, icon, instance_type, daily_cost diff --git a/coderd/database/queries/parameterschemas.sql b/coderd/database/queries/deprecatedparameterschemas.sql similarity index 100% rename from coderd/database/queries/parameterschemas.sql rename to coderd/database/queries/deprecatedparameterschemas.sql diff --git a/coderd/database/queries/parametervalues.sql b/coderd/database/queries/deprecatedparametervalues.sql similarity index 100% rename from coderd/database/queries/parametervalues.sql rename to coderd/database/queries/deprecatedparametervalues.sql diff --git a/coderd/database/queries/templateparameters.sql b/coderd/database/queries/templateparameters.sql new file mode 100644 index 0000000000000..7fa247f279392 --- /dev/null +++ b/coderd/database/queries/templateparameters.sql @@ -0,0 +1,32 @@ +-- name: InsertTemplateVersionParameter :one +INSERT INTO + template_version_parameters ( + template_version_id, + name, + description, + type, + mutable, + default_value, + icon, + options, + validation_regex, + validation_min, + validation_max + ) +VALUES + ( + $1, + $2, + $3, + $4, + $5, + $6, + $7, + $8, + $9, + $10, + $11 + ) RETURNING *; + +-- name: GetTemplateVersionParameters :many +SELECT * FROM template_version_parameters WHERE template_version_id = $1; diff --git a/coderd/database/queries/workspaceparameters.sql b/coderd/database/queries/workspaceparameters.sql new file mode 100644 index 0000000000000..07198d4e3725e --- /dev/null +++ b/coderd/database/queries/workspaceparameters.sql @@ -0,0 +1,16 @@ +-- name: InsertWorkspaceBuildParameters :exec +INSERT INTO + workspace_build_parameters (workspace_build_id, name, value) +SELECT + @workspace_build_id :: uuid AS workspace_build_id, + unnest(@name :: text[]) AS name, + unnest(@value :: text[]) AS value +RETURNING *; + +-- name: GetWorkspaceBuildParameters :many +SELECT + * +FROM + workspace_build_parameters +WHERE + workspace_build_id = $1; diff --git a/coderd/database/unique_constraint.go b/coderd/database/unique_constraint.go index 83c7821207025..7bc55ad7cf31b 100644 --- a/coderd/database/unique_constraint.go +++ b/coderd/database/unique_constraint.go @@ -6,25 +6,27 @@ type UniqueConstraint string // UniqueConstraint enums. const ( - UniqueFilesHashCreatedByKey UniqueConstraint = "files_hash_created_by_key" // ALTER TABLE ONLY files ADD CONSTRAINT files_hash_created_by_key UNIQUE (hash, created_by); - UniqueGitAuthLinksProviderIDUserIDKey UniqueConstraint = "git_auth_links_provider_id_user_id_key" // ALTER TABLE ONLY git_auth_links ADD CONSTRAINT git_auth_links_provider_id_user_id_key UNIQUE (provider_id, user_id); - UniqueGroupMembersUserIDGroupIDKey UniqueConstraint = "group_members_user_id_group_id_key" // ALTER TABLE ONLY group_members ADD CONSTRAINT group_members_user_id_group_id_key UNIQUE (user_id, group_id); - UniqueGroupsNameOrganizationIDKey UniqueConstraint = "groups_name_organization_id_key" // ALTER TABLE ONLY groups ADD CONSTRAINT groups_name_organization_id_key UNIQUE (name, organization_id); - UniqueLicensesJWTKey UniqueConstraint = "licenses_jwt_key" // ALTER TABLE ONLY licenses ADD CONSTRAINT licenses_jwt_key UNIQUE (jwt); - UniqueParameterSchemasJobIDNameKey UniqueConstraint = "parameter_schemas_job_id_name_key" // ALTER TABLE ONLY parameter_schemas ADD CONSTRAINT parameter_schemas_job_id_name_key UNIQUE (job_id, name); - UniqueParameterValuesScopeIDNameKey UniqueConstraint = "parameter_values_scope_id_name_key" // ALTER TABLE ONLY parameter_values ADD CONSTRAINT parameter_values_scope_id_name_key UNIQUE (scope_id, name); - UniqueProvisionerDaemonsNameKey UniqueConstraint = "provisioner_daemons_name_key" // ALTER TABLE ONLY provisioner_daemons ADD CONSTRAINT provisioner_daemons_name_key UNIQUE (name); - UniqueSiteConfigsKeyKey UniqueConstraint = "site_configs_key_key" // ALTER TABLE ONLY site_configs ADD CONSTRAINT site_configs_key_key UNIQUE (key); - UniqueTemplateVersionsTemplateIDNameKey UniqueConstraint = "template_versions_template_id_name_key" // ALTER TABLE ONLY template_versions ADD CONSTRAINT template_versions_template_id_name_key UNIQUE (template_id, name); - UniqueWorkspaceAppsAgentIDSlugIndex UniqueConstraint = "workspace_apps_agent_id_slug_idx" // ALTER TABLE ONLY workspace_apps ADD CONSTRAINT workspace_apps_agent_id_slug_idx UNIQUE (agent_id, slug); - UniqueWorkspaceBuildsJobIDKey UniqueConstraint = "workspace_builds_job_id_key" // ALTER TABLE ONLY workspace_builds ADD CONSTRAINT workspace_builds_job_id_key UNIQUE (job_id); - UniqueWorkspaceBuildsWorkspaceIDBuildNumberKey UniqueConstraint = "workspace_builds_workspace_id_build_number_key" // ALTER TABLE ONLY workspace_builds ADD CONSTRAINT workspace_builds_workspace_id_build_number_key UNIQUE (workspace_id, build_number); - UniqueIndexOrganizationName UniqueConstraint = "idx_organization_name" // CREATE UNIQUE INDEX idx_organization_name ON organizations USING btree (name); - UniqueIndexOrganizationNameLower UniqueConstraint = "idx_organization_name_lower" // CREATE UNIQUE INDEX idx_organization_name_lower ON organizations USING btree (lower(name)); - UniqueIndexUsersEmail UniqueConstraint = "idx_users_email" // CREATE UNIQUE INDEX idx_users_email ON users USING btree (email) WHERE (deleted = false); - UniqueIndexUsersUsername UniqueConstraint = "idx_users_username" // CREATE UNIQUE INDEX idx_users_username ON users USING btree (username) WHERE (deleted = false); - UniqueTemplatesOrganizationIDNameIndex UniqueConstraint = "templates_organization_id_name_idx" // CREATE UNIQUE INDEX templates_organization_id_name_idx ON templates USING btree (organization_id, lower((name)::text)) WHERE (deleted = false); - UniqueUsersEmailLowerIndex UniqueConstraint = "users_email_lower_idx" // CREATE UNIQUE INDEX users_email_lower_idx ON users USING btree (lower(email)) WHERE (deleted = false); - UniqueUsersUsernameLowerIndex UniqueConstraint = "users_username_lower_idx" // CREATE UNIQUE INDEX users_username_lower_idx ON users USING btree (lower(username)) WHERE (deleted = false); - UniqueWorkspacesOwnerIDLowerIndex UniqueConstraint = "workspaces_owner_id_lower_idx" // CREATE UNIQUE INDEX workspaces_owner_id_lower_idx ON workspaces USING btree (owner_id, lower((name)::text)) WHERE (deleted = false); + UniqueFilesHashCreatedByKey UniqueConstraint = "files_hash_created_by_key" // ALTER TABLE ONLY files ADD CONSTRAINT files_hash_created_by_key UNIQUE (hash, created_by); + UniqueGitAuthLinksProviderIDUserIDKey UniqueConstraint = "git_auth_links_provider_id_user_id_key" // ALTER TABLE ONLY git_auth_links ADD CONSTRAINT git_auth_links_provider_id_user_id_key UNIQUE (provider_id, user_id); + UniqueGroupMembersUserIDGroupIDKey UniqueConstraint = "group_members_user_id_group_id_key" // ALTER TABLE ONLY group_members ADD CONSTRAINT group_members_user_id_group_id_key UNIQUE (user_id, group_id); + UniqueGroupsNameOrganizationIDKey UniqueConstraint = "groups_name_organization_id_key" // ALTER TABLE ONLY groups ADD CONSTRAINT groups_name_organization_id_key UNIQUE (name, organization_id); + UniqueLicensesJWTKey UniqueConstraint = "licenses_jwt_key" // ALTER TABLE ONLY licenses ADD CONSTRAINT licenses_jwt_key UNIQUE (jwt); + UniqueParameterSchemasJobIDNameKey UniqueConstraint = "parameter_schemas_job_id_name_key" // ALTER TABLE ONLY parameter_schemas ADD CONSTRAINT parameter_schemas_job_id_name_key UNIQUE (job_id, name); + UniqueParameterValuesScopeIDNameKey UniqueConstraint = "parameter_values_scope_id_name_key" // ALTER TABLE ONLY parameter_values ADD CONSTRAINT parameter_values_scope_id_name_key UNIQUE (scope_id, name); + UniqueProvisionerDaemonsNameKey UniqueConstraint = "provisioner_daemons_name_key" // ALTER TABLE ONLY provisioner_daemons ADD CONSTRAINT provisioner_daemons_name_key UNIQUE (name); + UniqueSiteConfigsKeyKey UniqueConstraint = "site_configs_key_key" // ALTER TABLE ONLY site_configs ADD CONSTRAINT site_configs_key_key UNIQUE (key); + UniqueTemplateVersionParametersTemplateVersionIDNameKey UniqueConstraint = "template_version_parameters_template_version_id_name_key" // ALTER TABLE ONLY template_version_parameters ADD CONSTRAINT template_version_parameters_template_version_id_name_key UNIQUE (template_version_id, name); + UniqueTemplateVersionsTemplateIDNameKey UniqueConstraint = "template_versions_template_id_name_key" // ALTER TABLE ONLY template_versions ADD CONSTRAINT template_versions_template_id_name_key UNIQUE (template_id, name); + UniqueWorkspaceAppsAgentIDSlugIndex UniqueConstraint = "workspace_apps_agent_id_slug_idx" // ALTER TABLE ONLY workspace_apps ADD CONSTRAINT workspace_apps_agent_id_slug_idx UNIQUE (agent_id, slug); + UniqueWorkspaceBuildParametersWorkspaceBuildIDNameKey UniqueConstraint = "workspace_build_parameters_workspace_build_id_name_key" // ALTER TABLE ONLY workspace_build_parameters ADD CONSTRAINT workspace_build_parameters_workspace_build_id_name_key UNIQUE (workspace_build_id, name); + UniqueWorkspaceBuildsJobIDKey UniqueConstraint = "workspace_builds_job_id_key" // ALTER TABLE ONLY workspace_builds ADD CONSTRAINT workspace_builds_job_id_key UNIQUE (job_id); + UniqueWorkspaceBuildsWorkspaceIDBuildNumberKey UniqueConstraint = "workspace_builds_workspace_id_build_number_key" // ALTER TABLE ONLY workspace_builds ADD CONSTRAINT workspace_builds_workspace_id_build_number_key UNIQUE (workspace_id, build_number); + UniqueIndexOrganizationName UniqueConstraint = "idx_organization_name" // CREATE UNIQUE INDEX idx_organization_name ON organizations USING btree (name); + UniqueIndexOrganizationNameLower UniqueConstraint = "idx_organization_name_lower" // CREATE UNIQUE INDEX idx_organization_name_lower ON organizations USING btree (lower(name)); + UniqueIndexUsersEmail UniqueConstraint = "idx_users_email" // CREATE UNIQUE INDEX idx_users_email ON users USING btree (email) WHERE (deleted = false); + UniqueIndexUsersUsername UniqueConstraint = "idx_users_username" // CREATE UNIQUE INDEX idx_users_username ON users USING btree (username) WHERE (deleted = false); + UniqueTemplatesOrganizationIDNameIndex UniqueConstraint = "templates_organization_id_name_idx" // CREATE UNIQUE INDEX templates_organization_id_name_idx ON templates USING btree (organization_id, lower((name)::text)) WHERE (deleted = false); + UniqueUsersEmailLowerIndex UniqueConstraint = "users_email_lower_idx" // CREATE UNIQUE INDEX users_email_lower_idx ON users USING btree (lower(email)) WHERE (deleted = false); + UniqueUsersUsernameLowerIndex UniqueConstraint = "users_username_lower_idx" // CREATE UNIQUE INDEX users_username_lower_idx ON users USING btree (lower(username)) WHERE (deleted = false); + UniqueWorkspacesOwnerIDLowerIndex UniqueConstraint = "workspaces_owner_id_lower_idx" // CREATE UNIQUE INDEX workspaces_owner_id_lower_idx ON workspaces USING btree (owner_id, lower((name)::text)) WHERE (deleted = false); ) diff --git a/coderd/parameters.go b/coderd/parameters.go index ba3fd2349f48a..61c0817fe6f84 100644 --- a/coderd/parameters.go +++ b/coderd/parameters.go @@ -18,7 +18,7 @@ import ( "github.com/coder/coder/codersdk" ) -func (api *API) postParameter(rw http.ResponseWriter, r *http.Request) { +func (api *API) deprecatedPostParameter(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() scope, scopeID, valid := readScopeAndID(ctx, rw, r) if !valid { @@ -33,7 +33,7 @@ func (api *API) postParameter(rw http.ResponseWriter, r *http.Request) { return } - var createRequest codersdk.CreateParameterRequest + var createRequest codersdk.DeprecatedCreateParameterRequest if !httpapi.Read(ctx, rw, r, &createRequest) { return } @@ -78,7 +78,7 @@ func (api *API) postParameter(rw http.ResponseWriter, r *http.Request) { httpapi.Write(ctx, rw, http.StatusCreated, convertParameterValue(parameterValue)) } -func (api *API) parameters(rw http.ResponseWriter, r *http.Request) { +func (api *API) deprecatedParameters(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() scope, scopeID, valid := readScopeAndID(ctx, rw, r) if !valid { @@ -108,7 +108,7 @@ func (api *API) parameters(rw http.ResponseWriter, r *http.Request) { }) return } - apiParameterValues := make([]codersdk.Parameter, 0, len(parameterValues)) + apiParameterValues := make([]codersdk.DeprecatedParameter, 0, len(parameterValues)) for _, parameterValue := range parameterValues { apiParameterValues = append(apiParameterValues, convertParameterValue(parameterValue)) } @@ -116,7 +116,7 @@ func (api *API) parameters(rw http.ResponseWriter, r *http.Request) { httpapi.Write(ctx, rw, http.StatusOK, apiParameterValues) } -func (api *API) deleteParameter(rw http.ResponseWriter, r *http.Request) { +func (api *API) deprecatedDeleteParameter(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() scope, scopeID, valid := readScopeAndID(ctx, rw, r) if !valid { @@ -162,26 +162,26 @@ func (api *API) deleteParameter(rw http.ResponseWriter, r *http.Request) { }) } -func convertParameterSchema(parameterSchema database.ParameterSchema) (codersdk.ParameterSchema, error) { +func convertParameterSchema(parameterSchema database.ParameterSchema) (codersdk.DeprecatedParameterSchema, error) { contains := []string{} if parameterSchema.ValidationCondition != "" { var err error contains, _, err = parameter.Contains(parameterSchema.ValidationCondition) if err != nil { - return codersdk.ParameterSchema{}, xerrors.Errorf("parse validation condition for %q: %w", parameterSchema.Name, err) + return codersdk.DeprecatedParameterSchema{}, xerrors.Errorf("parse validation condition for %q: %w", parameterSchema.Name, err) } } - return codersdk.ParameterSchema{ + return codersdk.DeprecatedParameterSchema{ ID: parameterSchema.ID, CreatedAt: parameterSchema.CreatedAt, JobID: parameterSchema.JobID, Name: parameterSchema.Name, Description: parameterSchema.Description, - DefaultSourceScheme: codersdk.ParameterSourceScheme(parameterSchema.DefaultSourceScheme), + DefaultSourceScheme: codersdk.DeprecatedParameterSourceScheme(parameterSchema.DefaultSourceScheme), DefaultSourceValue: parameterSchema.DefaultSourceValue, AllowOverrideSource: parameterSchema.AllowOverrideSource, - DefaultDestinationScheme: codersdk.ParameterDestinationScheme(parameterSchema.DefaultDestinationScheme), + DefaultDestinationScheme: codersdk.DeprecatedParameterDestinationScheme(parameterSchema.DefaultDestinationScheme), AllowOverrideDestination: parameterSchema.AllowOverrideDestination, DefaultRefresh: parameterSchema.DefaultRefresh, RedisplayValue: parameterSchema.RedisplayValue, @@ -193,16 +193,16 @@ func convertParameterSchema(parameterSchema database.ParameterSchema) (codersdk. }, nil } -func convertParameterValue(parameterValue database.ParameterValue) codersdk.Parameter { - return codersdk.Parameter{ +func convertParameterValue(parameterValue database.ParameterValue) codersdk.DeprecatedParameter { + return codersdk.DeprecatedParameter{ ID: parameterValue.ID, CreatedAt: parameterValue.CreatedAt, UpdatedAt: parameterValue.UpdatedAt, - Scope: codersdk.ParameterScope(parameterValue.Scope), + Scope: codersdk.DeprecatedParameterScope(parameterValue.Scope), ScopeID: parameterValue.ScopeID, Name: parameterValue.Name, - SourceScheme: codersdk.ParameterSourceScheme(parameterValue.SourceScheme), - DestinationScheme: codersdk.ParameterDestinationScheme(parameterValue.DestinationScheme), + SourceScheme: codersdk.DeprecatedParameterSourceScheme(parameterValue.SourceScheme), + DestinationScheme: codersdk.DeprecatedParameterDestinationScheme(parameterValue.DestinationScheme), } } diff --git a/coderd/parameters_test.go b/coderd/parameters_test.go index 89bf2be8c4f77..f2640e0a7210b 100644 --- a/coderd/parameters_test.go +++ b/coderd/parameters_test.go @@ -25,11 +25,11 @@ func TestPostParameter(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) defer cancel() - _, err := client.CreateParameter(ctx, codersdk.ParameterScope("something"), user.OrganizationID, codersdk.CreateParameterRequest{ + _, err := client.DeprecatedCreateParameter(ctx, codersdk.DeprecatedParameterScope("something"), user.OrganizationID, codersdk.DeprecatedCreateParameterRequest{ Name: "example", SourceValue: "tomato", - SourceScheme: codersdk.ParameterSourceSchemeData, - DestinationScheme: codersdk.ParameterDestinationSchemeProvisionerVariable, + SourceScheme: codersdk.DeprecatedParameterSourceSchemeData, + DestinationScheme: codersdk.DeprecatedParameterDestinationSchemeProvisionerVariable, }) var apiErr *codersdk.Error require.ErrorAs(t, err, &apiErr) @@ -45,11 +45,11 @@ func TestPostParameter(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) defer cancel() - _, err := client.CreateParameter(ctx, codersdk.ParameterTemplate, template.ID, codersdk.CreateParameterRequest{ + _, err := client.DeprecatedCreateParameter(ctx, codersdk.DeprecatedParameterTemplate, template.ID, codersdk.DeprecatedCreateParameterRequest{ Name: "example", SourceValue: "tomato", - SourceScheme: codersdk.ParameterSourceSchemeData, - DestinationScheme: codersdk.ParameterDestinationSchemeProvisionerVariable, + SourceScheme: codersdk.DeprecatedParameterSourceSchemeData, + DestinationScheme: codersdk.DeprecatedParameterDestinationSchemeProvisionerVariable, }) require.NoError(t, err) }) @@ -63,19 +63,19 @@ func TestPostParameter(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) defer cancel() - _, err := client.CreateParameter(ctx, codersdk.ParameterTemplate, template.ID, codersdk.CreateParameterRequest{ + _, err := client.DeprecatedCreateParameter(ctx, codersdk.DeprecatedParameterTemplate, template.ID, codersdk.DeprecatedCreateParameterRequest{ Name: "example", SourceValue: "tomato", - SourceScheme: codersdk.ParameterSourceSchemeData, - DestinationScheme: codersdk.ParameterDestinationSchemeProvisionerVariable, + SourceScheme: codersdk.DeprecatedParameterSourceSchemeData, + DestinationScheme: codersdk.DeprecatedParameterDestinationSchemeProvisionerVariable, }) require.NoError(t, err) - _, err = client.CreateParameter(ctx, codersdk.ParameterTemplate, template.ID, codersdk.CreateParameterRequest{ + _, err = client.DeprecatedCreateParameter(ctx, codersdk.DeprecatedParameterTemplate, template.ID, codersdk.DeprecatedCreateParameterRequest{ Name: "example", SourceValue: "tomato", - SourceScheme: codersdk.ParameterSourceSchemeData, - DestinationScheme: codersdk.ParameterDestinationSchemeProvisionerVariable, + SourceScheme: codersdk.DeprecatedParameterSourceSchemeData, + DestinationScheme: codersdk.DeprecatedParameterDestinationSchemeProvisionerVariable, }) var apiErr *codersdk.Error require.ErrorAs(t, err, &apiErr) @@ -94,7 +94,7 @@ func TestParameters(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) defer cancel() - _, err := client.Parameters(ctx, codersdk.ParameterTemplate, template.ID) + _, err := client.DeprecatedParameters(ctx, codersdk.DeprecatedParameterTemplate, template.ID) require.NoError(t, err) }) t.Run("List", func(t *testing.T) { @@ -106,14 +106,14 @@ func TestParameters(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) defer cancel() - _, err := client.CreateParameter(ctx, codersdk.ParameterTemplate, template.ID, codersdk.CreateParameterRequest{ + _, err := client.DeprecatedCreateParameter(ctx, codersdk.DeprecatedParameterTemplate, template.ID, codersdk.DeprecatedCreateParameterRequest{ Name: "example", SourceValue: "tomato", - SourceScheme: codersdk.ParameterSourceSchemeData, - DestinationScheme: codersdk.ParameterDestinationSchemeProvisionerVariable, + SourceScheme: codersdk.DeprecatedParameterSourceSchemeData, + DestinationScheme: codersdk.DeprecatedParameterDestinationSchemeProvisionerVariable, }) require.NoError(t, err) - params, err := client.Parameters(ctx, codersdk.ParameterTemplate, template.ID) + params, err := client.DeprecatedParameters(ctx, codersdk.DeprecatedParameterTemplate, template.ID) require.NoError(t, err) require.Len(t, params, 1) }) @@ -130,7 +130,7 @@ func TestDeleteParameter(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) defer cancel() - err := client.DeleteParameter(ctx, codersdk.ParameterTemplate, template.ID, "something") + err := client.DeprecatedDeleteParameter(ctx, codersdk.DeprecatedParameterTemplate, template.ID, "something") var apiErr *codersdk.Error require.ErrorAs(t, err, &apiErr) require.Equal(t, http.StatusNotFound, apiErr.StatusCode()) @@ -144,14 +144,14 @@ func TestDeleteParameter(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) defer cancel() - param, err := client.CreateParameter(ctx, codersdk.ParameterTemplate, template.ID, codersdk.CreateParameterRequest{ + param, err := client.DeprecatedCreateParameter(ctx, codersdk.DeprecatedParameterTemplate, template.ID, codersdk.DeprecatedCreateParameterRequest{ Name: "example", SourceValue: "tomato", - SourceScheme: codersdk.ParameterSourceSchemeData, - DestinationScheme: codersdk.ParameterDestinationSchemeProvisionerVariable, + SourceScheme: codersdk.DeprecatedParameterSourceSchemeData, + DestinationScheme: codersdk.DeprecatedParameterDestinationSchemeProvisionerVariable, }) require.NoError(t, err) - err = client.DeleteParameter(ctx, codersdk.ParameterTemplate, template.ID, param.Name) + err = client.DeprecatedDeleteParameter(ctx, codersdk.DeprecatedParameterTemplate, template.ID, param.Name) require.NoError(t, err) }) } diff --git a/coderd/provisionerdserver/provisionerdserver.go b/coderd/provisionerdserver/provisionerdserver.go index 0c3705f719c81..dd83abb4d3b15 100644 --- a/coderd/provisionerdserver/provisionerdserver.go +++ b/coderd/provisionerdserver/provisionerdserver.go @@ -154,8 +154,8 @@ func (server *Server) AcquireJob(ctx context.Context, _ *proto.Empty) (*proto.Ac return nil, failJob(fmt.Sprintf("publish workspace update: %s", err)) } - // Compute parameters for the workspace to consume. - parameters, err := parameter.Compute(ctx, server.Database, parameter.ComputeScope{ + // Compute deprecatedParameters for the workspace to consume. + deprecatedParameters, err := parameter.Compute(ctx, server.Database, parameter.ComputeScope{ TemplateImportJobID: templateVersion.JobID, TemplateID: uuid.NullUUID{ UUID: template.ID, @@ -171,21 +171,31 @@ func (server *Server) AcquireJob(ctx context.Context, _ *proto.Empty) (*proto.Ac } // Convert types to their corresponding protobuf types. - protoParameters, err := convertComputedParameterValues(parameters) - if err != nil { - return nil, failJob(fmt.Sprintf("convert computed parameters to protobuf: %s", err)) - } + deprecatedProtoParameters := convertComputedParameterValues(deprecatedParameters) transition, err := convertWorkspaceTransition(workspaceBuild.Transition) if err != nil { return nil, failJob(fmt.Sprintf("convert workspace transition: %s", err)) } + protoParameters := make([]*sdkproto.ParameterValue, 0) + parameters, err := server.Database.GetWorkspaceBuildParameters(ctx, workspaceBuild.ID) + if err != nil { + return nil, failJob(fmt.Sprintf("get workspace build parameters: %s", err)) + } + for _, parameter := range parameters { + protoParameters = append(protoParameters, &sdkproto.ParameterValue{ + Name: parameter.Name, + Value: parameter.Value, + }) + } + protoJob.Type = &proto.AcquiredJob_WorkspaceBuild_{ WorkspaceBuild: &proto.AcquiredJob_WorkspaceBuild{ - WorkspaceBuildId: workspaceBuild.ID.String(), - WorkspaceName: workspace.Name, - State: workspaceBuild.ProvisionerState, - ParameterValues: protoParameters, + WorkspaceBuildId: workspaceBuild.ID.String(), + WorkspaceName: workspace.Name, + State: workspaceBuild.ProvisionerState, + ParameterValues: protoParameters, + DeprecatedParameterValues: deprecatedProtoParameters, Metadata: &sdkproto.Provision_Metadata{ CoderUrl: server.AccessURL.String(), WorkspaceTransition: transition, @@ -221,11 +231,7 @@ func (server *Server) AcquireJob(ctx context.Context, _ *proto.Empty) (*proto.Ac } // Convert types to their corresponding protobuf types. - protoParameters, err := convertComputedParameterValues(parameters) - if err != nil { - return nil, failJob(fmt.Sprintf("convert computed parameters to protobuf: %s", err)) - } - + protoParameters := convertComputedParameterValues(parameters) protoJob.Type = &proto.AcquiredJob_TemplateDryRun_{ TemplateDryRun: &proto.AcquiredJob_TemplateDryRun{ ParameterValues: protoParameters, @@ -371,8 +377,8 @@ func (server *Server) UpdateJob(ctx context.Context, request *proto.UpdateJobReq } } - if len(request.ParameterSchemas) > 0 { - for index, protoParameter := range request.ParameterSchemas { + if len(request.DeprecatedParameterSchemas) > 0 { + for index, protoParameter := range request.DeprecatedParameterSchemas { validationTypeSystem, err := convertValidationTypeSystem(protoParameter.ValidationTypeSystem) if err != nil { return nil, xerrors.Errorf("convert validation type system for %q: %w", protoParameter.Name, err) @@ -393,7 +399,7 @@ func (server *Server) UpdateJob(ctx context.Context, request *proto.UpdateJobReq DefaultSourceScheme: database.ParameterSourceSchemeNone, DefaultDestinationScheme: database.ParameterDestinationSchemeNone, - AllowOverrideDestination: protoParameter.AllowOverrideDestination, + AllowOverrideDestination: false, AllowOverrideSource: protoParameter.AllowOverrideSource, Index: int32(index), @@ -408,15 +414,7 @@ func (server *Server) UpdateJob(ctx context.Context, request *proto.UpdateJobReq parameterSchema.DefaultSourceScheme = parameterSourceScheme parameterSchema.DefaultSourceValue = protoParameter.DefaultSource.Value } - - // It's possible a parameter doesn't define a default destination! - if protoParameter.DefaultDestination != nil { - parameterDestinationScheme, err := convertParameterDestinationScheme(protoParameter.DefaultDestination.Scheme) - if err != nil { - return nil, xerrors.Errorf("convert parameter destination scheme: %w", err) - } - parameterSchema.DefaultDestinationScheme = parameterDestinationScheme - } + parameterSchema.DefaultDestinationScheme = database.ParameterDestinationSchemeProvisionerVariable _, err = server.Database.InsertParameterSchema(ctx, parameterSchema) if err != nil { @@ -443,16 +441,12 @@ func (server *Server) UpdateJob(ctx context.Context, request *proto.UpdateJobReq // Convert parameters to the protobuf type. protoParameters := make([]*sdkproto.ParameterValue, 0, len(parameters)) for _, computedParameter := range parameters { - converted, err := convertComputedParameterValue(computedParameter) - if err != nil { - return nil, xerrors.Errorf("convert parameter: %s", err) - } - protoParameters = append(protoParameters, converted) + protoParameters = append(protoParameters, convertComputedParameterValue(computedParameter)) } return &proto.UpdateJobResponse{ - Canceled: job.CanceledAt.Valid, - ParameterValues: protoParameters, + Canceled: job.CanceledAt.Valid, + DeprecatedParameterValues: protoParameters, }, nil } @@ -595,6 +589,12 @@ func (server *Server) CompleteJob(ctx context.Context, completed *proto.Complete switch jobType := completed.Type.(type) { case *proto.CompletedJob_TemplateImport_: + var input TemplateVersionImportJob + err = json.Unmarshal(job.Input, &input) + if err != nil { + return nil, xerrors.Errorf("unmarshal job data: %w", err) + } + for transition, resources := range map[database.WorkspaceTransition][]*sdkproto.Resource{ database.WorkspaceTransitionStart: jobType.TemplateImport.StartResources, database.WorkspaceTransitionStop: jobType.TemplateImport.StopResources, @@ -613,6 +613,33 @@ func (server *Server) CompleteJob(ctx context.Context, completed *proto.Complete } } + for _, parameter := range jobType.TemplateImport.Parameters { + server.Logger.Info(ctx, "inserting template import job parameter", + slog.F("job_id", job.ID.String()), + slog.F("parameter_name", parameter.Name), + ) + options, err := json.Marshal(parameter.Options) + if err != nil { + return nil, xerrors.Errorf("marshal parameter options: %w", err) + } + _, err = server.Database.InsertTemplateVersionParameter(ctx, database.InsertTemplateVersionParameterParams{ + TemplateVersionID: input.TemplateVersionID, + Name: parameter.Name, + Description: parameter.Description, + Type: parameter.Type, + Mutable: parameter.Mutable, + DefaultValue: parameter.DefaultValue, + Icon: parameter.Icon, + Options: options, + ValidationRegex: parameter.ValidationRegex, + ValidationMin: parameter.ValidationMin, + ValidationMax: parameter.ValidationMax, + }) + if err != nil { + return nil, xerrors.Errorf("insert parameter: %w", err) + } + } + err = server.Database.UpdateProvisionerJobWithCompleteByID(ctx, database.UpdateProvisionerJobWithCompleteByIDParams{ ID: jobID, UpdatedAt: database.Now(), @@ -984,37 +1011,26 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid. return nil } -func convertValidationTypeSystem(typeSystem sdkproto.ParameterSchema_TypeSystem) (database.ParameterTypeSystem, error) { +func convertValidationTypeSystem(typeSystem sdkproto.DeprecatedParameterSchema_TypeSystem) (database.ParameterTypeSystem, error) { switch typeSystem { - case sdkproto.ParameterSchema_None: + case sdkproto.DeprecatedParameterSchema_None: return database.ParameterTypeSystemNone, nil - case sdkproto.ParameterSchema_HCL: + case sdkproto.DeprecatedParameterSchema_HCL: return database.ParameterTypeSystemHCL, nil default: return database.ParameterTypeSystem(""), xerrors.Errorf("unknown type system: %d", typeSystem) } } -func convertParameterSourceScheme(sourceScheme sdkproto.ParameterSource_Scheme) (database.ParameterSourceScheme, error) { +func convertParameterSourceScheme(sourceScheme sdkproto.DeprecatedParameterSource_Scheme) (database.ParameterSourceScheme, error) { switch sourceScheme { - case sdkproto.ParameterSource_DATA: + case sdkproto.DeprecatedParameterSource_DATA: return database.ParameterSourceSchemeData, nil default: return database.ParameterSourceScheme(""), xerrors.Errorf("unknown parameter source scheme: %d", sourceScheme) } } -func convertParameterDestinationScheme(destinationScheme sdkproto.ParameterDestination_Scheme) (database.ParameterDestinationScheme, error) { - switch destinationScheme { - case sdkproto.ParameterDestination_ENVIRONMENT_VARIABLE: - return database.ParameterDestinationSchemeEnvironmentVariable, nil - case sdkproto.ParameterDestination_PROVISIONER_VARIABLE: - return database.ParameterDestinationSchemeProvisionerVariable, nil - default: - return database.ParameterDestinationScheme(""), xerrors.Errorf("unknown parameter destination scheme: %d", destinationScheme) - } -} - func convertLogLevel(logLevel sdkproto.LogLevel) (database.LogLevel, error) { switch logLevel { case sdkproto.LogLevel_TRACE: @@ -1043,35 +1059,19 @@ func convertLogSource(logSource proto.LogSource) (database.LogSource, error) { } } -func convertComputedParameterValues(parameters []parameter.ComputedValue) ([]*sdkproto.ParameterValue, error) { +func convertComputedParameterValues(parameters []parameter.ComputedValue) []*sdkproto.ParameterValue { protoParameters := make([]*sdkproto.ParameterValue, len(parameters)) for i, computedParameter := range parameters { - converted, err := convertComputedParameterValue(computedParameter) - if err != nil { - return nil, xerrors.Errorf("convert parameter: %w", err) - } - protoParameters[i] = converted + protoParameters[i] = convertComputedParameterValue(computedParameter) } - - return protoParameters, nil + return protoParameters } -func convertComputedParameterValue(param parameter.ComputedValue) (*sdkproto.ParameterValue, error) { - var scheme sdkproto.ParameterDestination_Scheme - switch param.DestinationScheme { - case database.ParameterDestinationSchemeEnvironmentVariable: - scheme = sdkproto.ParameterDestination_ENVIRONMENT_VARIABLE - case database.ParameterDestinationSchemeProvisionerVariable: - scheme = sdkproto.ParameterDestination_PROVISIONER_VARIABLE - default: - return nil, xerrors.Errorf("unrecognized destination scheme: %q", param.DestinationScheme) - } - +func convertComputedParameterValue(param parameter.ComputedValue) *sdkproto.ParameterValue { return &sdkproto.ParameterValue{ - DestinationScheme: scheme, - Name: param.Name, - Value: param.SourceValue, - }, nil + Name: param.Name, + Value: param.SourceValue, + } } func convertWorkspaceTransition(transition database.WorkspaceTransition) (sdkproto.WorkspaceTransition, error) { @@ -1100,6 +1100,10 @@ func auditActionFromTransition(transition database.WorkspaceTransition) database } } +type TemplateVersionImportJob struct { + TemplateVersionID uuid.UUID `json:"template_version_id"` +} + // WorkspaceProvisionJob is the payload for the "workspace_provision" job type. type WorkspaceProvisionJob struct { WorkspaceBuildID uuid.UUID `json:"workspace_build_id"` diff --git a/coderd/templateversions.go b/coderd/templateversions.go index 2952baede44e8..288f2eebe2541 100644 --- a/coderd/templateversions.go +++ b/coderd/templateversions.go @@ -23,6 +23,8 @@ import ( "github.com/coder/coder/coderd/provisionerdserver" "github.com/coder/coder/coderd/rbac" "github.com/coder/coder/codersdk" + + sdkproto "github.com/coder/coder/provisionersdk/proto" ) func (api *API) templateVersion(rw http.ResponseWriter, r *http.Request) { @@ -113,7 +115,7 @@ func (api *API) patchCancelTemplateVersion(rw http.ResponseWriter, r *http.Reque }) } -func (api *API) templateVersionSchema(rw http.ResponseWriter, r *http.Request) { +func (api *API) deprecatedTemplateVersionSchema(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() var ( templateVersion = httpmw.TemplateVersionParam(r) @@ -150,7 +152,7 @@ func (api *API) templateVersionSchema(rw http.ResponseWriter, r *http.Request) { }) return } - apiSchemas := make([]codersdk.ParameterSchema, 0) + apiSchemas := make([]codersdk.DeprecatedParameterSchema, 0) for _, schema := range schemas { apiSchema, err := convertParameterSchema(schema) if err != nil { @@ -165,7 +167,7 @@ func (api *API) templateVersionSchema(rw http.ResponseWriter, r *http.Request) { httpapi.Write(ctx, rw, http.StatusOK, apiSchemas) } -func (api *API) templateVersionParameters(rw http.ResponseWriter, r *http.Request) { +func (api *API) deprecatedTemplateVersionParameters(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() var ( templateVersion = httpmw.TemplateVersionParam(r) @@ -210,6 +212,51 @@ func (api *API) templateVersionParameters(rw http.ResponseWriter, r *http.Reques httpapi.Write(ctx, rw, http.StatusOK, values) } +func (api *API) templateVersionParameters(rw http.ResponseWriter, r *http.Request) { + ctx := r.Context() + templateVersion := httpmw.TemplateVersionParam(r) + template := httpmw.TemplateParam(r) + if !api.Authorize(r, rbac.ActionRead, templateVersion.RBACObject(template)) { + httpapi.ResourceNotFound(rw) + return + } + job, err := api.Database.GetProvisionerJobByID(ctx, templateVersion.JobID) + if err != nil { + httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{ + Message: "Internal error fetching provisioner job.", + Detail: err.Error(), + }) + return + } + if !job.CompletedAt.Valid { + httpapi.Write(ctx, rw, http.StatusPreconditionFailed, codersdk.Response{ + Message: "Job hasn't completed!", + }) + return + } + dbParameters, err := api.Database.GetTemplateVersionParameters(ctx, templateVersion.ID) + if err != nil { + httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{ + Message: "Internal error fetching template version parameters.", + Detail: err.Error(), + }) + return + } + parameters := make([]codersdk.TemplateVersionParameter, 0) + for _, dbParameter := range dbParameters { + parameter, err := convertTemplateVersionParameter(dbParameter) + if err != nil { + httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{ + Message: "Internal error converting template version parameter.", + Detail: err.Error(), + }) + return + } + parameters = append(parameters, parameter) + } + httpapi.Write(ctx, rw, http.StatusOK, parameters) +} + func (api *API) postTemplateVersionDryRun(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() var ( @@ -826,11 +873,11 @@ func (api *API) postTemplateVersionsByOrganization(rw http.ResponseWriter, r *ht return xerrors.Errorf("copy parameter scope is %q, must be %q", copy.Scope, database.ParameterScopeImportJob) } // Add the copied param to the list to process - req.ParameterValues = append(req.ParameterValues, codersdk.CreateParameterRequest{ + req.ParameterValues = append(req.ParameterValues, codersdk.DeprecatedCreateParameterRequest{ Name: copy.Name, SourceValue: copy.SourceValue, - SourceScheme: codersdk.ParameterSourceScheme(copy.SourceScheme), - DestinationScheme: codersdk.ParameterDestinationScheme(copy.DestinationScheme), + SourceScheme: codersdk.DeprecatedParameterSourceScheme(copy.SourceScheme), + DestinationScheme: codersdk.DeprecatedParameterDestinationScheme(copy.DestinationScheme), }) } } @@ -856,6 +903,13 @@ func (api *API) postTemplateVersionsByOrganization(rw http.ResponseWriter, r *ht } } + templateVersionID := uuid.New() + jobInput, err := json.Marshal(provisionerdserver.TemplateVersionImportJob{ + TemplateVersionID: templateVersionID, + }) + if err != nil { + return xerrors.Errorf("marshal job input: %w", err) + } provisionerJob, err = tx.InsertProvisionerJob(ctx, database.InsertProvisionerJobParams{ ID: jobID, CreatedAt: database.Now(), @@ -866,7 +920,7 @@ func (api *API) postTemplateVersionsByOrganization(rw http.ResponseWriter, r *ht StorageMethod: database.ProvisionerStorageMethodFile, FileID: file.ID, Type: database.ProvisionerJobTypeTemplateVersionImport, - Input: []byte{'{', '}'}, + Input: jobInput, Tags: tags, }) if err != nil { @@ -886,7 +940,7 @@ func (api *API) postTemplateVersionsByOrganization(rw http.ResponseWriter, r *ht } templateVersion, err = tx.InsertTemplateVersion(ctx, database.InsertTemplateVersionParams{ - ID: uuid.New(), + ID: templateVersionID, TemplateID: templateID, OrganizationID: organization.ID, CreatedAt: database.Now(), @@ -1000,6 +1054,35 @@ func convertTemplateVersion(version database.TemplateVersion, job codersdk.Provi } } +func convertTemplateVersionParameter(param database.TemplateVersionParameter) (codersdk.TemplateVersionParameter, error) { + var protoOptions []*sdkproto.ParameterOption + err := json.Unmarshal(param.Options, &protoOptions) + if err != nil { + return codersdk.TemplateVersionParameter{}, err + } + options := make([]codersdk.TemplateVersionParameterOption, 0) + for _, option := range protoOptions { + options = append(options, codersdk.TemplateVersionParameterOption{ + Name: option.Name, + Description: option.Description, + Value: option.Value, + Icon: option.Icon, + }) + } + return codersdk.TemplateVersionParameter{ + Name: param.Name, + Description: param.Description, + Type: param.Type, + Mutable: param.Mutable, + DefaultValue: param.DefaultValue, + Icon: param.Icon, + Options: options, + ValidationRegex: param.ValidationRegex, + ValidationMin: param.ValidationMin, + ValidationMax: param.ValidationMax, + }, nil +} + func watchTemplateChannel(id uuid.UUID) string { return fmt.Sprintf("template:%s", id) } diff --git a/coderd/templateversions_test.go b/coderd/templateversions_test.go index 65c1ec31d06e6..34d3115c0b02d 100644 --- a/coderd/templateversions_test.go +++ b/coderd/templateversions_test.go @@ -92,7 +92,7 @@ func TestPostTemplateVersionsByOrganization(t *testing.T) { require.Equal(t, http.StatusNotFound, apiErr.StatusCode()) }) - t.Run("WithParameters", func(t *testing.T) { + t.Run("WithDeprecatedParameters", func(t *testing.T) { t.Parallel() auditor := audit.NewMock() client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true, Auditor: auditor}) @@ -114,11 +114,11 @@ func TestPostTemplateVersionsByOrganization(t *testing.T) { StorageMethod: codersdk.ProvisionerStorageMethodFile, FileID: file.ID, Provisioner: codersdk.ProvisionerTypeEcho, - ParameterValues: []codersdk.CreateParameterRequest{{ + ParameterValues: []codersdk.DeprecatedCreateParameterRequest{{ Name: "example", SourceValue: "value", - SourceScheme: codersdk.ParameterSourceSchemeData, - DestinationScheme: codersdk.ParameterDestinationSchemeProvisionerVariable, + SourceScheme: codersdk.DeprecatedParameterSourceSchemeData, + DestinationScheme: codersdk.DeprecatedParameterDestinationSchemeProvisionerVariable, }}, }) require.NoError(t, err) @@ -225,7 +225,7 @@ func TestPatchCancelTemplateVersion(t *testing.T) { }) } -func TestTemplateVersionSchema(t *testing.T) { +func TestDeprecatedTemplateVersionSchema(t *testing.T) { t.Parallel() t.Run("ListRunning", func(t *testing.T) { t.Parallel() @@ -236,7 +236,7 @@ func TestTemplateVersionSchema(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) defer cancel() - _, err := client.TemplateVersionSchema(ctx, version.ID) + _, err := client.DeprecatedTemplateVersionSchema(ctx, version.ID) var apiErr *codersdk.Error require.ErrorAs(t, err, &apiErr) require.Equal(t, http.StatusPreconditionFailed, apiErr.StatusCode()) @@ -246,14 +246,11 @@ func TestTemplateVersionSchema(t *testing.T) { client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: []*proto.Parse_Response{{ - Type: &proto.Parse_Response_Complete{ - Complete: &proto.Parse_Complete{ - ParameterSchemas: []*proto.ParameterSchema{{ + Parse: []*proto.DeprecatedParse_Response{{ + Type: &proto.DeprecatedParse_Response_Complete{ + Complete: &proto.DeprecatedParse_Complete{ + ParameterSchemas: []*proto.DeprecatedParameterSchema{{ Name: "example", - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, }}, }, }, @@ -265,7 +262,7 @@ func TestTemplateVersionSchema(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) defer cancel() - schemas, err := client.TemplateVersionSchema(ctx, version.ID) + schemas, err := client.DeprecatedTemplateVersionSchema(ctx, version.ID) require.NoError(t, err) require.NotNil(t, schemas) require.Len(t, schemas, 1) @@ -275,17 +272,14 @@ func TestTemplateVersionSchema(t *testing.T) { client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: []*proto.Parse_Response{{ - Type: &proto.Parse_Response_Complete{ - Complete: &proto.Parse_Complete{ - ParameterSchemas: []*proto.ParameterSchema{{ + Parse: []*proto.DeprecatedParse_Response{{ + Type: &proto.DeprecatedParse_Response_Complete{ + Complete: &proto.DeprecatedParse_Complete{ + ParameterSchemas: []*proto.DeprecatedParameterSchema{{ Name: "example", - ValidationTypeSystem: proto.ParameterSchema_HCL, + ValidationTypeSystem: proto.DeprecatedParameterSchema_HCL, ValidationValueType: "string", ValidationCondition: `contains(["first", "second"], var.example)`, - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, }}, }, }, @@ -297,7 +291,7 @@ func TestTemplateVersionSchema(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) defer cancel() - schemas, err := client.TemplateVersionSchema(ctx, version.ID) + schemas, err := client.DeprecatedTemplateVersionSchema(ctx, version.ID) require.NoError(t, err) require.NotNil(t, schemas) require.Len(t, schemas, 1) @@ -326,31 +320,71 @@ func TestTemplateVersionParameters(t *testing.T) { client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: []*proto.Parse_Response{{ - Type: &proto.Parse_Response_Complete{ - Complete: &proto.Parse_Complete{ - ParameterSchemas: []*proto.ParameterSchema{ + Parse: echo.ParseComplete, + ProvisionPlan: []*proto.Provision_Response{{ + Type: &proto.Provision_Response_Complete{ + Complete: &proto.Provision_Complete{ + Parameters: []*proto.Parameter{{ + Name: "Something", + Type: "string", + }}, + }, + }, + }}, + }) + coderdtest.AwaitTemplateVersionJob(t, client, version.ID) + + ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) + defer cancel() + + params, err := client.TemplateVersionParameters(ctx, version.ID) + require.NoError(t, err) + require.NotNil(t, params) + require.Len(t, params, 1) + require.Equal(t, "Something", params[0].Name) + }) +} + +func TestDeprecatedTemplateVersionParameters(t *testing.T) { + t.Parallel() + t.Run("ListRunning", func(t *testing.T) { + t.Parallel() + client := coderdtest.New(t, nil) + user := coderdtest.CreateFirstUser(t, client) + version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, nil) + + ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) + defer cancel() + + _, err := client.DeprecatedTemplateVersionParameters(ctx, version.ID) + var apiErr *codersdk.Error + require.ErrorAs(t, err, &apiErr) + require.Equal(t, http.StatusPreconditionFailed, apiErr.StatusCode()) + }) + t.Run("List", func(t *testing.T) { + t.Parallel() + client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) + user := coderdtest.CreateFirstUser(t, client) + version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ + Parse: []*proto.DeprecatedParse_Response{{ + Type: &proto.DeprecatedParse_Response_Complete{ + Complete: &proto.DeprecatedParse_Complete{ + ParameterSchemas: []*proto.DeprecatedParameterSchema{ { Name: "example", RedisplayValue: true, - DefaultSource: &proto.ParameterSource{ - Scheme: proto.ParameterSource_DATA, + DefaultSource: &proto.DeprecatedParameterSource{ + Scheme: proto.DeprecatedParameterSource_DATA, Value: "hello", }, - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, }, { Name: "abcd", RedisplayValue: true, - DefaultSource: &proto.ParameterSource{ - Scheme: proto.ParameterSource_DATA, + DefaultSource: &proto.DeprecatedParameterSource{ + Scheme: proto.DeprecatedParameterSource_DATA, Value: "world", }, - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, }, }, }, @@ -363,7 +397,7 @@ func TestTemplateVersionParameters(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) defer cancel() - params, err := client.TemplateVersionParameters(ctx, version.ID) + params, err := client.DeprecatedTemplateVersionParameters(ctx, version.ID) require.NoError(t, err) require.NotNil(t, params) require.Len(t, params, 2) @@ -626,7 +660,7 @@ func TestTemplateVersionDryRun(t *testing.T) { // Create template version dry-run job, err := client.CreateTemplateVersionDryRun(ctx, version.ID, codersdk.CreateTemplateVersionDryRunRequest{ - ParameterValues: []codersdk.CreateParameterRequest{}, + ParameterValues: []codersdk.DeprecatedCreateParameterRequest{}, }) require.NoError(t, err) @@ -684,7 +718,7 @@ func TestTemplateVersionDryRun(t *testing.T) { defer cancel() _, err := client.CreateTemplateVersionDryRun(ctx, version.ID, codersdk.CreateTemplateVersionDryRunRequest{ - ParameterValues: []codersdk.CreateParameterRequest{}, + ParameterValues: []codersdk.DeprecatedCreateParameterRequest{}, }) var apiErr *codersdk.Error require.ErrorAs(t, err, &apiErr) @@ -727,7 +761,7 @@ func TestTemplateVersionDryRun(t *testing.T) { // Create the dry-run job, err := client.CreateTemplateVersionDryRun(ctx, version.ID, codersdk.CreateTemplateVersionDryRunRequest{ - ParameterValues: []codersdk.CreateParameterRequest{}, + ParameterValues: []codersdk.DeprecatedCreateParameterRequest{}, }) require.NoError(t, err) require.Equal(t, codersdk.ProvisionerJobPending, job.Status) @@ -750,7 +784,7 @@ func TestTemplateVersionDryRun(t *testing.T) { // Create the dry-run job, err := client.CreateTemplateVersionDryRun(ctx, version.ID, codersdk.CreateTemplateVersionDryRunRequest{ - ParameterValues: []codersdk.CreateParameterRequest{}, + ParameterValues: []codersdk.DeprecatedCreateParameterRequest{}, }) require.NoError(t, err) @@ -802,7 +836,7 @@ func TestTemplateVersionDryRun(t *testing.T) { // Create the dry-run job, err := client.CreateTemplateVersionDryRun(ctx, version.ID, codersdk.CreateTemplateVersionDryRunRequest{ - ParameterValues: []codersdk.CreateParameterRequest{}, + ParameterValues: []codersdk.DeprecatedCreateParameterRequest{}, }) require.NoError(t, err) diff --git a/coderd/users_test.go b/coderd/users_test.go index 1211c35ac1f95..b202745624242 100644 --- a/coderd/users_test.go +++ b/coderd/users_test.go @@ -142,7 +142,7 @@ func TestFirstUser(t *testing.T) { for _, template := range templates { // Check template parameters. - templateParams, err := client.Parameters(ctx, codersdk.ParameterTemplate, template.ID) + templateParams, err := client.DeprecatedParameters(ctx, codersdk.DeprecatedParameterTemplate, template.ID) require.NoErrorf(t, err, "get template parameters for %q", template.Name) // Ensure all template parameters are present. @@ -171,7 +171,7 @@ func TestFirstUser(t *testing.T) { require.NoErrorf(t, err, "get template version for %q", template.Name) // Compare job parameters to template parameters. - jobParams, err := client.Parameters(ctx, codersdk.ParameterImportJob, templateVersion.Job.ID) + jobParams, err := client.DeprecatedParameters(ctx, codersdk.DeprecatedParameterImportJob, templateVersion.Job.ID) require.NoErrorf(t, err, "get template import job parameters for %q", template.Name) for _, v := range jobParams { if _, ok := expectedParams[v.Name]; !ok { diff --git a/coderd/workspacebuilds.go b/coderd/workspacebuilds.go index 5f944851096c9..c7411401229b0 100644 --- a/coderd/workspacebuilds.go +++ b/coderd/workspacebuilds.go @@ -321,6 +321,7 @@ func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) { return } + var parameters []codersdk.WorkspaceBuildParameter var state []byte // If custom state, deny request since user could be corrupting or leaking // cloud state. @@ -333,6 +334,9 @@ func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) { } state = createBuild.ProvisionerState } + if createBuild.Parameters != nil { + parameters = createBuild.Parameters + } if createBuild.Orphan { if createBuild.Transition != codersdk.WorkspaceTransitionDelete { @@ -405,6 +409,23 @@ func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) { if state == nil { state = priorHistory.ProvisionerState } + if parameters == nil { + buildParameters, err := api.Database.GetWorkspaceBuildParameters(ctx, priorHistory.ID) + if err != nil { + httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{ + Message: "Internal error fetching prior workspace build parameters.", + Detail: err.Error(), + }) + return + } + parameters = make([]codersdk.WorkspaceBuildParameter, 0, len(buildParameters)) + for _, param := range buildParameters { + parameters = append(parameters, codersdk.WorkspaceBuildParameter{ + Name: param.Name, + Value: param.Value, + }) + } + } var workspaceBuild database.WorkspaceBuild var provisionerJob database.ProvisionerJob @@ -421,7 +442,7 @@ func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) { // Write/Update any new params now := database.Now() - for _, param := range createBuild.ParameterValues { + for _, param := range createBuild.DeprecatedParameterValues { for _, exists := range existing { // If the param exists, delete the old param before inserting the new one if exists.Name == param.Name { @@ -489,6 +510,21 @@ func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) { return xerrors.Errorf("insert workspace build: %w", err) } + names := make([]string, 0, len(parameters)) + values := make([]string, 0, len(parameters)) + for _, param := range parameters { + names = append(names, param.Name) + values = append(values, param.Value) + } + err = db.InsertWorkspaceBuildParameters(ctx, database.InsertWorkspaceBuildParametersParams{ + WorkspaceBuildID: workspaceBuildID, + Name: names, + Value: values, + }) + if err != nil { + return xerrors.Errorf("insert workspace build parameter: %w", err) + } + return nil }, nil) if err != nil { diff --git a/coderd/workspaces.go b/coderd/workspaces.go index d46b0d7d2cfab..966abd0e05cbd 100644 --- a/coderd/workspaces.go +++ b/coderd/workspaces.go @@ -398,7 +398,7 @@ func (api *API) postWorkspacesByOrganization(rw http.ResponseWriter, r *http.Req if err != nil { return xerrors.Errorf("insert workspace: %w", err) } - for _, parameterValue := range createWorkspace.ParameterValues { + for _, parameterValue := range createWorkspace.DeprecatedParameterValues { // If the value is empty, we don't want to save it on database so // Terraform can use the default value if parameterValue.SourceValue == "" { @@ -459,6 +459,22 @@ func (api *API) postWorkspacesByOrganization(rw http.ResponseWriter, r *http.Req if err != nil { return xerrors.Errorf("insert workspace build: %w", err) } + + parameterNames := make([]string, 0, len(createWorkspace.Parameters)) + parameterValues := make([]string, 0, len(createWorkspace.Parameters)) + for _, param := range createWorkspace.Parameters { + parameterNames = append(parameterNames, param.Name) + parameterValues = append(parameterValues, param.Value) + } + err = db.InsertWorkspaceBuildParameters(ctx, database.InsertWorkspaceBuildParametersParams{ + WorkspaceBuildID: workspaceBuildID, + Name: parameterNames, + Value: parameterValues, + }) + if err != nil { + return xerrors.Errorf("insert workspace build parameter: %w", err) + } + return nil }, nil) if err != nil { diff --git a/codersdk/organizations.go b/codersdk/organizations.go index c61161abd7dcf..ba24abeaf552c 100644 --- a/codersdk/organizations.go +++ b/codersdk/organizations.go @@ -44,7 +44,7 @@ type CreateTemplateVersionRequest struct { // ParameterValues allows for additional parameters to be provided // during the dry-run provision stage. - ParameterValues []CreateParameterRequest `json:"parameter_values,omitempty"` + ParameterValues []DeprecatedCreateParameterRequest `json:"parameter_values,omitempty"` } // CreateTemplateRequest provides options when creating a template. @@ -66,8 +66,8 @@ type CreateTemplateRequest struct { // This is required on creation to enable a user-flow of validating a // template works. There is no reason the data-model cannot support empty // templates, but it doesn't make sense for users. - VersionID uuid.UUID `json:"template_version_id" validate:"required"` - ParameterValues []CreateParameterRequest `json:"parameter_values,omitempty"` + VersionID uuid.UUID `json:"template_version_id" validate:"required"` + ParameterValues []DeprecatedCreateParameterRequest `json:"parameter_values,omitempty"` // DefaultTTLMillis allows optionally specifying the default TTL // for all workspaces created from this template. @@ -84,9 +84,10 @@ type CreateWorkspaceRequest struct { Name string `json:"name" validate:"workspace_name,required"` AutostartSchedule *string `json:"autostart_schedule"` TTLMillis *int64 `json:"ttl_ms,omitempty"` - // ParameterValues allows for additional parameters to be provided + // DeprecatedParameterValues allows for additional parameters to be provided // during the initial provision. - ParameterValues []CreateParameterRequest `json:"parameter_values,omitempty"` + DeprecatedParameterValues []DeprecatedCreateParameterRequest `json:"deprecated_parameter_values,omitempty"` + Parameters []WorkspaceBuildParameter `json:"parameters"` } func (c *Client) Organization(ctx context.Context, id uuid.UUID) (Organization, error) { diff --git a/codersdk/parameters.go b/codersdk/parameters.go index 20184622ddd34..e2761c0757760 100644 --- a/codersdk/parameters.go +++ b/codersdk/parameters.go @@ -11,80 +11,80 @@ import ( "github.com/google/uuid" ) -type ParameterScope string +type DeprecatedParameterScope string const ( - ParameterTemplate ParameterScope = "template" - ParameterWorkspace ParameterScope = "workspace" - ParameterImportJob ParameterScope = "import_job" + DeprecatedParameterTemplate DeprecatedParameterScope = "template" + DeprecatedParameterWorkspace DeprecatedParameterScope = "workspace" + DeprecatedParameterImportJob DeprecatedParameterScope = "import_job" ) -type ParameterSourceScheme string +type DeprecatedParameterSourceScheme string const ( - ParameterSourceSchemeNone ParameterSourceScheme = "none" - ParameterSourceSchemeData ParameterSourceScheme = "data" + DeprecatedParameterSourceSchemeNone DeprecatedParameterSourceScheme = "none" + DeprecatedParameterSourceSchemeData DeprecatedParameterSourceScheme = "data" ) -type ParameterDestinationScheme string +type DeprecatedParameterDestinationScheme string const ( - ParameterDestinationSchemeNone ParameterDestinationScheme = "none" - ParameterDestinationSchemeEnvironmentVariable ParameterDestinationScheme = "environment_variable" - ParameterDestinationSchemeProvisionerVariable ParameterDestinationScheme = "provisioner_variable" + DeprecatedParameterDestinationSchemeNone DeprecatedParameterDestinationScheme = "none" + DeprecatedParameterDestinationSchemeEnvironmentVariable DeprecatedParameterDestinationScheme = "environment_variable" + DeprecatedParameterDestinationSchemeProvisionerVariable DeprecatedParameterDestinationScheme = "provisioner_variable" ) -type ParameterTypeSystem string +type DeprecatedParameterTypeSystem string const ( - ParameterTypeSystemNone ParameterTypeSystem = "none" - ParameterTypeSystemHCL ParameterTypeSystem = "hcl" + DeprecatedParameterTypeSystemNone DeprecatedParameterTypeSystem = "none" + DeprecatedParameterTypeSystemHCL DeprecatedParameterTypeSystem = "hcl" ) -type ComputedParameter struct { - Parameter +type DeprecatedComputedParameter struct { + DeprecatedParameter SourceValue string `json:"source_value"` SchemaID uuid.UUID `json:"schema_id"` DefaultSourceValue bool `json:"default_source_value"` } -// Parameter represents a set value for the scope. -type Parameter struct { - ID uuid.UUID `json:"id" table:"id"` - Scope ParameterScope `json:"scope" table:"scope"` - ScopeID uuid.UUID `json:"scope_id" table:"scope id"` - Name string `json:"name" table:"name"` - SourceScheme ParameterSourceScheme `json:"source_scheme" table:"source scheme" validate:"ne=none"` - DestinationScheme ParameterDestinationScheme `json:"destination_scheme" table:"destination scheme" validate:"ne=none"` - CreatedAt time.Time `json:"created_at" table:"created at"` - UpdatedAt time.Time `json:"updated_at" table:"updated at"` +// DeprecatedParameter represents a set value for the scope. +type DeprecatedParameter struct { + ID uuid.UUID `json:"id" table:"id"` + Scope DeprecatedParameterScope `json:"scope" table:"scope"` + ScopeID uuid.UUID `json:"scope_id" table:"scope id"` + Name string `json:"name" table:"name"` + SourceScheme DeprecatedParameterSourceScheme `json:"source_scheme" table:"source scheme" validate:"ne=none"` + DestinationScheme DeprecatedParameterDestinationScheme `json:"destination_scheme" table:"destination scheme" validate:"ne=none"` + CreatedAt time.Time `json:"created_at" table:"created at"` + UpdatedAt time.Time `json:"updated_at" table:"updated at"` } -type ParameterSchema struct { - ID uuid.UUID `json:"id"` - CreatedAt time.Time `json:"created_at"` - JobID uuid.UUID `json:"job_id"` - Name string `json:"name"` - Description string `json:"description"` - DefaultSourceScheme ParameterSourceScheme `json:"default_source_scheme"` - DefaultSourceValue string `json:"default_source_value"` - AllowOverrideSource bool `json:"allow_override_source"` - DefaultDestinationScheme ParameterDestinationScheme `json:"default_destination_scheme"` - AllowOverrideDestination bool `json:"allow_override_destination"` - DefaultRefresh string `json:"default_refresh"` - RedisplayValue bool `json:"redisplay_value"` - ValidationError string `json:"validation_error"` - ValidationCondition string `json:"validation_condition"` - ValidationTypeSystem string `json:"validation_type_system"` - ValidationValueType string `json:"validation_value_type"` +type DeprecatedParameterSchema struct { + ID uuid.UUID `json:"id"` + CreatedAt time.Time `json:"created_at"` + JobID uuid.UUID `json:"job_id"` + Name string `json:"name"` + Description string `json:"description"` + DefaultSourceScheme DeprecatedParameterSourceScheme `json:"default_source_scheme"` + DefaultSourceValue string `json:"default_source_value"` + AllowOverrideSource bool `json:"allow_override_source"` + DefaultDestinationScheme DeprecatedParameterDestinationScheme `json:"default_destination_scheme"` + AllowOverrideDestination bool `json:"allow_override_destination"` + DefaultRefresh string `json:"default_refresh"` + RedisplayValue bool `json:"redisplay_value"` + ValidationError string `json:"validation_error"` + ValidationCondition string `json:"validation_condition"` + ValidationTypeSystem string `json:"validation_type_system"` + ValidationValueType string `json:"validation_value_type"` // This is a special array of items provided if the validation condition // explicitly states the value must be one of a set. ValidationContains []string `json:"validation_contains,omitempty"` } -// CreateParameterRequest is used to create a new parameter value for a scope. -type CreateParameterRequest struct { +// DeprecatedCreateParameterRequest is used to create a new parameter value for a scope. +type DeprecatedCreateParameterRequest struct { // CloneID allows copying the value of another parameter. // The other param must be related to the same template_id for this to // succeed. @@ -92,29 +92,29 @@ type CreateParameterRequest struct { // from the other parameter. CloneID uuid.UUID `json:"copy_from_parameter,omitempty" validate:""` - Name string `json:"name" validate:"required"` - SourceValue string `json:"source_value" validate:"required"` - SourceScheme ParameterSourceScheme `json:"source_scheme" validate:"oneof=data,required"` - DestinationScheme ParameterDestinationScheme `json:"destination_scheme" validate:"oneof=environment_variable provisioner_variable,required"` + Name string `json:"name" validate:"required"` + SourceValue string `json:"source_value" validate:"required"` + SourceScheme DeprecatedParameterSourceScheme `json:"source_scheme" validate:"oneof=data,required"` + DestinationScheme DeprecatedParameterDestinationScheme `json:"destination_scheme" validate:"oneof=environment_variable provisioner_variable,required"` } -func (c *Client) CreateParameter(ctx context.Context, scope ParameterScope, id uuid.UUID, req CreateParameterRequest) (Parameter, error) { - res, err := c.Request(ctx, http.MethodPost, fmt.Sprintf("/api/v2/parameters/%s/%s", scope, id.String()), req) +func (c *Client) DeprecatedCreateParameter(ctx context.Context, scope DeprecatedParameterScope, id uuid.UUID, req DeprecatedCreateParameterRequest) (DeprecatedParameter, error) { + res, err := c.Request(ctx, http.MethodPost, fmt.Sprintf("/api/v2/deprecated-parameters/%s/%s", scope, id.String()), req) if err != nil { - return Parameter{}, err + return DeprecatedParameter{}, err } defer res.Body.Close() if res.StatusCode != http.StatusCreated { - return Parameter{}, readBodyAsError(res) + return DeprecatedParameter{}, readBodyAsError(res) } - var param Parameter + var param DeprecatedParameter return param, json.NewDecoder(res.Body).Decode(¶m) } -func (c *Client) DeleteParameter(ctx context.Context, scope ParameterScope, id uuid.UUID, name string) error { - res, err := c.Request(ctx, http.MethodDelete, fmt.Sprintf("/api/v2/parameters/%s/%s/%s", scope, id.String(), name), nil) +func (c *Client) DeprecatedDeleteParameter(ctx context.Context, scope DeprecatedParameterScope, id uuid.UUID, name string) error { + res, err := c.Request(ctx, http.MethodDelete, fmt.Sprintf("/api/v2/deprecated-parameters/%s/%s/%s", scope, id.String(), name), nil) if err != nil { return err } @@ -128,8 +128,8 @@ func (c *Client) DeleteParameter(ctx context.Context, scope ParameterScope, id u return nil } -func (c *Client) Parameters(ctx context.Context, scope ParameterScope, id uuid.UUID) ([]Parameter, error) { - res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/parameters/%s/%s", scope, id.String()), nil) +func (c *Client) DeprecatedParameters(ctx context.Context, scope DeprecatedParameterScope, id uuid.UUID) ([]DeprecatedParameter, error) { + res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/deprecated-parameters/%s/%s", scope, id.String()), nil) if err != nil { return nil, err } @@ -139,6 +139,6 @@ func (c *Client) Parameters(ctx context.Context, scope ParameterScope, id uuid.U return nil, readBodyAsError(res) } - var parameters []Parameter + var parameters []DeprecatedParameter return parameters, json.NewDecoder(res.Body).Decode(¶meters) } diff --git a/codersdk/templateversions.go b/codersdk/templateversions.go index 3273b31b28f86..15320cf39d12d 100644 --- a/codersdk/templateversions.go +++ b/codersdk/templateversions.go @@ -24,6 +24,29 @@ type TemplateVersion struct { CreatedBy User `json:"created_by"` } +// TemplateVersionParameter represents a parameter for a template version. +type TemplateVersionParameter struct { + Name string `json:"name"` + Description string `json:"description"` + Type string `json:"type"` + Mutable bool `json:"mutable"` + DefaultValue string `json:"default_value"` + Icon string `json:"icon"` + Options []TemplateVersionParameterOption `json:"options"` + ValidationError string `json:"validation_error"` + ValidationRegex string `json:"validation_regex"` + ValidationMin int32 `json:"validation_min"` + ValidationMax int32 `json:"validation_max"` +} + +// TemplateVersionParameterOption represents a selectable option for a template parameter. +type TemplateVersionParameterOption struct { + Name string `json:"name"` + Description string `json:"description"` + Value string `json:"value"` + Icon string `json:"icon"` +} + // TemplateVersion returns a template version by ID. func (c *Client) TemplateVersion(ctx context.Context, id uuid.UUID) (TemplateVersion, error) { res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/templateversions/%s", id), nil) @@ -51,9 +74,9 @@ func (c *Client) CancelTemplateVersion(ctx context.Context, version uuid.UUID) e return nil } -// TemplateVersionSchema returns schemas for a template version by ID. -func (c *Client) TemplateVersionSchema(ctx context.Context, version uuid.UUID) ([]ParameterSchema, error) { - res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/templateversions/%s/schema", version), nil) +// TemplateVersionParameters returns parameters a template version exposes. +func (c *Client) TemplateVersionParameters(ctx context.Context, version uuid.UUID) ([]TemplateVersionParameter, error) { + res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/templateversions/%s/parameters", version), nil) if err != nil { return nil, err } @@ -61,13 +84,27 @@ func (c *Client) TemplateVersionSchema(ctx context.Context, version uuid.UUID) ( if res.StatusCode != http.StatusOK { return nil, readBodyAsError(res) } - var params []ParameterSchema + var params []TemplateVersionParameter return params, json.NewDecoder(res.Body).Decode(¶ms) } -// TemplateVersionParameters returns computed parameters for a template version. -func (c *Client) TemplateVersionParameters(ctx context.Context, version uuid.UUID) ([]ComputedParameter, error) { - res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/templateversions/%s/parameters", version), nil) +// DeprecatedTemplateVersionSchema returns schemas for a template version by ID. +func (c *Client) DeprecatedTemplateVersionSchema(ctx context.Context, version uuid.UUID) ([]DeprecatedParameterSchema, error) { + res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/templateversions/%s/deprecated-schema", version), nil) + if err != nil { + return nil, err + } + defer res.Body.Close() + if res.StatusCode != http.StatusOK { + return nil, readBodyAsError(res) + } + var params []DeprecatedParameterSchema + return params, json.NewDecoder(res.Body).Decode(¶ms) +} + +// DeprecatedTemplateVersionParameters returns computed parameters for a template version. +func (c *Client) DeprecatedTemplateVersionParameters(ctx context.Context, version uuid.UUID) ([]DeprecatedComputedParameter, error) { + res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/templateversions/%s/deprecated-parameters", version), nil) if err != nil { return nil, err } @@ -75,7 +112,7 @@ func (c *Client) TemplateVersionParameters(ctx context.Context, version uuid.UUI if res.StatusCode != http.StatusOK { return nil, readBodyAsError(res) } - var params []ComputedParameter + var params []DeprecatedComputedParameter return params, json.NewDecoder(res.Body).Decode(¶ms) } @@ -106,8 +143,8 @@ func (c *Client) TemplateVersionLogsAfter(ctx context.Context, version uuid.UUID // CreateTemplateVersionDryRunRequest defines the request parameters for // CreateTemplateVersionDryRun. type CreateTemplateVersionDryRunRequest struct { - WorkspaceName string `json:"workspace_name"` - ParameterValues []CreateParameterRequest `json:"parameter_values"` + WorkspaceName string `json:"workspace_name"` + ParameterValues []DeprecatedCreateParameterRequest `json:"parameter_values"` } // CreateTemplateVersionDryRun begins a dry-run provisioner job against the diff --git a/codersdk/workspacebuilds.go b/codersdk/workspacebuilds.go index 41924032463a3..bf53615f26c39 100644 --- a/codersdk/workspacebuilds.go +++ b/codersdk/workspacebuilds.go @@ -92,6 +92,12 @@ type WorkspaceResourceMetadata struct { Sensitive bool `json:"sensitive"` } +// WorkspaceBuildParameter represents a parameter specific for a workspace build. +type WorkspaceBuildParameter struct { + Name string `json:"name"` + Value string `json:"value"` +} + // WorkspaceBuild returns a single workspace build for a workspace. // If history is "", the latest version is returned. func (c *Client) WorkspaceBuild(ctx context.Context, id uuid.UUID) (WorkspaceBuild, error) { diff --git a/codersdk/workspaces.go b/codersdk/workspaces.go index d03e4d7c8ac9e..700124b7d9be1 100644 --- a/codersdk/workspaces.go +++ b/codersdk/workspaces.go @@ -51,12 +51,18 @@ type CreateWorkspaceBuildRequest struct { Transition WorkspaceTransition `json:"transition" validate:"oneof=create start stop delete,required"` DryRun bool `json:"dry_run,omitempty"` ProvisionerState []byte `json:"state,omitempty"` + // Parameters are an optional list of parameters to use for the workspace build. + // If not provided, the prior build parameter list will be used. + // + // A build will fail to create if the template defines parameters that are invalid or missing. + Parameters []WorkspaceBuildParameter `json:"parameters,omitempty"` // Orphan may be set for the Destroy transition. Orphan bool `json:"orphan,omitempty"` - // ParameterValues are optional. It will write params to the 'workspace' scope. + + // DeprecatedParameterValues are optional. It will write params to the 'workspace' scope. // This will overwrite any existing parameters with the same name. // This will not delete old params not included in this list. - ParameterValues []CreateParameterRequest `json:"parameter_values,omitempty"` + DeprecatedParameterValues []DeprecatedCreateParameterRequest `json:"parameter_values,omitempty"` } type WorkspaceOptions struct { diff --git a/examples/templates/gcp-linux/main.tf b/examples/templates/gcp-linux/main.tf index 585a079ebff91..b4c2cacafa288 100644 --- a/examples/templates/gcp-linux/main.tf +++ b/examples/templates/gcp-linux/main.tf @@ -11,22 +11,52 @@ terraform { } } -variable "project_id" { +data "coder_parameter" "project_id" { + name = "Project ID" + icon = "/icon/folder.svg" description = "Which Google Compute Project should your workspace live in?" + default = "something" } -variable "zone" { - description = "What region should your workspace live in?" - default = "us-central1-a" - validation { - condition = contains(["northamerica-northeast1-a", "us-central1-a", "us-west2-c", "europe-west4-b", "southamerica-east1-a"], var.zone) - error_message = "Invalid zone!" +data "coder_parameter" "region" { + name = "Region" + description = "Select a location for your workspace to live." + icon = "/emojis/1f30e.png" + option { + name = "Toronto, Canada" + value = "northamerica-northeast1-a" + icon = "/emojis/1f1e8-1f1e6.png" + } + option { + name = "Council Bluff, Iowa, USA" + value = "us-central1-a" + icon = "/emojis/1f920.png" + } + option { + name = "Hamina, Finland" + value = "europe-north1-a" + icon = "/emojis/1f1eb-1f1ee.png" + } + option { + name = "Warsaw, Poland" + value = "europe-central2-a" + icon = "/emojis/1f1f5-1f1f1.png" + } + option { + name = "Madrid, Spain" + value = "europe-southwest1-a" + icon = "/emojis/1f1ea-1f1f8.png" + } + option { + name = "London, England" + value = "europe-west2-a" + icon = "/emojis/1f1ec-1f1e7.png" } } provider "google" { - zone = var.zone - project = var.project_id + zone = data.coder_parameter.region.value + project = data.coder_parameter.project_id.value } data "google_compute_default_service_account" "default" { @@ -38,7 +68,7 @@ data "coder_workspace" "me" { resource "google_compute_disk" "root" { name = "coder-${data.coder_workspace.me.id}-root" type = "pd-ssd" - zone = var.zone + zone = data.coder_parameter.region.value image = "debian-cloud/debian-11" lifecycle { ignore_changes = [name, image] @@ -76,7 +106,7 @@ resource "coder_app" "code-server" { } resource "google_compute_instance" "dev" { - zone = var.zone + zone = data.coder_parameter.region.value count = data.coder_workspace.me.start_count name = "coder-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}-root" machine_type = "e2-medium" diff --git a/go.mod b/go.mod index 1cbb8028fb4cb..a08e3fff0cd1f 100644 --- a/go.mod +++ b/go.mod @@ -58,7 +58,6 @@ require ( github.com/adrg/xdg v0.4.0 github.com/andybalholm/brotli v1.0.4 github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2 - github.com/awalterschulze/gographviz v2.0.3+incompatible github.com/bgentry/speakeasy v0.1.0 github.com/bramvdbogaerde/go-scp v1.2.0 github.com/briandowns/spinner v1.18.1 @@ -67,6 +66,7 @@ require ( github.com/charmbracelet/lipgloss v0.6.0 github.com/cli/safeexec v1.0.0 github.com/coder/retry v1.3.0 + github.com/coder/terraform-provider-coder v0.6.0 github.com/coreos/go-oidc/v3 v3.4.0 github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf github.com/creack/pty v1.1.18 @@ -165,6 +165,24 @@ require ( tailscale.com v1.32.2 ) +require github.com/awalterschulze/gographviz v2.0.3+incompatible + +require ( + github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect + github.com/hashicorp/go-hclog v1.2.1 // indirect + github.com/hashicorp/go-uuid v1.0.3 // indirect + github.com/hashicorp/logutils v1.0.0 // indirect + github.com/hashicorp/terraform-plugin-go v0.12.0 // indirect + github.com/hashicorp/terraform-plugin-log v0.7.0 // indirect + github.com/hashicorp/terraform-plugin-sdk/v2 v2.20.0 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/go-testing-interface v1.14.1 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect + github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect + github.com/vmihailenco/tagparser v0.1.1 // indirect +) + require ( cloud.google.com/go/compute v1.12.1 // indirect filippo.io/edwards25519 v1.0.0-rc.1 // indirect diff --git a/go.sum b/go.sum index 09c281e72bdc5..bbb364bd4f7aa 100644 --- a/go.sum +++ b/go.sum @@ -199,7 +199,9 @@ github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g github.com/apache/arrow/go/arrow v0.0.0-20210818145353-234c94e4ce64/go.mod h1:2qMFB56yOP3KzkB3PbYZ4AlUFg3a88F67TIx5lB/WwY= github.com/apache/arrow/go/arrow v0.0.0-20211013220434-5962184e7a30/go.mod h1:Q7yQnSMnLvcXlZ8RV+jwz/6y1rQTqbX6C82SndT52Zs= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= +github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= +github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= @@ -357,6 +359,8 @@ github.com/coder/ssh v0.0.0-20220811105153-fcea99919338 h1:tN5GKFT68YLVzJoA8AHui github.com/coder/ssh v0.0.0-20220811105153-fcea99919338/go.mod h1:ZSS+CUoKHDrqVakTfTWUlKSr9MtMFkC4UvtQKD7O914= github.com/coder/tailscale v1.1.1-0.20221117204504-2d6503f027c3 h1:lq8GmpE5bn8A36uxq1h+TWnaQKPugtRkxKrYZA78O9c= github.com/coder/tailscale v1.1.1-0.20221117204504-2d6503f027c3/go.mod h1:lkCb74eSJwxeNq8YwyILoHD5vtHktiZnTOxBxo3tbNc= +github.com/coder/terraform-provider-coder v0.6.0 h1:Q3qSweZEFcH87XC4Q0LVITZ0mfBeT4e688LTfL3GfJE= +github.com/coder/terraform-provider-coder v0.6.0/go.mod h1:UIfU3bYNeSzJJvHyJ30tEKjD6Z9utloI+HUM/7n94CY= github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4/go.mod h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE= github.com/containerd/aufs v0.0.0-20201003224125-76a6863f2989/go.mod h1:AkGGQs9NM2vtYHaUen+NljV0/baGCAPELGm2q9ZXpWU= github.com/containerd/aufs v0.0.0-20210316121734-20793ff83c97/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= @@ -969,12 +973,17 @@ github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FK github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI= +github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.2.1 h1:YQsLlGDJgwhXFpucSPyVbCBviQtjlHv3jLTlp8YmtEw= +github.com/hashicorp/go-hclog v1.2.1/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= @@ -982,6 +991,7 @@ github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHh github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-plugin v1.4.4 h1:NVdrSdFRt3SkZtNckJ6tog7gbpRrcbOjQi/rgF7JYWQ= github.com/hashicorp/go-reap v0.0.0-20170704170343-bf58d8a43e7b h1:3GrpnZQBxcMj1gCXQLelfjCT1D5MPGTuGMKHVzSIH6A= github.com/hashicorp/go-reap v0.0.0-20170704170343-bf58d8a43e7b/go.mod h1:qIFzeFcJU3OIFk/7JreWXcUjFmcCaeHTH9KoNyHYVCs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= @@ -990,6 +1000,8 @@ github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerX github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= @@ -1006,6 +1018,7 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T github.com/hashicorp/hcl/v2 v2.0.0/go.mod h1:oVVDG71tEinNGYCxinCYadcmKU9bglqW9pV3txagJ90= github.com/hashicorp/hcl/v2 v2.14.0 h1:jX6+Q38Ly9zaAJlAjnFVyeNSNCKKW8D0wvyg7vij5Wc= github.com/hashicorp/hcl/v2 v2.14.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0= +github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= @@ -1013,8 +1026,17 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= +github.com/hashicorp/terraform-exec v0.17.2 h1:EU7i3Fh7vDUI9nNRdMATCEfnm9axzTnad8zszYZ73Go= github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s= github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM= +github.com/hashicorp/terraform-plugin-go v0.12.0 h1:6wW9mT1dSs0Xq4LR6HXj1heQ5ovr5GxXNJwkErZzpJw= +github.com/hashicorp/terraform-plugin-go v0.12.0/go.mod h1:kwhmaWHNDvT1B3QiSJdAtrB/D4RaKSY/v3r2BuoWK4M= +github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs= +github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.20.0 h1:+KxZULPsbjpAVoP0WNj/8aVW6EqpcX5JcUcQ5wl7Da4= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.20.0/go.mod h1:DwGJG3KNxIPluVk6hexvDfYR/MS/eKGpiztJoT3Bbbw= +github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c h1:D8aRO6+mTqHfLsK/BC3j5OAoogv1WLRWzY1AaTo3rBg= +github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0= github.com/hashicorp/yamux v0.0.0-20220718163420-dd80a7ee44ce h1:7FO+LmZwiG/eDsBWo50ZeqV5PoH0gwiM1mxFajXAkas= github.com/hashicorp/yamux v0.0.0-20220718163420-dd80a7ee44ce/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 h1:aSVUgRRRtOrZOC1fYmY9gV0e9z/Iu+xNVSASWjsuyGU= @@ -1329,12 +1351,15 @@ github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceT github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/cli v1.1.4/go.mod h1:vTLESy5mRhKOs9KDp0/RATawxP1UqBmdrpVRMnpcvKQ= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc= github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= +github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= @@ -1351,6 +1376,7 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/moby v20.10.21+incompatible h1:LfdCNzNpDYtOTtlO5wxLcUEk0nyM3KqPyeIyXVdvl/U= @@ -1410,10 +1436,12 @@ github.com/niklasfasching/go-org v1.6.5/go.mod h1:ybv0eGDnxylFUfFE+ySaQc734j/L3+ github.com/nishanths/exhaustive v0.2.3/go.mod h1:bhIX678Nx8inLM9PbpvK1yv6oGtoP8BfaIeMzgBNKvc= github.com/nishanths/predeclared v0.0.0-20190419143655-18a43bb90ffc/go.mod h1:62PewwiQTlm/7Rj+cxVYqZvDIUc+JjZq6GHAC1fsObQ= github.com/nishanths/predeclared v0.2.1/go.mod h1:HvkGJcA3naj4lOwnFXFDkFxVtSqQMB9sbB1usJ+xjQE= +github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k+Mg7cowZ8yv4Trqw9UsJby758= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= @@ -1710,6 +1738,7 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.7.4/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= @@ -1797,7 +1826,11 @@ github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f/go.mod h1:DD4vA1 github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 h1:gga7acRE695APm9hlsSMoOoE65U4/TcqNj90mc69Rlg= github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= +github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= +github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= +github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U= github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= +github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY= github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI= diff --git a/provisioner/echo/serve.go b/provisioner/echo/serve.go index 6684b92c6ee94..82bbba6661bb4 100644 --- a/provisioner/echo/serve.go +++ b/provisioner/echo/serve.go @@ -38,9 +38,9 @@ func formatExecValue(key, value string) string { var ( // ParseComplete is a helper to indicate an empty parse completion. - ParseComplete = []*proto.Parse_Response{{ - Type: &proto.Parse_Response_Complete{ - Complete: &proto.Parse_Complete{}, + ParseComplete = []*proto.DeprecatedParse_Response{{ + Type: &proto.DeprecatedParse_Response_Complete{ + Complete: &proto.DeprecatedParse_Complete{}, }, }} // ProvisionComplete is a helper to indicate an empty provision completion. @@ -50,18 +50,15 @@ var ( }, }} - ParameterSuccess = []*proto.ParameterSchema{ + ParameterSuccess = []*proto.DeprecatedParameterSchema{ { AllowOverrideSource: true, Name: ParameterExecKey, Description: "description 1", - DefaultSource: &proto.ParameterSource{ - Scheme: proto.ParameterSource_DATA, + DefaultSource: &proto.DeprecatedParameterSource{ + Scheme: proto.DeprecatedParameterSource_DATA, Value: formatExecValue(successKey, ""), }, - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, }, } ) @@ -81,7 +78,7 @@ type echo struct { } // Parse reads requests from the provided directory to stream responses. -func (e *echo) Parse(request *proto.Parse_Request, stream proto.DRPCProvisioner_ParseStream) error { +func (e *echo) DeprecatedParse(request *proto.DeprecatedParse_Request, stream proto.DRPCProvisioner_DeprecatedParseStream) error { for index := 0; ; index++ { path := filepath.Join(request.Directory, fmt.Sprintf("%d.parse.protobuf", index)) _, err := e.filesystem.Stat(path) @@ -96,7 +93,7 @@ func (e *echo) Parse(request *proto.Parse_Request, stream proto.DRPCProvisioner_ if err != nil { return xerrors.Errorf("read file %q: %w", path, err) } - var response proto.Parse_Response + var response proto.DeprecatedParse_Response err = protobuf.Unmarshal(data, &response) if err != nil { return xerrors.Errorf("unmarshal: %w", err) @@ -183,7 +180,7 @@ func (*echo) Shutdown(_ context.Context, _ *proto.Empty) (*proto.Empty, error) { } type Responses struct { - Parse []*proto.Parse_Response + Parse []*proto.DeprecatedParse_Response ProvisionApply []*proto.Provision_Response ProvisionPlan []*proto.Provision_Response } @@ -196,6 +193,9 @@ func Tar(responses *Responses) ([]byte, error) { if responses.ProvisionPlan == nil { responses.ProvisionPlan = responses.ProvisionApply } + if responses.Parse == nil { + responses.Parse = ParseComplete + } var buffer bytes.Buffer writer := tar.NewWriter(&buffer) diff --git a/provisioner/echo/serve_test.go b/provisioner/echo/serve_test.go index be3d1dd50304d..c16707dceaa57 100644 --- a/provisioner/echo/serve_test.go +++ b/provisioner/echo/serve_test.go @@ -41,16 +41,16 @@ func TestEcho(t *testing.T) { t.Run("Parse", func(t *testing.T) { t.Parallel() - responses := []*proto.Parse_Response{{ - Type: &proto.Parse_Response_Log{ + responses := []*proto.DeprecatedParse_Response{{ + Type: &proto.DeprecatedParse_Response_Log{ Log: &proto.Log{ Output: "log-output", }, }, }, { - Type: &proto.Parse_Response_Complete{ - Complete: &proto.Parse_Complete{ - ParameterSchemas: []*proto.ParameterSchema{{ + Type: &proto.DeprecatedParse_Response_Complete{ + Complete: &proto.DeprecatedParse_Complete{ + ParameterSchemas: []*proto.DeprecatedParameterSchema{{ Name: "parameter-schema", }}, }, @@ -60,7 +60,7 @@ func TestEcho(t *testing.T) { Parse: responses, }) require.NoError(t, err) - client, err := api.Parse(ctx, &proto.Parse_Request{ + client, err := api.DeprecatedParse(ctx, &proto.DeprecatedParse_Request{ Directory: unpackTar(t, fs, data), }) require.NoError(t, err) diff --git a/provisioner/terraform/executor.go b/provisioner/terraform/executor.go index c39a33faacc9d..aa48a59b25b37 100644 --- a/provisioner/terraform/executor.go +++ b/provisioner/terraform/executor.go @@ -239,7 +239,7 @@ func (e executor) plan(ctx, killCtx context.Context, env, vars []string, logr lo if err != nil { return nil, xerrors.Errorf("terraform plan: %w", err) } - resources, err := e.planResources(ctx, killCtx, planfilePath) + resources, parameters, err := e.planResources(ctx, killCtx, planfilePath) if err != nil { return nil, err } @@ -250,24 +250,30 @@ func (e executor) plan(ctx, killCtx context.Context, env, vars []string, logr lo return &proto.Provision_Response{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ - Resources: resources, - Plan: planFileByt, + Resources: resources, + Parameters: parameters, + Plan: planFileByt, }, }, }, nil } -func (e executor) planResources(ctx, killCtx context.Context, planfilePath string) ([]*proto.Resource, error) { +func (e executor) planResources(ctx, killCtx context.Context, planfilePath string) ([]*proto.Resource, []*proto.Parameter, error) { plan, err := e.showPlan(ctx, killCtx, planfilePath) if err != nil { - return nil, xerrors.Errorf("show terraform plan file: %w", err) + return nil, nil, xerrors.Errorf("show terraform plan file: %w", err) } rawGraph, err := e.graph(ctx, killCtx) if err != nil { - return nil, xerrors.Errorf("graph: %w", err) + return nil, nil, xerrors.Errorf("graph: %w", err) } - return ConvertResources(plan.PlannedValues.RootModule, rawGraph) + modules := []*tfjson.StateModule{} + if plan.PriorState != nil { + modules = append(modules, plan.PriorState.Values.RootModule) + } + modules = append(modules, plan.PlannedValues.RootModule) + return ConvertResourcesAndParameters(modules, rawGraph) } func (e executor) showPlan(ctx, killCtx context.Context, planfilePath string) (*tfjson.Plan, error) { @@ -337,7 +343,7 @@ func (e executor) apply( if err != nil { return nil, xerrors.Errorf("terraform apply: %w", err) } - resources, err := e.stateResources(ctx, killCtx) + resources, parameters, err := e.stateResources(ctx, killCtx) if err != nil { return nil, err } @@ -349,30 +355,34 @@ func (e executor) apply( return &proto.Provision_Response{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ - Resources: resources, - State: stateContent, + Resources: resources, + Parameters: parameters, + State: stateContent, }, }, }, nil } -func (e executor) stateResources(ctx, killCtx context.Context) ([]*proto.Resource, error) { +func (e executor) stateResources(ctx, killCtx context.Context) ([]*proto.Resource, []*proto.Parameter, error) { state, err := e.state(ctx, killCtx) if err != nil { - return nil, err + return nil, nil, err } rawGraph, err := e.graph(ctx, killCtx) if err != nil { - return nil, xerrors.Errorf("get terraform graph: %w", err) + return nil, nil, xerrors.Errorf("get terraform graph: %w", err) } var resources []*proto.Resource + var parameters []*proto.Parameter if state.Values != nil { - resources, err = ConvertResources(state.Values.RootModule, rawGraph) + resources, parameters, err = ConvertResourcesAndParameters([]*tfjson.StateModule{ + state.Values.RootModule, + }, rawGraph) if err != nil { - return nil, err + return nil, nil, err } } - return resources, nil + return resources, parameters, nil } func (e executor) state(ctx, killCtx context.Context) (*tfjson.State, error) { diff --git a/provisioner/terraform/parse.go b/provisioner/terraform/parse.go index de6781d443622..702d375a7ea73 100644 --- a/provisioner/terraform/parse.go +++ b/provisioner/terraform/parse.go @@ -15,8 +15,8 @@ import ( "github.com/coder/coder/provisionersdk/proto" ) -// Parse extracts Terraform variables from source-code. -func (*server) Parse(request *proto.Parse_Request, stream proto.DRPCProvisioner_ParseStream) error { +// DeprecatedParse extracts Terraform variables from source-code. +func (*server) DeprecatedParse(request *proto.DeprecatedParse_Request, stream proto.DRPCProvisioner_DeprecatedParseStream) error { // Load the module and print any parse errors. module, diags := tfconfig.LoadModule(request.Directory) if diags.HasErrors() { @@ -32,7 +32,7 @@ func (*server) Parse(request *proto.Parse_Request, stream proto.DRPCProvisioner_ return compareSourcePos(variables[i].Pos, variables[j].Pos) }) - parameters := make([]*proto.ParameterSchema, 0, len(variables)) + parameters := make([]*proto.DeprecatedParameterSchema, 0, len(variables)) for _, v := range variables { schema, err := convertVariableToParameter(v) if err != nil { @@ -42,9 +42,9 @@ func (*server) Parse(request *proto.Parse_Request, stream proto.DRPCProvisioner_ parameters = append(parameters, schema) } - return stream.Send(&proto.Parse_Response{ - Type: &proto.Parse_Response_Complete{ - Complete: &proto.Parse_Complete{ + return stream.Send(&proto.DeprecatedParse_Response{ + Type: &proto.DeprecatedParse_Response_Complete{ + Complete: &proto.DeprecatedParse_Complete{ ParameterSchemas: parameters, }, }, @@ -52,16 +52,13 @@ func (*server) Parse(request *proto.Parse_Request, stream proto.DRPCProvisioner_ } // Converts a Terraform variable to a provisioner parameter. -func convertVariableToParameter(variable *tfconfig.Variable) (*proto.ParameterSchema, error) { - schema := &proto.ParameterSchema{ +func convertVariableToParameter(variable *tfconfig.Variable) (*proto.DeprecatedParameterSchema, error) { + schema := &proto.DeprecatedParameterSchema{ Name: variable.Name, Description: variable.Description, RedisplayValue: !variable.Sensitive, AllowOverrideSource: !variable.Sensitive, ValidationValueType: variable.Type, - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, } if variable.Default != nil { @@ -74,8 +71,8 @@ func convertVariableToParameter(variable *tfconfig.Variable) (*proto.ParameterSc defaultData = string(defaultDataRaw) } - schema.DefaultSource = &proto.ParameterSource{ - Scheme: proto.ParameterSource_DATA, + schema.DefaultSource = &proto.DeprecatedParameterSource{ + Scheme: proto.DeprecatedParameterSource_DATA, Value: defaultData, } } @@ -90,7 +87,7 @@ func convertVariableToParameter(variable *tfconfig.Variable) (*proto.ParameterSc } schema.ValidationCondition = string(filedata[validation.Condition.Range().Start.Byte:validation.Condition.Range().End.Byte]) schema.ValidationError = validation.ErrorMessage - schema.ValidationTypeSystem = proto.ParameterSchema_HCL + schema.ValidationTypeSystem = proto.DeprecatedParameterSchema_HCL } return schema, nil diff --git a/provisioner/terraform/parse_test.go b/provisioner/terraform/parse_test.go index d00edc8a9b303..89aff5330bc83 100644 --- a/provisioner/terraform/parse_test.go +++ b/provisioner/terraform/parse_test.go @@ -21,7 +21,7 @@ func TestParse(t *testing.T) { testCases := []struct { Name string Files map[string]string - Response *proto.Parse_Response + Response *proto.DeprecatedParse_Response // If ErrorContains is not empty, then response.Recv() should return an // error containing this string before a Complete response is returned. ErrorContains string @@ -33,17 +33,14 @@ func TestParse(t *testing.T) { description = "Testing!" }`, }, - Response: &proto.Parse_Response{ - Type: &proto.Parse_Response_Complete{ - Complete: &proto.Parse_Complete{ - ParameterSchemas: []*proto.ParameterSchema{{ + Response: &proto.DeprecatedParse_Response{ + Type: &proto.DeprecatedParse_Response_Complete{ + Complete: &proto.DeprecatedParse_Complete{ + ParameterSchemas: []*proto.DeprecatedParameterSchema{{ Name: "A", RedisplayValue: true, AllowOverrideSource: true, Description: "Testing!", - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, }}, }, }, @@ -56,20 +53,17 @@ func TestParse(t *testing.T) { default = "wow" }`, }, - Response: &proto.Parse_Response{ - Type: &proto.Parse_Response_Complete{ - Complete: &proto.Parse_Complete{ - ParameterSchemas: []*proto.ParameterSchema{{ + Response: &proto.DeprecatedParse_Response{ + Type: &proto.DeprecatedParse_Response_Complete{ + Complete: &proto.DeprecatedParse_Complete{ + ParameterSchemas: []*proto.DeprecatedParameterSchema{{ Name: "A", RedisplayValue: true, AllowOverrideSource: true, - DefaultSource: &proto.ParameterSource{ - Scheme: proto.ParameterSource_DATA, + DefaultSource: &proto.DeprecatedParameterSource{ + Scheme: proto.DeprecatedParameterSource_DATA, Value: "wow", }, - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, }}, }, }, @@ -84,18 +78,15 @@ func TestParse(t *testing.T) { } }`, }, - Response: &proto.Parse_Response{ - Type: &proto.Parse_Response_Complete{ - Complete: &proto.Parse_Complete{ - ParameterSchemas: []*proto.ParameterSchema{{ + Response: &proto.DeprecatedParse_Response{ + Type: &proto.DeprecatedParse_Response_Complete{ + Complete: &proto.DeprecatedParse_Complete{ + ParameterSchemas: []*proto.DeprecatedParameterSchema{{ Name: "A", RedisplayValue: true, ValidationCondition: `var.A == "value"`, - ValidationTypeSystem: proto.ParameterSchema_HCL, + ValidationTypeSystem: proto.DeprecatedParameterSchema_HCL, AllowOverrideSource: true, - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, }}, }, }, @@ -116,45 +107,33 @@ func TestParse(t *testing.T) { "main2.tf": `variable "baz" { } variable "quux" { }`, }, - Response: &proto.Parse_Response{ - Type: &proto.Parse_Response_Complete{ - Complete: &proto.Parse_Complete{ - ParameterSchemas: []*proto.ParameterSchema{ + Response: &proto.DeprecatedParse_Response{ + Type: &proto.DeprecatedParse_Response_Complete{ + Complete: &proto.DeprecatedParse_Complete{ + ParameterSchemas: []*proto.DeprecatedParameterSchema{ { Name: "foo", RedisplayValue: true, AllowOverrideSource: true, Description: "", - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, }, { Name: "bar", RedisplayValue: true, AllowOverrideSource: true, Description: "", - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, }, { Name: "baz", RedisplayValue: true, AllowOverrideSource: true, Description: "", - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, }, { Name: "quux", RedisplayValue: true, AllowOverrideSource: true, Description: "", - DefaultDestination: &proto.ParameterDestination{ - Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - }, }, }, }, @@ -175,7 +154,7 @@ func TestParse(t *testing.T) { require.NoError(t, err) } - response, err := api.Parse(ctx, &proto.Parse_Request{ + response, err := api.DeprecatedParse(ctx, &proto.DeprecatedParse_Request{ Directory: directory, }) require.NoError(t, err) diff --git a/provisioner/terraform/provision.go b/provisioner/terraform/provision.go index a267085126f76..213eb2d234b52 100644 --- a/provisioner/terraform/provision.go +++ b/provisioner/terraform/provision.go @@ -12,6 +12,7 @@ import ( "github.com/coder/coder/provisionersdk" "github.com/coder/coder/provisionersdk/proto" + "github.com/coder/terraform-provider-coder/provider" ) // Provision executes `terraform apply` or `terraform plan` for dry runs. @@ -191,15 +192,8 @@ func (s *server) Provision(stream proto.DRPCProvisioner_ProvisionStream) error { func planVars(plan *proto.Provision_Plan) ([]string, error) { vars := []string{} - for _, param := range plan.ParameterValues { - switch param.DestinationScheme { - case proto.ParameterDestination_ENVIRONMENT_VARIABLE: - continue - case proto.ParameterDestination_PROVISIONER_VARIABLE: - vars = append(vars, fmt.Sprintf("%s=%s", param.Name, param.Value)) - default: - return nil, xerrors.Errorf("unsupported parameter type %q for %q", param.DestinationScheme, param.Name) - } + for _, param := range plan.DeprecatedParameterValues { + vars = append(vars, fmt.Sprintf("%s=%s", param.Name, param.Value)) } return vars, nil } @@ -218,15 +212,8 @@ func provisionEnv(config *proto.Provision_Config, params []*proto.ParameterValue for key, value := range provisionersdk.AgentScriptEnv() { env = append(env, key+"="+value) } - for _, param := range params { - switch param.DestinationScheme { - case proto.ParameterDestination_ENVIRONMENT_VARIABLE: - env = append(env, fmt.Sprintf("%s=%s", param.Name, param.Value)) - case proto.ParameterDestination_PROVISIONER_VARIABLE: - continue - default: - return nil, xerrors.Errorf("unsupported parameter type %q for %q", param.DestinationScheme, param.Name) - } + for _, parameter := range params { + env = append(env, provider.ParameterEnvironmentVariable(parameter.Name)+"="+parameter.Value) } return env, nil } diff --git a/provisioner/terraform/provision_test.go b/provisioner/terraform/provision_test.go index d12fbc2b8a24f..6e24157e6e47f 100644 --- a/provisioner/terraform/provision_test.go +++ b/provisioner/terraform/provision_test.go @@ -214,9 +214,8 @@ func TestProvision(t *testing.T) { }, Request: &proto.Provision_Plan{ ParameterValues: []*proto.ParameterValue{{ - DestinationScheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - Name: "A", - Value: "example", + Name: "A", + Value: "example", }}, }, Response: &proto.Provision_Response{ @@ -314,9 +313,8 @@ func TestProvision(t *testing.T) { Request: &proto.Provision_Plan{ ParameterValues: []*proto.ParameterValue{ { - DestinationScheme: 88, - Name: "UNSUPPORTED", - Value: "sadface", + Name: "UNSUPPORTED", + Value: "sadface", }, }, }, diff --git a/provisioner/terraform/resources.go b/provisioner/terraform/resources.go index d8c0581c59b6a..4baebeb6521bb 100644 --- a/provisioner/terraform/resources.go +++ b/provisioner/terraform/resources.go @@ -8,6 +8,8 @@ import ( "github.com/mitchellh/mapstructure" "golang.org/x/xerrors" + "github.com/coder/terraform-provider-coder/provider" + "github.com/coder/coder/provisioner" "github.com/coder/coder/provisionersdk/proto" ) @@ -67,17 +69,17 @@ type metadataItem struct { IsNull bool `mapstructure:"is_null"` } -// ConvertResources consumes Terraform state and a GraphViz representation produced by +// ConvertResourcesAndParameters consumes Terraform state and a GraphViz representation produced by // `terraform graph` to produce resources consumable by Coder. // nolint:gocyclo -func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Resource, error) { +func ConvertResourcesAndParameters(modules []*tfjson.StateModule, rawGraph string) ([]*proto.Resource, []*proto.Parameter, error) { parsedGraph, err := gographviz.ParseString(rawGraph) if err != nil { - return nil, xerrors.Errorf("parse graph: %w", err) + return nil, nil, xerrors.Errorf("parse graph: %w", err) } graph, err := gographviz.NewAnalysedGraph(parsedGraph) if err != nil { - return nil, xerrors.Errorf("analyze graph: %w", err) + return nil, nil, xerrors.Errorf("analyze graph: %w", err) } resources := make([]*proto.Resource, 0) @@ -109,7 +111,9 @@ func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Res } } } - findTerraformResources(module) + for _, module := range modules { + findTerraformResources(module) + } // Find all agents! for _, tfResource := range tfResourceByLabel { @@ -119,7 +123,7 @@ func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Res var attrs agentAttributes err = mapstructure.Decode(tfResource.AttributeValues, &attrs) if err != nil { - return nil, xerrors.Errorf("decode agent attributes: %w", err) + return nil, nil, xerrors.Errorf("decode agent attributes: %w", err) } agent := &proto.Agent{ Name: tfResource.Name, @@ -158,7 +162,7 @@ func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Res break } if agentNode == nil { - return nil, xerrors.Errorf("couldn't find node on graph: %q", agentLabel) + return nil, nil, xerrors.Errorf("couldn't find node on graph: %q", agentLabel) } var agentResource *graphResource @@ -236,7 +240,7 @@ func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Res var attrs agentAppAttributes err = mapstructure.Decode(resource.AttributeValues, &attrs) if err != nil { - return nil, xerrors.Errorf("decode app attributes: %w", err) + return nil, nil, xerrors.Errorf("decode app attributes: %w", err) } // Default to the resource name if none is set! @@ -253,11 +257,11 @@ func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Res } if !provisioner.AppSlugRegex.MatchString(attrs.Slug) { - return nil, xerrors.Errorf("invalid app slug %q, please update your coder/coder provider to the latest version and specify the slug property on each coder_app", attrs.Slug) + return nil, nil, xerrors.Errorf("invalid app slug %q, please update your coder/coder provider to the latest version and specify the slug property on each coder_app", attrs.Slug) } if _, exists := appSlugs[attrs.Slug]; exists { - return nil, xerrors.Errorf("duplicate app slug, they must be unique per template: %q", attrs.Slug) + return nil, nil, xerrors.Errorf("duplicate app slug, they must be unique per template: %q", attrs.Slug) } appSlugs[attrs.Slug] = struct{}{} @@ -313,7 +317,7 @@ func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Res var attrs metadataAttributes err = mapstructure.Decode(resource.AttributeValues, &attrs) if err != nil { - return nil, xerrors.Errorf("decode metadata attributes: %w", err) + return nil, nil, xerrors.Errorf("decode metadata attributes: %w", err) } var targetLabel string @@ -403,7 +407,44 @@ func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Res }) } - return resources, nil + parameters := make([]*proto.Parameter, 0) + for _, resource := range tfResourceByLabel { + if resource.Type != "coder_parameter" { + continue + } + var param provider.Parameter + err = mapstructure.Decode(resource.AttributeValues, ¶m) + if err != nil { + return nil, nil, xerrors.Errorf("decode map values for coder_parameter.%s: %w", resource.Name, err) + } + protoParam := &proto.Parameter{ + Name: param.Name, + Description: param.Description, + Type: param.Type, + Mutable: param.Mutable, + DefaultValue: param.Default, + Icon: param.Icon, + } + if len(param.Validation) == 1 { + protoParam.ValidationRegex = param.Validation[0].Regex + protoParam.ValidationMax = int32(param.Validation[0].Max) + protoParam.ValidationMin = int32(param.Validation[0].Min) + } + if len(param.Option) > 0 { + protoParam.Options = make([]*proto.ParameterOption, 0, len(param.Option)) + for _, option := range param.Option { + protoParam.Options = append(protoParam.Options, &proto.ParameterOption{ + Name: option.Name, + Description: option.Description, + Value: option.Value, + Icon: option.Icon, + }) + } + } + parameters = append(parameters, protoParam) + } + + return resources, parameters, nil } // convertAddressToLabel returns the Terraform address without the count diff --git a/provisioner/terraform/resources_test.go b/provisioner/terraform/resources_test.go index ebcc07dc84a16..fe3d713331a5c 100644 --- a/provisioner/terraform/resources_test.go +++ b/provisioner/terraform/resources_test.go @@ -22,149 +22,195 @@ func TestConvertResources(t *testing.T) { t.Parallel() // nolint:dogsled _, filename, _, _ := runtime.Caller(0) + type testCase struct { + resources []*proto.Resource + parameters []*proto.Parameter + } // nolint:paralleltest - for folderName, expected := range map[string][]*proto.Resource{ + for folderName, expected := range map[string]testCase{ // When a resource depends on another, the shortest route // to a resource should always be chosen for the agent. - "chaining-resources": {{ - Name: "a", - Type: "null_resource", - }, { - Name: "b", - Type: "null_resource", - Agents: []*proto.Agent{{ - Name: "main", - OperatingSystem: "linux", - Architecture: "amd64", - Auth: &proto.Agent_Token{}, - ConnectionTimeoutSeconds: 120, + "chaining-resources": { + resources: []*proto.Resource{{ + Name: "a", + Type: "null_resource", + }, { + Name: "b", + Type: "null_resource", + Agents: []*proto.Agent{{ + Name: "main", + OperatingSystem: "linux", + Architecture: "amd64", + Auth: &proto.Agent_Token{}, + ConnectionTimeoutSeconds: 120, + }}, }}, - }}, + }, // This can happen when resources hierarchically conflict. // When multiple resources exist at the same level, the first // listed in state will be chosen. - "conflicting-resources": {{ - Name: "first", - Type: "null_resource", - Agents: []*proto.Agent{{ - Name: "main", - OperatingSystem: "linux", - Architecture: "amd64", - Auth: &proto.Agent_Token{}, - ConnectionTimeoutSeconds: 120, + "conflicting-resources": { + resources: []*proto.Resource{{ + Name: "first", + Type: "null_resource", + Agents: []*proto.Agent{{ + Name: "main", + OperatingSystem: "linux", + Architecture: "amd64", + Auth: &proto.Agent_Token{}, + ConnectionTimeoutSeconds: 120, + }}, + }, { + Name: "second", + Type: "null_resource", }}, - }, { - Name: "second", - Type: "null_resource", - }}, + }, // Ensures the instance ID authentication type surfaces. - "instance-id": {{ - Name: "main", - Type: "null_resource", - Agents: []*proto.Agent{{ - Name: "main", - OperatingSystem: "linux", - Architecture: "amd64", - Auth: &proto.Agent_InstanceId{}, - ConnectionTimeoutSeconds: 120, + "instance-id": { + resources: []*proto.Resource{{ + Name: "main", + Type: "null_resource", + Agents: []*proto.Agent{{ + Name: "main", + OperatingSystem: "linux", + Architecture: "amd64", + Auth: &proto.Agent_InstanceId{}, + ConnectionTimeoutSeconds: 120, + }}, }}, - }}, + }, // Ensures that calls to resources through modules work // as expected. - "calling-module": {{ - Name: "example", - Type: "null_resource", - Agents: []*proto.Agent{{ - Name: "main", - OperatingSystem: "linux", - Architecture: "amd64", - Auth: &proto.Agent_Token{}, - ConnectionTimeoutSeconds: 120, + "calling-module": { + resources: []*proto.Resource{{ + Name: "example", + Type: "null_resource", + Agents: []*proto.Agent{{ + Name: "main", + OperatingSystem: "linux", + Architecture: "amd64", + Auth: &proto.Agent_Token{}, + ConnectionTimeoutSeconds: 120, + }}, }}, - }}, + }, // Ensures the attachment of multiple agents to a single // resource is successful. - "multiple-agents": {{ - Name: "dev", - Type: "null_resource", - Agents: []*proto.Agent{{ - Name: "dev1", - OperatingSystem: "linux", - Architecture: "amd64", - Auth: &proto.Agent_Token{}, - ConnectionTimeoutSeconds: 120, - }, { - Name: "dev2", - OperatingSystem: "darwin", - Architecture: "amd64", - Auth: &proto.Agent_Token{}, - ConnectionTimeoutSeconds: 1, - MotdFile: "/etc/motd", - }, { - Name: "dev3", - OperatingSystem: "windows", - Architecture: "arm64", - Auth: &proto.Agent_Token{}, - ConnectionTimeoutSeconds: 120, - TroubleshootingUrl: "https://coder.com/troubleshoot", + "multiple-agents": { + resources: []*proto.Resource{{ + Name: "dev", + Type: "null_resource", + Agents: []*proto.Agent{{ + Name: "dev1", + OperatingSystem: "linux", + Architecture: "amd64", + Auth: &proto.Agent_Token{}, + ConnectionTimeoutSeconds: 120, + }, { + Name: "dev2", + OperatingSystem: "darwin", + Architecture: "amd64", + Auth: &proto.Agent_Token{}, + ConnectionTimeoutSeconds: 1, + MotdFile: "/etc/motd", + }, { + Name: "dev3", + OperatingSystem: "windows", + Architecture: "arm64", + Auth: &proto.Agent_Token{}, + ConnectionTimeoutSeconds: 120, + TroubleshootingUrl: "https://coder.com/troubleshoot", + }}, }}, - }}, + }, // Ensures multiple applications can be set for a single agent. - "multiple-apps": {{ - Name: "dev", - Type: "null_resource", - Agents: []*proto.Agent{{ - Name: "dev1", - OperatingSystem: "linux", - Architecture: "amd64", - Apps: []*proto.App{ - { - Slug: "app1", - DisplayName: "app1", - // Subdomain defaults to false if unspecified. - Subdomain: false, - }, - { - Slug: "app2", - DisplayName: "app2", - Subdomain: true, - Healthcheck: &proto.Healthcheck{ - Url: "http://localhost:13337/healthz", - Interval: 5, - Threshold: 6, + "multiple-apps": { + resources: []*proto.Resource{{ + Name: "dev", + Type: "null_resource", + Agents: []*proto.Agent{{ + Name: "dev1", + OperatingSystem: "linux", + Architecture: "amd64", + Auth: &proto.Agent_Token{}, + ConnectionTimeoutSeconds: 120, + Apps: []*proto.App{ + { + Slug: "app1", + DisplayName: "app1", + // Subdomain defaults to false if unspecified. + Subdomain: false, + }, + { + Slug: "app2", + DisplayName: "app2", + Subdomain: true, + Healthcheck: &proto.Healthcheck{ + Url: "http://localhost:13337/healthz", + Interval: 5, + Threshold: 6, + }, + }, + { + Slug: "app3", + DisplayName: "app3", + Subdomain: false, + }, + { + Slug: "app3", + DisplayName: "app3", + Subdomain: false, }, }, - { - Slug: "app3", - DisplayName: "app3", - Subdomain: false, - }, - }, - Auth: &proto.Agent_Token{}, - ConnectionTimeoutSeconds: 120, + }}, }}, - }}, + }, // Tests fetching metadata about workspace resources. - "resource-metadata": {{ - Name: "about", - Type: "null_resource", - Hide: true, - Icon: "/icon/server.svg", - DailyCost: 29, - Metadata: []*proto.Resource_Metadata{{ - Key: "hello", - Value: "world", - }, { - Key: "null", - IsNull: true, - }, { - Key: "empty", - }, { - Key: "secret", - Value: "squirrel", - Sensitive: true, + "resource-metadata": { + resources: []*proto.Resource{{ + Name: "about", + Type: "null_resource", + Hide: true, + Icon: "/icon/server.svg", + DailyCost: 29, + Metadata: []*proto.Resource_Metadata{{ + Key: "hello", + Value: "world", + }, { + Key: "null", + IsNull: true, + }, { + Key: "empty", + }, { + Key: "secret", + Value: "squirrel", + Sensitive: true, + }}, + }}, + }, + "parameters": { + resources: []*proto.Resource{{ + Name: "dev", + Type: "null_resource", + Agents: []*proto.Agent{{ + Name: "dev", + OperatingSystem: "windows", + Architecture: "arm64", + Auth: &proto.Agent_Token{}, + }}, + }}, + parameters: []*proto.Parameter{{ + Name: "Example", + Type: "string", + Options: []*proto.ParameterOption{{ + Name: "First Option", + Value: "first", + }, { + Name: "Second Option", + Value: "second", + }}, }}, - }}, + }, } { folderName := folderName expected := expected @@ -182,12 +228,18 @@ func TestConvertResources(t *testing.T) { tfPlanGraph, err := os.ReadFile(filepath.Join(dir, folderName+".tfplan.dot")) require.NoError(t, err) - resources, err := terraform.ConvertResources(tfPlan.PlannedValues.RootModule, string(tfPlanGraph)) + modules := []*tfjson.StateModule{} + if tfPlan.PriorState != nil { + modules = append(modules, tfPlan.PriorState.Values.RootModule) + } + modules = append(modules, tfPlan.PlannedValues.RootModule) + resources, parameters, err := terraform.ConvertResourcesAndParameters(modules, string(tfPlanGraph)) require.NoError(t, err) sortResources(resources) + sortParameters(parameters) - var expectedNoMetadata []*proto.Resource - for _, resource := range expected { + expectedNoMetadata := make([]*proto.Resource, 0) + for _, resource := range expected.resources { resourceCopy, _ := protobuf.Clone(resource).(*proto.Resource) // plan cannot know whether values are null or not for _, metadata := range resourceCopy.Metadata { @@ -209,7 +261,16 @@ func TestConvertResources(t *testing.T) { var resourcesMap []map[string]interface{} err = json.Unmarshal(data, &resourcesMap) require.NoError(t, err) + require.Equal(t, expectedNoMetadataMap, resourcesMap) + if expected.parameters == nil { + expected.parameters = []*proto.Parameter{} + } + parametersWant, err := json.Marshal(expected.parameters) + require.NoError(t, err) + parametersGot, err := json.Marshal(parameters) + require.NoError(t, err) + require.Equal(t, string(parametersWant), string(parametersGot)) require.Equal(t, expectedNoMetadataMap, resourcesMap) }) @@ -223,9 +284,10 @@ func TestConvertResources(t *testing.T) { tfStateGraph, err := os.ReadFile(filepath.Join(dir, folderName+".tfstate.dot")) require.NoError(t, err) - resources, err := terraform.ConvertResources(tfState.Values.RootModule, string(tfStateGraph)) + resources, parameters, err := terraform.ConvertResourcesAndParameters([]*tfjson.StateModule{tfState.Values.RootModule}, string(tfStateGraph)) require.NoError(t, err) sortResources(resources) + sortParameters(parameters) for _, resource := range resources { for _, agent := range resource.Agents { agent.Id = "" @@ -239,7 +301,7 @@ func TestConvertResources(t *testing.T) { } // Convert expectedNoMetadata and resources into a // []map[string]interface{} so they can be compared easily. - data, err := json.Marshal(expected) + data, err := json.Marshal(expected.resources) require.NoError(t, err) var expectedMap []map[string]interface{} err = json.Unmarshal(data, &expectedMap) @@ -280,7 +342,7 @@ func TestAppSlugValidation(t *testing.T) { } } - resources, err := terraform.ConvertResources(tfPlan.PlannedValues.RootModule, string(tfPlanGraph)) + resources, _, err := terraform.ConvertResourcesAndParameters([]*tfjson.StateModule{tfPlan.PlannedValues.RootModule}, string(tfPlanGraph)) require.Nil(t, resources) require.Error(t, err) require.ErrorContains(t, err, "invalid app slug") @@ -292,7 +354,7 @@ func TestAppSlugValidation(t *testing.T) { } } - resources, err = terraform.ConvertResources(tfPlan.PlannedValues.RootModule, string(tfPlanGraph)) + resources, _, err = terraform.ConvertResourcesAndParameters([]*tfjson.StateModule{tfPlan.PlannedValues.RootModule}, string(tfPlanGraph)) require.Nil(t, resources) require.Error(t, err) require.ErrorContains(t, err, "duplicate app slug") @@ -325,7 +387,7 @@ func TestInstanceTypeAssociation(t *testing.T) { t.Parallel() instanceType, err := cryptorand.String(12) require.NoError(t, err) - resources, err := terraform.ConvertResources(&tfjson.StateModule{ + resources, _, err := terraform.ConvertResourcesAndParameters([]*tfjson.StateModule{{ Resources: []*tfjson.StateResource{{ Address: tc.ResourceType + ".dev", Type: tc.ResourceType, @@ -336,7 +398,7 @@ func TestInstanceTypeAssociation(t *testing.T) { }, }}, // This is manually created to join the edges. - }, `digraph { + }}, `digraph { compound = "true" newrank = "true" subgraph "root" { @@ -383,7 +445,7 @@ func TestInstanceIDAssociation(t *testing.T) { t.Parallel() instanceID, err := cryptorand.String(12) require.NoError(t, err) - resources, err := terraform.ConvertResources(&tfjson.StateModule{ + resources, _, err := terraform.ConvertResourcesAndParameters([]*tfjson.StateModule{{ Resources: []*tfjson.StateResource{{ Address: "coder_agent.dev", Type: "coder_agent", @@ -404,7 +466,7 @@ func TestInstanceIDAssociation(t *testing.T) { }, }}, // This is manually created to join the edges. - }, `digraph { + }}, `digraph { compound = "true" newrank = "true" subgraph "root" { @@ -439,3 +501,14 @@ func sortResources(resources []*proto.Resource) { }) } } + +func sortParameters(parameters []*proto.Parameter) { + sort.Slice(parameters, func(i, j int) bool { + return parameters[i].Name < parameters[j].Name + }) + for _, parameter := range parameters { + sort.Slice(parameter.Options, func(i, j int) bool { + return parameter.Options[i].Name < parameter.Options[j].Name + }) + } +} diff --git a/provisioner/terraform/testdata/generate.sh b/provisioner/terraform/testdata/generate.sh index 41e94f9c207e5..31c922eab3498 100755 --- a/provisioner/terraform/testdata/generate.sh +++ b/provisioner/terraform/testdata/generate.sh @@ -4,6 +4,7 @@ set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")" for d in */; do + d="parameters" pushd "$d" name=$(basename "$(pwd)") terraform init -upgrade @@ -16,4 +17,5 @@ for d in */; do rm terraform.tfstate terraform graph >"$name".tfstate.dot popd + exit 0 done diff --git a/provisioner/terraform/testdata/parameters/parameters.tf b/provisioner/terraform/testdata/parameters/parameters.tf new file mode 100644 index 0000000000000..ad48a4afd9385 --- /dev/null +++ b/provisioner/terraform/testdata/parameters/parameters.tf @@ -0,0 +1,30 @@ +terraform { + required_providers { + coder = { + source = "coder/coder" + version = "0.5.0-pre" + } + } +} + +data "coder_parameter" "example" { + name = "Example" + type = "string" + option { + name = "First Option" + value = "first" + } + option { + name = "Second Option" + value = "second" + } +} + +resource "coder_agent" "dev" { + os = "windows" + arch = "arm64" +} + +resource "null_resource" "dev" { + depends_on = [coder_agent.dev] +} diff --git a/provisioner/terraform/testdata/parameters/parameters.tfplan.dot b/provisioner/terraform/testdata/parameters/parameters.tfplan.dot new file mode 100644 index 0000000000000..b01458bfd999a --- /dev/null +++ b/provisioner/terraform/testdata/parameters/parameters.tfplan.dot @@ -0,0 +1,21 @@ +digraph { + compound = "true" + newrank = "true" + subgraph "root" { + "[root] coder_agent.dev (expand)" [label = "coder_agent.dev", shape = "box"] + "[root] data.coder_parameter.example (expand)" [label = "data.coder_parameter.example", shape = "box"] + "[root] null_resource.dev (expand)" [label = "null_resource.dev", shape = "box"] + "[root] provider[\"registry.terraform.io/coder/coder\"]" [label = "provider[\"registry.terraform.io/coder/coder\"]", shape = "diamond"] + "[root] provider[\"registry.terraform.io/hashicorp/null\"]" [label = "provider[\"registry.terraform.io/hashicorp/null\"]", shape = "diamond"] + "[root] coder_agent.dev (expand)" -> "[root] provider[\"registry.terraform.io/coder/coder\"]" + "[root] data.coder_parameter.example (expand)" -> "[root] provider[\"registry.terraform.io/coder/coder\"]" + "[root] null_resource.dev (expand)" -> "[root] coder_agent.dev (expand)" + "[root] null_resource.dev (expand)" -> "[root] provider[\"registry.terraform.io/hashicorp/null\"]" + "[root] provider[\"registry.terraform.io/coder/coder\"] (close)" -> "[root] coder_agent.dev (expand)" + "[root] provider[\"registry.terraform.io/coder/coder\"] (close)" -> "[root] data.coder_parameter.example (expand)" + "[root] provider[\"registry.terraform.io/hashicorp/null\"] (close)" -> "[root] null_resource.dev (expand)" + "[root] root" -> "[root] provider[\"registry.terraform.io/coder/coder\"] (close)" + "[root] root" -> "[root] provider[\"registry.terraform.io/hashicorp/null\"] (close)" + } +} + diff --git a/provisioner/terraform/testdata/parameters/parameters.tfplan.json b/provisioner/terraform/testdata/parameters/parameters.tfplan.json new file mode 100644 index 0000000000000..6f21186356c4e --- /dev/null +++ b/provisioner/terraform/testdata/parameters/parameters.tfplan.json @@ -0,0 +1,219 @@ +{ + "format_version": "1.1", + "terraform_version": "1.2.8", + "planned_values": { + "root_module": { + "resources": [ + { + "address": "coder_agent.dev", + "mode": "managed", + "type": "coder_agent", + "name": "dev", + "provider_name": "registry.terraform.io/coder/coder", + "schema_version": 0, + "values": { + "arch": "arm64", + "auth": "token", + "dir": null, + "env": null, + "os": "windows", + "startup_script": null + }, + "sensitive_values": {} + }, + { + "address": "null_resource.dev", + "mode": "managed", + "type": "null_resource", + "name": "dev", + "provider_name": "registry.terraform.io/hashicorp/null", + "schema_version": 0, + "values": { + "triggers": null + }, + "sensitive_values": {} + } + ] + } + }, + "resource_changes": [ + { + "address": "coder_agent.dev", + "mode": "managed", + "type": "coder_agent", + "name": "dev", + "provider_name": "registry.terraform.io/coder/coder", + "change": { + "actions": [ + "create" + ], + "before": null, + "after": { + "arch": "arm64", + "auth": "token", + "dir": null, + "env": null, + "os": "windows", + "startup_script": null + }, + "after_unknown": { + "id": true, + "init_script": true, + "token": true + }, + "before_sensitive": false, + "after_sensitive": { + "token": true + } + } + }, + { + "address": "null_resource.dev", + "mode": "managed", + "type": "null_resource", + "name": "dev", + "provider_name": "registry.terraform.io/hashicorp/null", + "change": { + "actions": [ + "create" + ], + "before": null, + "after": { + "triggers": null + }, + "after_unknown": { + "id": true + }, + "before_sensitive": false, + "after_sensitive": {} + } + } + ], + "prior_state": { + "format_version": "1.0", + "terraform_version": "1.2.8", + "values": { + "root_module": { + "resources": [ + { + "address": "data.coder_parameter.example", + "mode": "data", + "type": "coder_parameter", + "name": "example", + "provider_name": "registry.terraform.io/coder/coder", + "schema_version": 0, + "values": { + "default": null, + "description": null, + "icon": null, + "id": "f6ecbde6-cf44-476c-aa07-bf1daf658986", + "mutable": false, + "name": "Example", + "option": [ + { + "description": "", + "icon": "", + "name": "First Option", + "value": "first" + }, + { + "description": "", + "icon": "", + "name": "Second Option", + "value": "second" + } + ], + "type": "string", + "validation": null, + "value": "" + }, + "sensitive_values": { + "option": [ + {}, + {} + ] + } + } + ] + } + } + }, + "configuration": { + "provider_config": { + "coder": { + "name": "coder", + "full_name": "registry.terraform.io/coder/coder", + "version_constraint": "0.5.0-pre" + }, + "null": { + "name": "null", + "full_name": "registry.terraform.io/hashicorp/null" + } + }, + "root_module": { + "resources": [ + { + "address": "coder_agent.dev", + "mode": "managed", + "type": "coder_agent", + "name": "dev", + "provider_config_key": "coder", + "expressions": { + "arch": { + "constant_value": "arm64" + }, + "os": { + "constant_value": "windows" + } + }, + "schema_version": 0 + }, + { + "address": "null_resource.dev", + "mode": "managed", + "type": "null_resource", + "name": "dev", + "provider_config_key": "null", + "schema_version": 0, + "depends_on": [ + "coder_agent.dev" + ] + }, + { + "address": "data.coder_parameter.example", + "mode": "data", + "type": "coder_parameter", + "name": "example", + "provider_config_key": "coder", + "expressions": { + "name": { + "constant_value": "Example" + }, + "option": [ + { + "name": { + "constant_value": "First Option" + }, + "value": { + "constant_value": "first" + } + }, + { + "name": { + "constant_value": "Second Option" + }, + "value": { + "constant_value": "second" + } + } + ], + "type": { + "constant_value": "string" + } + }, + "schema_version": 0 + } + ] + } + } +} diff --git a/provisioner/terraform/testdata/parameters/parameters.tfstate.dot b/provisioner/terraform/testdata/parameters/parameters.tfstate.dot new file mode 100644 index 0000000000000..b01458bfd999a --- /dev/null +++ b/provisioner/terraform/testdata/parameters/parameters.tfstate.dot @@ -0,0 +1,21 @@ +digraph { + compound = "true" + newrank = "true" + subgraph "root" { + "[root] coder_agent.dev (expand)" [label = "coder_agent.dev", shape = "box"] + "[root] data.coder_parameter.example (expand)" [label = "data.coder_parameter.example", shape = "box"] + "[root] null_resource.dev (expand)" [label = "null_resource.dev", shape = "box"] + "[root] provider[\"registry.terraform.io/coder/coder\"]" [label = "provider[\"registry.terraform.io/coder/coder\"]", shape = "diamond"] + "[root] provider[\"registry.terraform.io/hashicorp/null\"]" [label = "provider[\"registry.terraform.io/hashicorp/null\"]", shape = "diamond"] + "[root] coder_agent.dev (expand)" -> "[root] provider[\"registry.terraform.io/coder/coder\"]" + "[root] data.coder_parameter.example (expand)" -> "[root] provider[\"registry.terraform.io/coder/coder\"]" + "[root] null_resource.dev (expand)" -> "[root] coder_agent.dev (expand)" + "[root] null_resource.dev (expand)" -> "[root] provider[\"registry.terraform.io/hashicorp/null\"]" + "[root] provider[\"registry.terraform.io/coder/coder\"] (close)" -> "[root] coder_agent.dev (expand)" + "[root] provider[\"registry.terraform.io/coder/coder\"] (close)" -> "[root] data.coder_parameter.example (expand)" + "[root] provider[\"registry.terraform.io/hashicorp/null\"] (close)" -> "[root] null_resource.dev (expand)" + "[root] root" -> "[root] provider[\"registry.terraform.io/coder/coder\"] (close)" + "[root] root" -> "[root] provider[\"registry.terraform.io/hashicorp/null\"] (close)" + } +} + diff --git a/provisioner/terraform/testdata/parameters/parameters.tfstate.json b/provisioner/terraform/testdata/parameters/parameters.tfstate.json new file mode 100644 index 0000000000000..3327ad4eaf57b --- /dev/null +++ b/provisioner/terraform/testdata/parameters/parameters.tfstate.json @@ -0,0 +1,85 @@ +{ + "format_version": "1.0", + "terraform_version": "1.2.8", + "values": { + "root_module": { + "resources": [ + { + "address": "coder_agent.dev", + "mode": "managed", + "type": "coder_agent", + "name": "dev", + "provider_name": "registry.terraform.io/coder/coder", + "schema_version": 0, + "values": { + "arch": "arm64", + "auth": "token", + "dir": null, + "env": null, + "id": "f7fe5fb5-68eb-4df0-bf69-dc1c536429a5", + "init_script": "", + "os": "windows", + "startup_script": null, + "token": "e9f84ffb-4972-4f5e-bea9-2211f821df22" + }, + "sensitive_values": {} + }, + { + "address": "data.coder_parameter.example", + "mode": "data", + "type": "coder_parameter", + "name": "example", + "provider_name": "registry.terraform.io/coder/coder", + "schema_version": 0, + "values": { + "default": null, + "description": null, + "icon": null, + "id": "c6c42d66-d677-4c75-8a5f-b03f2af7b7cb", + "mutable": false, + "name": "Example", + "option": [ + { + "description": "", + "icon": "", + "name": "First Option", + "value": "first" + }, + { + "description": "", + "icon": "", + "name": "Second Option", + "value": "second" + } + ], + "type": "string", + "validation": null, + "value": "" + }, + "sensitive_values": { + "option": [ + {}, + {} + ] + } + }, + { + "address": "null_resource.dev", + "mode": "managed", + "type": "null_resource", + "name": "dev", + "provider_name": "registry.terraform.io/hashicorp/null", + "schema_version": 0, + "values": { + "id": "2221359697377043150", + "triggers": null + }, + "sensitive_values": {}, + "depends_on": [ + "coder_agent.dev" + ] + } + ] + } + } +} diff --git a/provisionerd/proto/provisionerd.pb.go b/provisionerd/proto/provisionerd.pb.go index ee6f8f9e01cd2..38175d3b592c0 100644 --- a/provisionerd/proto/provisionerd.pb.go +++ b/provisionerd/proto/provisionerd.pb.go @@ -544,10 +544,10 @@ type UpdateJobRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - JobId string `protobuf:"bytes,1,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"` - Logs []*Log `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs,omitempty"` - ParameterSchemas []*proto.ParameterSchema `protobuf:"bytes,3,rep,name=parameter_schemas,json=parameterSchemas,proto3" json:"parameter_schemas,omitempty"` - Readme []byte `protobuf:"bytes,4,opt,name=readme,proto3" json:"readme,omitempty"` + JobId string `protobuf:"bytes,1,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"` + Logs []*Log `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs,omitempty"` + DeprecatedParameterSchemas []*proto.DeprecatedParameterSchema `protobuf:"bytes,3,rep,name=deprecated_parameter_schemas,json=deprecatedParameterSchemas,proto3" json:"deprecated_parameter_schemas,omitempty"` + Readme []byte `protobuf:"bytes,4,opt,name=readme,proto3" json:"readme,omitempty"` } func (x *UpdateJobRequest) Reset() { @@ -596,9 +596,9 @@ func (x *UpdateJobRequest) GetLogs() []*Log { return nil } -func (x *UpdateJobRequest) GetParameterSchemas() []*proto.ParameterSchema { +func (x *UpdateJobRequest) GetDeprecatedParameterSchemas() []*proto.DeprecatedParameterSchema { if x != nil { - return x.ParameterSchemas + return x.DeprecatedParameterSchemas } return nil } @@ -618,7 +618,7 @@ type UpdateJobResponse struct { Canceled bool `protobuf:"varint,1,opt,name=canceled,proto3" json:"canceled,omitempty"` // If parameter schemas are sent, the job will respond // with resolved parameter values. - ParameterValues []*proto.ParameterValue `protobuf:"bytes,2,rep,name=parameter_values,json=parameterValues,proto3" json:"parameter_values,omitempty"` + DeprecatedParameterValues []*proto.ParameterValue `protobuf:"bytes,2,rep,name=deprecated_parameter_values,json=deprecatedParameterValues,proto3" json:"deprecated_parameter_values,omitempty"` } func (x *UpdateJobResponse) Reset() { @@ -660,9 +660,9 @@ func (x *UpdateJobResponse) GetCanceled() bool { return false } -func (x *UpdateJobResponse) GetParameterValues() []*proto.ParameterValue { +func (x *UpdateJobResponse) GetDeprecatedParameterValues() []*proto.ParameterValue { if x != nil { - return x.ParameterValues + return x.DeprecatedParameterValues } return nil } @@ -790,11 +790,12 @@ type AcquiredJob_WorkspaceBuild struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - WorkspaceBuildId string `protobuf:"bytes,1,opt,name=workspace_build_id,json=workspaceBuildId,proto3" json:"workspace_build_id,omitempty"` - WorkspaceName string `protobuf:"bytes,2,opt,name=workspace_name,json=workspaceName,proto3" json:"workspace_name,omitempty"` - ParameterValues []*proto.ParameterValue `protobuf:"bytes,3,rep,name=parameter_values,json=parameterValues,proto3" json:"parameter_values,omitempty"` - Metadata *proto.Provision_Metadata `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` - State []byte `protobuf:"bytes,5,opt,name=state,proto3" json:"state,omitempty"` + WorkspaceBuildId string `protobuf:"bytes,1,opt,name=workspace_build_id,json=workspaceBuildId,proto3" json:"workspace_build_id,omitempty"` + WorkspaceName string `protobuf:"bytes,2,opt,name=workspace_name,json=workspaceName,proto3" json:"workspace_name,omitempty"` + DeprecatedParameterValues []*proto.ParameterValue `protobuf:"bytes,3,rep,name=deprecated_parameter_values,json=deprecatedParameterValues,proto3" json:"deprecated_parameter_values,omitempty"` + ParameterValues []*proto.ParameterValue `protobuf:"bytes,4,rep,name=parameter_values,json=parameterValues,proto3" json:"parameter_values,omitempty"` + Metadata *proto.Provision_Metadata `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"` + State []byte `protobuf:"bytes,6,opt,name=state,proto3" json:"state,omitempty"` } func (x *AcquiredJob_WorkspaceBuild) Reset() { @@ -843,6 +844,13 @@ func (x *AcquiredJob_WorkspaceBuild) GetWorkspaceName() string { return "" } +func (x *AcquiredJob_WorkspaceBuild) GetDeprecatedParameterValues() []*proto.ParameterValue { + if x != nil { + return x.DeprecatedParameterValues + } + return nil +} + func (x *AcquiredJob_WorkspaceBuild) GetParameterValues() []*proto.ParameterValue { if x != nil { return x.ParameterValues @@ -1149,8 +1157,9 @@ type CompletedJob_TemplateImport struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - StartResources []*proto.Resource `protobuf:"bytes,1,rep,name=start_resources,json=startResources,proto3" json:"start_resources,omitempty"` - StopResources []*proto.Resource `protobuf:"bytes,2,rep,name=stop_resources,json=stopResources,proto3" json:"stop_resources,omitempty"` + StartResources []*proto.Resource `protobuf:"bytes,1,rep,name=start_resources,json=startResources,proto3" json:"start_resources,omitempty"` + StopResources []*proto.Resource `protobuf:"bytes,2,rep,name=stop_resources,json=stopResources,proto3" json:"stop_resources,omitempty"` + Parameters []*proto.Parameter `protobuf:"bytes,3,rep,name=parameters,proto3" json:"parameters,omitempty"` } func (x *CompletedJob_TemplateImport) Reset() { @@ -1199,6 +1208,13 @@ func (x *CompletedJob_TemplateImport) GetStopResources() []*proto.Resource { return nil } +func (x *CompletedJob_TemplateImport) GetParameters() []*proto.Parameter { + if x != nil { + return x.Parameters + } + return nil +} + type CompletedJob_TemplateDryRun struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1255,7 +1271,7 @@ var file_provisionerd_proto_provisionerd_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x1a, 0x26, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x07, 0x0a, - 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xac, 0x07, 0x0a, 0x0b, 0x41, 0x63, 0x71, 0x75, 0x69, + 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x89, 0x08, 0x0a, 0x0b, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x12, 0x15, 0x0a, 0x06, 0x6a, 0x6f, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6a, 0x6f, 0x62, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, @@ -1283,172 +1299,185 @@ var file_provisionerd_proto_provisionerd_proto_rawDesc = []byte{ 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x44, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x48, 0x00, 0x52, 0x0e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x44, 0x72, 0x79, - 0x52, 0x75, 0x6e, 0x1a, 0x80, 0x02, 0x0a, 0x0e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, + 0x52, 0x75, 0x6e, 0x1a, 0xdd, 0x02, 0x0a, 0x0e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x77, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x46, 0x0a, 0x10, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, - 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, - 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x4d, 0x0a, 0x0e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, - 0x74, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x3b, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, - 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, - 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x95, 0x01, 0x0a, 0x0e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, - 0x74, 0x65, 0x44, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x12, 0x46, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x5b, 0x0a, 0x1b, 0x64, + 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, + 0x74, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x19, 0x64, + 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x12, 0x3b, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, + 0x12, 0x3b, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x86, 0x03, 0x0a, 0x09, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, - 0x4a, 0x6f, 0x62, 0x12, 0x15, 0x0a, 0x06, 0x6a, 0x6f, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x6a, 0x6f, 0x62, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x12, 0x51, 0x0a, 0x0f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x62, 0x75, - 0x69, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x76, + 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x1a, 0x4d, 0x0a, 0x0e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x49, + 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x3b, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x1a, 0x95, 0x01, 0x0a, 0x0e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x44, + 0x72, 0x79, 0x52, 0x75, 0x6e, 0x12, 0x46, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3b, 0x0a, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x22, 0x86, 0x03, 0x0a, 0x09, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x4a, 0x6f, 0x62, + 0x12, 0x15, 0x0a, 0x06, 0x6a, 0x6f, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x6a, 0x6f, 0x62, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x51, 0x0a, + 0x0f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, + 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x2e, + 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x48, 0x00, + 0x52, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, + 0x12, 0x51, 0x0a, 0x0f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x69, 0x6d, 0x70, + 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x4a, - 0x6f, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x75, 0x69, 0x6c, - 0x64, 0x48, 0x00, 0x52, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x75, - 0x69, 0x6c, 0x64, 0x12, 0x51, 0x0a, 0x0f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, - 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, - 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x46, 0x61, 0x69, 0x6c, - 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x49, 0x6d, - 0x70, 0x6f, 0x72, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, - 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x52, 0x0a, 0x10, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, - 0x74, 0x65, 0x5f, 0x64, 0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, - 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, - 0x74, 0x65, 0x44, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x48, 0x00, 0x52, 0x0e, 0x74, 0x65, 0x6d, 0x70, - 0x6c, 0x61, 0x74, 0x65, 0x44, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x1a, 0x26, 0x0a, 0x0e, 0x57, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x12, 0x14, 0x0a, 0x05, - 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, - 0x74, 0x65, 0x1a, 0x10, 0x0a, 0x0e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x49, 0x6d, - 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x10, 0x0a, 0x0e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, - 0x44, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xe5, - 0x04, 0x0a, 0x0c, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x12, - 0x15, 0x0a, 0x06, 0x6a, 0x6f, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x6a, 0x6f, 0x62, 0x49, 0x64, 0x12, 0x54, 0x0a, 0x0f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x43, - 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x48, 0x00, 0x52, 0x0e, 0x77, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x12, 0x54, 0x0a, 0x0f, - 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, - 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x4a, 0x6f, - 0x62, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, - 0x48, 0x00, 0x52, 0x0e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x49, 0x6d, 0x70, 0x6f, - 0x72, 0x74, 0x12, 0x55, 0x0a, 0x10, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x64, - 0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, + 0x6f, 0x62, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, + 0x74, 0x48, 0x00, 0x52, 0x0e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x49, 0x6d, 0x70, + 0x6f, 0x72, 0x74, 0x12, 0x52, 0x0a, 0x10, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, + 0x64, 0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x46, 0x61, 0x69, + 0x6c, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x44, + 0x72, 0x79, 0x52, 0x75, 0x6e, 0x48, 0x00, 0x52, 0x0e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, + 0x65, 0x44, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x1a, 0x26, 0x0a, 0x0e, 0x57, 0x6f, 0x72, 0x6b, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, + 0x10, 0x0a, 0x0e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, + 0x74, 0x1a, 0x10, 0x0a, 0x0e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x44, 0x72, 0x79, + 0x52, 0x75, 0x6e, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x9d, 0x05, 0x0a, 0x0c, + 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x12, 0x15, 0x0a, 0x06, + 0x6a, 0x6f, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6a, 0x6f, + 0x62, 0x49, 0x64, 0x12, 0x54, 0x0a, 0x0f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x43, 0x6f, 0x6d, 0x70, - 0x6c, 0x65, 0x74, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, - 0x65, 0x44, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x48, 0x00, 0x52, 0x0e, 0x74, 0x65, 0x6d, 0x70, 0x6c, - 0x61, 0x74, 0x65, 0x44, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x1a, 0x5b, 0x0a, 0x0e, 0x57, 0x6f, 0x72, - 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, - 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, - 0x65, 0x12, 0x33, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, - 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x1a, 0x8e, 0x01, 0x0a, 0x0e, 0x54, 0x65, 0x6d, 0x70, 0x6c, - 0x61, 0x74, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x3e, 0x0a, 0x0f, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, - 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x0e, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x3c, 0x0a, 0x0e, 0x73, 0x74, 0x6f, - 0x70, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x6c, 0x65, 0x74, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x48, 0x00, 0x52, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x12, 0x54, 0x0a, 0x0f, 0x74, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, + 0x64, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x2e, 0x54, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x48, 0x00, 0x52, + 0x0e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, + 0x55, 0x0a, 0x10, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x64, 0x72, 0x79, 0x5f, + 0x72, 0x75, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, + 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x44, 0x72, + 0x79, 0x52, 0x75, 0x6e, 0x48, 0x00, 0x52, 0x0e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x44, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x1a, 0x5b, 0x0a, 0x0e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x33, + 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x0d, 0x73, 0x74, 0x6f, 0x70, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x1a, 0x45, 0x0a, 0x0e, 0x54, 0x65, 0x6d, 0x70, 0x6c, - 0x61, 0x74, 0x65, 0x44, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x12, 0x33, 0x0a, 0x09, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, - 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x42, 0x06, - 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xb0, 0x01, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x2f, - 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, - 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x4c, 0x6f, - 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, - 0x2b, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, - 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, - 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, - 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, - 0x74, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x67, - 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0xb3, 0x01, 0x0a, 0x10, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, - 0x0a, 0x06, 0x6a, 0x6f, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x6a, 0x6f, 0x62, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, - 0x72, 0x64, 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0x49, 0x0a, 0x11, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x1a, 0xc6, 0x01, 0x0a, 0x0e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x3e, 0x0a, 0x0f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x52, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x0e, 0x73, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x3c, 0x0a, 0x0e, 0x73, 0x74, 0x6f, 0x70, 0x5f, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, + 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x0d, 0x73, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x12, 0x36, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x45, 0x0a, 0x0e, + 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x44, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x12, 0x33, + 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xb0, 0x01, 0x0a, 0x03, + 0x4c, 0x6f, 0x67, 0x12, 0x2f, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, + 0x72, 0x64, 0x2e, 0x4c, 0x6f, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x06, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, + 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, + 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x73, 0x74, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0xd2, + 0x01, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x6a, 0x6f, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x6a, 0x6f, 0x62, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x04, 0x6c, 0x6f, + 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x04, 0x6c, 0x6f, 0x67, + 0x73, 0x12, 0x68, 0x0a, 0x1c, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x10, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x64, 0x6d, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x72, 0x65, 0x61, 0x64, 0x6d, 0x65, 0x22, - 0x77, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x65, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x65, 0x64, - 0x12, 0x46, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x76, 0x61, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, + 0x1a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x72, + 0x65, 0x61, 0x64, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x72, 0x65, 0x61, + 0x64, 0x6d, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4a, 0x6f, + 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x6e, + 0x63, 0x65, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x63, 0x61, 0x6e, + 0x63, 0x65, 0x6c, 0x65, 0x64, 0x12, 0x5b, 0x0a, 0x1b, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x4a, 0x0a, 0x12, 0x43, 0x6f, 0x6d, 0x6d, - 0x69, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, - 0x0a, 0x06, 0x6a, 0x6f, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x6a, 0x6f, 0x62, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x61, 0x69, 0x6c, 0x79, 0x5f, 0x63, - 0x6f, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x64, 0x61, 0x69, 0x6c, 0x79, - 0x43, 0x6f, 0x73, 0x74, 0x22, 0x68, 0x0a, 0x13, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x51, 0x75, - 0x6f, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, - 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x12, 0x29, 0x0a, 0x10, 0x63, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x43, 0x6f, - 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x64, 0x67, 0x65, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x75, 0x64, 0x67, 0x65, 0x74, 0x2a, 0x34, - 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x50, - 0x52, 0x4f, 0x56, 0x49, 0x53, 0x49, 0x4f, 0x4e, 0x45, 0x52, 0x5f, 0x44, 0x41, 0x45, 0x4d, 0x4f, - 0x4e, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x53, 0x49, 0x4f, 0x4e, - 0x45, 0x52, 0x10, 0x01, 0x32, 0xec, 0x02, 0x0a, 0x11, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, - 0x6f, 0x6e, 0x65, 0x72, 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x12, 0x3c, 0x0a, 0x0a, 0x41, 0x63, - 0x71, 0x75, 0x69, 0x72, 0x65, 0x4a, 0x6f, 0x62, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, - 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x19, 0x2e, - 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x41, 0x63, 0x71, - 0x75, 0x69, 0x72, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x12, 0x52, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, - 0x69, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x51, 0x75, 0x6f, - 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x76, - 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x51, - 0x75, 0x6f, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x09, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4a, 0x6f, 0x62, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x76, - 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4a, - 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, - 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4a, - 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x46, 0x61, - 0x69, 0x6c, 0x4a, 0x6f, 0x62, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, - 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x1a, 0x13, - 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x12, 0x3e, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x4a, - 0x6f, 0x62, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, - 0x64, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x1a, 0x13, - 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x42, 0x2b, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2f, 0x70, 0x72, - 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x19, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, + 0x74, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x22, 0x4a, 0x0a, 0x12, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x51, 0x75, 0x6f, 0x74, + 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x6a, 0x6f, 0x62, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6a, 0x6f, 0x62, 0x49, 0x64, 0x12, + 0x1d, 0x0a, 0x0a, 0x64, 0x61, 0x69, 0x6c, 0x79, 0x5f, 0x63, 0x6f, 0x73, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x09, 0x64, 0x61, 0x69, 0x6c, 0x79, 0x43, 0x6f, 0x73, 0x74, 0x22, 0x68, + 0x0a, 0x13, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, + 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x0f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x64, + 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x64, 0x67, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x06, 0x62, 0x75, 0x64, 0x67, 0x65, 0x74, 0x2a, 0x34, 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x53, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x53, 0x49, + 0x4f, 0x4e, 0x45, 0x52, 0x5f, 0x44, 0x41, 0x45, 0x4d, 0x4f, 0x4e, 0x10, 0x00, 0x12, 0x0f, 0x0a, + 0x0b, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x53, 0x49, 0x4f, 0x4e, 0x45, 0x52, 0x10, 0x01, 0x32, 0xec, + 0x02, 0x0a, 0x11, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x44, 0x61, + 0x65, 0x6d, 0x6f, 0x6e, 0x12, 0x3c, 0x0a, 0x0a, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x4a, + 0x6f, 0x62, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, + 0x64, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x4a, + 0x6f, 0x62, 0x12, 0x52, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x51, 0x75, 0x6f, 0x74, + 0x61, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, + 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, + 0x72, 0x64, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x4a, 0x6f, 0x62, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, + 0x72, 0x64, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, + 0x72, 0x64, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x46, 0x61, 0x69, 0x6c, 0x4a, 0x6f, 0x62, 0x12, + 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x46, + 0x61, 0x69, 0x6c, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3e, 0x0a, + 0x0b, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x4a, 0x6f, 0x62, 0x12, 0x1a, 0x2e, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x43, 0x6f, 0x6d, 0x70, + 0x6c, 0x65, 0x74, 0x65, 0x64, 0x4a, 0x6f, 0x62, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x2b, 0x5a, + 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x64, 0x65, + 0x72, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -1466,30 +1495,31 @@ func file_provisionerd_proto_provisionerd_proto_rawDescGZIP() []byte { var file_provisionerd_proto_provisionerd_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_provisionerd_proto_provisionerd_proto_msgTypes = make([]protoimpl.MessageInfo, 18) var file_provisionerd_proto_provisionerd_proto_goTypes = []interface{}{ - (LogSource)(0), // 0: provisionerd.LogSource - (*Empty)(nil), // 1: provisionerd.Empty - (*AcquiredJob)(nil), // 2: provisionerd.AcquiredJob - (*FailedJob)(nil), // 3: provisionerd.FailedJob - (*CompletedJob)(nil), // 4: provisionerd.CompletedJob - (*Log)(nil), // 5: provisionerd.Log - (*UpdateJobRequest)(nil), // 6: provisionerd.UpdateJobRequest - (*UpdateJobResponse)(nil), // 7: provisionerd.UpdateJobResponse - (*CommitQuotaRequest)(nil), // 8: provisionerd.CommitQuotaRequest - (*CommitQuotaResponse)(nil), // 9: provisionerd.CommitQuotaResponse - (*AcquiredJob_WorkspaceBuild)(nil), // 10: provisionerd.AcquiredJob.WorkspaceBuild - (*AcquiredJob_TemplateImport)(nil), // 11: provisionerd.AcquiredJob.TemplateImport - (*AcquiredJob_TemplateDryRun)(nil), // 12: provisionerd.AcquiredJob.TemplateDryRun - (*FailedJob_WorkspaceBuild)(nil), // 13: provisionerd.FailedJob.WorkspaceBuild - (*FailedJob_TemplateImport)(nil), // 14: provisionerd.FailedJob.TemplateImport - (*FailedJob_TemplateDryRun)(nil), // 15: provisionerd.FailedJob.TemplateDryRun - (*CompletedJob_WorkspaceBuild)(nil), // 16: provisionerd.CompletedJob.WorkspaceBuild - (*CompletedJob_TemplateImport)(nil), // 17: provisionerd.CompletedJob.TemplateImport - (*CompletedJob_TemplateDryRun)(nil), // 18: provisionerd.CompletedJob.TemplateDryRun - (proto.LogLevel)(0), // 19: provisioner.LogLevel - (*proto.ParameterSchema)(nil), // 20: provisioner.ParameterSchema - (*proto.ParameterValue)(nil), // 21: provisioner.ParameterValue - (*proto.Provision_Metadata)(nil), // 22: provisioner.Provision.Metadata - (*proto.Resource)(nil), // 23: provisioner.Resource + (LogSource)(0), // 0: provisionerd.LogSource + (*Empty)(nil), // 1: provisionerd.Empty + (*AcquiredJob)(nil), // 2: provisionerd.AcquiredJob + (*FailedJob)(nil), // 3: provisionerd.FailedJob + (*CompletedJob)(nil), // 4: provisionerd.CompletedJob + (*Log)(nil), // 5: provisionerd.Log + (*UpdateJobRequest)(nil), // 6: provisionerd.UpdateJobRequest + (*UpdateJobResponse)(nil), // 7: provisionerd.UpdateJobResponse + (*CommitQuotaRequest)(nil), // 8: provisionerd.CommitQuotaRequest + (*CommitQuotaResponse)(nil), // 9: provisionerd.CommitQuotaResponse + (*AcquiredJob_WorkspaceBuild)(nil), // 10: provisionerd.AcquiredJob.WorkspaceBuild + (*AcquiredJob_TemplateImport)(nil), // 11: provisionerd.AcquiredJob.TemplateImport + (*AcquiredJob_TemplateDryRun)(nil), // 12: provisionerd.AcquiredJob.TemplateDryRun + (*FailedJob_WorkspaceBuild)(nil), // 13: provisionerd.FailedJob.WorkspaceBuild + (*FailedJob_TemplateImport)(nil), // 14: provisionerd.FailedJob.TemplateImport + (*FailedJob_TemplateDryRun)(nil), // 15: provisionerd.FailedJob.TemplateDryRun + (*CompletedJob_WorkspaceBuild)(nil), // 16: provisionerd.CompletedJob.WorkspaceBuild + (*CompletedJob_TemplateImport)(nil), // 17: provisionerd.CompletedJob.TemplateImport + (*CompletedJob_TemplateDryRun)(nil), // 18: provisionerd.CompletedJob.TemplateDryRun + (proto.LogLevel)(0), // 19: provisioner.LogLevel + (*proto.DeprecatedParameterSchema)(nil), // 20: provisioner.DeprecatedParameterSchema + (*proto.ParameterValue)(nil), // 21: provisioner.ParameterValue + (*proto.Provision_Metadata)(nil), // 22: provisioner.Provision.Metadata + (*proto.Resource)(nil), // 23: provisioner.Resource + (*proto.Parameter)(nil), // 24: provisioner.Parameter } var file_provisionerd_proto_provisionerd_proto_depIdxs = []int32{ 10, // 0: provisionerd.AcquiredJob.workspace_build:type_name -> provisionerd.AcquiredJob.WorkspaceBuild @@ -1504,32 +1534,34 @@ var file_provisionerd_proto_provisionerd_proto_depIdxs = []int32{ 0, // 9: provisionerd.Log.source:type_name -> provisionerd.LogSource 19, // 10: provisionerd.Log.level:type_name -> provisioner.LogLevel 5, // 11: provisionerd.UpdateJobRequest.logs:type_name -> provisionerd.Log - 20, // 12: provisionerd.UpdateJobRequest.parameter_schemas:type_name -> provisioner.ParameterSchema - 21, // 13: provisionerd.UpdateJobResponse.parameter_values:type_name -> provisioner.ParameterValue - 21, // 14: provisionerd.AcquiredJob.WorkspaceBuild.parameter_values:type_name -> provisioner.ParameterValue - 22, // 15: provisionerd.AcquiredJob.WorkspaceBuild.metadata:type_name -> provisioner.Provision.Metadata - 22, // 16: provisionerd.AcquiredJob.TemplateImport.metadata:type_name -> provisioner.Provision.Metadata - 21, // 17: provisionerd.AcquiredJob.TemplateDryRun.parameter_values:type_name -> provisioner.ParameterValue - 22, // 18: provisionerd.AcquiredJob.TemplateDryRun.metadata:type_name -> provisioner.Provision.Metadata - 23, // 19: provisionerd.CompletedJob.WorkspaceBuild.resources:type_name -> provisioner.Resource - 23, // 20: provisionerd.CompletedJob.TemplateImport.start_resources:type_name -> provisioner.Resource - 23, // 21: provisionerd.CompletedJob.TemplateImport.stop_resources:type_name -> provisioner.Resource - 23, // 22: provisionerd.CompletedJob.TemplateDryRun.resources:type_name -> provisioner.Resource - 1, // 23: provisionerd.ProvisionerDaemon.AcquireJob:input_type -> provisionerd.Empty - 8, // 24: provisionerd.ProvisionerDaemon.CommitQuota:input_type -> provisionerd.CommitQuotaRequest - 6, // 25: provisionerd.ProvisionerDaemon.UpdateJob:input_type -> provisionerd.UpdateJobRequest - 3, // 26: provisionerd.ProvisionerDaemon.FailJob:input_type -> provisionerd.FailedJob - 4, // 27: provisionerd.ProvisionerDaemon.CompleteJob:input_type -> provisionerd.CompletedJob - 2, // 28: provisionerd.ProvisionerDaemon.AcquireJob:output_type -> provisionerd.AcquiredJob - 9, // 29: provisionerd.ProvisionerDaemon.CommitQuota:output_type -> provisionerd.CommitQuotaResponse - 7, // 30: provisionerd.ProvisionerDaemon.UpdateJob:output_type -> provisionerd.UpdateJobResponse - 1, // 31: provisionerd.ProvisionerDaemon.FailJob:output_type -> provisionerd.Empty - 1, // 32: provisionerd.ProvisionerDaemon.CompleteJob:output_type -> provisionerd.Empty - 28, // [28:33] is the sub-list for method output_type - 23, // [23:28] is the sub-list for method input_type - 23, // [23:23] is the sub-list for extension type_name - 23, // [23:23] is the sub-list for extension extendee - 0, // [0:23] is the sub-list for field type_name + 20, // 12: provisionerd.UpdateJobRequest.deprecated_parameter_schemas:type_name -> provisioner.DeprecatedParameterSchema + 21, // 13: provisionerd.UpdateJobResponse.deprecated_parameter_values:type_name -> provisioner.ParameterValue + 21, // 14: provisionerd.AcquiredJob.WorkspaceBuild.deprecated_parameter_values:type_name -> provisioner.ParameterValue + 21, // 15: provisionerd.AcquiredJob.WorkspaceBuild.parameter_values:type_name -> provisioner.ParameterValue + 22, // 16: provisionerd.AcquiredJob.WorkspaceBuild.metadata:type_name -> provisioner.Provision.Metadata + 22, // 17: provisionerd.AcquiredJob.TemplateImport.metadata:type_name -> provisioner.Provision.Metadata + 21, // 18: provisionerd.AcquiredJob.TemplateDryRun.parameter_values:type_name -> provisioner.ParameterValue + 22, // 19: provisionerd.AcquiredJob.TemplateDryRun.metadata:type_name -> provisioner.Provision.Metadata + 23, // 20: provisionerd.CompletedJob.WorkspaceBuild.resources:type_name -> provisioner.Resource + 23, // 21: provisionerd.CompletedJob.TemplateImport.start_resources:type_name -> provisioner.Resource + 23, // 22: provisionerd.CompletedJob.TemplateImport.stop_resources:type_name -> provisioner.Resource + 24, // 23: provisionerd.CompletedJob.TemplateImport.parameters:type_name -> provisioner.Parameter + 23, // 24: provisionerd.CompletedJob.TemplateDryRun.resources:type_name -> provisioner.Resource + 1, // 25: provisionerd.ProvisionerDaemon.AcquireJob:input_type -> provisionerd.Empty + 8, // 26: provisionerd.ProvisionerDaemon.CommitQuota:input_type -> provisionerd.CommitQuotaRequest + 6, // 27: provisionerd.ProvisionerDaemon.UpdateJob:input_type -> provisionerd.UpdateJobRequest + 3, // 28: provisionerd.ProvisionerDaemon.FailJob:input_type -> provisionerd.FailedJob + 4, // 29: provisionerd.ProvisionerDaemon.CompleteJob:input_type -> provisionerd.CompletedJob + 2, // 30: provisionerd.ProvisionerDaemon.AcquireJob:output_type -> provisionerd.AcquiredJob + 9, // 31: provisionerd.ProvisionerDaemon.CommitQuota:output_type -> provisionerd.CommitQuotaResponse + 7, // 32: provisionerd.ProvisionerDaemon.UpdateJob:output_type -> provisionerd.UpdateJobResponse + 1, // 33: provisionerd.ProvisionerDaemon.FailJob:output_type -> provisionerd.Empty + 1, // 34: provisionerd.ProvisionerDaemon.CompleteJob:output_type -> provisionerd.Empty + 30, // [30:35] is the sub-list for method output_type + 25, // [25:30] is the sub-list for method input_type + 25, // [25:25] is the sub-list for extension type_name + 25, // [25:25] is the sub-list for extension extendee + 0, // [0:25] is the sub-list for field type_name } func init() { file_provisionerd_proto_provisionerd_proto_init() } diff --git a/provisionerd/proto/provisionerd.proto b/provisionerd/proto/provisionerd.proto index 6f9fbb53db5da..994d11374245d 100644 --- a/provisionerd/proto/provisionerd.proto +++ b/provisionerd/proto/provisionerd.proto @@ -14,9 +14,10 @@ message AcquiredJob { message WorkspaceBuild { string workspace_build_id = 1; string workspace_name = 2; - repeated provisioner.ParameterValue parameter_values = 3; - provisioner.Provision.Metadata metadata = 4; - bytes state = 5; + repeated provisioner.ParameterValue deprecated_parameter_values = 3; + repeated provisioner.ParameterValue parameter_values = 4; + provisioner.Provision.Metadata metadata = 5; + bytes state = 6; } message TemplateImport { provisioner.Provision.Metadata metadata = 1; @@ -63,6 +64,7 @@ message CompletedJob { message TemplateImport { repeated provisioner.Resource start_resources = 1; repeated provisioner.Resource stop_resources = 2; + repeated provisioner.Parameter parameters = 3; } message TemplateDryRun { repeated provisioner.Resource resources = 1; @@ -95,7 +97,7 @@ message Log { message UpdateJobRequest { string job_id = 1; repeated Log logs = 2; - repeated provisioner.ParameterSchema parameter_schemas = 3; + repeated provisioner.DeprecatedParameterSchema deprecated_parameter_schemas = 3; bytes readme = 4; } @@ -103,7 +105,7 @@ message UpdateJobResponse { bool canceled = 1; // If parameter schemas are sent, the job will respond // with resolved parameter values. - repeated provisioner.ParameterValue parameter_values = 2; + repeated provisioner.ParameterValue deprecated_parameter_values = 2; } message CommitQuotaRequest { diff --git a/provisionerd/provisionerd_test.go b/provisionerd/provisionerd_test.go index ec885a9a7fd98..b2bc3e61d12b3 100644 --- a/provisionerd/provisionerd_test.go +++ b/provisionerd/provisionerd_test.go @@ -130,7 +130,7 @@ func TestProvisionerd(t *testing.T) { }), nil }, provisionerd.Provisioners{ "someprovisioner": createProvisionerClient(t, provisionerTestServer{ - parse: func(request *sdkproto.Parse_Request, stream sdkproto.DRPCProvisioner_ParseStream) error { + deprecatedParse: func(request *sdkproto.DeprecatedParse_Request, stream sdkproto.DRPCProvisioner_DeprecatedParseStream) error { closerMutex.Lock() defer closerMutex.Unlock() return closer.Close() @@ -213,7 +213,7 @@ func TestProvisionerd(t *testing.T) { }), nil }, provisionerd.Provisioners{ "someprovisioner": createProvisionerClient(t, provisionerTestServer{ - parse: func(request *sdkproto.Parse_Request, stream sdkproto.DRPCProvisioner_ParseStream) error { + deprecatedParse: func(request *sdkproto.DeprecatedParse_Request, stream sdkproto.DRPCProvisioner_DeprecatedParseStream) error { <-stream.Context().Done() return nil }, @@ -273,13 +273,13 @@ func TestProvisionerd(t *testing.T) { }), nil }, provisionerd.Provisioners{ "someprovisioner": createProvisionerClient(t, provisionerTestServer{ - parse: func(request *sdkproto.Parse_Request, stream sdkproto.DRPCProvisioner_ParseStream) error { + deprecatedParse: func(request *sdkproto.DeprecatedParse_Request, stream sdkproto.DRPCProvisioner_DeprecatedParseStream) error { data, err := os.ReadFile(filepath.Join(request.Directory, "test.txt")) require.NoError(t, err) require.Equal(t, "content", string(data)) - err = stream.Send(&sdkproto.Parse_Response{ - Type: &sdkproto.Parse_Response_Log{ + err = stream.Send(&sdkproto.DeprecatedParse_Response{ + Type: &sdkproto.DeprecatedParse_Response_Log{ Log: &sdkproto.Log{ Level: sdkproto.LogLevel_INFO, Output: "hello", @@ -288,9 +288,9 @@ func TestProvisionerd(t *testing.T) { }) require.NoError(t, err) - err = stream.Send(&sdkproto.Parse_Response{ - Type: &sdkproto.Parse_Response_Complete{ - Complete: &sdkproto.Parse_Complete{}, + err = stream.Send(&sdkproto.DeprecatedParse_Response{ + Type: &sdkproto.DeprecatedParse_Response_Complete{ + Complete: &sdkproto.DeprecatedParse_Complete{}, }, }) require.NoError(t, err) @@ -342,14 +342,12 @@ func TestProvisionerd(t *testing.T) { parameterValues = []*sdkproto.ParameterValue{ { - DestinationScheme: sdkproto.ParameterDestination_PROVISIONER_VARIABLE, - Name: "test_var", - Value: "dean was here", + Name: "test_var", + Value: "dean was here", }, { - DestinationScheme: sdkproto.ParameterDestination_PROVISIONER_VARIABLE, - Name: "test_var_2", - Value: "1234", + Name: "test_var_2", + Value: "1234", }, } metadata = &sdkproto.Provision_Metadata{} @@ -1116,12 +1114,12 @@ func createProvisionerClient(t *testing.T, server provisionerTestServer) sdkprot } type provisionerTestServer struct { - parse func(request *sdkproto.Parse_Request, stream sdkproto.DRPCProvisioner_ParseStream) error - provision func(stream sdkproto.DRPCProvisioner_ProvisionStream) error + deprecatedParse func(request *sdkproto.DeprecatedParse_Request, stream sdkproto.DRPCProvisioner_DeprecatedParseStream) error + provision func(stream sdkproto.DRPCProvisioner_ProvisionStream) error } -func (p *provisionerTestServer) Parse(request *sdkproto.Parse_Request, stream sdkproto.DRPCProvisioner_ParseStream) error { - return p.parse(request, stream) +func (p *provisionerTestServer) DeprecatedParse(request *sdkproto.DeprecatedParse_Request, stream sdkproto.DRPCProvisioner_DeprecatedParseStream) error { + return p.deprecatedParse(request, stream) } func (p *provisionerTestServer) Provision(stream sdkproto.DRPCProvisioner_ProvisionStream) error { diff --git a/provisionerd/runner/runner.go b/provisionerd/runner/runner.go index 927b57fbec72f..015f4aec5c299 100644 --- a/provisionerd/runner/runner.go +++ b/provisionerd/runner/runner.go @@ -188,7 +188,7 @@ func (r *Runner) Run() { if err != nil { r.logger.Error(ctx, "send FailJob", slog.Error(err)) } else { - r.logger.Info(ctx, "sent FailedJob") + r.logger.Info(ctx, "sent FailedJob", slog.F("error", r.failedJob.Error)) } } else { r.logger.Debug(ctx, "sending CompletedJob") @@ -536,23 +536,23 @@ func (r *Runner) runTemplateImport(ctx context.Context) (*proto.CompletedJob, *p Stage: "Parsing template parameters", CreatedAt: time.Now().UnixMilli(), }) - parameterSchemas, err := r.runTemplateImportParse(ctx) + deprecatedParameterSchemas, err := r.runTemplateImportParse(ctx) if err != nil { return nil, r.failedJobf("run parse: %s", err) } updateResponse, err := r.update(ctx, &proto.UpdateJobRequest{ - JobId: r.job.JobId, - ParameterSchemas: parameterSchemas, + JobId: r.job.JobId, + DeprecatedParameterSchemas: deprecatedParameterSchemas, }) if err != nil { return nil, r.failedJobf("update job: %s", err) } valueByName := map[string]*sdkproto.ParameterValue{} - for _, parameterValue := range updateResponse.ParameterValues { + for _, parameterValue := range updateResponse.DeprecatedParameterValues { valueByName[parameterValue.Name] = parameterValue } - for _, parameterSchema := range parameterSchemas { + for _, parameterSchema := range deprecatedParameterSchemas { _, ok := valueByName[parameterSchema.Name] if !ok { return nil, r.failedJobf("%s: %s", MissingParameterErrorText, parameterSchema.Name) @@ -566,7 +566,7 @@ func (r *Runner) runTemplateImport(ctx context.Context) (*proto.CompletedJob, *p Stage: "Detecting persistent resources", CreatedAt: time.Now().UnixMilli(), }) - startResources, err := r.runTemplateImportProvision(ctx, updateResponse.ParameterValues, &sdkproto.Provision_Metadata{ + startResources, parameters, err := r.runTemplateImportProvision(ctx, updateResponse.DeprecatedParameterValues, &sdkproto.Provision_Metadata{ CoderUrl: r.job.GetTemplateImport().Metadata.CoderUrl, WorkspaceTransition: sdkproto.WorkspaceTransition_START, }) @@ -581,7 +581,7 @@ func (r *Runner) runTemplateImport(ctx context.Context) (*proto.CompletedJob, *p Stage: "Detecting ephemeral resources", CreatedAt: time.Now().UnixMilli(), }) - stopResources, err := r.runTemplateImportProvision(ctx, updateResponse.ParameterValues, &sdkproto.Provision_Metadata{ + stopResources, _, err := r.runTemplateImportProvision(ctx, updateResponse.DeprecatedParameterValues, &sdkproto.Provision_Metadata{ CoderUrl: r.job.GetTemplateImport().Metadata.CoderUrl, WorkspaceTransition: sdkproto.WorkspaceTransition_STOP, }) @@ -595,17 +595,18 @@ func (r *Runner) runTemplateImport(ctx context.Context) (*proto.CompletedJob, *p TemplateImport: &proto.CompletedJob_TemplateImport{ StartResources: startResources, StopResources: stopResources, + Parameters: parameters, }, }, }, nil } // Parses parameter schemas from source. -func (r *Runner) runTemplateImportParse(ctx context.Context) ([]*sdkproto.ParameterSchema, error) { +func (r *Runner) runTemplateImportParse(ctx context.Context) ([]*sdkproto.DeprecatedParameterSchema, error) { ctx, span := r.startTrace(ctx, tracing.FuncName()) defer span.End() - stream, err := r.provisioner.Parse(ctx, &sdkproto.Parse_Request{ + stream, err := r.provisioner.DeprecatedParse(ctx, &sdkproto.DeprecatedParse_Request{ Directory: r.workDirectory, }) if err != nil { @@ -618,7 +619,7 @@ func (r *Runner) runTemplateImportParse(ctx context.Context) ([]*sdkproto.Parame return nil, xerrors.Errorf("recv parse source: %w", err) } switch msgType := msg.Type.(type) { - case *sdkproto.Parse_Response_Log: + case *sdkproto.DeprecatedParse_Response_Log: r.logger.Debug(context.Background(), "parse job logged", slog.F("level", msgType.Log.Level), slog.F("output", msgType.Log.Output), @@ -631,7 +632,7 @@ func (r *Runner) runTemplateImportParse(ctx context.Context) ([]*sdkproto.Parame Output: msgType.Log.Output, Stage: "Parse parameters", }) - case *sdkproto.Parse_Response_Complete: + case *sdkproto.DeprecatedParse_Response_Complete: r.logger.Info(context.Background(), "parse complete", slog.F("parameter_schemas", msgType.Complete.ParameterSchemas)) @@ -646,7 +647,7 @@ func (r *Runner) runTemplateImportParse(ctx context.Context) ([]*sdkproto.Parame // Performs a dry-run provision when importing a template. // This is used to detect resources that would be provisioned // for a workspace in various states. -func (r *Runner) runTemplateImportProvision(ctx context.Context, values []*sdkproto.ParameterValue, metadata *sdkproto.Provision_Metadata) ([]*sdkproto.Resource, error) { +func (r *Runner) runTemplateImportProvision(ctx context.Context, values []*sdkproto.ParameterValue, metadata *sdkproto.Provision_Metadata) ([]*sdkproto.Resource, []*sdkproto.Parameter, error) { ctx, span := r.startTrace(ctx, tracing.FuncName()) defer span.End() @@ -661,7 +662,7 @@ func (r *Runner) runTemplateImportProvision(ctx context.Context, values []*sdkpr // to send the cancel to the provisioner stream, err := r.provisioner.Provision(ctx) if err != nil { - return nil, xerrors.Errorf("provision: %w", err) + return nil, nil, xerrors.Errorf("provision: %w", err) } defer stream.Close() go func() { @@ -688,13 +689,13 @@ func (r *Runner) runTemplateImportProvision(ctx context.Context, values []*sdkpr }, }) if err != nil { - return nil, xerrors.Errorf("start provision: %w", err) + return nil, nil, xerrors.Errorf("start provision: %w", err) } for { msg, err := stream.Recv() if err != nil { - return nil, xerrors.Errorf("recv import provision: %w", err) + return nil, nil, xerrors.Errorf("recv import provision: %w", err) } switch msgType := msg.Type.(type) { case *sdkproto.Provision_Response_Log: @@ -715,7 +716,7 @@ func (r *Runner) runTemplateImportProvision(ctx context.Context, values []*sdkpr slog.F("error", msgType.Complete.Error), ) - return nil, xerrors.New(msgType.Complete.Error) + return nil, nil, xerrors.New(msgType.Complete.Error) } r.logger.Info(context.Background(), "parse dry-run provision successful", @@ -724,10 +725,9 @@ func (r *Runner) runTemplateImportProvision(ctx context.Context, values []*sdkpr slog.F("state_length", len(msgType.Complete.State)), ) - return msgType.Complete.Resources, nil + return msgType.Complete.Resources, msgType.Complete.Parameters, nil default: - return nil, xerrors.Errorf("invalid message type %q received from provisioner", - reflect.TypeOf(msg.Type).String()) + return nil, nil, xerrors.Errorf("invalid message type %T received from provisioner", msg) } } } @@ -765,7 +765,7 @@ func (r *Runner) runTemplateDryRun(ctx context.Context) (*proto.CompletedJob, *p } // Run the template import provision task since it's already a dry run. - resources, err := r.runTemplateImportProvision(ctx, + resources, _, err := r.runTemplateImportProvision(ctx, r.job.GetTemplateDryRun().GetParameterValues(), metadata, ) diff --git a/provisionersdk/proto/provisioner.pb.go b/provisionersdk/proto/provisioner.pb.go index c9b60b6a9ba3e..cb2115e15c11a 100644 --- a/provisionersdk/proto/provisioner.pb.go +++ b/provisionersdk/proto/provisioner.pb.go @@ -174,139 +174,93 @@ func (WorkspaceTransition) EnumDescriptor() ([]byte, []int) { return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{2} } -type ParameterSource_Scheme int32 +type DeprecatedParameterSource_Scheme int32 const ( - ParameterSource_DATA ParameterSource_Scheme = 0 + DeprecatedParameterSource_DATA DeprecatedParameterSource_Scheme = 0 ) -// Enum value maps for ParameterSource_Scheme. +// Enum value maps for DeprecatedParameterSource_Scheme. var ( - ParameterSource_Scheme_name = map[int32]string{ + DeprecatedParameterSource_Scheme_name = map[int32]string{ 0: "DATA", } - ParameterSource_Scheme_value = map[string]int32{ + DeprecatedParameterSource_Scheme_value = map[string]int32{ "DATA": 0, } ) -func (x ParameterSource_Scheme) Enum() *ParameterSource_Scheme { - p := new(ParameterSource_Scheme) +func (x DeprecatedParameterSource_Scheme) Enum() *DeprecatedParameterSource_Scheme { + p := new(DeprecatedParameterSource_Scheme) *p = x return p } -func (x ParameterSource_Scheme) String() string { +func (x DeprecatedParameterSource_Scheme) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (ParameterSource_Scheme) Descriptor() protoreflect.EnumDescriptor { +func (DeprecatedParameterSource_Scheme) Descriptor() protoreflect.EnumDescriptor { return file_provisionersdk_proto_provisioner_proto_enumTypes[3].Descriptor() } -func (ParameterSource_Scheme) Type() protoreflect.EnumType { +func (DeprecatedParameterSource_Scheme) Type() protoreflect.EnumType { return &file_provisionersdk_proto_provisioner_proto_enumTypes[3] } -func (x ParameterSource_Scheme) Number() protoreflect.EnumNumber { +func (x DeprecatedParameterSource_Scheme) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// Deprecated: Use ParameterSource_Scheme.Descriptor instead. -func (ParameterSource_Scheme) EnumDescriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{1, 0} -} - -type ParameterDestination_Scheme int32 - -const ( - ParameterDestination_ENVIRONMENT_VARIABLE ParameterDestination_Scheme = 0 - ParameterDestination_PROVISIONER_VARIABLE ParameterDestination_Scheme = 1 -) - -// Enum value maps for ParameterDestination_Scheme. -var ( - ParameterDestination_Scheme_name = map[int32]string{ - 0: "ENVIRONMENT_VARIABLE", - 1: "PROVISIONER_VARIABLE", - } - ParameterDestination_Scheme_value = map[string]int32{ - "ENVIRONMENT_VARIABLE": 0, - "PROVISIONER_VARIABLE": 1, - } -) - -func (x ParameterDestination_Scheme) Enum() *ParameterDestination_Scheme { - p := new(ParameterDestination_Scheme) - *p = x - return p -} - -func (x ParameterDestination_Scheme) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ParameterDestination_Scheme) Descriptor() protoreflect.EnumDescriptor { - return file_provisionersdk_proto_provisioner_proto_enumTypes[4].Descriptor() -} - -func (ParameterDestination_Scheme) Type() protoreflect.EnumType { - return &file_provisionersdk_proto_provisioner_proto_enumTypes[4] -} - -func (x ParameterDestination_Scheme) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ParameterDestination_Scheme.Descriptor instead. -func (ParameterDestination_Scheme) EnumDescriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{2, 0} +// Deprecated: Use DeprecatedParameterSource_Scheme.Descriptor instead. +func (DeprecatedParameterSource_Scheme) EnumDescriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 0} } -type ParameterSchema_TypeSystem int32 +type DeprecatedParameterSchema_TypeSystem int32 const ( - ParameterSchema_None ParameterSchema_TypeSystem = 0 - ParameterSchema_HCL ParameterSchema_TypeSystem = 1 + DeprecatedParameterSchema_None DeprecatedParameterSchema_TypeSystem = 0 + DeprecatedParameterSchema_HCL DeprecatedParameterSchema_TypeSystem = 1 ) -// Enum value maps for ParameterSchema_TypeSystem. +// Enum value maps for DeprecatedParameterSchema_TypeSystem. var ( - ParameterSchema_TypeSystem_name = map[int32]string{ + DeprecatedParameterSchema_TypeSystem_name = map[int32]string{ 0: "None", 1: "HCL", } - ParameterSchema_TypeSystem_value = map[string]int32{ + DeprecatedParameterSchema_TypeSystem_value = map[string]int32{ "None": 0, "HCL": 1, } ) -func (x ParameterSchema_TypeSystem) Enum() *ParameterSchema_TypeSystem { - p := new(ParameterSchema_TypeSystem) +func (x DeprecatedParameterSchema_TypeSystem) Enum() *DeprecatedParameterSchema_TypeSystem { + p := new(DeprecatedParameterSchema_TypeSystem) *p = x return p } -func (x ParameterSchema_TypeSystem) String() string { +func (x DeprecatedParameterSchema_TypeSystem) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (ParameterSchema_TypeSystem) Descriptor() protoreflect.EnumDescriptor { - return file_provisionersdk_proto_provisioner_proto_enumTypes[5].Descriptor() +func (DeprecatedParameterSchema_TypeSystem) Descriptor() protoreflect.EnumDescriptor { + return file_provisionersdk_proto_provisioner_proto_enumTypes[4].Descriptor() } -func (ParameterSchema_TypeSystem) Type() protoreflect.EnumType { - return &file_provisionersdk_proto_provisioner_proto_enumTypes[5] +func (DeprecatedParameterSchema_TypeSystem) Type() protoreflect.EnumType { + return &file_provisionersdk_proto_provisioner_proto_enumTypes[4] } -func (x ParameterSchema_TypeSystem) Number() protoreflect.EnumNumber { +func (x DeprecatedParameterSchema_TypeSystem) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// Deprecated: Use ParameterSchema_TypeSystem.Descriptor instead. -func (ParameterSchema_TypeSystem) EnumDescriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{4, 0} +// Deprecated: Use DeprecatedParameterSchema_TypeSystem.Descriptor instead. +func (DeprecatedParameterSchema_TypeSystem) EnumDescriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{13, 0} } // Empty indicates a successful request/response. @@ -348,18 +302,18 @@ func (*Empty) Descriptor() ([]byte, []int) { return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{0} } -// ParameterSource represents the source location for a parameter to get it's value from. -type ParameterSource struct { +// Log represents output from a request. +type Log struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Scheme ParameterSource_Scheme `protobuf:"varint,1,opt,name=scheme,proto3,enum=provisioner.ParameterSource_Scheme" json:"scheme,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Level LogLevel `protobuf:"varint,1,opt,name=level,proto3,enum=provisioner.LogLevel" json:"level,omitempty"` + Output string `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"` } -func (x *ParameterSource) Reset() { - *x = ParameterSource{} +func (x *Log) Reset() { + *x = Log{} if protoimpl.UnsafeEnabled { mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -367,13 +321,13 @@ func (x *ParameterSource) Reset() { } } -func (x *ParameterSource) String() string { +func (x *Log) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ParameterSource) ProtoMessage() {} +func (*Log) ProtoMessage() {} -func (x *ParameterSource) ProtoReflect() protoreflect.Message { +func (x *Log) ProtoReflect() protoreflect.Message { mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -385,36 +339,35 @@ func (x *ParameterSource) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ParameterSource.ProtoReflect.Descriptor instead. -func (*ParameterSource) Descriptor() ([]byte, []int) { +// Deprecated: Use Log.ProtoReflect.Descriptor instead. +func (*Log) Descriptor() ([]byte, []int) { return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{1} } -func (x *ParameterSource) GetScheme() ParameterSource_Scheme { +func (x *Log) GetLevel() LogLevel { if x != nil { - return x.Scheme + return x.Level } - return ParameterSource_DATA + return LogLevel_TRACE } -func (x *ParameterSource) GetValue() string { +func (x *Log) GetOutput() string { if x != nil { - return x.Value + return x.Output } return "" } -// ParameterDestination represents the target location for a provisioner to set the value. -type ParameterDestination struct { +type InstanceIdentityAuth struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Scheme ParameterDestination_Scheme `protobuf:"varint,1,opt,name=scheme,proto3,enum=provisioner.ParameterDestination_Scheme" json:"scheme,omitempty"` + InstanceId string `protobuf:"bytes,1,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` } -func (x *ParameterDestination) Reset() { - *x = ParameterDestination{} +func (x *InstanceIdentityAuth) Reset() { + *x = InstanceIdentityAuth{} if protoimpl.UnsafeEnabled { mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -422,13 +375,13 @@ func (x *ParameterDestination) Reset() { } } -func (x *ParameterDestination) String() string { +func (x *InstanceIdentityAuth) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ParameterDestination) ProtoMessage() {} +func (*InstanceIdentityAuth) ProtoMessage() {} -func (x *ParameterDestination) ProtoReflect() protoreflect.Message { +func (x *InstanceIdentityAuth) ProtoReflect() protoreflect.Message { mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -440,31 +393,44 @@ func (x *ParameterDestination) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ParameterDestination.ProtoReflect.Descriptor instead. -func (*ParameterDestination) Descriptor() ([]byte, []int) { +// Deprecated: Use InstanceIdentityAuth.ProtoReflect.Descriptor instead. +func (*InstanceIdentityAuth) Descriptor() ([]byte, []int) { return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{2} } -func (x *ParameterDestination) GetScheme() ParameterDestination_Scheme { +func (x *InstanceIdentityAuth) GetInstanceId() string { if x != nil { - return x.Scheme + return x.InstanceId } - return ParameterDestination_ENVIRONMENT_VARIABLE + return "" } -// ParameterValue represents the resolved source and destination of a parameter. -type ParameterValue struct { +// Agent represents a running agent on the workspace. +type Agent struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - DestinationScheme ParameterDestination_Scheme `protobuf:"varint,1,opt,name=destination_scheme,json=destinationScheme,proto3,enum=provisioner.ParameterDestination_Scheme" json:"destination_scheme,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Env map[string]string `protobuf:"bytes,3,rep,name=env,proto3" json:"env,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + StartupScript string `protobuf:"bytes,4,opt,name=startup_script,json=startupScript,proto3" json:"startup_script,omitempty"` + OperatingSystem string `protobuf:"bytes,5,opt,name=operating_system,json=operatingSystem,proto3" json:"operating_system,omitempty"` + Architecture string `protobuf:"bytes,6,opt,name=architecture,proto3" json:"architecture,omitempty"` + Directory string `protobuf:"bytes,7,opt,name=directory,proto3" json:"directory,omitempty"` + Apps []*App `protobuf:"bytes,8,rep,name=apps,proto3" json:"apps,omitempty"` + // Types that are assignable to Auth: + // + // *Agent_Token + // *Agent_InstanceId + Auth isAgent_Auth `protobuf_oneof:"auth"` + ConnectionTimeoutSeconds int32 `protobuf:"varint,11,opt,name=connection_timeout_seconds,json=connectionTimeoutSeconds,proto3" json:"connection_timeout_seconds,omitempty"` + TroubleshootingUrl string `protobuf:"bytes,12,opt,name=troubleshooting_url,json=troubleshootingUrl,proto3" json:"troubleshooting_url,omitempty"` + MotdFile string `protobuf:"bytes,13,opt,name=motd_file,json=motdFile,proto3" json:"motd_file,omitempty"` } -func (x *ParameterValue) Reset() { - *x = ParameterValue{} +func (x *Agent) Reset() { + *x = Agent{} if protoimpl.UnsafeEnabled { mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -472,13 +438,13 @@ func (x *ParameterValue) Reset() { } } -func (x *ParameterValue) String() string { +func (x *Agent) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ParameterValue) ProtoMessage() {} +func (*Agent) ProtoMessage() {} -func (x *ParameterValue) ProtoReflect() protoreflect.Message { +func (x *Agent) ProtoReflect() protoreflect.Message { mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -490,187 +456,160 @@ func (x *ParameterValue) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ParameterValue.ProtoReflect.Descriptor instead. -func (*ParameterValue) Descriptor() ([]byte, []int) { +// Deprecated: Use Agent.ProtoReflect.Descriptor instead. +func (*Agent) Descriptor() ([]byte, []int) { return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{3} } -func (x *ParameterValue) GetDestinationScheme() ParameterDestination_Scheme { +func (x *Agent) GetId() string { if x != nil { - return x.DestinationScheme + return x.Id } - return ParameterDestination_ENVIRONMENT_VARIABLE + return "" } -func (x *ParameterValue) GetName() string { +func (x *Agent) GetName() string { if x != nil { return x.Name } return "" } -func (x *ParameterValue) GetValue() string { +func (x *Agent) GetEnv() map[string]string { if x != nil { - return x.Value - } - return "" -} - -// ParameterSchema represents validation and type information for a parsed parameter. -type ParameterSchema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - DefaultSource *ParameterSource `protobuf:"bytes,3,opt,name=default_source,json=defaultSource,proto3" json:"default_source,omitempty"` - AllowOverrideSource bool `protobuf:"varint,4,opt,name=allow_override_source,json=allowOverrideSource,proto3" json:"allow_override_source,omitempty"` - DefaultDestination *ParameterDestination `protobuf:"bytes,5,opt,name=default_destination,json=defaultDestination,proto3" json:"default_destination,omitempty"` - AllowOverrideDestination bool `protobuf:"varint,6,opt,name=allow_override_destination,json=allowOverrideDestination,proto3" json:"allow_override_destination,omitempty"` - RedisplayValue bool `protobuf:"varint,7,opt,name=redisplay_value,json=redisplayValue,proto3" json:"redisplay_value,omitempty"` - ValidationTypeSystem ParameterSchema_TypeSystem `protobuf:"varint,8,opt,name=validation_type_system,json=validationTypeSystem,proto3,enum=provisioner.ParameterSchema_TypeSystem" json:"validation_type_system,omitempty"` - ValidationValueType string `protobuf:"bytes,9,opt,name=validation_value_type,json=validationValueType,proto3" json:"validation_value_type,omitempty"` - ValidationError string `protobuf:"bytes,10,opt,name=validation_error,json=validationError,proto3" json:"validation_error,omitempty"` - ValidationCondition string `protobuf:"bytes,11,opt,name=validation_condition,json=validationCondition,proto3" json:"validation_condition,omitempty"` -} - -func (x *ParameterSchema) Reset() { - *x = ParameterSchema{} - if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + return x.Env } + return nil } -func (x *ParameterSchema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParameterSchema) ProtoMessage() {} - -func (x *ParameterSchema) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (x *Agent) GetStartupScript() string { + if x != nil { + return x.StartupScript } - return mi.MessageOf(x) -} - -// Deprecated: Use ParameterSchema.ProtoReflect.Descriptor instead. -func (*ParameterSchema) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{4} + return "" } -func (x *ParameterSchema) GetName() string { +func (x *Agent) GetOperatingSystem() string { if x != nil { - return x.Name + return x.OperatingSystem } return "" } -func (x *ParameterSchema) GetDescription() string { +func (x *Agent) GetArchitecture() string { if x != nil { - return x.Description + return x.Architecture } return "" } -func (x *ParameterSchema) GetDefaultSource() *ParameterSource { +func (x *Agent) GetDirectory() string { if x != nil { - return x.DefaultSource + return x.Directory } - return nil + return "" } -func (x *ParameterSchema) GetAllowOverrideSource() bool { +func (x *Agent) GetApps() []*App { if x != nil { - return x.AllowOverrideSource + return x.Apps } - return false + return nil } -func (x *ParameterSchema) GetDefaultDestination() *ParameterDestination { - if x != nil { - return x.DefaultDestination +func (m *Agent) GetAuth() isAgent_Auth { + if m != nil { + return m.Auth } return nil } -func (x *ParameterSchema) GetAllowOverrideDestination() bool { - if x != nil { - return x.AllowOverrideDestination +func (x *Agent) GetToken() string { + if x, ok := x.GetAuth().(*Agent_Token); ok { + return x.Token } - return false + return "" } -func (x *ParameterSchema) GetRedisplayValue() bool { - if x != nil { - return x.RedisplayValue +func (x *Agent) GetInstanceId() string { + if x, ok := x.GetAuth().(*Agent_InstanceId); ok { + return x.InstanceId } - return false + return "" } -func (x *ParameterSchema) GetValidationTypeSystem() ParameterSchema_TypeSystem { +func (x *Agent) GetConnectionTimeoutSeconds() int32 { if x != nil { - return x.ValidationTypeSystem + return x.ConnectionTimeoutSeconds } - return ParameterSchema_None + return 0 } -func (x *ParameterSchema) GetValidationValueType() string { +func (x *Agent) GetTroubleshootingUrl() string { if x != nil { - return x.ValidationValueType + return x.TroubleshootingUrl } return "" } -func (x *ParameterSchema) GetValidationError() string { +func (x *Agent) GetMotdFile() string { if x != nil { - return x.ValidationError + return x.MotdFile } return "" } -func (x *ParameterSchema) GetValidationCondition() string { - if x != nil { - return x.ValidationCondition - } - return "" +type isAgent_Auth interface { + isAgent_Auth() } -// Log represents output from a request. -type Log struct { +type Agent_Token struct { + Token string `protobuf:"bytes,9,opt,name=token,proto3,oneof"` +} + +type Agent_InstanceId struct { + InstanceId string `protobuf:"bytes,10,opt,name=instance_id,json=instanceId,proto3,oneof"` +} + +func (*Agent_Token) isAgent_Auth() {} + +func (*Agent_InstanceId) isAgent_Auth() {} + +// App represents a dev-accessible application on the workspace. +type App struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Level LogLevel `protobuf:"varint,1,opt,name=level,proto3,enum=provisioner.LogLevel" json:"level,omitempty"` - Output string `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"` + // slug is the unique identifier for the app, usually the name from the + // template. It must be URL-safe and hostname-safe. + Slug string `protobuf:"bytes,1,opt,name=slug,proto3" json:"slug,omitempty"` + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + Command string `protobuf:"bytes,3,opt,name=command,proto3" json:"command,omitempty"` + Url string `protobuf:"bytes,4,opt,name=url,proto3" json:"url,omitempty"` + Icon string `protobuf:"bytes,5,opt,name=icon,proto3" json:"icon,omitempty"` + Subdomain bool `protobuf:"varint,6,opt,name=subdomain,proto3" json:"subdomain,omitempty"` + Healthcheck *Healthcheck `protobuf:"bytes,7,opt,name=healthcheck,proto3" json:"healthcheck,omitempty"` + SharingLevel AppSharingLevel `protobuf:"varint,8,opt,name=sharing_level,json=sharingLevel,proto3,enum=provisioner.AppSharingLevel" json:"sharing_level,omitempty"` } -func (x *Log) Reset() { - *x = Log{} +func (x *App) Reset() { + *x = App{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[5] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *Log) String() string { +func (x *App) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Log) ProtoMessage() {} +func (*App) ProtoMessage() {} -func (x *Log) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[5] +func (x *App) ProtoReflect() protoreflect.Message { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -681,113 +620,95 @@ func (x *Log) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Log.ProtoReflect.Descriptor instead. -func (*Log) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{5} +// Deprecated: Use App.ProtoReflect.Descriptor instead. +func (*App) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{4} } -func (x *Log) GetLevel() LogLevel { +func (x *App) GetSlug() string { if x != nil { - return x.Level + return x.Slug } - return LogLevel_TRACE + return "" } -func (x *Log) GetOutput() string { +func (x *App) GetDisplayName() string { if x != nil { - return x.Output + return x.DisplayName } return "" } -type InstanceIdentityAuth struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - InstanceId string `protobuf:"bytes,1,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` +func (x *App) GetCommand() string { + if x != nil { + return x.Command + } + return "" } -func (x *InstanceIdentityAuth) Reset() { - *x = InstanceIdentityAuth{} - if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +func (x *App) GetUrl() string { + if x != nil { + return x.Url } + return "" } -func (x *InstanceIdentityAuth) String() string { - return protoimpl.X.MessageStringOf(x) +func (x *App) GetIcon() string { + if x != nil { + return x.Icon + } + return "" } -func (*InstanceIdentityAuth) ProtoMessage() {} - -func (x *InstanceIdentityAuth) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (x *App) GetSubdomain() bool { + if x != nil { + return x.Subdomain } - return mi.MessageOf(x) + return false } -// Deprecated: Use InstanceIdentityAuth.ProtoReflect.Descriptor instead. -func (*InstanceIdentityAuth) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{6} +func (x *App) GetHealthcheck() *Healthcheck { + if x != nil { + return x.Healthcheck + } + return nil } -func (x *InstanceIdentityAuth) GetInstanceId() string { +func (x *App) GetSharingLevel() AppSharingLevel { if x != nil { - return x.InstanceId + return x.SharingLevel } - return "" + return AppSharingLevel_OWNER } -// Agent represents a running agent on the workspace. -type Agent struct { +// Healthcheck represents configuration for checking for app readiness. +type Healthcheck struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Env map[string]string `protobuf:"bytes,3,rep,name=env,proto3" json:"env,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - StartupScript string `protobuf:"bytes,4,opt,name=startup_script,json=startupScript,proto3" json:"startup_script,omitempty"` - OperatingSystem string `protobuf:"bytes,5,opt,name=operating_system,json=operatingSystem,proto3" json:"operating_system,omitempty"` - Architecture string `protobuf:"bytes,6,opt,name=architecture,proto3" json:"architecture,omitempty"` - Directory string `protobuf:"bytes,7,opt,name=directory,proto3" json:"directory,omitempty"` - Apps []*App `protobuf:"bytes,8,rep,name=apps,proto3" json:"apps,omitempty"` - // Types that are assignable to Auth: - // - // *Agent_Token - // *Agent_InstanceId - Auth isAgent_Auth `protobuf_oneof:"auth"` - ConnectionTimeoutSeconds int32 `protobuf:"varint,11,opt,name=connection_timeout_seconds,json=connectionTimeoutSeconds,proto3" json:"connection_timeout_seconds,omitempty"` - TroubleshootingUrl string `protobuf:"bytes,12,opt,name=troubleshooting_url,json=troubleshootingUrl,proto3" json:"troubleshooting_url,omitempty"` - MotdFile string `protobuf:"bytes,13,opt,name=motd_file,json=motdFile,proto3" json:"motd_file,omitempty"` + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + Interval int32 `protobuf:"varint,2,opt,name=interval,proto3" json:"interval,omitempty"` + Threshold int32 `protobuf:"varint,3,opt,name=threshold,proto3" json:"threshold,omitempty"` } -func (x *Agent) Reset() { - *x = Agent{} +func (x *Healthcheck) Reset() { + *x = Healthcheck{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[7] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *Agent) String() string { +func (x *Healthcheck) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Agent) ProtoMessage() {} +func (*Healthcheck) ProtoMessage() {} -func (x *Agent) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[7] +func (x *Healthcheck) ProtoReflect() protoreflect.Message { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -798,160 +719,65 @@ func (x *Agent) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Agent.ProtoReflect.Descriptor instead. -func (*Agent) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{7} -} - -func (x *Agent) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *Agent) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Agent) GetEnv() map[string]string { - if x != nil { - return x.Env - } - return nil -} - -func (x *Agent) GetStartupScript() string { - if x != nil { - return x.StartupScript - } - return "" -} - -func (x *Agent) GetOperatingSystem() string { - if x != nil { - return x.OperatingSystem - } - return "" -} - -func (x *Agent) GetArchitecture() string { - if x != nil { - return x.Architecture - } - return "" -} - -func (x *Agent) GetDirectory() string { - if x != nil { - return x.Directory - } - return "" +// Deprecated: Use Healthcheck.ProtoReflect.Descriptor instead. +func (*Healthcheck) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{5} } -func (x *Agent) GetApps() []*App { +func (x *Healthcheck) GetUrl() string { if x != nil { - return x.Apps - } - return nil -} - -func (m *Agent) GetAuth() isAgent_Auth { - if m != nil { - return m.Auth - } - return nil -} - -func (x *Agent) GetToken() string { - if x, ok := x.GetAuth().(*Agent_Token); ok { - return x.Token - } - return "" -} - -func (x *Agent) GetInstanceId() string { - if x, ok := x.GetAuth().(*Agent_InstanceId); ok { - return x.InstanceId + return x.Url } return "" } -func (x *Agent) GetConnectionTimeoutSeconds() int32 { +func (x *Healthcheck) GetInterval() int32 { if x != nil { - return x.ConnectionTimeoutSeconds + return x.Interval } return 0 } -func (x *Agent) GetTroubleshootingUrl() string { - if x != nil { - return x.TroubleshootingUrl - } - return "" -} - -func (x *Agent) GetMotdFile() string { +func (x *Healthcheck) GetThreshold() int32 { if x != nil { - return x.MotdFile + return x.Threshold } - return "" -} - -type isAgent_Auth interface { - isAgent_Auth() -} - -type Agent_Token struct { - Token string `protobuf:"bytes,9,opt,name=token,proto3,oneof"` -} - -type Agent_InstanceId struct { - InstanceId string `protobuf:"bytes,10,opt,name=instance_id,json=instanceId,proto3,oneof"` + return 0 } -func (*Agent_Token) isAgent_Auth() {} - -func (*Agent_InstanceId) isAgent_Auth() {} - -// App represents a dev-accessible application on the workspace. -type App struct { +// Resource represents created infrastructure. +type Resource struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // slug is the unique identifier for the app, usually the name from the - // template. It must be URL-safe and hostname-safe. - Slug string `protobuf:"bytes,1,opt,name=slug,proto3" json:"slug,omitempty"` - DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` - Command string `protobuf:"bytes,3,opt,name=command,proto3" json:"command,omitempty"` - Url string `protobuf:"bytes,4,opt,name=url,proto3" json:"url,omitempty"` - Icon string `protobuf:"bytes,5,opt,name=icon,proto3" json:"icon,omitempty"` - Subdomain bool `protobuf:"varint,6,opt,name=subdomain,proto3" json:"subdomain,omitempty"` - Healthcheck *Healthcheck `protobuf:"bytes,7,opt,name=healthcheck,proto3" json:"healthcheck,omitempty"` - SharingLevel AppSharingLevel `protobuf:"varint,8,opt,name=sharing_level,json=sharingLevel,proto3,enum=provisioner.AppSharingLevel" json:"sharing_level,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + Agents []*Agent `protobuf:"bytes,3,rep,name=agents,proto3" json:"agents,omitempty"` + Metadata []*Resource_Metadata `protobuf:"bytes,4,rep,name=metadata,proto3" json:"metadata,omitempty"` + Hide bool `protobuf:"varint,5,opt,name=hide,proto3" json:"hide,omitempty"` + Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon,omitempty"` + InstanceType string `protobuf:"bytes,7,opt,name=instance_type,json=instanceType,proto3" json:"instance_type,omitempty"` + DailyCost int32 `protobuf:"varint,8,opt,name=daily_cost,json=dailyCost,proto3" json:"daily_cost,omitempty"` } -func (x *App) Reset() { - *x = App{} +func (x *Resource) Reset() { + *x = Resource{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[8] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *App) String() string { +func (x *Resource) String() string { return protoimpl.X.MessageStringOf(x) } -func (*App) ProtoMessage() {} +func (*Resource) ProtoMessage() {} -func (x *App) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[8] +func (x *Resource) ProtoReflect() protoreflect.Message { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -962,95 +788,96 @@ func (x *App) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use App.ProtoReflect.Descriptor instead. -func (*App) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{8} +// Deprecated: Use Resource.ProtoReflect.Descriptor instead. +func (*Resource) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{6} } -func (x *App) GetSlug() string { +func (x *Resource) GetName() string { if x != nil { - return x.Slug + return x.Name } return "" } -func (x *App) GetDisplayName() string { +func (x *Resource) GetType() string { if x != nil { - return x.DisplayName + return x.Type } return "" } -func (x *App) GetCommand() string { +func (x *Resource) GetAgents() []*Agent { if x != nil { - return x.Command + return x.Agents } - return "" + return nil } -func (x *App) GetUrl() string { +func (x *Resource) GetMetadata() []*Resource_Metadata { if x != nil { - return x.Url + return x.Metadata } - return "" + return nil } -func (x *App) GetIcon() string { +func (x *Resource) GetHide() bool { if x != nil { - return x.Icon + return x.Hide } - return "" + return false } -func (x *App) GetSubdomain() bool { +func (x *Resource) GetIcon() string { if x != nil { - return x.Subdomain + return x.Icon } - return false + return "" } -func (x *App) GetHealthcheck() *Healthcheck { +func (x *Resource) GetInstanceType() string { if x != nil { - return x.Healthcheck + return x.InstanceType } - return nil + return "" } -func (x *App) GetSharingLevel() AppSharingLevel { +func (x *Resource) GetDailyCost() int32 { if x != nil { - return x.SharingLevel + return x.DailyCost } - return AppSharingLevel_OWNER + return 0 } -// Healthcheck represents configuration for checking for app readiness. -type Healthcheck struct { +// ParameterOption represents a singular option that a parameter may expose. +type ParameterOption struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` - Interval int32 `protobuf:"varint,2,opt,name=interval,proto3" json:"interval,omitempty"` - Threshold int32 `protobuf:"varint,3,opt,name=threshold,proto3" json:"threshold,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + Icon string `protobuf:"bytes,4,opt,name=icon,proto3" json:"icon,omitempty"` } -func (x *Healthcheck) Reset() { - *x = Healthcheck{} +func (x *ParameterOption) Reset() { + *x = ParameterOption{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[9] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *Healthcheck) String() string { +func (x *ParameterOption) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Healthcheck) ProtoMessage() {} - -func (x *Healthcheck) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[9] +func (*ParameterOption) ProtoMessage() {} + +func (x *ParameterOption) ProtoReflect() protoreflect.Message { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1061,65 +888,74 @@ func (x *Healthcheck) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Healthcheck.ProtoReflect.Descriptor instead. -func (*Healthcheck) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{9} +// Deprecated: Use ParameterOption.ProtoReflect.Descriptor instead. +func (*ParameterOption) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{7} } -func (x *Healthcheck) GetUrl() string { +func (x *ParameterOption) GetName() string { if x != nil { - return x.Url + return x.Name } return "" } -func (x *Healthcheck) GetInterval() int32 { +func (x *ParameterOption) GetDescription() string { if x != nil { - return x.Interval + return x.Description } - return 0 + return "" } -func (x *Healthcheck) GetThreshold() int32 { +func (x *ParameterOption) GetValue() string { if x != nil { - return x.Threshold + return x.Value } - return 0 + return "" } -// Resource represents created infrastructure. -type Resource struct { +func (x *ParameterOption) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + +// Parameter represents a variable that is exposed. +type Parameter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - Agents []*Agent `protobuf:"bytes,3,rep,name=agents,proto3" json:"agents,omitempty"` - Metadata []*Resource_Metadata `protobuf:"bytes,4,rep,name=metadata,proto3" json:"metadata,omitempty"` - Hide bool `protobuf:"varint,5,opt,name=hide,proto3" json:"hide,omitempty"` - Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon,omitempty"` - InstanceType string `protobuf:"bytes,7,opt,name=instance_type,json=instanceType,proto3" json:"instance_type,omitempty"` - DailyCost int32 `protobuf:"varint,8,opt,name=daily_cost,json=dailyCost,proto3" json:"daily_cost,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` + Mutable bool `protobuf:"varint,4,opt,name=mutable,proto3" json:"mutable,omitempty"` + DefaultValue string `protobuf:"bytes,5,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` + Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon,omitempty"` + Options []*ParameterOption `protobuf:"bytes,7,rep,name=options,proto3" json:"options,omitempty"` + ValidationRegex string `protobuf:"bytes,8,opt,name=validation_regex,json=validationRegex,proto3" json:"validation_regex,omitempty"` + ValidationMin int32 `protobuf:"varint,9,opt,name=validation_min,json=validationMin,proto3" json:"validation_min,omitempty"` + ValidationMax int32 `protobuf:"varint,10,opt,name=validation_max,json=validationMax,proto3" json:"validation_max,omitempty"` } -func (x *Resource) Reset() { - *x = Resource{} +func (x *Parameter) Reset() { + *x = Parameter{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[10] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *Resource) String() string { +func (x *Parameter) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Resource) ProtoMessage() {} +func (*Parameter) ProtoMessage() {} -func (x *Resource) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[10] +func (x *Parameter) ProtoReflect() protoreflect.Message { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1130,91 +966,108 @@ func (x *Resource) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Resource.ProtoReflect.Descriptor instead. -func (*Resource) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10} +// Deprecated: Use Parameter.ProtoReflect.Descriptor instead. +func (*Parameter) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{8} } -func (x *Resource) GetName() string { +func (x *Parameter) GetName() string { if x != nil { return x.Name } return "" } -func (x *Resource) GetType() string { +func (x *Parameter) GetDescription() string { if x != nil { - return x.Type + return x.Description } return "" } -func (x *Resource) GetAgents() []*Agent { +func (x *Parameter) GetType() string { if x != nil { - return x.Agents + return x.Type } - return nil + return "" } -func (x *Resource) GetMetadata() []*Resource_Metadata { +func (x *Parameter) GetMutable() bool { if x != nil { - return x.Metadata + return x.Mutable } - return nil + return false } -func (x *Resource) GetHide() bool { +func (x *Parameter) GetDefaultValue() string { if x != nil { - return x.Hide + return x.DefaultValue } - return false + return "" } -func (x *Resource) GetIcon() string { +func (x *Parameter) GetIcon() string { if x != nil { return x.Icon } return "" } -func (x *Resource) GetInstanceType() string { +func (x *Parameter) GetOptions() []*ParameterOption { if x != nil { - return x.InstanceType + return x.Options + } + return nil +} + +func (x *Parameter) GetValidationRegex() string { + if x != nil { + return x.ValidationRegex } return "" } -func (x *Resource) GetDailyCost() int32 { +func (x *Parameter) GetValidationMin() int32 { if x != nil { - return x.DailyCost + return x.ValidationMin + } + return 0 +} + +func (x *Parameter) GetValidationMax() int32 { + if x != nil { + return x.ValidationMax } return 0 } -// Parse consumes source-code from a directory to produce inputs. -type Parse struct { +// ParameterValue holds the key/value mapping of a parameter! +type ParameterValue struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } -func (x *Parse) Reset() { - *x = Parse{} +func (x *ParameterValue) Reset() { + *x = ParameterValue{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[11] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *Parse) String() string { +func (x *ParameterValue) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Parse) ProtoMessage() {} +func (*ParameterValue) ProtoMessage() {} -func (x *Parse) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[11] +func (x *ParameterValue) ProtoReflect() protoreflect.Message { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1225,9 +1078,23 @@ func (x *Parse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Parse.ProtoReflect.Descriptor instead. -func (*Parse) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{11} +// Deprecated: Use ParameterValue.ProtoReflect.Descriptor instead. +func (*ParameterValue) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{9} +} + +func (x *ParameterValue) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ParameterValue) GetValue() string { + if x != nil { + return x.Value + } + return "" } // Provision consumes source-code from a directory to produce resources. @@ -1241,7 +1108,7 @@ type Provision struct { func (x *Provision) Reset() { *x = Provision{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[12] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1254,7 +1121,7 @@ func (x *Provision) String() string { func (*Provision) ProtoMessage() {} func (x *Provision) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[12] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1267,37 +1134,33 @@ func (x *Provision) ProtoReflect() protoreflect.Message { // Deprecated: Use Provision.ProtoReflect.Descriptor instead. func (*Provision) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10} } -type Resource_Metadata struct { +// DeprecatedParse consumes source-code from a directory to produce inputs. +type DeprecatedParse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - Sensitive bool `protobuf:"varint,3,opt,name=sensitive,proto3" json:"sensitive,omitempty"` - IsNull bool `protobuf:"varint,4,opt,name=is_null,json=isNull,proto3" json:"is_null,omitempty"` } -func (x *Resource_Metadata) Reset() { - *x = Resource_Metadata{} +func (x *DeprecatedParse) Reset() { + *x = DeprecatedParse{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[14] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *Resource_Metadata) String() string { +func (x *DeprecatedParse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Resource_Metadata) ProtoMessage() {} +func (*DeprecatedParse) ProtoMessage() {} -func (x *Resource_Metadata) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[14] +func (x *DeprecatedParse) ProtoReflect() protoreflect.Message { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1308,64 +1171,38 @@ func (x *Resource_Metadata) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Resource_Metadata.ProtoReflect.Descriptor instead. -func (*Resource_Metadata) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 0} -} - -func (x *Resource_Metadata) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *Resource_Metadata) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -func (x *Resource_Metadata) GetSensitive() bool { - if x != nil { - return x.Sensitive - } - return false -} - -func (x *Resource_Metadata) GetIsNull() bool { - if x != nil { - return x.IsNull - } - return false +// Deprecated: Use DeprecatedParse.ProtoReflect.Descriptor instead. +func (*DeprecatedParse) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{11} } -type Parse_Request struct { +// DeprecatedParameterSource represents the source location for a parameter to get it's value from. +type DeprecatedParameterSource struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Directory string `protobuf:"bytes,1,opt,name=directory,proto3" json:"directory,omitempty"` + Scheme DeprecatedParameterSource_Scheme `protobuf:"varint,1,opt,name=scheme,proto3,enum=provisioner.DeprecatedParameterSource_Scheme" json:"scheme,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } -func (x *Parse_Request) Reset() { - *x = Parse_Request{} +func (x *DeprecatedParameterSource) Reset() { + *x = DeprecatedParameterSource{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[15] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *Parse_Request) String() string { +func (x *DeprecatedParameterSource) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Parse_Request) ProtoMessage() {} +func (*DeprecatedParameterSource) ProtoMessage() {} -func (x *Parse_Request) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[15] +func (x *DeprecatedParameterSource) ProtoReflect() protoreflect.Message { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1376,43 +1213,59 @@ func (x *Parse_Request) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Parse_Request.ProtoReflect.Descriptor instead. -func (*Parse_Request) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{11, 0} +// Deprecated: Use DeprecatedParameterSource.ProtoReflect.Descriptor instead. +func (*DeprecatedParameterSource) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12} } -func (x *Parse_Request) GetDirectory() string { +func (x *DeprecatedParameterSource) GetScheme() DeprecatedParameterSource_Scheme { if x != nil { - return x.Directory + return x.Scheme + } + return DeprecatedParameterSource_DATA +} + +func (x *DeprecatedParameterSource) GetValue() string { + if x != nil { + return x.Value } return "" } -type Parse_Complete struct { +// DeprecatedParameterSchema represents validation and type information for a parsed parameter. +type DeprecatedParameterSchema struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ParameterSchemas []*ParameterSchema `protobuf:"bytes,2,rep,name=parameter_schemas,json=parameterSchemas,proto3" json:"parameter_schemas,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + DefaultSource *DeprecatedParameterSource `protobuf:"bytes,3,opt,name=default_source,json=defaultSource,proto3" json:"default_source,omitempty"` + AllowOverrideSource bool `protobuf:"varint,4,opt,name=allow_override_source,json=allowOverrideSource,proto3" json:"allow_override_source,omitempty"` + RedisplayValue bool `protobuf:"varint,5,opt,name=redisplay_value,json=redisplayValue,proto3" json:"redisplay_value,omitempty"` + ValidationTypeSystem DeprecatedParameterSchema_TypeSystem `protobuf:"varint,6,opt,name=validation_type_system,json=validationTypeSystem,proto3,enum=provisioner.DeprecatedParameterSchema_TypeSystem" json:"validation_type_system,omitempty"` + ValidationValueType string `protobuf:"bytes,7,opt,name=validation_value_type,json=validationValueType,proto3" json:"validation_value_type,omitempty"` + ValidationError string `protobuf:"bytes,8,opt,name=validation_error,json=validationError,proto3" json:"validation_error,omitempty"` + ValidationCondition string `protobuf:"bytes,9,opt,name=validation_condition,json=validationCondition,proto3" json:"validation_condition,omitempty"` } -func (x *Parse_Complete) Reset() { - *x = Parse_Complete{} +func (x *DeprecatedParameterSchema) Reset() { + *x = DeprecatedParameterSchema{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[16] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *Parse_Complete) String() string { +func (x *DeprecatedParameterSchema) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Parse_Complete) ProtoMessage() {} +func (*DeprecatedParameterSchema) ProtoMessage() {} -func (x *Parse_Complete) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[16] +func (x *DeprecatedParameterSchema) ProtoReflect() protoreflect.Message { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1423,47 +1276,102 @@ func (x *Parse_Complete) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Parse_Complete.ProtoReflect.Descriptor instead. -func (*Parse_Complete) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{11, 1} +// Deprecated: Use DeprecatedParameterSchema.ProtoReflect.Descriptor instead. +func (*DeprecatedParameterSchema) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{13} } -func (x *Parse_Complete) GetParameterSchemas() []*ParameterSchema { +func (x *DeprecatedParameterSchema) GetName() string { if x != nil { - return x.ParameterSchemas + return x.Name + } + return "" +} + +func (x *DeprecatedParameterSchema) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *DeprecatedParameterSchema) GetDefaultSource() *DeprecatedParameterSource { + if x != nil { + return x.DefaultSource } return nil } -type Parse_Response struct { +func (x *DeprecatedParameterSchema) GetAllowOverrideSource() bool { + if x != nil { + return x.AllowOverrideSource + } + return false +} + +func (x *DeprecatedParameterSchema) GetRedisplayValue() bool { + if x != nil { + return x.RedisplayValue + } + return false +} + +func (x *DeprecatedParameterSchema) GetValidationTypeSystem() DeprecatedParameterSchema_TypeSystem { + if x != nil { + return x.ValidationTypeSystem + } + return DeprecatedParameterSchema_None +} + +func (x *DeprecatedParameterSchema) GetValidationValueType() string { + if x != nil { + return x.ValidationValueType + } + return "" +} + +func (x *DeprecatedParameterSchema) GetValidationError() string { + if x != nil { + return x.ValidationError + } + return "" +} + +func (x *DeprecatedParameterSchema) GetValidationCondition() string { + if x != nil { + return x.ValidationCondition + } + return "" +} + +type Resource_Metadata struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Types that are assignable to Type: - // - // *Parse_Response_Log - // *Parse_Response_Complete - Type isParse_Response_Type `protobuf_oneof:"type"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Sensitive bool `protobuf:"varint,3,opt,name=sensitive,proto3" json:"sensitive,omitempty"` + IsNull bool `protobuf:"varint,4,opt,name=is_null,json=isNull,proto3" json:"is_null,omitempty"` } -func (x *Parse_Response) Reset() { - *x = Parse_Response{} +func (x *Resource_Metadata) Reset() { + *x = Resource_Metadata{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[17] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *Parse_Response) String() string { +func (x *Resource_Metadata) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Parse_Response) ProtoMessage() {} +func (*Resource_Metadata) ProtoMessage() {} -func (x *Parse_Response) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[17] +func (x *Resource_Metadata) ProtoReflect() protoreflect.Message { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1474,48 +1382,39 @@ func (x *Parse_Response) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Parse_Response.ProtoReflect.Descriptor instead. -func (*Parse_Response) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{11, 2} -} - -func (m *Parse_Response) GetType() isParse_Response_Type { - if m != nil { - return m.Type - } - return nil -} - -func (x *Parse_Response) GetLog() *Log { - if x, ok := x.GetType().(*Parse_Response_Log); ok { - return x.Log - } - return nil +// Deprecated: Use Resource_Metadata.ProtoReflect.Descriptor instead. +func (*Resource_Metadata) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{6, 0} } -func (x *Parse_Response) GetComplete() *Parse_Complete { - if x, ok := x.GetType().(*Parse_Response_Complete); ok { - return x.Complete +func (x *Resource_Metadata) GetKey() string { + if x != nil { + return x.Key } - return nil + return "" } -type isParse_Response_Type interface { - isParse_Response_Type() +func (x *Resource_Metadata) GetValue() string { + if x != nil { + return x.Value + } + return "" } -type Parse_Response_Log struct { - Log *Log `protobuf:"bytes,1,opt,name=log,proto3,oneof"` +func (x *Resource_Metadata) GetSensitive() bool { + if x != nil { + return x.Sensitive + } + return false } -type Parse_Response_Complete struct { - Complete *Parse_Complete `protobuf:"bytes,2,opt,name=complete,proto3,oneof"` +func (x *Resource_Metadata) GetIsNull() bool { + if x != nil { + return x.IsNull + } + return false } -func (*Parse_Response_Log) isParse_Response_Type() {} - -func (*Parse_Response_Complete) isParse_Response_Type() {} - type Provision_Metadata struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1533,7 +1432,7 @@ type Provision_Metadata struct { func (x *Provision_Metadata) Reset() { *x = Provision_Metadata{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[18] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1546,7 +1445,7 @@ func (x *Provision_Metadata) String() string { func (*Provision_Metadata) ProtoMessage() {} func (x *Provision_Metadata) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[18] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1559,7 +1458,7 @@ func (x *Provision_Metadata) ProtoReflect() protoreflect.Message { // Deprecated: Use Provision_Metadata.ProtoReflect.Descriptor instead. func (*Provision_Metadata) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 0} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 0} } func (x *Provision_Metadata) GetCoderUrl() string { @@ -1626,7 +1525,7 @@ type Provision_Config struct { func (x *Provision_Config) Reset() { *x = Provision_Config{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[19] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1639,7 +1538,7 @@ func (x *Provision_Config) String() string { func (*Provision_Config) ProtoMessage() {} func (x *Provision_Config) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[19] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1652,7 +1551,7 @@ func (x *Provision_Config) ProtoReflect() protoreflect.Message { // Deprecated: Use Provision_Config.ProtoReflect.Descriptor instead. func (*Provision_Config) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 1} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 1} } func (x *Provision_Config) GetDirectory() string { @@ -1681,14 +1580,15 @@ type Provision_Plan struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Config *Provision_Config `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` - ParameterValues []*ParameterValue `protobuf:"bytes,2,rep,name=parameter_values,json=parameterValues,proto3" json:"parameter_values,omitempty"` + Config *Provision_Config `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` + DeprecatedParameterValues []*ParameterValue `protobuf:"bytes,2,rep,name=deprecated_parameter_values,json=deprecatedParameterValues,proto3" json:"deprecated_parameter_values,omitempty"` + ParameterValues []*ParameterValue `protobuf:"bytes,3,rep,name=parameter_values,json=parameterValues,proto3" json:"parameter_values,omitempty"` } func (x *Provision_Plan) Reset() { *x = Provision_Plan{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[20] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1701,7 +1601,7 @@ func (x *Provision_Plan) String() string { func (*Provision_Plan) ProtoMessage() {} func (x *Provision_Plan) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[20] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1714,7 +1614,7 @@ func (x *Provision_Plan) ProtoReflect() protoreflect.Message { // Deprecated: Use Provision_Plan.ProtoReflect.Descriptor instead. func (*Provision_Plan) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 2} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 2} } func (x *Provision_Plan) GetConfig() *Provision_Config { @@ -1724,6 +1624,13 @@ func (x *Provision_Plan) GetConfig() *Provision_Config { return nil } +func (x *Provision_Plan) GetDeprecatedParameterValues() []*ParameterValue { + if x != nil { + return x.DeprecatedParameterValues + } + return nil +} + func (x *Provision_Plan) GetParameterValues() []*ParameterValue { if x != nil { return x.ParameterValues @@ -1743,7 +1650,7 @@ type Provision_Apply struct { func (x *Provision_Apply) Reset() { *x = Provision_Apply{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[21] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1756,7 +1663,7 @@ func (x *Provision_Apply) String() string { func (*Provision_Apply) ProtoMessage() {} func (x *Provision_Apply) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[21] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1769,7 +1676,7 @@ func (x *Provision_Apply) ProtoReflect() protoreflect.Message { // Deprecated: Use Provision_Apply.ProtoReflect.Descriptor instead. func (*Provision_Apply) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 3} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 3} } func (x *Provision_Apply) GetConfig() *Provision_Config { @@ -1795,7 +1702,7 @@ type Provision_Cancel struct { func (x *Provision_Cancel) Reset() { *x = Provision_Cancel{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[22] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1808,7 +1715,7 @@ func (x *Provision_Cancel) String() string { func (*Provision_Cancel) ProtoMessage() {} func (x *Provision_Cancel) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[22] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1821,7 +1728,7 @@ func (x *Provision_Cancel) ProtoReflect() protoreflect.Message { // Deprecated: Use Provision_Cancel.ProtoReflect.Descriptor instead. func (*Provision_Cancel) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 4} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 4} } type Provision_Request struct { @@ -1840,7 +1747,7 @@ type Provision_Request struct { func (x *Provision_Request) Reset() { *x = Provision_Request{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[23] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1853,7 +1760,7 @@ func (x *Provision_Request) String() string { func (*Provision_Request) ProtoMessage() {} func (x *Provision_Request) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[23] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1866,7 +1773,7 @@ func (x *Provision_Request) ProtoReflect() protoreflect.Message { // Deprecated: Use Provision_Request.ProtoReflect.Descriptor instead. func (*Provision_Request) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 5} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 5} } func (m *Provision_Request) GetType() isProvision_Request_Type { @@ -1924,16 +1831,17 @@ type Provision_Complete struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - State []byte `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` - Plan []byte `protobuf:"bytes,4,opt,name=plan,proto3" json:"plan,omitempty"` - Resources []*Resource `protobuf:"bytes,3,rep,name=resources,proto3" json:"resources,omitempty"` + State []byte `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` + Resources []*Resource `protobuf:"bytes,3,rep,name=resources,proto3" json:"resources,omitempty"` + Parameters []*Parameter `protobuf:"bytes,4,rep,name=parameters,proto3" json:"parameters,omitempty"` + Plan []byte `protobuf:"bytes,5,opt,name=plan,proto3" json:"plan,omitempty"` } func (x *Provision_Complete) Reset() { *x = Provision_Complete{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[24] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1946,7 +1854,7 @@ func (x *Provision_Complete) String() string { func (*Provision_Complete) ProtoMessage() {} func (x *Provision_Complete) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[24] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1959,7 +1867,7 @@ func (x *Provision_Complete) ProtoReflect() protoreflect.Message { // Deprecated: Use Provision_Complete.ProtoReflect.Descriptor instead. func (*Provision_Complete) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 6} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 6} } func (x *Provision_Complete) GetState() []byte { @@ -1976,16 +1884,23 @@ func (x *Provision_Complete) GetError() string { return "" } -func (x *Provision_Complete) GetPlan() []byte { +func (x *Provision_Complete) GetResources() []*Resource { if x != nil { - return x.Plan + return x.Resources } return nil } -func (x *Provision_Complete) GetResources() []*Resource { +func (x *Provision_Complete) GetParameters() []*Parameter { if x != nil { - return x.Resources + return x.Parameters + } + return nil +} + +func (x *Provision_Complete) GetPlan() []byte { + if x != nil { + return x.Plan } return nil } @@ -2005,7 +1920,7 @@ type Provision_Response struct { func (x *Provision_Response) Reset() { *x = Provision_Response{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[25] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2018,7 +1933,7 @@ func (x *Provision_Response) String() string { func (*Provision_Response) ProtoMessage() {} func (x *Provision_Response) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[25] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2031,7 +1946,7 @@ func (x *Provision_Response) ProtoReflect() protoreflect.Message { // Deprecated: Use Provision_Response.ProtoReflect.Descriptor instead. func (*Provision_Response) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 7} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 7} } func (m *Provision_Response) GetType() isProvision_Response_Type { @@ -2071,221 +1986,351 @@ func (*Provision_Response_Log) isProvision_Response_Type() {} func (*Provision_Response_Complete) isProvision_Response_Type() {} +type DeprecatedParse_Request struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Directory string `protobuf:"bytes,1,opt,name=directory,proto3" json:"directory,omitempty"` +} + +func (x *DeprecatedParse_Request) Reset() { + *x = DeprecatedParse_Request{} + if protoimpl.UnsafeEnabled { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeprecatedParse_Request) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeprecatedParse_Request) ProtoMessage() {} + +func (x *DeprecatedParse_Request) ProtoReflect() protoreflect.Message { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeprecatedParse_Request.ProtoReflect.Descriptor instead. +func (*DeprecatedParse_Request) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{11, 0} +} + +func (x *DeprecatedParse_Request) GetDirectory() string { + if x != nil { + return x.Directory + } + return "" +} + +type DeprecatedParse_Complete struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ParameterSchemas []*DeprecatedParameterSchema `protobuf:"bytes,2,rep,name=parameter_schemas,json=parameterSchemas,proto3" json:"parameter_schemas,omitempty"` +} + +func (x *DeprecatedParse_Complete) Reset() { + *x = DeprecatedParse_Complete{} + if protoimpl.UnsafeEnabled { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeprecatedParse_Complete) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeprecatedParse_Complete) ProtoMessage() {} + +func (x *DeprecatedParse_Complete) ProtoReflect() protoreflect.Message { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeprecatedParse_Complete.ProtoReflect.Descriptor instead. +func (*DeprecatedParse_Complete) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{11, 1} +} + +func (x *DeprecatedParse_Complete) GetParameterSchemas() []*DeprecatedParameterSchema { + if x != nil { + return x.ParameterSchemas + } + return nil +} + +type DeprecatedParse_Response struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Type: + // + // *DeprecatedParse_Response_Log + // *DeprecatedParse_Response_Complete + Type isDeprecatedParse_Response_Type `protobuf_oneof:"type"` +} + +func (x *DeprecatedParse_Response) Reset() { + *x = DeprecatedParse_Response{} + if protoimpl.UnsafeEnabled { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeprecatedParse_Response) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeprecatedParse_Response) ProtoMessage() {} + +func (x *DeprecatedParse_Response) ProtoReflect() protoreflect.Message { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeprecatedParse_Response.ProtoReflect.Descriptor instead. +func (*DeprecatedParse_Response) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{11, 2} +} + +func (m *DeprecatedParse_Response) GetType() isDeprecatedParse_Response_Type { + if m != nil { + return m.Type + } + return nil +} + +func (x *DeprecatedParse_Response) GetLog() *Log { + if x, ok := x.GetType().(*DeprecatedParse_Response_Log); ok { + return x.Log + } + return nil +} + +func (x *DeprecatedParse_Response) GetComplete() *DeprecatedParse_Complete { + if x, ok := x.GetType().(*DeprecatedParse_Response_Complete); ok { + return x.Complete + } + return nil +} + +type isDeprecatedParse_Response_Type interface { + isDeprecatedParse_Response_Type() +} + +type DeprecatedParse_Response_Log struct { + Log *Log `protobuf:"bytes,1,opt,name=log,proto3,oneof"` +} + +type DeprecatedParse_Response_Complete struct { + Complete *DeprecatedParse_Complete `protobuf:"bytes,2,opt,name=complete,proto3,oneof"` +} + +func (*DeprecatedParse_Response_Log) isDeprecatedParse_Response_Type() {} + +func (*DeprecatedParse_Response_Complete) isDeprecatedParse_Response_Type() {} + var File_provisionersdk_proto_provisioner_proto protoreflect.FileDescriptor var file_provisionersdk_proto_provisioner_proto_rawDesc = []byte{ 0x0a, 0x26, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x78, - 0x0a, 0x0f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, - 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0x12, 0x0a, 0x06, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x08, - 0x0a, 0x04, 0x44, 0x41, 0x54, 0x41, 0x10, 0x00, 0x22, 0x96, 0x01, 0x0a, 0x14, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x40, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x28, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, - 0x65, 0x6d, 0x65, 0x22, 0x3c, 0x0a, 0x06, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x18, 0x0a, - 0x14, 0x45, 0x4e, 0x56, 0x49, 0x52, 0x4f, 0x4e, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x56, 0x41, 0x52, - 0x49, 0x41, 0x42, 0x4c, 0x45, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x52, 0x4f, 0x56, 0x49, - 0x53, 0x49, 0x4f, 0x4e, 0x45, 0x52, 0x5f, 0x56, 0x41, 0x52, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x10, - 0x01, 0x22, 0x93, 0x01, 0x0a, 0x0e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x57, 0x0a, 0x12, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x28, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x52, 0x11, 0x64, 0x65, 0x73, 0x74, - 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x12, 0x0a, + 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x4a, + 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x2b, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, + 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x65, 0x76, + 0x65, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0x37, 0x0a, 0x14, 0x49, 0x6e, + 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x41, 0x75, + 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, + 0x65, 0x49, 0x64, 0x22, 0x9b, 0x04, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8d, 0x05, 0x0a, 0x0f, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x43, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x76, + 0x65, 0x12, 0x2d, 0x0a, 0x03, 0x65, 0x6e, 0x76, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x67, 0x65, + 0x6e, 0x74, 0x2e, 0x45, 0x6e, 0x76, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x03, 0x65, 0x6e, 0x76, + 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x72, 0x74, 0x75, 0x70, 0x5f, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x75, + 0x70, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x6f, 0x70, 0x65, 0x72, 0x61, + 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x72, 0x63, 0x68, 0x69, 0x74, 0x65, 0x63, 0x74, 0x75, + 0x72, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x72, 0x63, 0x68, 0x69, 0x74, + 0x65, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x79, 0x12, 0x24, 0x0a, 0x04, 0x61, 0x70, 0x70, 0x73, 0x18, 0x08, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, + 0x2e, 0x41, 0x70, 0x70, 0x52, 0x04, 0x61, 0x70, 0x70, 0x73, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x12, 0x21, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, + 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x3c, 0x0a, 0x1a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x18, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0x73, 0x12, 0x2f, 0x0a, 0x13, 0x74, 0x72, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x73, 0x68, + 0x6f, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x12, 0x74, 0x72, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x73, 0x68, 0x6f, 0x6f, 0x74, 0x69, 0x6e, + 0x67, 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x6f, 0x74, 0x64, 0x5f, 0x66, 0x69, 0x6c, + 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x6f, 0x74, 0x64, 0x46, 0x69, 0x6c, + 0x65, 0x1a, 0x36, 0x0a, 0x08, 0x45, 0x6e, 0x76, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x0a, 0x04, 0x61, 0x75, 0x74, + 0x68, 0x22, 0x99, 0x02, 0x0a, 0x03, 0x41, 0x70, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6c, 0x75, + 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x6c, 0x75, 0x67, 0x12, 0x21, 0x0a, + 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, + 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, + 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x63, 0x6f, 0x6e, + 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x75, 0x62, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x3a, + 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, + 0x72, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x0b, 0x68, + 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x41, 0x0a, 0x0d, 0x73, 0x68, + 0x61, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, + 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, + 0x0c, 0x73, 0x68, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0x59, 0x0a, + 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x10, 0x0a, 0x03, + 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x1a, + 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x68, + 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x74, + 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x22, 0xf1, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, + 0x06, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x67, 0x65, 0x6e, + 0x74, 0x52, 0x06, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x69, 0x64, 0x65, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x04, 0x68, 0x69, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, + 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x23, 0x0a, + 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x61, 0x69, 0x6c, 0x79, 0x5f, 0x63, 0x6f, 0x73, 0x74, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x64, 0x61, 0x69, 0x6c, 0x79, 0x43, 0x6f, 0x73, + 0x74, 0x1a, 0x69, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, + 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, + 0x69, 0x76, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x4e, 0x75, 0x6c, 0x6c, 0x22, 0x71, 0x0a, 0x0f, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, + 0x63, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x22, + 0xd9, 0x02, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x75, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6d, 0x75, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, + 0x74, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x72, 0x65, 0x67, 0x65, 0x78, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x76, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x12, 0x25, 0x0a, + 0x0e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x69, 0x6e, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x4d, 0x69, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x78, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x76, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x78, 0x22, 0x3a, 0x0a, 0x0e, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x86, 0x0a, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x76, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0xd1, 0x02, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x55, 0x72, 0x6c, 0x12, + 0x53, 0x0a, 0x14, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x57, 0x6f, 0x72, 0x6b, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x77, 0x6f, + 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x77, + 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4f, + 0x77, 0x6e, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x77, 0x6f, 0x72, 0x6b, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4f, 0x77, + 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x15, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4f, + 0x77, 0x6e, 0x65, 0x72, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x1a, 0x79, 0x0a, 0x06, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x1a, 0xe2, 0x01, 0x0a, 0x04, 0x50, 0x6c, 0x61, 0x6e, 0x12, 0x35, 0x0a, + 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x12, 0x5b, 0x0a, 0x1b, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x15, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, - 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x4f, 0x76, 0x65, 0x72, - 0x72, 0x69, 0x64, 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x52, 0x0a, 0x13, 0x64, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x44, - 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x12, 0x64, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3c, - 0x0a, 0x1a, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, - 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x18, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, - 0x65, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f, - 0x72, 0x65, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x72, 0x65, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x5d, 0x0a, 0x16, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, - 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x14, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x53, 0x79, - 0x73, 0x74, 0x65, 0x6d, 0x12, 0x32, 0x0a, 0x15, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x13, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, - 0x72, 0x6f, 0x72, 0x12, 0x31, 0x0a, 0x14, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x13, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, - 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x1f, 0x0a, 0x0a, 0x54, 0x79, 0x70, 0x65, 0x53, 0x79, - 0x73, 0x74, 0x65, 0x6d, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x07, - 0x0a, 0x03, 0x48, 0x43, 0x4c, 0x10, 0x01, 0x22, 0x4a, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x2b, - 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, - 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x4c, - 0x65, 0x76, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x6f, - 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x75, 0x74, - 0x70, 0x75, 0x74, 0x22, 0x37, 0x0a, 0x14, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x41, 0x75, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x69, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x22, 0x9b, 0x04, 0x0a, - 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2d, 0x0a, 0x03, 0x65, 0x6e, - 0x76, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x6e, 0x76, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x03, 0x65, 0x6e, 0x76, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x75, 0x70, 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x75, 0x70, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x12, 0x29, 0x0a, 0x10, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x79, - 0x73, 0x74, 0x65, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6f, 0x70, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x22, 0x0a, 0x0c, 0x61, - 0x72, 0x63, 0x68, 0x69, 0x74, 0x65, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0c, 0x61, 0x72, 0x63, 0x68, 0x69, 0x74, 0x65, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, - 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x24, 0x0a, - 0x04, 0x61, 0x70, 0x70, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, - 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x70, 0x70, 0x52, 0x04, 0x61, - 0x70, 0x70, 0x73, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x21, 0x0a, 0x0b, 0x69, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x3c, - 0x0a, 0x1a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, - 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x0b, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x18, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, - 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x2f, 0x0a, 0x13, - 0x74, 0x72, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x73, 0x68, 0x6f, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x5f, - 0x75, 0x72, 0x6c, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x74, 0x72, 0x6f, 0x75, 0x62, - 0x6c, 0x65, 0x73, 0x68, 0x6f, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a, - 0x09, 0x6d, 0x6f, 0x74, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x6d, 0x6f, 0x74, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x1a, 0x36, 0x0a, 0x08, 0x45, 0x6e, - 0x76, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x42, 0x06, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x22, 0x99, 0x02, 0x0a, 0x03, 0x41, - 0x70, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6c, 0x75, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x73, 0x6c, 0x75, 0x67, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, - 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, - 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, - 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, - 0x61, 0x6e, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x75, 0x62, - 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x75, - 0x62, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x3a, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x6c, 0x74, - 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, - 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, - 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x0b, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, - 0x65, 0x63, 0x6b, 0x12, 0x41, 0x0a, 0x0d, 0x73, 0x68, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6c, - 0x65, 0x76, 0x65, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, - 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, - 0x69, 0x6e, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x0c, 0x73, 0x68, 0x61, 0x72, 0x69, 0x6e, - 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0x59, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, - 0x63, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x76, 0x61, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, - 0x64, 0x22, 0xf1, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, - 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x61, 0x67, 0x65, 0x6e, - 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, - 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, - 0x0a, 0x04, 0x68, 0x69, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x68, 0x69, - 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, - 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x64, - 0x61, 0x69, 0x6c, 0x79, 0x5f, 0x63, 0x6f, 0x73, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x09, 0x64, 0x61, 0x69, 0x6c, 0x79, 0x43, 0x6f, 0x73, 0x74, 0x1a, 0x69, 0x0a, 0x08, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, - 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x12, 0x17, 0x0a, 0x07, - 0x69, 0x73, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, - 0x73, 0x4e, 0x75, 0x6c, 0x6c, 0x22, 0xfc, 0x01, 0x0a, 0x05, 0x50, 0x61, 0x72, 0x73, 0x65, 0x1a, - 0x27, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, - 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, - 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x1a, 0x55, 0x0a, 0x08, 0x43, 0x6f, 0x6d, 0x70, - 0x6c, 0x65, 0x74, 0x65, 0x12, 0x49, 0x0a, 0x11, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x10, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x1a, - 0x73, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x03, 0x6c, - 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, - 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x48, 0x00, 0x52, 0x03, 0x6c, 0x6f, - 0x67, 0x12, 0x39, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, - 0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, - 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x06, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x22, 0xf0, 0x08, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, - 0x6f, 0x6e, 0x1a, 0xd1, 0x02, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, - 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x53, 0x0a, 0x14, - 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, - 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x77, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x77, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4f, 0x77, 0x6e, 0x65, - 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, - 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, - 0x49, 0x64, 0x12, 0x32, 0x0a, 0x15, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, - 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4f, 0x77, 0x6e, 0x65, - 0x72, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x1a, 0x79, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, - 0x74, 0x61, 0x74, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, - 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x1a, 0x85, 0x01, 0x0a, 0x04, 0x50, 0x6c, 0x61, 0x6e, 0x12, 0x35, 0x0a, 0x06, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, - 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, - 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x12, 0x46, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, + 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x19, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, + 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x46, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x1a, 0x52, 0x0a, 0x05, 0x41, 0x70, 0x70, @@ -2305,48 +2350,114 @@ var file_provisionersdk_proto_provisioner_proto_rawDesc = []byte{ 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x48, 0x00, 0x52, 0x06, 0x63, - 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x1a, 0x7f, 0x0a, - 0x08, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, - 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6c, 0x61, 0x6e, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x04, 0x70, 0x6c, 0x61, 0x6e, 0x12, 0x33, 0x0a, 0x09, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, - 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x1a, 0x77, + 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x1a, 0xb7, 0x01, + 0x0a, 0x08, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, + 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x33, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x36, 0x0a, 0x0a, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6c, 0x61, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x04, 0x70, 0x6c, 0x61, 0x6e, 0x1a, 0x77, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x4c, + 0x6f, 0x67, 0x48, 0x00, 0x52, 0x03, 0x6c, 0x6f, 0x67, 0x12, 0x3d, 0x0a, 0x08, 0x63, 0x6f, 0x6d, + 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, + 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x22, 0x9a, 0x02, 0x0a, 0x0f, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x50, + 0x61, 0x72, 0x73, 0x65, 0x1a, 0x27, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x1a, 0x5f, 0x0a, + 0x08, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x53, 0x0a, 0x11, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, + 0x65, 0x72, 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x10, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x1a, 0x7d, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x48, 0x00, 0x52, 0x03, 0x6c, 0x6f, 0x67, - 0x12, 0x3d, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, - 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, - 0x65, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x42, - 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x2a, 0x3f, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x4c, 0x65, - 0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x46, - 0x4f, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x41, 0x52, 0x4e, 0x10, 0x03, 0x12, 0x09, 0x0a, - 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x2a, 0x3b, 0x0a, 0x0f, 0x41, 0x70, 0x70, 0x53, - 0x68, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x4f, - 0x57, 0x4e, 0x45, 0x52, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x55, 0x54, 0x48, 0x45, 0x4e, - 0x54, 0x49, 0x43, 0x41, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x55, 0x42, - 0x4c, 0x49, 0x43, 0x10, 0x02, 0x2a, 0x37, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, - 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x54, 0x4f, 0x50, 0x10, - 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x53, 0x54, 0x52, 0x4f, 0x59, 0x10, 0x02, 0x32, 0xa3, - 0x01, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x12, 0x42, - 0x0a, 0x05, 0x50, 0x61, 0x72, 0x73, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, - 0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x30, 0x01, 0x12, 0x50, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, - 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, - 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x28, 0x01, 0x30, 0x01, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2f, 0x70, - 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x43, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, + 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x72, 0x73, 0x65, + 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6d, + 0x70, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x8c, 0x01, + 0x0a, 0x19, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x45, 0x0a, 0x06, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, + 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x12, 0x0a, 0x06, 0x53, 0x63, 0x68, 0x65, + 0x6d, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x41, 0x54, 0x41, 0x10, 0x00, 0x22, 0x99, 0x04, 0x0a, + 0x19, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, + 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x4d, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, + 0x32, 0x0a, 0x15, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, + 0x65, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, + 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x53, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x72, 0x65, + 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x67, 0x0a, 0x16, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, + 0x63, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, + 0x14, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x53, + 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x32, 0x0a, 0x15, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x76, 0x61, 0x6c, + 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x12, 0x31, 0x0a, 0x14, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x13, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, + 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x1f, 0x0a, 0x0a, 0x54, 0x79, 0x70, 0x65, 0x53, + 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, + 0x07, 0x0a, 0x03, 0x48, 0x43, 0x4c, 0x10, 0x01, 0x2a, 0x3f, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x4c, + 0x65, 0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, + 0x46, 0x4f, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x41, 0x52, 0x4e, 0x10, 0x03, 0x12, 0x09, + 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x2a, 0x3b, 0x0a, 0x0f, 0x41, 0x70, 0x70, + 0x53, 0x68, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, + 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x55, 0x54, 0x48, 0x45, + 0x4e, 0x54, 0x49, 0x43, 0x41, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x55, + 0x42, 0x4c, 0x49, 0x43, 0x10, 0x02, 0x2a, 0x37, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, + 0x05, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x54, 0x4f, 0x50, + 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x53, 0x54, 0x52, 0x4f, 0x59, 0x10, 0x02, 0x32, + 0xc1, 0x01, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x12, + 0x60, 0x0a, 0x0f, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x72, + 0x73, 0x65, 0x12, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, + 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x72, 0x73, 0x65, + 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, + 0x01, 0x12, 0x50, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, + 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, + 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, + 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, + 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, + 0x01, 0x30, 0x01, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2f, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2361,74 +2472,74 @@ func file_provisionersdk_proto_provisioner_proto_rawDescGZIP() []byte { return file_provisionersdk_proto_provisioner_proto_rawDescData } -var file_provisionersdk_proto_provisioner_proto_enumTypes = make([]protoimpl.EnumInfo, 6) -var file_provisionersdk_proto_provisioner_proto_msgTypes = make([]protoimpl.MessageInfo, 26) +var file_provisionersdk_proto_provisioner_proto_enumTypes = make([]protoimpl.EnumInfo, 5) +var file_provisionersdk_proto_provisioner_proto_msgTypes = make([]protoimpl.MessageInfo, 27) var file_provisionersdk_proto_provisioner_proto_goTypes = []interface{}{ - (LogLevel)(0), // 0: provisioner.LogLevel - (AppSharingLevel)(0), // 1: provisioner.AppSharingLevel - (WorkspaceTransition)(0), // 2: provisioner.WorkspaceTransition - (ParameterSource_Scheme)(0), // 3: provisioner.ParameterSource.Scheme - (ParameterDestination_Scheme)(0), // 4: provisioner.ParameterDestination.Scheme - (ParameterSchema_TypeSystem)(0), // 5: provisioner.ParameterSchema.TypeSystem - (*Empty)(nil), // 6: provisioner.Empty - (*ParameterSource)(nil), // 7: provisioner.ParameterSource - (*ParameterDestination)(nil), // 8: provisioner.ParameterDestination - (*ParameterValue)(nil), // 9: provisioner.ParameterValue - (*ParameterSchema)(nil), // 10: provisioner.ParameterSchema - (*Log)(nil), // 11: provisioner.Log - (*InstanceIdentityAuth)(nil), // 12: provisioner.InstanceIdentityAuth - (*Agent)(nil), // 13: provisioner.Agent - (*App)(nil), // 14: provisioner.App - (*Healthcheck)(nil), // 15: provisioner.Healthcheck - (*Resource)(nil), // 16: provisioner.Resource - (*Parse)(nil), // 17: provisioner.Parse - (*Provision)(nil), // 18: provisioner.Provision - nil, // 19: provisioner.Agent.EnvEntry - (*Resource_Metadata)(nil), // 20: provisioner.Resource.Metadata - (*Parse_Request)(nil), // 21: provisioner.Parse.Request - (*Parse_Complete)(nil), // 22: provisioner.Parse.Complete - (*Parse_Response)(nil), // 23: provisioner.Parse.Response - (*Provision_Metadata)(nil), // 24: provisioner.Provision.Metadata - (*Provision_Config)(nil), // 25: provisioner.Provision.Config - (*Provision_Plan)(nil), // 26: provisioner.Provision.Plan - (*Provision_Apply)(nil), // 27: provisioner.Provision.Apply - (*Provision_Cancel)(nil), // 28: provisioner.Provision.Cancel - (*Provision_Request)(nil), // 29: provisioner.Provision.Request - (*Provision_Complete)(nil), // 30: provisioner.Provision.Complete - (*Provision_Response)(nil), // 31: provisioner.Provision.Response + (LogLevel)(0), // 0: provisioner.LogLevel + (AppSharingLevel)(0), // 1: provisioner.AppSharingLevel + (WorkspaceTransition)(0), // 2: provisioner.WorkspaceTransition + (DeprecatedParameterSource_Scheme)(0), // 3: provisioner.DeprecatedParameterSource.Scheme + (DeprecatedParameterSchema_TypeSystem)(0), // 4: provisioner.DeprecatedParameterSchema.TypeSystem + (*Empty)(nil), // 5: provisioner.Empty + (*Log)(nil), // 6: provisioner.Log + (*InstanceIdentityAuth)(nil), // 7: provisioner.InstanceIdentityAuth + (*Agent)(nil), // 8: provisioner.Agent + (*App)(nil), // 9: provisioner.App + (*Healthcheck)(nil), // 10: provisioner.Healthcheck + (*Resource)(nil), // 11: provisioner.Resource + (*ParameterOption)(nil), // 12: provisioner.ParameterOption + (*Parameter)(nil), // 13: provisioner.Parameter + (*ParameterValue)(nil), // 14: provisioner.ParameterValue + (*Provision)(nil), // 15: provisioner.Provision + (*DeprecatedParse)(nil), // 16: provisioner.DeprecatedParse + (*DeprecatedParameterSource)(nil), // 17: provisioner.DeprecatedParameterSource + (*DeprecatedParameterSchema)(nil), // 18: provisioner.DeprecatedParameterSchema + nil, // 19: provisioner.Agent.EnvEntry + (*Resource_Metadata)(nil), // 20: provisioner.Resource.Metadata + (*Provision_Metadata)(nil), // 21: provisioner.Provision.Metadata + (*Provision_Config)(nil), // 22: provisioner.Provision.Config + (*Provision_Plan)(nil), // 23: provisioner.Provision.Plan + (*Provision_Apply)(nil), // 24: provisioner.Provision.Apply + (*Provision_Cancel)(nil), // 25: provisioner.Provision.Cancel + (*Provision_Request)(nil), // 26: provisioner.Provision.Request + (*Provision_Complete)(nil), // 27: provisioner.Provision.Complete + (*Provision_Response)(nil), // 28: provisioner.Provision.Response + (*DeprecatedParse_Request)(nil), // 29: provisioner.DeprecatedParse.Request + (*DeprecatedParse_Complete)(nil), // 30: provisioner.DeprecatedParse.Complete + (*DeprecatedParse_Response)(nil), // 31: provisioner.DeprecatedParse.Response } var file_provisionersdk_proto_provisioner_proto_depIdxs = []int32{ - 3, // 0: provisioner.ParameterSource.scheme:type_name -> provisioner.ParameterSource.Scheme - 4, // 1: provisioner.ParameterDestination.scheme:type_name -> provisioner.ParameterDestination.Scheme - 4, // 2: provisioner.ParameterValue.destination_scheme:type_name -> provisioner.ParameterDestination.Scheme - 7, // 3: provisioner.ParameterSchema.default_source:type_name -> provisioner.ParameterSource - 8, // 4: provisioner.ParameterSchema.default_destination:type_name -> provisioner.ParameterDestination - 5, // 5: provisioner.ParameterSchema.validation_type_system:type_name -> provisioner.ParameterSchema.TypeSystem - 0, // 6: provisioner.Log.level:type_name -> provisioner.LogLevel - 19, // 7: provisioner.Agent.env:type_name -> provisioner.Agent.EnvEntry - 14, // 8: provisioner.Agent.apps:type_name -> provisioner.App - 15, // 9: provisioner.App.healthcheck:type_name -> provisioner.Healthcheck - 1, // 10: provisioner.App.sharing_level:type_name -> provisioner.AppSharingLevel - 13, // 11: provisioner.Resource.agents:type_name -> provisioner.Agent - 20, // 12: provisioner.Resource.metadata:type_name -> provisioner.Resource.Metadata - 10, // 13: provisioner.Parse.Complete.parameter_schemas:type_name -> provisioner.ParameterSchema - 11, // 14: provisioner.Parse.Response.log:type_name -> provisioner.Log - 22, // 15: provisioner.Parse.Response.complete:type_name -> provisioner.Parse.Complete - 2, // 16: provisioner.Provision.Metadata.workspace_transition:type_name -> provisioner.WorkspaceTransition - 24, // 17: provisioner.Provision.Config.metadata:type_name -> provisioner.Provision.Metadata - 25, // 18: provisioner.Provision.Plan.config:type_name -> provisioner.Provision.Config - 9, // 19: provisioner.Provision.Plan.parameter_values:type_name -> provisioner.ParameterValue - 25, // 20: provisioner.Provision.Apply.config:type_name -> provisioner.Provision.Config - 26, // 21: provisioner.Provision.Request.plan:type_name -> provisioner.Provision.Plan - 27, // 22: provisioner.Provision.Request.apply:type_name -> provisioner.Provision.Apply - 28, // 23: provisioner.Provision.Request.cancel:type_name -> provisioner.Provision.Cancel - 16, // 24: provisioner.Provision.Complete.resources:type_name -> provisioner.Resource - 11, // 25: provisioner.Provision.Response.log:type_name -> provisioner.Log - 30, // 26: provisioner.Provision.Response.complete:type_name -> provisioner.Provision.Complete - 21, // 27: provisioner.Provisioner.Parse:input_type -> provisioner.Parse.Request - 29, // 28: provisioner.Provisioner.Provision:input_type -> provisioner.Provision.Request - 23, // 29: provisioner.Provisioner.Parse:output_type -> provisioner.Parse.Response - 31, // 30: provisioner.Provisioner.Provision:output_type -> provisioner.Provision.Response + 0, // 0: provisioner.Log.level:type_name -> provisioner.LogLevel + 19, // 1: provisioner.Agent.env:type_name -> provisioner.Agent.EnvEntry + 9, // 2: provisioner.Agent.apps:type_name -> provisioner.App + 10, // 3: provisioner.App.healthcheck:type_name -> provisioner.Healthcheck + 1, // 4: provisioner.App.sharing_level:type_name -> provisioner.AppSharingLevel + 8, // 5: provisioner.Resource.agents:type_name -> provisioner.Agent + 20, // 6: provisioner.Resource.metadata:type_name -> provisioner.Resource.Metadata + 12, // 7: provisioner.Parameter.options:type_name -> provisioner.ParameterOption + 3, // 8: provisioner.DeprecatedParameterSource.scheme:type_name -> provisioner.DeprecatedParameterSource.Scheme + 17, // 9: provisioner.DeprecatedParameterSchema.default_source:type_name -> provisioner.DeprecatedParameterSource + 4, // 10: provisioner.DeprecatedParameterSchema.validation_type_system:type_name -> provisioner.DeprecatedParameterSchema.TypeSystem + 2, // 11: provisioner.Provision.Metadata.workspace_transition:type_name -> provisioner.WorkspaceTransition + 21, // 12: provisioner.Provision.Config.metadata:type_name -> provisioner.Provision.Metadata + 22, // 13: provisioner.Provision.Plan.config:type_name -> provisioner.Provision.Config + 14, // 14: provisioner.Provision.Plan.deprecated_parameter_values:type_name -> provisioner.ParameterValue + 14, // 15: provisioner.Provision.Plan.parameter_values:type_name -> provisioner.ParameterValue + 22, // 16: provisioner.Provision.Apply.config:type_name -> provisioner.Provision.Config + 23, // 17: provisioner.Provision.Request.plan:type_name -> provisioner.Provision.Plan + 24, // 18: provisioner.Provision.Request.apply:type_name -> provisioner.Provision.Apply + 25, // 19: provisioner.Provision.Request.cancel:type_name -> provisioner.Provision.Cancel + 11, // 20: provisioner.Provision.Complete.resources:type_name -> provisioner.Resource + 13, // 21: provisioner.Provision.Complete.parameters:type_name -> provisioner.Parameter + 6, // 22: provisioner.Provision.Response.log:type_name -> provisioner.Log + 27, // 23: provisioner.Provision.Response.complete:type_name -> provisioner.Provision.Complete + 18, // 24: provisioner.DeprecatedParse.Complete.parameter_schemas:type_name -> provisioner.DeprecatedParameterSchema + 6, // 25: provisioner.DeprecatedParse.Response.log:type_name -> provisioner.Log + 30, // 26: provisioner.DeprecatedParse.Response.complete:type_name -> provisioner.DeprecatedParse.Complete + 29, // 27: provisioner.Provisioner.DeprecatedParse:input_type -> provisioner.DeprecatedParse.Request + 26, // 28: provisioner.Provisioner.Provision:input_type -> provisioner.Provision.Request + 31, // 29: provisioner.Provisioner.DeprecatedParse:output_type -> provisioner.DeprecatedParse.Response + 28, // 30: provisioner.Provisioner.Provision:output_type -> provisioner.Provision.Response 29, // [29:31] is the sub-list for method output_type 27, // [27:29] is the sub-list for method input_type 27, // [27:27] is the sub-list for extension type_name @@ -2455,7 +2566,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParameterSource); i { + switch v := v.(*Log); i { case 0: return &v.state case 1: @@ -2467,7 +2578,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParameterDestination); i { + switch v := v.(*InstanceIdentityAuth); i { case 0: return &v.state case 1: @@ -2479,7 +2590,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParameterValue); i { + switch v := v.(*Agent); i { case 0: return &v.state case 1: @@ -2491,7 +2602,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParameterSchema); i { + switch v := v.(*App); i { case 0: return &v.state case 1: @@ -2503,7 +2614,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Log); i { + switch v := v.(*Healthcheck); i { case 0: return &v.state case 1: @@ -2515,7 +2626,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InstanceIdentityAuth); i { + switch v := v.(*Resource); i { case 0: return &v.state case 1: @@ -2527,7 +2638,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Agent); i { + switch v := v.(*ParameterOption); i { case 0: return &v.state case 1: @@ -2539,7 +2650,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*App); i { + switch v := v.(*Parameter); i { case 0: return &v.state case 1: @@ -2551,7 +2662,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Healthcheck); i { + switch v := v.(*ParameterValue); i { case 0: return &v.state case 1: @@ -2563,7 +2674,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Resource); i { + switch v := v.(*Provision); i { case 0: return &v.state case 1: @@ -2575,7 +2686,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Parse); i { + switch v := v.(*DeprecatedParse); i { case 0: return &v.state case 1: @@ -2587,7 +2698,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Provision); i { + switch v := v.(*DeprecatedParameterSource); i { case 0: return &v.state case 1: @@ -2598,8 +2709,8 @@ func file_provisionersdk_proto_provisioner_proto_init() { return nil } } - file_provisionersdk_proto_provisioner_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Resource_Metadata); i { + file_provisionersdk_proto_provisioner_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeprecatedParameterSchema); i { case 0: return &v.state case 1: @@ -2611,7 +2722,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Parse_Request); i { + switch v := v.(*Resource_Metadata); i { case 0: return &v.state case 1: @@ -2623,7 +2734,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Parse_Complete); i { + switch v := v.(*Provision_Metadata); i { case 0: return &v.state case 1: @@ -2635,7 +2746,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Parse_Response); i { + switch v := v.(*Provision_Config); i { case 0: return &v.state case 1: @@ -2647,7 +2758,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Provision_Metadata); i { + switch v := v.(*Provision_Plan); i { case 0: return &v.state case 1: @@ -2659,7 +2770,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Provision_Config); i { + switch v := v.(*Provision_Apply); i { case 0: return &v.state case 1: @@ -2671,7 +2782,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Provision_Plan); i { + switch v := v.(*Provision_Cancel); i { case 0: return &v.state case 1: @@ -2683,7 +2794,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Provision_Apply); i { + switch v := v.(*Provision_Request); i { case 0: return &v.state case 1: @@ -2695,7 +2806,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Provision_Cancel); i { + switch v := v.(*Provision_Complete); i { case 0: return &v.state case 1: @@ -2707,7 +2818,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Provision_Request); i { + switch v := v.(*Provision_Response); i { case 0: return &v.state case 1: @@ -2719,7 +2830,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Provision_Complete); i { + switch v := v.(*DeprecatedParse_Request); i { case 0: return &v.state case 1: @@ -2731,7 +2842,19 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Provision_Response); i { + switch v := v.(*DeprecatedParse_Complete); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_provisionersdk_proto_provisioner_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeprecatedParse_Response); i { case 0: return &v.state case 1: @@ -2743,30 +2866,30 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } } - file_provisionersdk_proto_provisioner_proto_msgTypes[7].OneofWrappers = []interface{}{ + file_provisionersdk_proto_provisioner_proto_msgTypes[3].OneofWrappers = []interface{}{ (*Agent_Token)(nil), (*Agent_InstanceId)(nil), } - file_provisionersdk_proto_provisioner_proto_msgTypes[17].OneofWrappers = []interface{}{ - (*Parse_Response_Log)(nil), - (*Parse_Response_Complete)(nil), - } - file_provisionersdk_proto_provisioner_proto_msgTypes[23].OneofWrappers = []interface{}{ + file_provisionersdk_proto_provisioner_proto_msgTypes[21].OneofWrappers = []interface{}{ (*Provision_Request_Plan)(nil), (*Provision_Request_Apply)(nil), (*Provision_Request_Cancel)(nil), } - file_provisionersdk_proto_provisioner_proto_msgTypes[25].OneofWrappers = []interface{}{ + file_provisionersdk_proto_provisioner_proto_msgTypes[23].OneofWrappers = []interface{}{ (*Provision_Response_Log)(nil), (*Provision_Response_Complete)(nil), } + file_provisionersdk_proto_provisioner_proto_msgTypes[26].OneofWrappers = []interface{}{ + (*DeprecatedParse_Response_Log)(nil), + (*DeprecatedParse_Response_Complete)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_provisionersdk_proto_provisioner_proto_rawDesc, - NumEnums: 6, - NumMessages: 26, + NumEnums: 5, + NumMessages: 27, NumExtensions: 0, NumServices: 1, }, diff --git a/provisionersdk/proto/provisioner.proto b/provisionersdk/proto/provisioner.proto index a4d1b0f8bf64c..df5338a77cecc 100644 --- a/provisionersdk/proto/provisioner.proto +++ b/provisionersdk/proto/provisioner.proto @@ -7,51 +7,6 @@ package provisioner; // Empty indicates a successful request/response. message Empty {} -// ParameterSource represents the source location for a parameter to get it's value from. -message ParameterSource { - enum Scheme { - DATA = 0; - } - Scheme scheme = 1; - string value = 2; -} - -// ParameterDestination represents the target location for a provisioner to set the value. -message ParameterDestination { - enum Scheme { - ENVIRONMENT_VARIABLE = 0; - PROVISIONER_VARIABLE = 1; - } - Scheme scheme = 1; -} - -// ParameterValue represents the resolved source and destination of a parameter. -message ParameterValue { - ParameterDestination.Scheme destination_scheme = 1; - string name = 2; - string value = 3; -} - -// ParameterSchema represents validation and type information for a parsed parameter. -message ParameterSchema { - string name = 1; - string description = 2; - ParameterSource default_source = 3; - bool allow_override_source = 4; - ParameterDestination default_destination = 5; - bool allow_override_destination = 6; - bool redisplay_value = 7; - - enum TypeSystem { - None = 0; - HCL = 1; - } - TypeSystem validation_type_system = 8; - string validation_value_type = 9; - string validation_error = 10; - string validation_condition = 11; -} - // LogLevel represents severity of the log. enum LogLevel { TRACE = 0; @@ -136,20 +91,32 @@ message Resource { int32 daily_cost = 8; } -// Parse consumes source-code from a directory to produce inputs. -message Parse { - message Request { - string directory = 1; - } - message Complete { - repeated ParameterSchema parameter_schemas = 2; - } - message Response { - oneof type { - Log log = 1; - Complete complete = 2; - } - } +// ParameterOption represents a singular option that a parameter may expose. +message ParameterOption { + string name = 1; + string description = 2; + string value = 3; + string icon = 4; +} + +// Parameter represents a variable that is exposed. +message Parameter { + string name = 1; + string description = 2; + string type = 3; + bool mutable = 4; + string default_value = 5; + string icon = 6; + repeated ParameterOption options = 7; + string validation_regex = 8; + int32 validation_min = 9; + int32 validation_max = 10; +} + +// ParameterValue holds the key/value mapping of a parameter! +message ParameterValue { + string name = 1; + string value = 2; } enum WorkspaceTransition { @@ -181,7 +148,8 @@ message Provision { message Plan { Config config = 1; - repeated ParameterValue parameter_values = 2; + repeated ParameterValue deprecated_parameter_values = 2; + repeated ParameterValue parameter_values = 3; } message Apply { @@ -200,8 +168,9 @@ message Provision { message Complete { bytes state = 1; string error = 2; - bytes plan = 4; repeated Resource resources = 3; + repeated Parameter parameters = 4; + bytes plan = 5; } message Response { oneof type { @@ -212,6 +181,54 @@ message Provision { } service Provisioner { - rpc Parse(Parse.Request) returns (stream Parse.Response); + rpc DeprecatedParse(DeprecatedParse.Request) returns (stream DeprecatedParse.Response); rpc Provision(stream Provision.Request) returns (stream Provision.Response); } + +// DEPRECATED +// The values below can be removed in November 2022. +// These were used for parsing Terraform variables and providing values. +// We're changing to a data-source model, so these are left for compatibility. + +// DeprecatedParse consumes source-code from a directory to produce inputs. +message DeprecatedParse { + message Request { + string directory = 1; + } + message Complete { + repeated DeprecatedParameterSchema parameter_schemas = 2; + } + message Response { + oneof type { + Log log = 1; + Complete complete = 2; + } + } +} + +// DeprecatedParameterSource represents the source location for a parameter to get it's value from. +message DeprecatedParameterSource { + enum Scheme { + DATA = 0; + } + Scheme scheme = 1; + string value = 2; +} + +// DeprecatedParameterSchema represents validation and type information for a parsed parameter. +message DeprecatedParameterSchema { + string name = 1; + string description = 2; + DeprecatedParameterSource default_source = 3; + bool allow_override_source = 4; + bool redisplay_value = 5; + + enum TypeSystem { + None = 0; + HCL = 1; + } + TypeSystem validation_type_system = 6; + string validation_value_type = 7; + string validation_error = 8; + string validation_condition = 9; +} diff --git a/provisionersdk/proto/provisioner_drpc.pb.go b/provisionersdk/proto/provisioner_drpc.pb.go index c990f6f645b7f..a8530f3c8dcf7 100644 --- a/provisionersdk/proto/provisioner_drpc.pb.go +++ b/provisionersdk/proto/provisioner_drpc.pb.go @@ -38,7 +38,7 @@ func (drpcEncoding_File_provisionersdk_proto_provisioner_proto) JSONUnmarshal(bu type DRPCProvisionerClient interface { DRPCConn() drpc.Conn - Parse(ctx context.Context, in *Parse_Request) (DRPCProvisioner_ParseClient, error) + DeprecatedParse(ctx context.Context, in *DeprecatedParse_Request) (DRPCProvisioner_DeprecatedParseClient, error) Provision(ctx context.Context) (DRPCProvisioner_ProvisionClient, error) } @@ -52,12 +52,12 @@ func NewDRPCProvisionerClient(cc drpc.Conn) DRPCProvisionerClient { func (c *drpcProvisionerClient) DRPCConn() drpc.Conn { return c.cc } -func (c *drpcProvisionerClient) Parse(ctx context.Context, in *Parse_Request) (DRPCProvisioner_ParseClient, error) { - stream, err := c.cc.NewStream(ctx, "/provisioner.Provisioner/Parse", drpcEncoding_File_provisionersdk_proto_provisioner_proto{}) +func (c *drpcProvisionerClient) DeprecatedParse(ctx context.Context, in *DeprecatedParse_Request) (DRPCProvisioner_DeprecatedParseClient, error) { + stream, err := c.cc.NewStream(ctx, "/provisioner.Provisioner/DeprecatedParse", drpcEncoding_File_provisionersdk_proto_provisioner_proto{}) if err != nil { return nil, err } - x := &drpcProvisioner_ParseClient{stream} + x := &drpcProvisioner_DeprecatedParseClient{stream} if err := x.MsgSend(in, drpcEncoding_File_provisionersdk_proto_provisioner_proto{}); err != nil { return nil, err } @@ -67,24 +67,24 @@ func (c *drpcProvisionerClient) Parse(ctx context.Context, in *Parse_Request) (D return x, nil } -type DRPCProvisioner_ParseClient interface { +type DRPCProvisioner_DeprecatedParseClient interface { drpc.Stream - Recv() (*Parse_Response, error) + Recv() (*DeprecatedParse_Response, error) } -type drpcProvisioner_ParseClient struct { +type drpcProvisioner_DeprecatedParseClient struct { drpc.Stream } -func (x *drpcProvisioner_ParseClient) Recv() (*Parse_Response, error) { - m := new(Parse_Response) +func (x *drpcProvisioner_DeprecatedParseClient) Recv() (*DeprecatedParse_Response, error) { + m := new(DeprecatedParse_Response) if err := x.MsgRecv(m, drpcEncoding_File_provisionersdk_proto_provisioner_proto{}); err != nil { return nil, err } return m, nil } -func (x *drpcProvisioner_ParseClient) RecvMsg(m *Parse_Response) error { +func (x *drpcProvisioner_DeprecatedParseClient) RecvMsg(m *DeprecatedParse_Response) error { return x.MsgRecv(m, drpcEncoding_File_provisionersdk_proto_provisioner_proto{}) } @@ -124,13 +124,13 @@ func (x *drpcProvisioner_ProvisionClient) RecvMsg(m *Provision_Response) error { } type DRPCProvisionerServer interface { - Parse(*Parse_Request, DRPCProvisioner_ParseStream) error + DeprecatedParse(*DeprecatedParse_Request, DRPCProvisioner_DeprecatedParseStream) error Provision(DRPCProvisioner_ProvisionStream) error } type DRPCProvisionerUnimplementedServer struct{} -func (s *DRPCProvisionerUnimplementedServer) Parse(*Parse_Request, DRPCProvisioner_ParseStream) error { +func (s *DRPCProvisionerUnimplementedServer) DeprecatedParse(*DeprecatedParse_Request, DRPCProvisioner_DeprecatedParseStream) error { return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } @@ -145,14 +145,14 @@ func (DRPCProvisionerDescription) NumMethods() int { return 2 } func (DRPCProvisionerDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { switch n { case 0: - return "/provisioner.Provisioner/Parse", drpcEncoding_File_provisionersdk_proto_provisioner_proto{}, + return "/provisioner.Provisioner/DeprecatedParse", drpcEncoding_File_provisionersdk_proto_provisioner_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return nil, srv.(DRPCProvisionerServer). - Parse( - in1.(*Parse_Request), - &drpcProvisioner_ParseStream{in2.(drpc.Stream)}, + DeprecatedParse( + in1.(*DeprecatedParse_Request), + &drpcProvisioner_DeprecatedParseStream{in2.(drpc.Stream)}, ) - }, DRPCProvisionerServer.Parse, true + }, DRPCProvisionerServer.DeprecatedParse, true case 1: return "/provisioner.Provisioner/Provision", drpcEncoding_File_provisionersdk_proto_provisioner_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { @@ -170,16 +170,16 @@ func DRPCRegisterProvisioner(mux drpc.Mux, impl DRPCProvisionerServer) error { return mux.Register(impl, DRPCProvisionerDescription{}) } -type DRPCProvisioner_ParseStream interface { +type DRPCProvisioner_DeprecatedParseStream interface { drpc.Stream - Send(*Parse_Response) error + Send(*DeprecatedParse_Response) error } -type drpcProvisioner_ParseStream struct { +type drpcProvisioner_DeprecatedParseStream struct { drpc.Stream } -func (x *drpcProvisioner_ParseStream) Send(m *Parse_Response) error { +func (x *drpcProvisioner_DeprecatedParseStream) Send(m *DeprecatedParse_Response) error { return x.MsgSend(m, drpcEncoding_File_provisionersdk_proto_provisioner_proto{}) } diff --git a/provisionersdk/serve_test.go b/provisionersdk/serve_test.go index 28c7f0dfe5ef5..d698fea497e54 100644 --- a/provisionersdk/serve_test.go +++ b/provisionersdk/serve_test.go @@ -35,7 +35,7 @@ func TestProvisionerSDK(t *testing.T) { }() api := proto.NewDRPCProvisionerClient(client) - stream, err := api.Parse(context.Background(), &proto.Parse_Request{}) + stream, err := api.DeprecatedParse(context.Background(), &proto.DeprecatedParse_Request{}) require.NoError(t, err) _, err = stream.Recv() require.Equal(t, drpcerr.Unimplemented, int(drpcerr.Code(err))) diff --git a/site/src/api/api.ts b/site/src/api/api.ts index 1ee53a929d1ae..a1ecdfbff23ec 100644 --- a/site/src/api/api.ts +++ b/site/src/api/api.ts @@ -196,9 +196,18 @@ export const getTemplateVersion = async ( export const getTemplateVersionSchema = async ( versionId: string, -): Promise => { - const response = await axios.get( - `/api/v2/templateversions/${versionId}/schema`, +): Promise => { + const response = await axios.get( + `/api/v2/templateversions/${versionId}/deprecated-schema`, + ) + return response.data +} + +export const getTemplateVersionParameters = async ( + versionId: string, +): Promise => { + const response = await axios.get( + `/api/v2/templateversions/${versionId}/parameters`, ) return response.data } diff --git a/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index 4d54790b2c23e..13124d7471f93 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -122,13 +122,6 @@ export interface BuildInfoResponse { readonly version: string } -// From codersdk/parameters.go -export interface ComputedParameter extends Parameter { - readonly source_value: string - readonly schema_id: string - readonly default_source_value: boolean -} - // From codersdk/users.go export interface CreateFirstUserRequest { readonly email: string @@ -155,15 +148,6 @@ export interface CreateOrganizationRequest { readonly name: string } -// From codersdk/parameters.go -export interface CreateParameterRequest { - readonly copy_from_parameter?: string - readonly name: string - readonly source_value: string - readonly source_scheme: ParameterSourceScheme - readonly destination_scheme: ParameterDestinationScheme -} - // From codersdk/organizations.go export interface CreateTemplateRequest { readonly name: string @@ -171,7 +155,7 @@ export interface CreateTemplateRequest { readonly description?: string readonly icon?: string readonly template_version_id: string - readonly parameter_values?: CreateParameterRequest[] + readonly parameter_values?: DeprecatedCreateParameterRequest[] readonly default_ttl_ms?: number readonly allow_user_cancel_workspace_jobs?: boolean } @@ -179,7 +163,7 @@ export interface CreateTemplateRequest { // From codersdk/templateversions.go export interface CreateTemplateVersionDryRunRequest { readonly workspace_name: string - readonly parameter_values: CreateParameterRequest[] + readonly parameter_values: DeprecatedCreateParameterRequest[] } // From codersdk/organizations.go @@ -190,7 +174,7 @@ export interface CreateTemplateVersionRequest { readonly file_id: string readonly provisioner: ProvisionerType readonly tags: Record - readonly parameter_values?: CreateParameterRequest[] + readonly parameter_values?: DeprecatedCreateParameterRequest[] } // From codersdk/audit.go @@ -220,8 +204,9 @@ export interface CreateWorkspaceBuildRequest { readonly transition: WorkspaceTransition readonly dry_run?: boolean readonly state?: string + readonly parameters?: WorkspaceBuildParameter[] readonly orphan?: boolean - readonly parameter_values?: CreateParameterRequest[] + readonly parameter_values?: DeprecatedCreateParameterRequest[] } // From codersdk/organizations.go @@ -230,7 +215,8 @@ export interface CreateWorkspaceRequest { readonly name: string readonly autostart_schedule?: string readonly ttl_ms?: number - readonly parameter_values?: CreateParameterRequest[] + readonly deprecated_parameter_values?: DeprecatedCreateParameterRequest[] + readonly parameters: WorkspaceBuildParameter[] } // From codersdk/templates.go @@ -314,6 +300,55 @@ export interface DeploymentConfigField { readonly value: T } +// From codersdk/parameters.go +export interface DeprecatedComputedParameter extends DeprecatedParameter { + readonly source_value: string + readonly schema_id: string + readonly default_source_value: boolean +} + +// From codersdk/parameters.go +export interface DeprecatedCreateParameterRequest { + readonly copy_from_parameter?: string + readonly name: string + readonly source_value: string + readonly source_scheme: DeprecatedParameterSourceScheme + readonly destination_scheme: DeprecatedParameterDestinationScheme +} + +// From codersdk/parameters.go +export interface DeprecatedParameter { + readonly id: string + readonly scope: DeprecatedParameterScope + readonly scope_id: string + readonly name: string + readonly source_scheme: DeprecatedParameterSourceScheme + readonly destination_scheme: DeprecatedParameterDestinationScheme + readonly created_at: string + readonly updated_at: string +} + +// From codersdk/parameters.go +export interface DeprecatedParameterSchema { + readonly id: string + readonly created_at: string + readonly job_id: string + readonly name: string + readonly description: string + readonly default_source_scheme: DeprecatedParameterSourceScheme + readonly default_source_value: string + readonly allow_override_source: boolean + readonly default_destination_scheme: DeprecatedParameterDestinationScheme + readonly allow_override_destination: boolean + readonly default_refresh: string + readonly redisplay_value: boolean + readonly validation_error: string + readonly validation_condition: string + readonly validation_type_system: string + readonly validation_value_type: string + readonly validation_contains?: string[] +} + // From codersdk/features.go export interface Entitlements { readonly features: Record @@ -468,39 +503,6 @@ export interface Pagination { readonly offset?: number } -// From codersdk/parameters.go -export interface Parameter { - readonly id: string - readonly scope: ParameterScope - readonly scope_id: string - readonly name: string - readonly source_scheme: ParameterSourceScheme - readonly destination_scheme: ParameterDestinationScheme - readonly created_at: string - readonly updated_at: string -} - -// From codersdk/parameters.go -export interface ParameterSchema { - readonly id: string - readonly created_at: string - readonly job_id: string - readonly name: string - readonly description: string - readonly default_source_scheme: ParameterSourceScheme - readonly default_source_value: string - readonly allow_override_source: boolean - readonly default_destination_scheme: ParameterDestinationScheme - readonly allow_override_destination: boolean - readonly default_refresh: string - readonly redisplay_value: boolean - readonly validation_error: string - readonly validation_condition: string - readonly validation_type_system: string - readonly validation_value_type: string - readonly validation_contains?: string[] -} - // From codersdk/groups.go export interface PatchGroupRequest { readonly add_users: string[] @@ -678,6 +680,29 @@ export interface TemplateVersion { readonly created_by: User } +// From codersdk/templateversions.go +export interface TemplateVersionParameter { + readonly name: string + readonly description: string + readonly type: string + readonly mutable: boolean + readonly default_value: string + readonly icon: string + readonly options: TemplateVersionParameterOption[] + readonly validation_error: string + readonly validation_regex: string + readonly validation_min: number + readonly validation_max: number +} + +// From codersdk/templateversions.go +export interface TemplateVersionParameterOption { + readonly name: string + readonly description: string + readonly value: string + readonly icon: string +} + // From codersdk/templates.go export interface TemplateVersionsByTemplateRequest extends Pagination { readonly template_id: string @@ -892,6 +917,12 @@ export interface WorkspaceBuild { readonly daily_cost: number } +// From codersdk/workspacebuilds.go +export interface WorkspaceBuildParameter { + readonly name: string + readonly value: string +} + // From codersdk/workspaces.go export interface WorkspaceBuildsRequest extends Pagination { readonly WorkspaceID: string @@ -956,6 +987,21 @@ export type AuditAction = "create" | "delete" | "start" | "stop" | "write" // From codersdk/workspacebuilds.go export type BuildReason = "autostart" | "autostop" | "initiator" +// From codersdk/parameters.go +export type DeprecatedParameterDestinationScheme = + | "environment_variable" + | "none" + | "provisioner_variable" + +// From codersdk/parameters.go +export type DeprecatedParameterScope = "import_job" | "template" | "workspace" + +// From codersdk/parameters.go +export type DeprecatedParameterSourceScheme = "data" | "none" + +// From codersdk/parameters.go +export type DeprecatedParameterTypeSystem = "hcl" | "none" + // From codersdk/features.go export type Entitlement = "entitled" | "grace_period" | "not_entitled" @@ -971,21 +1017,6 @@ export type LogSource = "provisioner" | "provisioner_daemon" // From codersdk/apikey.go export type LoginType = "github" | "oidc" | "password" | "token" -// From codersdk/parameters.go -export type ParameterDestinationScheme = - | "environment_variable" - | "none" - | "provisioner_variable" - -// From codersdk/parameters.go -export type ParameterScope = "import_job" | "template" | "workspace" - -// From codersdk/parameters.go -export type ParameterSourceScheme = "data" | "none" - -// From codersdk/parameters.go -export type ParameterTypeSystem = "hcl" | "none" - // From codersdk/provisionerdaemons.go export type ProvisionerJobStatus = | "canceled" diff --git a/site/src/components/UserAutocomplete/UserAutocomplete.tsx b/site/src/components/UserAutocomplete/UserAutocomplete.tsx index 186b8841fb90c..b44449458941e 100644 --- a/site/src/components/UserAutocomplete/UserAutocomplete.tsx +++ b/site/src/components/UserAutocomplete/UserAutocomplete.tsx @@ -48,7 +48,7 @@ export const UserAutocomplete: FC = ({ (event: ChangeEvent) => { sendSearch("SEARCH", { query: event.target.value }) }, - 1000, + 250, ) return ( diff --git a/site/src/components/WorkspaceParameter/WorkspaceParameter.stories.tsx b/site/src/components/WorkspaceParameter/WorkspaceParameter.stories.tsx new file mode 100644 index 0000000000000..98991ebe88197 --- /dev/null +++ b/site/src/components/WorkspaceParameter/WorkspaceParameter.stories.tsx @@ -0,0 +1,192 @@ +import { Story } from "@storybook/react" +import { + WorkspaceParameter, + WorkspaceParameterProps, +} from "./WorkspaceParameter" + +export default { + title: "components/WorkspaceParameter", + component: WorkspaceParameter, +} + +const Template: Story = (args) => ( + +) + +export const Region = Template.bind({}) +Region.args = { + templateParameter: { + name: "Region", + default_value: "canada", + description: "Select a location for your workspace to live.", + icon: "/emojis/1f30e.png", + mutable: false, + options: [ + { + name: "Toronto, Canada", + description: "", + icon: "/emojis/1f1e8-1f1e6.png", + value: "canada", + }, + { + name: "Hamina, Finland", + description: "", + icon: "/emojis/1f1eb-1f1ee.png", + value: "finland", + }, + { + name: "Warsaw, Poland", + description: "", + icon: "/emojis/1f1f5-1f1f1.png", + value: "poland", + }, + { + name: "Madrid, Spain", + description: "", + icon: "/emojis/1f1ea-1f1f8.png", + value: "spain", + }, + { + name: "London, England", + description: "", + icon: "/emojis/1f1ec-1f1e7.png", + value: "england", + }, + { + name: "Dallas, Texas", + description: "", + icon: "/emojis/1f920.png", + value: "texas", + }, + ], + type: "string", + validation_max: 0, + validation_min: 0, + validation_regex: "", + validation_error: "", + }, + workspaceBuildParameter: { + name: "Region", + value: "canada", + }, +} + +export const Repo = Template.bind({}) +Repo.args = { + templateParameter: { + name: "Repo", + default_value: "coder", + description: + "Select a repository to work on. This will automatically be cloned.", + icon: "/icon/github.svg", + mutable: false, + options: [ + { + name: "coder/coder", + description: + "Remote development environments on your infrastructure provisioned with Terraform", + icon: "", + value: "https://github.com/coder/coder", + }, + { + name: "coder/v1", + description: "The home for Coder v1!", + icon: "", + value: "https://github.com/coder/v1", + }, + ], + type: "string", + validation_max: 0, + validation_min: 0, + validation_regex: "", + validation_error: "", + }, + workspaceBuildParameter: { + name: "Repo", + value: "https://github.com/coder/coder", + }, +} + +export const Size = Template.bind({}) +Size.args = { + templateParameter: { + name: "Instance Size", + default_value: "8", + description: "", + icon: "/emojis/1f916.png", + mutable: true, + options: [ + { + name: "Small", + description: "A tiny 4 core machine for small projects.", + icon: "/emojis/1f90f.png", + value: "4", + }, + { + name: "Medium", + description: "A larger 8 core machine for heavy-ish workloads.", + icon: "/emojis/1f44c.png", + value: "8", + }, + { + name: "Large", + description: "A beefy 16 core machine that can power most workloads.", + icon: "/emojis/1f4aa.png", + value: "16", + }, + ], + type: "string", + validation_max: 0, + validation_min: 0, + validation_regex: "", + validation_error: "", + }, + workspaceBuildParameter: { + name: "Instance Size", + value: "8", + }, +} + +export const Dotfiles = Template.bind({}) +Dotfiles.args = { + templateParameter: { + name: "Dotfiles URL", + default_value: "https://github.com/ammario/dotfiles", + description: + "A Git URL that points to your personal dotfiles! These will be automatically cloned at start.", + icon: "/emojis/1f3a8.png", + mutable: true, + type: "string", + options: [], + validation_max: 0, + validation_min: 0, + validation_regex: + "((git|ssh|http(s)?)|(git@[w.]+))(:(//)?)([w.@:/-~]+)(/)?", + validation_error: "Must be a valid Git URL!", + }, + workspaceBuildParameter: { + name: "Dotfiles URL", + value: "", + }, +} + +export const DiskSize = Template.bind({}) +DiskSize.args = { + templateParameter: { + name: "Disk Size", + default_value: "10", + description: "The number of gigabytes for your persistent home volume.", + icon: "", + mutable: true, + type: "number", + options: [], + validation_max: 200, + validation_min: 10, + validation_regex: "", + validation_error: "Some GB", + }, + workspaceBuildParameter: { + name: "Dotfiles URL", + value: "", + }, +} diff --git a/site/src/components/WorkspaceParameter/WorkspaceParameter.tsx b/site/src/components/WorkspaceParameter/WorkspaceParameter.tsx new file mode 100644 index 0000000000000..92d3e026c8e67 --- /dev/null +++ b/site/src/components/WorkspaceParameter/WorkspaceParameter.tsx @@ -0,0 +1,257 @@ +import Box from "@material-ui/core/Box" +import makeStyles from "@material-ui/core/styles/makeStyles" +import TextField from "@material-ui/core/TextField" +import Typography from "@material-ui/core/Typography" +import WarningIcon from "@material-ui/icons/Lock" +import ToggleButton from "@material-ui/lab/ToggleButton" +import ToggleButtonGroup from "@material-ui/lab/ToggleButtonGroup" +import { + TemplateVersionParameter, + WorkspaceBuildParameter, +} from "api/typesGenerated" +import React, { FC, useEffect, useState } from "react" + +export interface WorkspaceParameterProps { + disabled?: boolean + onChange?: (value: string) => void + + templateParameter: TemplateVersionParameter + workspaceBuildParameter?: WorkspaceBuildParameter +} + +export const WorkspaceParameter: FC< + React.PropsWithChildren +> = ({ templateParameter, workspaceBuildParameter, disabled, onChange }) => { + const [value, setValue] = useState( + workspaceBuildParameter?.value || templateParameter.default_value, + ) + const [error, setError] = useState() + const styles = useStyles() + const hasOptions = templateParameter.options.length > 0 + useEffect(() => { + if (onChange) { + onChange(value) + } + }, [onChange, value]) + + return ( +
+ + + {templateParameter.icon !== "" && ( + {`${templateParameter.name} + )} +

{templateParameter.name}

+ {!templateParameter.mutable && ( +
+ + Cannot be changed after create. +
+ )} +
+ {templateParameter.description && ( + + {templateParameter.description} + + )} +
+ {hasOptions && ( + setValue(selected)} + > + {templateParameter.options.map((option) => ( + + + + {option.icon && ( + {`${option.name} + )} + + {option.name} + + + {option.description && ( + + {option.description} + + )} + + + ))} + + )} + {!hasOptions && templateParameter.type === "string" && ( + { + setValue(event.target.value) + }} + inputProps={{ + // Empty strings break the pattern matching! + pattern: templateParameter.validation_regex || undefined, + }} + onBlur={(event) => { + if (event.target.checkValidity()) { + setError(undefined) + return + } + setError(templateParameter.validation_error) + }} + error={Boolean(error)} + helperText={error} + fullWidth + disabled={disabled} + /> + )} + {!hasOptions && templateParameter.type === "number" && ( + { + setValue(event.target.value) + if ( + parseInt(event.target.value) < templateParameter.validation_min + ) { + return setError(`Must be >= ${templateParameter.validation_min}.`) + } + if ( + parseInt(event.target.value) > templateParameter.validation_max + ) { + return setError(`Must be <= ${templateParameter.validation_max}.`) + } + setError(undefined) + }} + error={Boolean(error)} + helperText={ + error || + (templateParameter.validation_min !== 0 && + templateParameter.validation_max !== 0) + ? `Must be between ${templateParameter.validation_min} and ${templateParameter.validation_max}.` + : undefined + } + fullWidth + disabled + /> + )} +
+ ) +} + +const useStyles = makeStyles((theme) => ({ + root: { + maxWidth: 900, + }, + name: { + fontSize: 20, + margin: 0, + }, + description: { + marginBottom: theme.spacing(2), + }, + icon: { + width: 28, + height: 28, + marginRight: theme.spacing(1), + }, + immutable: { + marginLeft: theme.spacing(3), + color: theme.palette.text.hint, + display: "flex", + alignItems: "center", + + "& .icon": { + width: 14, + height: 14, + marginRight: 4, + }, + }, + options: { + display: "grid", + gridTemplateColumns: "repeat(auto-fit, minmax(min(100%/3.5), 1fr))", + gap: 16, + width: "100%", + background: "transparent", + + [theme.breakpoints.down("xs")]: { + gridTemplateColumns: "1fr", + }, + }, + option: { + background: theme.palette.background.paper, + textTransform: "unset", + letterSpacing: "unset", + padding: "6px 12px", + borderWidth: "2px", + height: "unset", + minHeight: theme.spacing(6), + flex: 1, + transition: "border 250ms ease", + + "&:not(:first-of-type)": { + borderRadius: theme.shape.borderRadius, + borderLeft: "2px solid rgba(255, 255, 255, 0.12)", + marginLeft: "unset", + }, + "&:first-of-type": { + borderRadius: theme.shape.borderRadius, + }, + + "&.Mui-selected": { + borderColor: `${theme.palette.primary.light}`, + }, + + "& .description": { + fontSize: 14, + marginTop: theme.spacing(1), + }, + + "&.Mui-selected .description": { + color: theme.palette.text.secondary, + }, + + "& .title": { + fontWeight: "500", + color: theme.palette.text.hint, + }, + + "&.Mui-selected .title": { + color: theme.palette.text.primary, + }, + + "& .icon": { + width: 20, + height: 20, + marginRight: theme.spacing(1.5), + transition: "filter 250ms ease", + }, + }, +})) diff --git a/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx b/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx index 5a6d790ed61aa..350b89ec96ec7 100644 --- a/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx +++ b/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx @@ -35,6 +35,7 @@ const CreateWorkspacePage: FC = () => { const { templates, templateSchema, + templateVersionParameters, selectedTemplate, getTemplateSchemaError, getTemplatesError, @@ -59,6 +60,7 @@ const CreateWorkspacePage: FC = () => { templates={templates} selectedTemplate={selectedTemplate} templateSchema={templateSchema} + templateParameters={templateVersionParameters} createWorkspaceErrors={{ [CreateWorkspaceErrors.GET_TEMPLATES_ERROR]: getTemplatesError, [CreateWorkspaceErrors.GET_TEMPLATE_SCHEMA_ERROR]: diff --git a/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx b/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx index ed9562351167d..5bb1e34e39d5f 100644 --- a/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx +++ b/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx @@ -4,6 +4,7 @@ import { FormFooter } from "components/FormFooter/FormFooter" import { ParameterInput } from "components/ParameterInput/ParameterInput" import { Stack } from "components/Stack/Stack" import { UserAutocomplete } from "components/UserAutocomplete/UserAutocomplete" +import { WorkspaceParameter } from "components/WorkspaceParameter/WorkspaceParameter" import { FormikContextType, FormikTouched, useFormik } from "formik" import { i18n } from "i18n" import { FC, useState } from "react" @@ -29,7 +30,8 @@ export interface CreateWorkspacePageViewProps { templateName: string templates?: TypesGen.Template[] selectedTemplate?: TypesGen.Template - templateSchema?: TypesGen.ParameterSchema[] + templateParameters?: TypesGen.TemplateVersionParameter[] + templateSchema?: TypesGen.DeprecatedParameterSchema[] createWorkspaceErrors: Partial> canCreateForUser?: boolean owner: TypesGen.User | null @@ -55,12 +57,16 @@ export const CreateWorkspacePageView: FC< const [parameterValues, setParameterValues] = useState< Record >({}) + const [deprecatedParameterValues, setDeprecatedParameterValues] = useState< + Record + >({}) const form: FormikContextType = useFormik({ initialValues: { name: "", template_id: props.selectedTemplate ? props.selectedTemplate.id : "", + parameters: [], }, enableReinitialize: true, validationSchema, @@ -70,11 +76,11 @@ export const CreateWorkspacePageView: FC< throw new Error("No template schema loaded") } - const createRequests: TypesGen.CreateParameterRequest[] = [] + const createRequests: TypesGen.DeprecatedCreateParameterRequest[] = [] props.templateSchema.forEach((schema) => { let value = schema.default_source_value - if (schema.name in parameterValues) { - value = parameterValues[schema.name] + if (schema.name in deprecatedParameterValues) { + value = deprecatedParameterValues[schema.name] } createRequests.push({ name: schema.name, @@ -83,9 +89,18 @@ export const CreateWorkspacePageView: FC< source_value: value, }) }) + const parameters: TypesGen.WorkspaceBuildParameter[] = [] + Object.keys(parameterValues).forEach((key) => + parameters.push({ + name: key, + value: parameterValues[key], + }), + ) + props.onSubmit({ ...request, - parameter_values: createRequests, + deprecated_parameter_values: createRequests, + parameters: parameters, }) form.setSubmitting(false) }, @@ -234,6 +249,20 @@ export const CreateWorkspacePageView: FC< )} + {props.templateParameters && + props.templateParameters.map((parameter) => ( + { + setParameterValues({ + ...parameterValues, + [parameter.name]: value, + }) + }} + /> + ))} + {/* Template params */} {props.templateSchema && props.templateSchema.length > 0 && (
@@ -255,8 +284,8 @@ export const CreateWorkspacePageView: FC< disabled={form.isSubmitting} key={schema.id} onChange={(value) => { - setParameterValues({ - ...parameterValues, + setDeprecatedParameterValues({ + ...deprecatedParameterValues, [schema.name]: value, }) }} diff --git a/site/src/testHelpers/handlers.ts b/site/src/testHelpers/handlers.ts index 32382402d64f7..d6df61e16f77b 100644 --- a/site/src/testHelpers/handlers.ts +++ b/site/src/testHelpers/handlers.ts @@ -52,7 +52,7 @@ export const handlers = [ }, ), rest.get( - "/api/v2/templateversions/:templateVersionId/schema", + "/api/v2/templateversions/:templateVersionId/deprecated-schema", async (req, res, ctx) => { return res(ctx.status(200), ctx.json([])) }, diff --git a/site/src/xServices/createWorkspace/createWorkspaceXService.ts b/site/src/xServices/createWorkspace/createWorkspaceXService.ts index 80b9ce6b6f42f..4612072c4039e 100644 --- a/site/src/xServices/createWorkspace/createWorkspaceXService.ts +++ b/site/src/xServices/createWorkspace/createWorkspaceXService.ts @@ -2,12 +2,14 @@ import { checkAuthorization, createWorkspace, getTemplates, + getTemplateVersionParameters, getTemplateVersionSchema, } from "api/api" import { CreateWorkspaceRequest, - ParameterSchema, + DeprecatedParameterSchema, Template, + TemplateVersionParameter, User, Workspace, } from "api/typesGenerated" @@ -19,7 +21,9 @@ type CreateWorkspaceContext = { templateName: string templates?: Template[] selectedTemplate?: Template - templateSchema?: ParameterSchema[] + templateSchema?: DeprecatedParameterSchema[] + templateVersionParameters?: TemplateVersionParameter[] + templateVersionParametersError?: Error | unknown createWorkspaceRequest?: CreateWorkspaceRequest createdWorkspace?: Workspace createWorkspaceError?: Error | unknown @@ -53,7 +57,10 @@ export const createWorkspaceMachine = createMachine( data: Template[] } getTemplateSchema: { - data: ParameterSchema[] + data: DeprecatedParameterSchema[] + } + getTemplateVersionParameters: { + data: TemplateVersionParameter[] } createWorkspace: { data: Workspace @@ -110,6 +117,19 @@ export const createWorkspaceMachine = createMachine( }, }, }, + gettingTemplateVersionParameters: { + entry: "clearTemplateVersionParametersError", + invoke: { + src: "getTemplateVersionParameters", + onDone: { + actions: ["assignTemplateVersionParameters"], + target: "fillingParams", + }, + onError: { + actions: ["assignTemplateVersionParametersError"], + }, + }, + }, fillingParams: { on: { CREATE_WORKSPACE: { @@ -154,6 +174,15 @@ export const createWorkspaceMachine = createMachine( return getTemplateVersionSchema(selectedTemplate.active_version_id) }, + getTemplateVersionParameters: (context) => { + const { selectedTemplate } = context + + if (!selectedTemplate) { + throw new Error("No selected template") + } + + return getTemplateVersionParameters(selectedTemplate.active_version_id) + }, checkPermissions: async (context) => { if (!context.organizationId) { throw new Error("No organization ID") @@ -212,6 +241,15 @@ export const createWorkspaceMachine = createMachine( templateSchema: (_, event) => event.data.filter((param) => param.allow_override_source), }), + assignTemplateVersionParameters: assign({ + templateVersionParameters: (_, event) => event.data, + }), + assignTemplateVersionParametersError: assign({ + templateVersionParametersError: (_, event) => event.data, + }), + clearTemplateVersionParametersError: assign({ + templateVersionParametersError: (_) => undefined, + }), assignPermissions: assign({ permissions: (_, event) => event.data as Record, }), diff --git a/site/static/icon/github-gradient.svg b/site/static/icon/github-gradient.svg new file mode 100644 index 0000000000000..6d55469abf56e --- /dev/null +++ b/site/static/icon/github-gradient.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + +