From c7e8d4e53097d973824dfa1b46b2b52fbe8f2fcb Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Thu, 29 Sep 2022 04:02:06 +0000 Subject: [PATCH 01/14] Add schema --- coderd/database/dump.sql | 29 +++++++++++++++++++ .../migrations/000055_parameters.down.sql | 0 .../migrations/000055_parameters.up.sql | 21 ++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 coderd/database/migrations/000055_parameters.down.sql create mode 100644 coderd/database/migrations/000055_parameters.up.sql diff --git a/coderd/database/dump.sql b/coderd/database/dump.sql index 9413e0822d154..920e4b85a97ad 100644 --- a/coderd/database/dump.sql +++ b/coderd/database/dump.sql @@ -269,6 +269,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, + immutable boolean NOT NULL, + default_value text NOT NULL, + icon text NOT NULL, + options jsonb DEFAULT '[]'::jsonb NOT NULL, + validation_regex text, + validation_min integer, + validation_max integer +); + CREATE TABLE template_versions ( id uuid NOT NULL, template_id uuid, @@ -374,6 +388,12 @@ CREATE TABLE workspace_builds ( reason build_reason DEFAULT 'initiator'::public.build_reason NOT NULL ); +CREATE TABLE workspace_parameters ( + workspace_id uuid NOT NULL, + name text NOT NULL, + value text NOT NULL +); + CREATE TABLE workspace_resource_metadata ( workspace_resource_id uuid NOT NULL, key character varying(1024) NOT NULL, @@ -462,6 +482,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); @@ -495,6 +518,9 @@ ALTER TABLE ONLY workspace_builds ALTER TABLE ONLY workspace_builds ADD CONSTRAINT workspace_builds_workspace_id_build_number_key UNIQUE (workspace_id, build_number); +ALTER TABLE ONLY workspace_parameters + ADD CONSTRAINT workspace_parameters_workspace_id_name_key UNIQUE (workspace_id, name); + ALTER TABLE ONLY workspace_resource_metadata ADD CONSTRAINT workspace_resource_metadata_pkey PRIMARY KEY (workspace_resource_id, key); @@ -559,6 +585,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; diff --git a/coderd/database/migrations/000055_parameters.down.sql b/coderd/database/migrations/000055_parameters.down.sql new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/coderd/database/migrations/000055_parameters.up.sql b/coderd/database/migrations/000055_parameters.up.sql new file mode 100644 index 0000000000000..b5e13149acebb --- /dev/null +++ b/coderd/database/migrations/000055_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, + immutable boolean not null, + default_value text not null, + icon text not null, + options jsonb not null default '[]'::jsonb, + validation_regex text, + validation_min integer, + validation_max integer, + unique (template_version_id, name) +); + +CREATE TABLE workspace_parameters ( + workspace_id uuid not null, + name text not null, + value text not null, + unique (workspace_id, name) +); From c6cda842adc9b3e0ecedf9130d952fbf353a5273 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Thu, 29 Sep 2022 16:29:44 +0000 Subject: [PATCH 02/14] Deprecate parse --- cli/create_test.go | 30 +- cli/templatecreate_test.go | 13 +- cli/templatepull_test.go | 8 +- coderd/database/dump.sql | 21 +- .../migrations/000055_parameters.up.sql | 6 +- coderd/database/models.go | 20 + coderd/database/unique_constraint.go | 36 +- coderd/provisionerdaemons.go | 80 +- coderd/templateversions_test.go | 46 +- provisioner/echo/serve.go | 21 +- provisioner/echo/serve_test.go | 12 +- provisioner/terraform/parse.go | 25 +- provisioner/terraform/parse_test.go | 63 +- provisioner/terraform/provision.go | 19 +- provisioner/terraform/provision_test.go | 30 +- provisionerd/proto/provisionerd.pb.go | 135 +- provisionerd/proto/provisionerd.proto | 2 +- provisionerd/provisionerd_test.go | 34 +- provisionerd/runner/runner.go | 8 +- provisionersdk/proto/provisioner.pb.go | 1969 +++++++++-------- provisionersdk/proto/provisioner.proto | 136 +- provisionersdk/proto/provisioner_drpc.pb.go | 42 +- provisionersdk/serve_test.go | 2 +- 23 files changed, 1387 insertions(+), 1371 deletions(-) diff --git a/cli/create_test.go b/cli/create_test.go index 806b365f0ec82..8022d29601833 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/templatecreate_test.go b/cli/templatecreate_test.go index ccffb45fc7114..9b83dbd858a26 100644 --- a/cli/templatecreate_test.go +++ b/cli/templatecreate_test.go @@ -258,17 +258,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 53cda41ed5fd5..47c8f6a5a5b4d 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/coderd/database/dump.sql b/coderd/database/dump.sql index 920e4b85a97ad..0b3d0125d76b7 100644 --- a/coderd/database/dump.sql +++ b/coderd/database/dump.sql @@ -373,6 +373,12 @@ CREATE TABLE workspace_apps ( health workspace_app_health DEFAULT 'disabled'::public.workspace_app_health 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, @@ -388,12 +394,6 @@ CREATE TABLE workspace_builds ( reason build_reason DEFAULT 'initiator'::public.build_reason NOT NULL ); -CREATE TABLE workspace_parameters ( - workspace_id uuid NOT NULL, - name text NOT NULL, - value text NOT NULL -); - CREATE TABLE workspace_resource_metadata ( workspace_resource_id uuid NOT NULL, key character varying(1024) NOT NULL, @@ -509,6 +509,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); @@ -518,9 +521,6 @@ ALTER TABLE ONLY workspace_builds ALTER TABLE ONLY workspace_builds ADD CONSTRAINT workspace_builds_workspace_id_build_number_key UNIQUE (workspace_id, build_number); -ALTER TABLE ONLY workspace_parameters - ADD CONSTRAINT workspace_parameters_workspace_id_name_key UNIQUE (workspace_id, name); - ALTER TABLE ONLY workspace_resource_metadata ADD CONSTRAINT workspace_resource_metadata_pkey PRIMARY KEY (workspace_resource_id, key); @@ -612,6 +612,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/000055_parameters.up.sql b/coderd/database/migrations/000055_parameters.up.sql index b5e13149acebb..1926a9373adcf 100644 --- a/coderd/database/migrations/000055_parameters.up.sql +++ b/coderd/database/migrations/000055_parameters.up.sql @@ -13,9 +13,9 @@ CREATE TABLE template_version_parameters ( unique (template_version_id, name) ); -CREATE TABLE workspace_parameters ( - workspace_id uuid not null, +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_id, name) + unique (workspace_build_id, name) ); diff --git a/coderd/database/models.go b/coderd/database/models.go index bfd7d3f7af1ad..5446fe5235bbb 100644 --- a/coderd/database/models.go +++ b/coderd/database/models.go @@ -537,6 +537,20 @@ type TemplateVersion struct { CreatedBy uuid.NullUUID `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"` + Immutable bool `db:"immutable" json:"immutable"` + DefaultValue string `db:"default_value" json:"default_value"` + Icon string `db:"icon" json:"icon"` + Options json.RawMessage `db:"options" json:"options"` + ValidationRegex sql.NullString `db:"validation_regex" json:"validation_regex"` + ValidationMin sql.NullInt32 `db:"validation_min" json:"validation_min"` + ValidationMax sql.NullInt32 `db:"validation_max" json:"validation_max"` +} + type User struct { ID uuid.UUID `db:"id" json:"id"` Email string `db:"email" json:"email"` @@ -627,6 +641,12 @@ type WorkspaceBuild struct { Reason BuildReason `db:"reason" json:"reason"` } +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/unique_constraint.go b/coderd/database/unique_constraint.go index e0f8dfb9cdbcc..9c7c2e2546ab2 100644 --- a/coderd/database/unique_constraint.go +++ b/coderd/database/unique_constraint.go @@ -6,21 +6,23 @@ type UniqueConstraint string // UniqueConstraint enums. const ( - 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); - UniqueWorkspaceAppsAgentIDNameKey UniqueConstraint = "workspace_apps_agent_id_name_key" // ALTER TABLE ONLY workspace_apps ADD CONSTRAINT workspace_apps_agent_id_name_key UNIQUE (agent_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); + 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); + UniqueWorkspaceAppsAgentIDNameKey UniqueConstraint = "workspace_apps_agent_id_name_key" // ALTER TABLE ONLY workspace_apps ADD CONSTRAINT workspace_apps_agent_id_name_key UNIQUE (agent_id, name); + 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/provisionerdaemons.go b/coderd/provisionerdaemons.go index 95fc2806db41f..cf0ff6dfa19db 100644 --- a/coderd/provisionerdaemons.go +++ b/coderd/provisionerdaemons.go @@ -240,10 +240,7 @@ func (server *provisionerdServer) AcquireJob(ctx context.Context, _ *proto.Empty } // 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) transition, err := convertWorkspaceTransition(workspaceBuild.Transition) if err != nil { return nil, failJob(fmt.Sprintf("convert workspace transition: %s", err)) @@ -290,11 +287,7 @@ func (server *provisionerdServer) AcquireJob(ctx context.Context, _ *proto.Empty } // 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, @@ -429,7 +422,7 @@ func (server *provisionerdServer) UpdateJob(ctx context.Context, request *proto. DefaultSourceScheme: database.ParameterSourceSchemeNone, DefaultDestinationScheme: database.ParameterDestinationSchemeNone, - AllowOverrideDestination: protoParameter.AllowOverrideDestination, + AllowOverrideDestination: false, AllowOverrideSource: protoParameter.AllowOverrideSource, Index: int32(index), @@ -444,15 +437,7 @@ func (server *provisionerdServer) UpdateJob(ctx context.Context, request *proto. 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 { @@ -479,11 +464,7 @@ func (server *provisionerdServer) UpdateJob(ctx context.Context, request *proto. // 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{ @@ -862,37 +843,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: @@ -921,35 +891,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) { diff --git a/coderd/templateversions_test.go b/coderd/templateversions_test.go index f51d7c2c46925..10cbb98cb67eb 100644 --- a/coderd/templateversions_test.go +++ b/coderd/templateversions_test.go @@ -229,14 +229,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, - }, }}, }, }, @@ -258,17 +255,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, - }, }}, }, }, @@ -309,31 +303,25 @@ 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: []*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, - }, }, }, }, diff --git a/provisioner/echo/serve.go b/provisioner/echo/serve.go index 934c715211675..d5465b938fdcd 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) @@ -175,7 +172,7 @@ func (*echo) Shutdown(_ context.Context, _ *proto.Empty) (*proto.Empty, error) { } type Responses struct { - Parse []*proto.Parse_Response + Parse []*proto.DeprecatedParse_Response Provision []*proto.Provision_Response ProvisionDryRun []*proto.Provision_Response } diff --git a/provisioner/echo/serve_test.go b/provisioner/echo/serve_test.go index cad2755f2a027..7fdc7eb576c25 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/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 8a858e3bb3bb6..3d31c46dc7209 100644 --- a/provisioner/terraform/provision.go +++ b/provisioner/terraform/provision.go @@ -175,14 +175,7 @@ func (s *server) Provision(stream proto.DRPCProvisioner_ProvisionStream) error { func provisionVars(start *proto.Provision_Start) ([]string, error) { vars := []string{} for _, param := range start.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) - } + vars = append(vars, fmt.Sprintf("%s=%s", param.Name, param.Value)) } return vars, nil } @@ -201,16 +194,6 @@ func provisionEnv(start *proto.Provision_Start) ([]string, error) { for key, value := range provisionersdk.AgentScriptEnv() { env = append(env, key+"="+value) } - for _, param := range start.ParameterValues { - 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) - } - } return env, nil } diff --git a/provisioner/terraform/provision_test.go b/provisioner/terraform/provision_test.go index a1ab1584e7df6..bd7bb0741eb36 100644 --- a/provisioner/terraform/provision_test.go +++ b/provisioner/terraform/provision_test.go @@ -115,9 +115,8 @@ func TestProvision_Cancel(t *testing.T) { Directory: dir, DryRun: false, ParameterValues: []*proto.ParameterValue{{ - DestinationScheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - Name: "A", - Value: "example", + Name: "A", + Value: "example", }}, Metadata: &proto.Provision_Metadata{}, }, @@ -193,9 +192,8 @@ func TestProvision(t *testing.T) { Type: &proto.Provision_Request_Start{ Start: &proto.Provision_Start{ ParameterValues: []*proto.ParameterValue{{ - DestinationScheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - Name: "A", - Value: "example", + Name: "A", + Value: "example", }}, }, }, @@ -297,26 +295,6 @@ func TestProvision(t *testing.T) { }, ExpectLogContains: "nothing to do", }, - { - Name: "unsupported-parameter-scheme", - Files: map[string]string{ - "main.tf": "", - }, - Request: &proto.Provision_Request{ - Type: &proto.Provision_Request_Start{ - Start: &proto.Provision_Start{ - ParameterValues: []*proto.ParameterValue{ - { - DestinationScheme: 88, - Name: "UNSUPPORTED", - Value: "sadface", - }, - }, - }, - }, - }, - ErrorContains: "unsupported parameter type", - }, } for _, testCase := range testCases { diff --git a/provisionerd/proto/provisionerd.pb.go b/provisionerd/proto/provisionerd.pb.go index 7a42fd40feb08..060b6f80f0e9a 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"` + ParameterSchemas []*proto.DeprecatedParameterSchema `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"` } func (x *UpdateJobRequest) Reset() { @@ -596,7 +596,7 @@ func (x *UpdateJobRequest) GetLogs() []*Log { return nil } -func (x *UpdateJobRequest) GetParameterSchemas() []*proto.ParameterSchema { +func (x *UpdateJobRequest) GetParameterSchemas() []*proto.DeprecatedParameterSchema { if x != nil { return x.ParameterSchemas } @@ -1270,50 +1270,51 @@ var file_provisionerd_proto_provisionerd_proto_rawDesc = []byte{ 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, + 0x09, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0xbd, 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, + 0x72, 0x64, 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0x53, 0x0a, 0x11, 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, - 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, 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, 0x98, - 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, 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, + 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, + 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, 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, 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, 0x98, 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, 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 ( @@ -1331,28 +1332,28 @@ 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, 16) 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 - (*AcquiredJob_WorkspaceBuild)(nil), // 8: provisionerd.AcquiredJob.WorkspaceBuild - (*AcquiredJob_TemplateImport)(nil), // 9: provisionerd.AcquiredJob.TemplateImport - (*AcquiredJob_TemplateDryRun)(nil), // 10: provisionerd.AcquiredJob.TemplateDryRun - (*FailedJob_WorkspaceBuild)(nil), // 11: provisionerd.FailedJob.WorkspaceBuild - (*FailedJob_TemplateImport)(nil), // 12: provisionerd.FailedJob.TemplateImport - (*FailedJob_TemplateDryRun)(nil), // 13: provisionerd.FailedJob.TemplateDryRun - (*CompletedJob_WorkspaceBuild)(nil), // 14: provisionerd.CompletedJob.WorkspaceBuild - (*CompletedJob_TemplateImport)(nil), // 15: provisionerd.CompletedJob.TemplateImport - (*CompletedJob_TemplateDryRun)(nil), // 16: provisionerd.CompletedJob.TemplateDryRun - (proto.LogLevel)(0), // 17: provisioner.LogLevel - (*proto.ParameterSchema)(nil), // 18: provisioner.ParameterSchema - (*proto.ParameterValue)(nil), // 19: provisioner.ParameterValue - (*proto.Provision_Metadata)(nil), // 20: provisioner.Provision.Metadata - (*proto.Resource)(nil), // 21: 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 + (*AcquiredJob_WorkspaceBuild)(nil), // 8: provisionerd.AcquiredJob.WorkspaceBuild + (*AcquiredJob_TemplateImport)(nil), // 9: provisionerd.AcquiredJob.TemplateImport + (*AcquiredJob_TemplateDryRun)(nil), // 10: provisionerd.AcquiredJob.TemplateDryRun + (*FailedJob_WorkspaceBuild)(nil), // 11: provisionerd.FailedJob.WorkspaceBuild + (*FailedJob_TemplateImport)(nil), // 12: provisionerd.FailedJob.TemplateImport + (*FailedJob_TemplateDryRun)(nil), // 13: provisionerd.FailedJob.TemplateDryRun + (*CompletedJob_WorkspaceBuild)(nil), // 14: provisionerd.CompletedJob.WorkspaceBuild + (*CompletedJob_TemplateImport)(nil), // 15: provisionerd.CompletedJob.TemplateImport + (*CompletedJob_TemplateDryRun)(nil), // 16: provisionerd.CompletedJob.TemplateDryRun + (proto.LogLevel)(0), // 17: provisioner.LogLevel + (*proto.DeprecatedParameterSchema)(nil), // 18: provisioner.DeprecatedParameterSchema + (*proto.ParameterValue)(nil), // 19: provisioner.ParameterValue + (*proto.Provision_Metadata)(nil), // 20: provisioner.Provision.Metadata + (*proto.Resource)(nil), // 21: provisioner.Resource } var file_provisionerd_proto_provisionerd_proto_depIdxs = []int32{ 8, // 0: provisionerd.AcquiredJob.workspace_build:type_name -> provisionerd.AcquiredJob.WorkspaceBuild @@ -1367,7 +1368,7 @@ var file_provisionerd_proto_provisionerd_proto_depIdxs = []int32{ 0, // 9: provisionerd.Log.source:type_name -> provisionerd.LogSource 17, // 10: provisionerd.Log.level:type_name -> provisioner.LogLevel 5, // 11: provisionerd.UpdateJobRequest.logs:type_name -> provisionerd.Log - 18, // 12: provisionerd.UpdateJobRequest.parameter_schemas:type_name -> provisioner.ParameterSchema + 18, // 12: provisionerd.UpdateJobRequest.parameter_schemas:type_name -> provisioner.DeprecatedParameterSchema 19, // 13: provisionerd.UpdateJobResponse.parameter_values:type_name -> provisioner.ParameterValue 19, // 14: provisionerd.AcquiredJob.WorkspaceBuild.parameter_values:type_name -> provisioner.ParameterValue 20, // 15: provisionerd.AcquiredJob.WorkspaceBuild.metadata:type_name -> provisioner.Provision.Metadata diff --git a/provisionerd/proto/provisionerd.proto b/provisionerd/proto/provisionerd.proto index 57f768ad68ada..8a1974f1ce97f 100644 --- a/provisionerd/proto/provisionerd.proto +++ b/provisionerd/proto/provisionerd.proto @@ -95,7 +95,7 @@ message Log { message UpdateJobRequest { string job_id = 1; repeated Log logs = 2; - repeated provisioner.ParameterSchema parameter_schemas = 3; + repeated provisioner.DeprecatedParameterSchema parameter_schemas = 3; bytes readme = 4; } diff --git a/provisionerd/provisionerd_test.go b/provisionerd/provisionerd_test.go index 05becb863ebd7..48c5a3583c1f3 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{} @@ -1011,12 +1009,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 c90df310576d1..7c7e1cf7d902d 100644 --- a/provisionerd/runner/runner.go +++ b/provisionerd/runner/runner.go @@ -592,11 +592,11 @@ func (r *Runner) runTemplateImport(ctx context.Context) (*proto.CompletedJob, *p } // 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 { @@ -609,7 +609,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), @@ -628,7 +628,7 @@ func (r *Runner) runTemplateImportParse(ctx context.Context) ([]*sdkproto.Parame if err != nil { return nil, xerrors.Errorf("update job: %w", err) } - case *sdkproto.Parse_Response_Complete: + case *sdkproto.DeprecatedParse_Response_Complete: r.logger.Info(context.Background(), "parse complete", slog.F("parameter_schemas", msgType.Complete.ParameterSchemas)) diff --git a/provisionersdk/proto/provisioner.pb.go b/provisionersdk/proto/provisioner.pb.go index e6134519976f3..bfc9fc38589cf 100644 --- a/provisionersdk/proto/provisioner.pb.go +++ b/provisionersdk/proto/provisioner.pb.go @@ -125,139 +125,93 @@ func (WorkspaceTransition) EnumDescriptor() ([]byte, []int) { return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{1} } -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[2].Descriptor() } -func (ParameterSource_Scheme) Type() protoreflect.EnumType { +func (DeprecatedParameterSource_Scheme) Type() protoreflect.EnumType { return &file_provisionersdk_proto_provisioner_proto_enumTypes[2] } -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[3].Descriptor() -} - -func (ParameterDestination_Scheme) Type() protoreflect.EnumType { - return &file_provisionersdk_proto_provisioner_proto_enumTypes[3] -} - -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[4].Descriptor() +func (DeprecatedParameterSchema_TypeSystem) Descriptor() protoreflect.EnumDescriptor { + return file_provisionersdk_proto_provisioner_proto_enumTypes[3].Descriptor() } -func (ParameterSchema_TypeSystem) Type() protoreflect.EnumType { - return &file_provisionersdk_proto_provisioner_proto_enumTypes[4] +func (DeprecatedParameterSchema_TypeSystem) Type() protoreflect.EnumType { + return &file_provisionersdk_proto_provisioner_proto_enumTypes[3] } -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. @@ -299,18 +253,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)) @@ -318,13 +272,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)) @@ -336,36 +290,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)) @@ -373,13 +326,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)) @@ -391,31 +344,41 @@ 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"` } -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)) @@ -423,13 +386,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)) @@ -441,187 +404,135 @@ 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) - } -} - -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 + return x.Env } - 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 nil } -func (x *ParameterSchema) GetName() string { +func (x *Agent) GetStartupScript() string { if x != nil { - return x.Name + return x.StartupScript } return "" } -func (x *ParameterSchema) GetDescription() string { +func (x *Agent) GetOperatingSystem() string { if x != nil { - return x.Description + return x.OperatingSystem } return "" } -func (x *ParameterSchema) GetDefaultSource() *ParameterSource { +func (x *Agent) GetArchitecture() string { if x != nil { - return x.DefaultSource + return x.Architecture } - return nil + return "" } -func (x *ParameterSchema) GetAllowOverrideSource() bool { +func (x *Agent) GetDirectory() string { if x != nil { - return x.AllowOverrideSource + return x.Directory } - return false + return "" } -func (x *ParameterSchema) GetDefaultDestination() *ParameterDestination { +func (x *Agent) GetApps() []*App { if x != nil { - return x.DefaultDestination + return x.Apps } return nil } -func (x *ParameterSchema) GetAllowOverrideDestination() bool { - if x != nil { - return x.AllowOverrideDestination +func (m *Agent) GetAuth() isAgent_Auth { + if m != nil { + return m.Auth } - return false + return nil } -func (x *ParameterSchema) GetRedisplayValue() bool { - if x != nil { - return x.RedisplayValue +func (x *Agent) GetToken() string { + if x, ok := x.GetAuth().(*Agent_Token); ok { + return x.Token } - return false + return "" } -func (x *ParameterSchema) GetValidationTypeSystem() ParameterSchema_TypeSystem { - if x != nil { - return x.ValidationTypeSystem +func (x *Agent) GetInstanceId() string { + if x, ok := x.GetAuth().(*Agent_InstanceId); ok { + return x.InstanceId } - return ParameterSchema_None + return "" } -func (x *ParameterSchema) GetValidationValueType() string { - if x != nil { - return x.ValidationValueType - } - return "" +type isAgent_Auth interface { + isAgent_Auth() } -func (x *ParameterSchema) GetValidationError() string { - if x != nil { - return x.ValidationError - } - return "" +type Agent_Token struct { + Token string `protobuf:"bytes,9,opt,name=token,proto3,oneof"` } -func (x *ParameterSchema) GetValidationCondition() string { - if x != nil { - return x.ValidationCondition - } - return "" +type Agent_InstanceId struct { + InstanceId string `protobuf:"bytes,10,opt,name=instance_id,json=instanceId,proto3,oneof"` } -// Log represents output from a request. -type Log struct { +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"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Command string `protobuf:"bytes,2,opt,name=command,proto3" json:"command,omitempty"` + Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"` + Icon string `protobuf:"bytes,4,opt,name=icon,proto3" json:"icon,omitempty"` + RelativePath bool `protobuf:"varint,5,opt,name=relative_path,json=relativePath,proto3" json:"relative_path,omitempty"` + Healthcheck *Healthcheck `protobuf:"bytes,6,opt,name=healthcheck,proto3" json:"healthcheck,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 { @@ -632,110 +543,81 @@ 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) GetName() string { if x != nil { - return x.Level + return x.Name } - return LogLevel_TRACE + return "" } -func (x *Log) GetOutput() string { +func (x *App) GetCommand() string { if x != nil { - return x.Output + return x.Command } 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) GetUrl() string { + if x != nil { + return x.Url + } + 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) GetIcon() string { + if x != nil { + return x.Icon } + return "" } -func (x *InstanceIdentityAuth) String() string { - return protoimpl.X.MessageStringOf(x) -} - -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) GetRelativePath() bool { + if x != nil { + return x.RelativePath } - return mi.MessageOf(x) -} - -// Deprecated: Use InstanceIdentityAuth.ProtoReflect.Descriptor instead. -func (*InstanceIdentityAuth) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{6} + return false } -func (x *InstanceIdentityAuth) GetInstanceId() string { +func (x *App) GetHealthcheck() *Healthcheck { if x != nil { - return x.InstanceId + return x.Healthcheck } - return "" + return nil } -// 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"` + 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 { @@ -746,135 +628,63 @@ 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 "" +// Deprecated: Use Healthcheck.ProtoReflect.Descriptor instead. +func (*Healthcheck) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{5} } -func (x *Agent) GetArchitecture() string { +func (x *Healthcheck) GetUrl() string { if x != nil { - return x.Architecture + return x.Url } return "" } -func (x *Agent) GetDirectory() string { +func (x *Healthcheck) GetInterval() int32 { if x != nil { - return x.Directory + return x.Interval } - return "" + return 0 } -func (x *Agent) GetApps() []*App { +func (x *Healthcheck) GetThreshold() int32 { 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.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 - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Command string `protobuf:"bytes,2,opt,name=command,proto3" json:"command,omitempty"` - Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"` - Icon string `protobuf:"bytes,4,opt,name=icon,proto3" json:"icon,omitempty"` - RelativePath bool `protobuf:"varint,5,opt,name=relative_path,json=relativePath,proto3" json:"relative_path,omitempty"` - Healthcheck *Healthcheck `protobuf:"bytes,6,opt,name=healthcheck,proto3" json:"healthcheck,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"` } -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 { @@ -885,81 +695,82 @@ 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) GetName() string { +func (x *Resource) GetName() string { if x != nil { return x.Name } return "" } -func (x *App) GetCommand() string { +func (x *Resource) GetType() string { if x != nil { - return x.Command + return x.Type } return "" } -func (x *App) GetUrl() string { +func (x *Resource) GetAgents() []*Agent { if x != nil { - return x.Url + return x.Agents } - return "" + return nil } -func (x *App) GetIcon() string { +func (x *Resource) GetMetadata() []*Resource_Metadata { if x != nil { - return x.Icon + return x.Metadata } - return "" + return nil } -func (x *App) GetRelativePath() bool { +func (x *Resource) GetHide() bool { if x != nil { - return x.RelativePath + return x.Hide } return false } -func (x *App) GetHealthcheck() *Healthcheck { +func (x *Resource) GetIcon() string { if x != nil { - return x.Healthcheck + return x.Icon } - return nil + return "" } -// 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 (*ParameterOption) ProtoMessage() {} -func (x *Healthcheck) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[9] +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 { @@ -970,63 +781,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"` + 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"` + Immutable bool `protobuf:"varint,4,opt,name=immutable,proto3" json:"immutable,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 { @@ -1037,77 +859,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) GetImmutable() bool { if x != nil { - return x.Metadata + return x.Immutable } - 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 "" } -// Parse consumes source-code from a directory to produce inputs. -type Parse struct { +func (x *Parameter) GetOptions() []*ParameterOption { + if x != nil { + return x.Options + } + return nil +} + +func (x *Parameter) GetValidationRegex() string { + if x != nil { + return x.ValidationRegex + } + return "" +} + +func (x *Parameter) GetValidationMin() int32 { + if x != nil { + return x.ValidationMin + } + return 0 +} + +func (x *Parameter) GetValidationMax() int32 { + if x != nil { + return x.ValidationMax + } + return 0 +} + +// 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 { @@ -1118,9 +971,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. @@ -1133,7 +1000,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) } @@ -1146,7 +1013,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 { @@ -1159,37 +1026,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 { @@ -1200,64 +1063,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 { @@ -1268,43 +1105,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 { @@ -1315,47 +1168,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 { @@ -1366,48 +1274,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} +// Deprecated: Use Resource_Metadata.ProtoReflect.Descriptor instead. +func (*Resource_Metadata) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{6, 0} } -func (m *Parse_Response) GetType() isParse_Response_Type { - if m != nil { - return m.Type +func (x *Resource_Metadata) GetKey() string { + if x != nil { + return x.Key } - return nil + return "" } -func (x *Parse_Response) GetLog() *Log { - if x, ok := x.GetType().(*Parse_Response_Log); ok { - return x.Log +func (x *Resource_Metadata) GetValue() string { + if x != nil { + return x.Value } - return nil + return "" } -func (x *Parse_Response) GetComplete() *Parse_Complete { - if x, ok := x.GetType().(*Parse_Response_Complete); ok { - return x.Complete +func (x *Resource_Metadata) GetSensitive() bool { + if x != nil { + return x.Sensitive } - return nil -} - -type isParse_Response_Type interface { - isParse_Response_Type() -} - -type Parse_Response_Log struct { - Log *Log `protobuf:"bytes,1,opt,name=log,proto3,oneof"` + 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 @@ -1425,7 +1324,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) } @@ -1438,7 +1337,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 { @@ -1451,7 +1350,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 { @@ -1518,7 +1417,7 @@ type Provision_Start struct { func (x *Provision_Start) Reset() { *x = Provision_Start{} 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) } @@ -1531,7 +1430,7 @@ func (x *Provision_Start) String() string { func (*Provision_Start) ProtoMessage() {} func (x *Provision_Start) 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 { @@ -1544,7 +1443,7 @@ func (x *Provision_Start) ProtoReflect() protoreflect.Message { // Deprecated: Use Provision_Start.ProtoReflect.Descriptor instead. func (*Provision_Start) 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_Start) GetDirectory() string { @@ -1591,7 +1490,7 @@ type Provision_Cancel struct { func (x *Provision_Cancel) Reset() { *x = Provision_Cancel{} 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) } @@ -1604,7 +1503,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[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 { @@ -1617,7 +1516,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, 2} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 2} } type Provision_Request struct { @@ -1635,7 +1534,7 @@ type Provision_Request struct { func (x *Provision_Request) Reset() { *x = Provision_Request{} 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) } @@ -1648,7 +1547,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[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 { @@ -1661,7 +1560,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, 3} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 3} } func (m *Provision_Request) GetType() isProvision_Request_Type { @@ -1706,15 +1605,16 @@ 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"` - 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"` } func (x *Provision_Complete) Reset() { *x = Provision_Complete{} 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) } @@ -1727,7 +1627,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[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 { @@ -1740,7 +1640,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, 4} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 4} } func (x *Provision_Complete) GetState() []byte { @@ -1764,6 +1664,13 @@ func (x *Provision_Complete) GetResources() []*Resource { return nil } +func (x *Provision_Complete) GetParameters() []*Parameter { + if x != nil { + return x.Parameters + } + return nil +} + type Provision_Response struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1779,7 +1686,7 @@ type Provision_Response struct { func (x *Provision_Response) Reset() { *x = Provision_Response{} 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) } @@ -1792,7 +1699,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[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 { @@ -1805,7 +1712,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, 5} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 5} } func (m *Provision_Response) GetType() isProvision_Response_Type { @@ -1845,218 +1752,346 @@ 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[22] + 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[22] + 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[23] + 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[23] + 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[24] + 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[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_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, 0x8f, 0x03, 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, - 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, 0x8f, 0x03, 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, 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, 0xba, - 0x01, 0x0a, 0x03, 0x41, 0x70, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, - 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, - 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, - 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0c, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, - 0x3a, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x18, 0x06, - 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, 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, 0xad, 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, 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, + 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, 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, 0xba, 0x01, 0x0a, 0x03, 0x41, 0x70, 0x70, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, + 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x12, 0x0a, + 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x63, 0x6f, + 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, + 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, + 0x76, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x3a, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, + 0x63, 0x68, 0x65, 0x63, 0x6b, 0x18, 0x06, 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, 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, 0xad, 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, 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, 0xdd, 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, 0x1c, 0x0a, 0x09, 0x69, 0x6d, 0x6d, 0x75, + 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x6d, 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, 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, 0xae, 0x07, 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, 0xd9, 0x01, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, - 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, 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, 0x6f, 0x76, + 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, 0xe7, 0x07, 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, 0xd9, + 0x01, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 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, 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, 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, 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, 0x12, 0x14, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x06, 0x64, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x1a, 0x08, 0x0a, 0x06, 0x43, 0x61, + 0x6e, 0x63, 0x65, 0x6c, 0x1a, 0x80, 0x01, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x34, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, 0x52, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x37, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, + 0x18, 0x02, 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, 0xa3, 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, 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, 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, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x72, - 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x64, 0x72, 0x79, - 0x52, 0x75, 0x6e, 0x1a, 0x08, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x1a, 0x80, 0x01, - 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, - 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, - 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, - 0x37, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x02, 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, 0x6b, 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, 0x1a, 0x77, 0x0a, + 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 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, @@ -2064,28 +2099,91 @@ var file_provisionersdk_proto_provisioner_proto_rawDesc = []byte{ 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, 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, + 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, 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, + 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 ( @@ -2100,72 +2198,71 @@ 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, 5) -var file_provisionersdk_proto_provisioner_proto_msgTypes = make([]protoimpl.MessageInfo, 24) +var file_provisionersdk_proto_provisioner_proto_enumTypes = make([]protoimpl.EnumInfo, 4) +var file_provisionersdk_proto_provisioner_proto_msgTypes = make([]protoimpl.MessageInfo, 25) var file_provisionersdk_proto_provisioner_proto_goTypes = []interface{}{ - (LogLevel)(0), // 0: provisioner.LogLevel - (WorkspaceTransition)(0), // 1: provisioner.WorkspaceTransition - (ParameterSource_Scheme)(0), // 2: provisioner.ParameterSource.Scheme - (ParameterDestination_Scheme)(0), // 3: provisioner.ParameterDestination.Scheme - (ParameterSchema_TypeSystem)(0), // 4: provisioner.ParameterSchema.TypeSystem - (*Empty)(nil), // 5: provisioner.Empty - (*ParameterSource)(nil), // 6: provisioner.ParameterSource - (*ParameterDestination)(nil), // 7: provisioner.ParameterDestination - (*ParameterValue)(nil), // 8: provisioner.ParameterValue - (*ParameterSchema)(nil), // 9: provisioner.ParameterSchema - (*Log)(nil), // 10: provisioner.Log - (*InstanceIdentityAuth)(nil), // 11: provisioner.InstanceIdentityAuth - (*Agent)(nil), // 12: provisioner.Agent - (*App)(nil), // 13: provisioner.App - (*Healthcheck)(nil), // 14: provisioner.Healthcheck - (*Resource)(nil), // 15: provisioner.Resource - (*Parse)(nil), // 16: provisioner.Parse - (*Provision)(nil), // 17: provisioner.Provision - nil, // 18: provisioner.Agent.EnvEntry - (*Resource_Metadata)(nil), // 19: provisioner.Resource.Metadata - (*Parse_Request)(nil), // 20: provisioner.Parse.Request - (*Parse_Complete)(nil), // 21: provisioner.Parse.Complete - (*Parse_Response)(nil), // 22: provisioner.Parse.Response - (*Provision_Metadata)(nil), // 23: provisioner.Provision.Metadata - (*Provision_Start)(nil), // 24: provisioner.Provision.Start - (*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 + (LogLevel)(0), // 0: provisioner.LogLevel + (WorkspaceTransition)(0), // 1: provisioner.WorkspaceTransition + (DeprecatedParameterSource_Scheme)(0), // 2: provisioner.DeprecatedParameterSource.Scheme + (DeprecatedParameterSchema_TypeSystem)(0), // 3: provisioner.DeprecatedParameterSchema.TypeSystem + (*Empty)(nil), // 4: provisioner.Empty + (*Log)(nil), // 5: provisioner.Log + (*InstanceIdentityAuth)(nil), // 6: provisioner.InstanceIdentityAuth + (*Agent)(nil), // 7: provisioner.Agent + (*App)(nil), // 8: provisioner.App + (*Healthcheck)(nil), // 9: provisioner.Healthcheck + (*Resource)(nil), // 10: provisioner.Resource + (*ParameterOption)(nil), // 11: provisioner.ParameterOption + (*Parameter)(nil), // 12: provisioner.Parameter + (*ParameterValue)(nil), // 13: provisioner.ParameterValue + (*Provision)(nil), // 14: provisioner.Provision + (*DeprecatedParse)(nil), // 15: provisioner.DeprecatedParse + (*DeprecatedParameterSource)(nil), // 16: provisioner.DeprecatedParameterSource + (*DeprecatedParameterSchema)(nil), // 17: provisioner.DeprecatedParameterSchema + nil, // 18: provisioner.Agent.EnvEntry + (*Resource_Metadata)(nil), // 19: provisioner.Resource.Metadata + (*Provision_Metadata)(nil), // 20: provisioner.Provision.Metadata + (*Provision_Start)(nil), // 21: provisioner.Provision.Start + (*Provision_Cancel)(nil), // 22: provisioner.Provision.Cancel + (*Provision_Request)(nil), // 23: provisioner.Provision.Request + (*Provision_Complete)(nil), // 24: provisioner.Provision.Complete + (*Provision_Response)(nil), // 25: provisioner.Provision.Response + (*DeprecatedParse_Request)(nil), // 26: provisioner.DeprecatedParse.Request + (*DeprecatedParse_Complete)(nil), // 27: provisioner.DeprecatedParse.Complete + (*DeprecatedParse_Response)(nil), // 28: provisioner.DeprecatedParse.Response } var file_provisionersdk_proto_provisioner_proto_depIdxs = []int32{ - 2, // 0: provisioner.ParameterSource.scheme:type_name -> provisioner.ParameterSource.Scheme - 3, // 1: provisioner.ParameterDestination.scheme:type_name -> provisioner.ParameterDestination.Scheme - 3, // 2: provisioner.ParameterValue.destination_scheme:type_name -> provisioner.ParameterDestination.Scheme - 6, // 3: provisioner.ParameterSchema.default_source:type_name -> provisioner.ParameterSource - 7, // 4: provisioner.ParameterSchema.default_destination:type_name -> provisioner.ParameterDestination - 4, // 5: provisioner.ParameterSchema.validation_type_system:type_name -> provisioner.ParameterSchema.TypeSystem - 0, // 6: provisioner.Log.level:type_name -> provisioner.LogLevel - 18, // 7: provisioner.Agent.env:type_name -> provisioner.Agent.EnvEntry - 13, // 8: provisioner.Agent.apps:type_name -> provisioner.App - 14, // 9: provisioner.App.healthcheck:type_name -> provisioner.Healthcheck - 12, // 10: provisioner.Resource.agents:type_name -> provisioner.Agent - 19, // 11: provisioner.Resource.metadata:type_name -> provisioner.Resource.Metadata - 9, // 12: provisioner.Parse.Complete.parameter_schemas:type_name -> provisioner.ParameterSchema - 10, // 13: provisioner.Parse.Response.log:type_name -> provisioner.Log - 21, // 14: provisioner.Parse.Response.complete:type_name -> provisioner.Parse.Complete - 1, // 15: provisioner.Provision.Metadata.workspace_transition:type_name -> provisioner.WorkspaceTransition - 8, // 16: provisioner.Provision.Start.parameter_values:type_name -> provisioner.ParameterValue - 23, // 17: provisioner.Provision.Start.metadata:type_name -> provisioner.Provision.Metadata - 24, // 18: provisioner.Provision.Request.start:type_name -> provisioner.Provision.Start - 25, // 19: provisioner.Provision.Request.cancel:type_name -> provisioner.Provision.Cancel - 15, // 20: provisioner.Provision.Complete.resources:type_name -> provisioner.Resource - 10, // 21: provisioner.Provision.Response.log:type_name -> provisioner.Log - 27, // 22: provisioner.Provision.Response.complete:type_name -> provisioner.Provision.Complete - 20, // 23: provisioner.Provisioner.Parse:input_type -> provisioner.Parse.Request - 26, // 24: provisioner.Provisioner.Provision:input_type -> provisioner.Provision.Request - 22, // 25: provisioner.Provisioner.Parse:output_type -> provisioner.Parse.Response - 28, // 26: provisioner.Provisioner.Provision:output_type -> provisioner.Provision.Response - 25, // [25:27] is the sub-list for method output_type - 23, // [23:25] 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 + 0, // 0: provisioner.Log.level:type_name -> provisioner.LogLevel + 18, // 1: provisioner.Agent.env:type_name -> provisioner.Agent.EnvEntry + 8, // 2: provisioner.Agent.apps:type_name -> provisioner.App + 9, // 3: provisioner.App.healthcheck:type_name -> provisioner.Healthcheck + 7, // 4: provisioner.Resource.agents:type_name -> provisioner.Agent + 19, // 5: provisioner.Resource.metadata:type_name -> provisioner.Resource.Metadata + 11, // 6: provisioner.Parameter.options:type_name -> provisioner.ParameterOption + 2, // 7: provisioner.DeprecatedParameterSource.scheme:type_name -> provisioner.DeprecatedParameterSource.Scheme + 16, // 8: provisioner.DeprecatedParameterSchema.default_source:type_name -> provisioner.DeprecatedParameterSource + 3, // 9: provisioner.DeprecatedParameterSchema.validation_type_system:type_name -> provisioner.DeprecatedParameterSchema.TypeSystem + 1, // 10: provisioner.Provision.Metadata.workspace_transition:type_name -> provisioner.WorkspaceTransition + 13, // 11: provisioner.Provision.Start.parameter_values:type_name -> provisioner.ParameterValue + 20, // 12: provisioner.Provision.Start.metadata:type_name -> provisioner.Provision.Metadata + 21, // 13: provisioner.Provision.Request.start:type_name -> provisioner.Provision.Start + 22, // 14: provisioner.Provision.Request.cancel:type_name -> provisioner.Provision.Cancel + 10, // 15: provisioner.Provision.Complete.resources:type_name -> provisioner.Resource + 12, // 16: provisioner.Provision.Complete.parameters:type_name -> provisioner.Parameter + 5, // 17: provisioner.Provision.Response.log:type_name -> provisioner.Log + 24, // 18: provisioner.Provision.Response.complete:type_name -> provisioner.Provision.Complete + 17, // 19: provisioner.DeprecatedParse.Complete.parameter_schemas:type_name -> provisioner.DeprecatedParameterSchema + 5, // 20: provisioner.DeprecatedParse.Response.log:type_name -> provisioner.Log + 27, // 21: provisioner.DeprecatedParse.Response.complete:type_name -> provisioner.DeprecatedParse.Complete + 26, // 22: provisioner.Provisioner.DeprecatedParse:input_type -> provisioner.DeprecatedParse.Request + 23, // 23: provisioner.Provisioner.Provision:input_type -> provisioner.Provision.Request + 28, // 24: provisioner.Provisioner.DeprecatedParse:output_type -> provisioner.DeprecatedParse.Response + 25, // 25: provisioner.Provisioner.Provision:output_type -> provisioner.Provision.Response + 24, // [24:26] is the sub-list for method output_type + 22, // [22:24] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name } func init() { file_provisionersdk_proto_provisioner_proto_init() } @@ -2187,7 +2284,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: @@ -2199,7 +2296,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: @@ -2211,7 +2308,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: @@ -2223,7 +2320,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: @@ -2235,7 +2332,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: @@ -2247,7 +2344,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: @@ -2259,7 +2356,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: @@ -2271,7 +2368,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: @@ -2283,7 +2380,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: @@ -2295,7 +2392,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: @@ -2307,7 +2404,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: @@ -2319,7 +2416,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: @@ -2330,8 +2427,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: @@ -2343,7 +2440,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: @@ -2355,7 +2452,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: @@ -2367,7 +2464,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_Start); i { case 0: return &v.state case 1: @@ -2379,7 +2476,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_Cancel); i { case 0: return &v.state case 1: @@ -2391,7 +2488,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_Start); i { + switch v := v.(*Provision_Request); i { case 0: return &v.state case 1: @@ -2403,7 +2500,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_Cancel); i { + switch v := v.(*Provision_Complete); i { case 0: return &v.state case 1: @@ -2415,7 +2512,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_Request); i { + switch v := v.(*Provision_Response); i { case 0: return &v.state case 1: @@ -2427,7 +2524,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_Complete); i { + switch v := v.(*DeprecatedParse_Request); i { case 0: return &v.state case 1: @@ -2439,7 +2536,19 @@ 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_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[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeprecatedParse_Response); i { case 0: return &v.state case 1: @@ -2451,29 +2560,29 @@ 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[21].OneofWrappers = []interface{}{ + file_provisionersdk_proto_provisioner_proto_msgTypes[19].OneofWrappers = []interface{}{ (*Provision_Request_Start)(nil), (*Provision_Request_Cancel)(nil), } - file_provisionersdk_proto_provisioner_proto_msgTypes[23].OneofWrappers = []interface{}{ + file_provisionersdk_proto_provisioner_proto_msgTypes[21].OneofWrappers = []interface{}{ (*Provision_Response_Log)(nil), (*Provision_Response_Complete)(nil), } + file_provisionersdk_proto_provisioner_proto_msgTypes[24].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: 5, - NumMessages: 24, + NumEnums: 4, + NumMessages: 25, NumExtensions: 0, NumServices: 1, }, diff --git a/provisionersdk/proto/provisioner.proto b/provisionersdk/proto/provisioner.proto index af30e32f10524..58a9bc503cc37 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; @@ -121,20 +76,32 @@ message Resource { string icon = 6; } -// 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 immutable = 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 { @@ -172,6 +139,7 @@ message Provision { bytes state = 1; string error = 2; repeated Resource resources = 3; + repeated Parameter parameters = 4; } message Response { oneof type { @@ -182,6 +150,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 97eef664f6729..ebec5974f6720 100644 --- a/provisionersdk/serve_test.go +++ b/provisionersdk/serve_test.go @@ -35,7 +35,7 @@ func TestProvisionerSDK(t *testing.T) { }() api := proto.NewDRPCProvisionerClient(provisionersdk.Conn(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))) From d242523bebb046602b3bae1471fdcf566f641a5a Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Thu, 29 Sep 2022 19:22:51 +0000 Subject: [PATCH 03/14] Rename parameter routes to deprecated --- cli/create.go | 2 +- cli/parameterslist.go | 2 +- cli/templatecreate.go | 6 +++--- cli/templatepush_test.go | 2 +- cli/update.go | 2 +- coderd/coderd.go | 12 ++++++------ coderd/coderdtest/authorize.go | 12 ++++++------ coderd/parameters.go | 6 +++--- coderd/parameters_test.go | 20 ++++++++++---------- coderd/templateversions.go | 4 ++-- coderd/templateversions_test.go | 10 +++++----- coderd/users_test.go | 4 ++-- codersdk/parameters.go | 12 ++++++------ codersdk/templateversions.go | 12 ++++++------ site/src/api/api.ts | 2 +- site/src/testHelpers/handlers.ts | 2 +- 16 files changed, 55 insertions(+), 55 deletions(-) diff --git a/cli/create.go b/cli/create.go index 793f4d99b4839..efbfb7c557dda 100644 --- a/cli/create.go +++ b/cli/create.go @@ -184,7 +184,7 @@ func prepWorkspaceBuild(cmd *cobra.Command, client *codersdk.Client, args prepWo if err != nil { return nil, err } - parameterSchemas, err := client.TemplateVersionSchema(ctx, templateVersion.ID) + parameterSchemas, err := client.DeprecatedTemplateVersionSchema(ctx, templateVersion.ID) if err != nil { return nil, err } diff --git a/cli/parameterslist.go b/cli/parameterslist.go index 438b15acea419..dd4065c990c4f 100644 --- a/cli/parameterslist.go +++ b/cli/parameterslist.go @@ -66,7 +66,7 @@ func parameterList() *cobra.Command { }) } - params, err := client.Parameters(cmd.Context(), codersdk.ParameterScope(scope), scopeID) + params, err := client.DeprecatedParameters(cmd.Context(), codersdk.ParameterScope(scope), scopeID) if err != nil { return xerrors.Errorf("fetch params: %w", err) } diff --git a/cli/templatecreate.go b/cli/templatecreate.go index a0f4014f712f0..5eee32a892d5c 100644 --- a/cli/templatecreate.go +++ b/cli/templatecreate.go @@ -198,11 +198,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 } @@ -218,7 +218,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.ParameterImportJob, activeVersion.Job.ID) if err != nil { return nil, nil, xerrors.Errorf("Fetch previous version parameters: %w", err) } diff --git a/cli/templatepush_test.go b/cli/templatepush_test.go index a372fb987e1ce..246296d0b4958 100644 --- a/cli/templatepush_test.go +++ b/cli/templatepush_test.go @@ -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.ParameterImportJob, tv.Job.ID) require.NoError(t, err) return tv, params diff --git a/cli/update.go b/cli/update.go index 1ccfaad33a0b3..0fca3f4554b22 100644 --- a/cli/update.go +++ b/cli/update.go @@ -41,7 +41,7 @@ func update() *cobra.Command { var existingParams []codersdk.Parameter if !alwaysPrompt { - existingParams, err = client.Parameters(cmd.Context(), codersdk.ParameterWorkspace, workspace.ID) + existingParams, err = client.DeprecatedParameters(cmd.Context(), codersdk.ParameterWorkspace, workspace.ID) if err != nil { return nil } diff --git a/coderd/coderd.go b/coderd/coderd.go index 0ac4a7c68dc5f..26d6b9472307e 100644 --- a/coderd/coderd.go +++ b/coderd/coderd.go @@ -305,12 +305,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) { @@ -336,8 +336,8 @@ 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 60fca71cd0062..3d58faaa31e6c 100644 --- a/coderd/coderdtest/authorize.go +++ b/coderd/coderdtest/authorize.go @@ -179,7 +179,7 @@ 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}/parameters": { + "GET:/api/v2/templateversions/{templateversion}/deprecated-parameters": { AssertAction: rbac.ActionRead, AssertObject: rbac.ResourceTemplate.InOrg(a.Template.OrganizationID), }, @@ -187,7 +187,7 @@ 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}/schema": { + "GET:/api/v2/templateversions/{templateversion}/deprecated-schema": { AssertAction: rbac.ActionRead, AssertObject: rbac.ResourceTemplate.InOrg(a.Template.OrganizationID), }, @@ -217,15 +217,15 @@ func AGPLRoutes(a *AuthTester) (map[string]string, map[string]RouteCheck) { AssertObject: rbac.ResourceProvisionerDaemon, }, - "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, }, @@ -358,7 +358,7 @@ func NewAuthTester(ctx context.Context, t *testing.T, client *codersdk.Client, a }) 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.ParameterTemplate, template.ID, codersdk.CreateParameterRequest{ Name: "test-param", SourceValue: "hello world", SourceScheme: codersdk.ParameterSourceSchemeData, diff --git a/coderd/parameters.go b/coderd/parameters.go index 3dc73259457f3..819b915d735c3 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 { @@ -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 { @@ -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 { diff --git a/coderd/parameters_test.go b/coderd/parameters_test.go index 450e0a26242e9..ee4e810856b2a 100644 --- a/coderd/parameters_test.go +++ b/coderd/parameters_test.go @@ -25,7 +25,7 @@ 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.ParameterScope("something"), user.OrganizationID, codersdk.CreateParameterRequest{ Name: "example", SourceValue: "tomato", SourceScheme: codersdk.ParameterSourceSchemeData, @@ -45,7 +45,7 @@ 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.ParameterTemplate, template.ID, codersdk.CreateParameterRequest{ Name: "example", SourceValue: "tomato", SourceScheme: codersdk.ParameterSourceSchemeData, @@ -63,7 +63,7 @@ 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.ParameterTemplate, template.ID, codersdk.CreateParameterRequest{ Name: "example", SourceValue: "tomato", SourceScheme: codersdk.ParameterSourceSchemeData, @@ -71,7 +71,7 @@ func TestPostParameter(t *testing.T) { }) require.NoError(t, err) - _, err = client.CreateParameter(ctx, codersdk.ParameterTemplate, template.ID, codersdk.CreateParameterRequest{ + _, err = client.DeprecatedCreateParameter(ctx, codersdk.ParameterTemplate, template.ID, codersdk.CreateParameterRequest{ Name: "example", SourceValue: "tomato", SourceScheme: codersdk.ParameterSourceSchemeData, @@ -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.ParameterTemplate, 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.ParameterTemplate, template.ID, codersdk.CreateParameterRequest{ Name: "example", SourceValue: "tomato", SourceScheme: codersdk.ParameterSourceSchemeData, DestinationScheme: codersdk.ParameterDestinationSchemeProvisionerVariable, }) require.NoError(t, err) - params, err := client.Parameters(ctx, codersdk.ParameterTemplate, template.ID) + params, err := client.DeprecatedParameters(ctx, codersdk.ParameterTemplate, 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.ParameterTemplate, 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.ParameterTemplate, template.ID, codersdk.CreateParameterRequest{ Name: "example", SourceValue: "tomato", SourceScheme: codersdk.ParameterSourceSchemeData, DestinationScheme: codersdk.ParameterDestinationSchemeProvisionerVariable, }) require.NoError(t, err) - err = client.DeleteParameter(ctx, codersdk.ParameterTemplate, template.ID, param.Name) + err = client.DeprecatedDeleteParameter(ctx, codersdk.ParameterTemplate, template.ID, param.Name) require.NoError(t, err) }) } diff --git a/coderd/templateversions.go b/coderd/templateversions.go index a8c658f8bd608..c08bfeff21af6 100644 --- a/coderd/templateversions.go +++ b/coderd/templateversions.go @@ -98,7 +98,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() templateVersion := httpmw.TemplateVersionParam(r) if !api.Authorize(r, rbac.ActionRead, templateVersion) { @@ -146,7 +146,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() templateVersion := httpmw.TemplateVersionParam(r) if !api.Authorize(r, rbac.ActionRead, templateVersion) { diff --git a/coderd/templateversions_test.go b/coderd/templateversions_test.go index 10cbb98cb67eb..b898780e0bb62 100644 --- a/coderd/templateversions_test.go +++ b/coderd/templateversions_test.go @@ -219,7 +219,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()) @@ -245,7 +245,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) @@ -274,7 +274,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) @@ -293,7 +293,7 @@ func TestTemplateVersionParameters(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) defer cancel() - _, err := client.TemplateVersionParameters(ctx, version.ID) + _, err := client.DeprecatedTemplateVersionParameters(ctx, version.ID) var apiErr *codersdk.Error require.ErrorAs(t, err, &apiErr) require.Equal(t, http.StatusPreconditionFailed, apiErr.StatusCode()) @@ -334,7 +334,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) diff --git a/coderd/users_test.go b/coderd/users_test.go index e6c8d5da26e17..cb29175e596e6 100644 --- a/coderd/users_test.go +++ b/coderd/users_test.go @@ -119,7 +119,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.ParameterTemplate, template.ID) require.NoErrorf(t, err, "get template parameters for %q", template.Name) // Ensure all template parameters are present. @@ -148,7 +148,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.ParameterImportJob, 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/codersdk/parameters.go b/codersdk/parameters.go index 20184622ddd34..3043931bc39d5 100644 --- a/codersdk/parameters.go +++ b/codersdk/parameters.go @@ -98,8 +98,8 @@ type CreateParameterRequest struct { DestinationScheme ParameterDestinationScheme `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 ParameterScope, id uuid.UUID, req CreateParameterRequest) (Parameter, 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 } @@ -113,8 +113,8 @@ func (c *Client) CreateParameter(ctx context.Context, scope ParameterScope, id u 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 ParameterScope, 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 ParameterScope, id uuid.UUID) ([]Parameter, 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 } diff --git a/codersdk/templateversions.go b/codersdk/templateversions.go index 5baad0a9e9deb..9db8340164a7b 100644 --- a/codersdk/templateversions.go +++ b/codersdk/templateversions.go @@ -52,9 +52,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) +// DeprecatedTemplateVersionSchema returns schemas for a template version by ID. +func (c *Client) DeprecatedTemplateVersionSchema(ctx context.Context, version uuid.UUID) ([]ParameterSchema, error) { + res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/templateversions/%s/deprecated-schema", version), nil) if err != nil { return nil, err } @@ -66,9 +66,9 @@ func (c *Client) TemplateVersionSchema(ctx context.Context, version uuid.UUID) ( 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) +// DeprecatedTemplateVersionParameters returns computed parameters for a template version. +func (c *Client) DeprecatedTemplateVersionParameters(ctx context.Context, version uuid.UUID) ([]ComputedParameter, error) { + res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/templateversions/%s/deprecated-parameters", version), nil) if err != nil { return nil, err } diff --git a/site/src/api/api.ts b/site/src/api/api.ts index 00ba5f6630efb..6e03b2ba34ed2 100644 --- a/site/src/api/api.ts +++ b/site/src/api/api.ts @@ -169,7 +169,7 @@ export const getTemplateVersionSchema = async ( versionId: string, ): Promise => { const response = await axios.get( - `/api/v2/templateversions/${versionId}/schema`, + `/api/v2/templateversions/${versionId}/deprecated-schema`, ) return response.data } diff --git a/site/src/testHelpers/handlers.ts b/site/src/testHelpers/handlers.ts index eaeef28c3a902..3e648f5345e70 100644 --- a/site/src/testHelpers/handlers.ts +++ b/site/src/testHelpers/handlers.ts @@ -38,7 +38,7 @@ export const handlers = [ rest.get("/api/v2/templateversions/:templateVersionId", async (req, res, ctx) => { return res(ctx.status(200), ctx.json(M.MockTemplateVersion)) }), - rest.get("/api/v2/templateversions/:templateVersionId/schema", async (req, res, ctx) => { + rest.get("/api/v2/templateversions/:templateVersionId/deprecated-schema", async (req, res, ctx) => { return res(ctx.status(200), ctx.json([])) }), rest.get("/api/v2/templateversions/:templateVersionId/resources", async (req, res, ctx) => { From e71711c71392958cf240db8bfc368a378db80cc1 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Thu, 29 Sep 2022 19:46:41 +0000 Subject: [PATCH 04/14] Add parameter parsing to builds --- coderd/database/dump.sql | 2 +- .../migrations/000055_parameters.up.sql | 2 +- coderd/database/models.go | 2 +- go.mod | 17 + go.sum | 32 ++ provisioner/terraform/executor.go | 33 +- provisioner/terraform/resources.go | 57 ++- provisioner/terraform/resources_test.go | 19 +- provisionersdk/proto/provisioner.pb.go | 337 +++++++++--------- provisionersdk/proto/provisioner.proto | 2 +- 10 files changed, 303 insertions(+), 200 deletions(-) diff --git a/coderd/database/dump.sql b/coderd/database/dump.sql index 0b3d0125d76b7..7cd3bcabf1430 100644 --- a/coderd/database/dump.sql +++ b/coderd/database/dump.sql @@ -274,7 +274,7 @@ CREATE TABLE template_version_parameters ( name text NOT NULL, description text NOT NULL, type text NOT NULL, - immutable boolean NOT NULL, + mutable boolean NOT NULL, default_value text NOT NULL, icon text NOT NULL, options jsonb DEFAULT '[]'::jsonb NOT NULL, diff --git a/coderd/database/migrations/000055_parameters.up.sql b/coderd/database/migrations/000055_parameters.up.sql index 1926a9373adcf..9bbe2343380ba 100644 --- a/coderd/database/migrations/000055_parameters.up.sql +++ b/coderd/database/migrations/000055_parameters.up.sql @@ -3,7 +3,7 @@ CREATE TABLE template_version_parameters ( name text not null, description text not null, type text not null, - immutable boolean not null, + mutable boolean not null, default_value text not null, icon text not null, options jsonb not null default '[]'::jsonb, diff --git a/coderd/database/models.go b/coderd/database/models.go index 5446fe5235bbb..48a865a6257f2 100644 --- a/coderd/database/models.go +++ b/coderd/database/models.go @@ -542,7 +542,7 @@ type TemplateVersionParameter struct { Name string `db:"name" json:"name"` Description string `db:"description" json:"description"` Type string `db:"type" json:"type"` - Immutable bool `db:"immutable" json:"immutable"` + 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"` diff --git a/go.mod b/go.mod index 0870322f9c4d0..ef0ff6c44e0a0 100644 --- a/go.mod +++ b/go.mod @@ -65,6 +65,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.4.16-0.20220929232427-aaa860cdfa3a 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 @@ -156,6 +157,22 @@ require ( tailscale.com v1.30.0 ) +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 ( filippo.io/edwards25519 v1.0.0-rc.1 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect diff --git a/go.sum b/go.sum index a0cd57f00ff08..8fba8dd1efc4d 100644 --- a/go.sum +++ b/go.sum @@ -195,7 +195,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= @@ -351,6 +353,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.20220926024748-50f068456c6c h1:xa6lr5Pj87Is26tgpzwBsEGKL7aVz7/fRGgY9QIbf3E= github.com/coder/tailscale v1.1.1-0.20220926024748-50f068456c6c/go.mod h1:5amxy08qijEa8bcTW2SeIy4MIqcmd7LMsuOxqOlj2Ak= +github.com/coder/terraform-provider-coder v0.4.16-0.20220929232427-aaa860cdfa3a h1:AQRie9LF7kXw/BzrJtfX1lKQXlYqBmt1j+fSOXOQ6/I= +github.com/coder/terraform-provider-coder v0.4.16-0.20220929232427-aaa860cdfa3a/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= @@ -960,12 +964,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= @@ -973,6 +982,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= @@ -981,6 +991,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= @@ -997,6 +1009,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= @@ -1004,8 +1017,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= @@ -1313,12 +1335,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= @@ -1335,6 +1360,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.18+incompatible h1:aAQ5lDb+SDrhVDnoMbR3kSzswd+41X34pex8VRJXvHg= @@ -1396,10 +1422,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= @@ -1775,7 +1803,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/terraform/executor.go b/provisioner/terraform/executor.go index 5c7d7199024c0..a1cf9c6ca4622 100644 --- a/provisioner/terraform/executor.go +++ b/provisioner/terraform/executor.go @@ -213,30 +213,31 @@ 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 } return &proto.Provision_Response{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ - Resources: resources, + Resources: resources, + Parameters: parameters, }, }, }, 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) + return ConvertResourcesAndParameters(plan.PlannedValues.RootModule, rawGraph) } func (e executor) showPlan(ctx, killCtx context.Context, planfilePath string) (*tfjson.Plan, error) { @@ -299,7 +300,7 @@ func (e executor) apply(ctx, killCtx context.Context, env, vars []string, logr l 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 } @@ -311,30 +312,32 @@ func (e executor) apply(ctx, killCtx context.Context, env, vars []string, logr l 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(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/resources.go b/provisioner/terraform/resources.go index 22685c566120a..37ed9dd8a21c8 100644 --- a/provisioner/terraform/resources.go +++ b/provisioner/terraform/resources.go @@ -10,6 +10,8 @@ import ( "github.com/mitchellh/mapstructure" "golang.org/x/xerrors" + "github.com/coder/terraform-provider-coder/provider" + "github.com/coder/coder/provisionersdk/proto" ) @@ -58,17 +60,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(module *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) @@ -110,7 +112,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, @@ -146,7 +148,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 @@ -224,7 +226,7 @@ func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Res if err != nil { d, _ := json.MarshalIndent(resource.AttributeValues, "", " ") fmt.Print(string(d)) - return nil, xerrors.Errorf("decode app attributes: %w", err) + return nil, nil, xerrors.Errorf("decode app attributes: %w", err) } if attrs.Name == "" { // Default to the resource name if none is set! @@ -267,7 +269,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 @@ -354,7 +356,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 7330a215eac17..4e004ecbbc586 100644 --- a/provisioner/terraform/resources_test.go +++ b/provisioner/terraform/resources_test.go @@ -158,9 +158,10 @@ 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)) + resources, parameters, err := terraform.ConvertResourcesAndParameters(tfPlan.PlannedValues.RootModule, string(tfPlanGraph)) require.NoError(t, err) sortResources(resources) + sortParameters(parameters) var expectedNoMetadata []*proto.Resource for _, resource := range expected { @@ -188,9 +189,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(tfState.Values.RootModule, string(tfStateGraph)) require.NoError(t, err) sortResources(resources) + sortParameters(parameters) for _, resource := range resources { for _, agent := range resource.Agents { agent.Id = "" @@ -246,7 +248,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", @@ -302,3 +304,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/provisionersdk/proto/provisioner.pb.go b/provisionersdk/proto/provisioner.pb.go index bfc9fc38589cf..842dfdfa2aa91 100644 --- a/provisionersdk/proto/provisioner.pb.go +++ b/provisionersdk/proto/provisioner.pb.go @@ -823,7 +823,7 @@ type Parameter struct { 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"` - Immutable bool `protobuf:"varint,4,opt,name=immutable,proto3" json:"immutable,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"` @@ -885,9 +885,9 @@ func (x *Parameter) GetType() string { return "" } -func (x *Parameter) GetImmutable() bool { +func (x *Parameter) GetMutable() bool { if x != nil { - return x.Immutable + return x.Mutable } return false } @@ -2011,179 +2011,178 @@ var file_provisionersdk_proto_provisioner_proto_rawDesc = []byte{ 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, 0xdd, 0x02, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x12, + 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, 0x1c, 0x0a, 0x09, 0x69, 0x6d, 0x6d, 0x75, - 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x6d, 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, 0xe7, 0x07, 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, 0xd9, - 0x01, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 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, 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, 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, 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, 0x12, 0x14, 0x0a, 0x05, 0x73, - 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, - 0x65, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x06, 0x64, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x1a, 0x08, 0x0a, 0x06, 0x43, 0x61, - 0x6e, 0x63, 0x65, 0x6c, 0x1a, 0x80, 0x01, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x34, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, - 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x37, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, - 0x18, 0x02, 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, 0xa3, 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, 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, + 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, 0xe7, 0x07, 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, 0xd9, 0x01, 0x0a, 0x05, 0x53, + 0x74, 0x61, 0x72, 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, 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, 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, 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, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x17, 0x0a, + 0x07, 0x64, 0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, + 0x64, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x1a, 0x08, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, + 0x1a, 0x80, 0x01, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x12, 0x37, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x02, 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, 0xa3, 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, 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, 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, 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, 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, + 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, 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, - 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, + 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, 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 ( diff --git a/provisionersdk/proto/provisioner.proto b/provisionersdk/proto/provisioner.proto index 58a9bc503cc37..887951003cd63 100644 --- a/provisionersdk/proto/provisioner.proto +++ b/provisionersdk/proto/provisioner.proto @@ -89,7 +89,7 @@ message Parameter { string name = 1; string description = 2; string type = 3; - bool immutable = 4; + bool mutable = 4; string default_value = 5; string icon = 6; repeated ParameterOption options = 7; From 4cd58268238d2ddb06c4e380f77a203420cbb7ed Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Fri, 30 Sep 2022 15:37:57 +0000 Subject: [PATCH 05/14] Add parameter parsing to the Terraform provider --- provisioner/terraform/executor.go | 11 +- provisioner/terraform/resources.go | 6 +- provisioner/terraform/resources_test.go | 265 +++++++++++------- provisioner/terraform/testdata/generate.sh | 2 + .../testdata/parameters/parameters.tf | 30 ++ .../testdata/parameters/parameters.tfplan.dot | 21 ++ .../parameters/parameters.tfplan.json | 219 +++++++++++++++ .../parameters/parameters.tfstate.dot | 21 ++ .../parameters/parameters.tfstate.json | 85 ++++++ 9 files changed, 551 insertions(+), 109 deletions(-) create mode 100644 provisioner/terraform/testdata/parameters/parameters.tf create mode 100644 provisioner/terraform/testdata/parameters/parameters.tfplan.dot create mode 100644 provisioner/terraform/testdata/parameters/parameters.tfplan.json create mode 100644 provisioner/terraform/testdata/parameters/parameters.tfstate.dot create mode 100644 provisioner/terraform/testdata/parameters/parameters.tfstate.json diff --git a/provisioner/terraform/executor.go b/provisioner/terraform/executor.go index a1cf9c6ca4622..0fa3250426c33 100644 --- a/provisioner/terraform/executor.go +++ b/provisioner/terraform/executor.go @@ -237,7 +237,12 @@ func (e executor) planResources(ctx, killCtx context.Context, planfilePath strin if err != nil { return nil, nil, xerrors.Errorf("graph: %w", err) } - return ConvertResourcesAndParameters(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) { @@ -332,7 +337,9 @@ func (e executor) stateResources(ctx, killCtx context.Context) ([]*proto.Resourc var resources []*proto.Resource var parameters []*proto.Parameter if state.Values != nil { - resources, parameters, err = ConvertResourcesAndParameters(state.Values.RootModule, rawGraph) + resources, parameters, err = ConvertResourcesAndParameters([]*tfjson.StateModule{ + state.Values.RootModule, + }, rawGraph) if err != nil { return nil, nil, err } diff --git a/provisioner/terraform/resources.go b/provisioner/terraform/resources.go index 37ed9dd8a21c8..741148b0699c4 100644 --- a/provisioner/terraform/resources.go +++ b/provisioner/terraform/resources.go @@ -63,7 +63,7 @@ type metadataItem struct { // ConvertResourcesAndParameters consumes Terraform state and a GraphViz representation produced by // `terraform graph` to produce resources consumable by Coder. // nolint:gocyclo -func ConvertResourcesAndParameters(module *tfjson.StateModule, rawGraph string) ([]*proto.Resource, []*proto.Parameter, error) { +func ConvertResourcesAndParameters(modules []*tfjson.StateModule, rawGraph string) ([]*proto.Resource, []*proto.Parameter, error) { parsedGraph, err := gographviz.ParseString(rawGraph) if err != nil { return nil, nil, xerrors.Errorf("parse graph: %w", err) @@ -102,7 +102,9 @@ func ConvertResourcesAndParameters(module *tfjson.StateModule, rawGraph string) } } } - findTerraformResources(module) + for _, module := range modules { + findTerraformResources(module) + } // Find all agents! for _, tfResource := range tfResourceByLabel { diff --git a/provisioner/terraform/resources_test.go b/provisioner/terraform/resources_test.go index 4e004ecbbc586..5010f893f0e90 100644 --- a/provisioner/terraform/resources_test.go +++ b/provisioner/terraform/resources_test.go @@ -22,125 +22,166 @@ 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{}, + "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{}, + }}, }}, - }}, + }, // 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{}, + "conflicting-resources": { + resources: []*proto.Resource{{ + Name: "first", + Type: "null_resource", + Agents: []*proto.Agent{{ + Name: "main", + OperatingSystem: "linux", + Architecture: "amd64", + Auth: &proto.Agent_Token{}, + }}, + }, { + 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{}, + "instance-id": { + resources: []*proto.Resource{{ + Name: "main", + Type: "null_resource", + Agents: []*proto.Agent{{ + Name: "main", + OperatingSystem: "linux", + Architecture: "amd64", + Auth: &proto.Agent_InstanceId{}, + }}, }}, - }}, + }, // 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{}, + "calling-module": { + resources: []*proto.Resource{{ + Name: "example", + Type: "null_resource", + Agents: []*proto.Agent{{ + Name: "main", + OperatingSystem: "linux", + Architecture: "amd64", + Auth: &proto.Agent_Token{}, + }}, }}, - }}, + }, // 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{}, - }, { - Name: "dev2", - OperatingSystem: "darwin", - Architecture: "amd64", - Auth: &proto.Agent_Token{}, - }, { - Name: "dev3", - OperatingSystem: "windows", - Architecture: "arm64", - Auth: &proto.Agent_Token{}, + "multiple-agents": { + resources: []*proto.Resource{{ + Name: "dev", + Type: "null_resource", + Agents: []*proto.Agent{{ + Name: "dev1", + OperatingSystem: "linux", + Architecture: "amd64", + Auth: &proto.Agent_Token{}, + }, { + Name: "dev2", + OperatingSystem: "darwin", + Architecture: "amd64", + Auth: &proto.Agent_Token{}, + }, { + Name: "dev3", + OperatingSystem: "windows", + Architecture: "arm64", + Auth: &proto.Agent_Token{}, + }}, }}, - }}, + }, // 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{{ - Name: "app1", - }, { - Name: "app2", - 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", + Apps: []*proto.App{{ + Name: "app1", + }, { + Name: "app2", + Healthcheck: &proto.Healthcheck{ + Url: "http://localhost:13337/healthz", + Interval: 5, + Threshold: 6, + }, + }}, + Auth: &proto.Agent_Token{}, }}, - Auth: &proto.Agent_Token{}, }}, - }}, + }, // Tests fetching metadata about workspace resources. - "resource-metadata": {{ - Name: "about", - Type: "null_resource", - Hide: true, - Icon: "/icon/server.svg", - 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", + 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 @@ -158,13 +199,18 @@ func TestConvertResources(t *testing.T) { tfPlanGraph, err := os.ReadFile(filepath.Join(dir, folderName+".tfplan.dot")) require.NoError(t, err) - resources, parameters, err := terraform.ConvertResourcesAndParameters(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 { @@ -178,6 +224,15 @@ func TestConvertResources(t *testing.T) { resourcesGot, err := json.Marshal(resources) require.NoError(t, err) require.Equal(t, string(resourcesWant), string(resourcesGot)) + + 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)) }) t.Run("Provision", func(t *testing.T) { t.Parallel() @@ -189,7 +244,7 @@ func TestConvertResources(t *testing.T) { tfStateGraph, err := os.ReadFile(filepath.Join(dir, folderName+".tfstate.dot")) require.NoError(t, err) - resources, parameters, err := terraform.ConvertResourcesAndParameters(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) @@ -204,7 +259,7 @@ func TestConvertResources(t *testing.T) { } } } - resourcesWant, err := json.Marshal(expected) + resourcesWant, err := json.Marshal(expected.resources) require.NoError(t, err) resourcesGot, err := json.Marshal(resources) require.NoError(t, err) @@ -248,7 +303,7 @@ func TestInstanceIDAssociation(t *testing.T) { t.Parallel() instanceID, err := cryptorand.String(12) require.NoError(t, err) - resources, _, err := terraform.ConvertResourcesAndParameters(&tfjson.StateModule{ + resources, _, err := terraform.ConvertResourcesAndParameters([]*tfjson.StateModule{{ Resources: []*tfjson.StateResource{{ Address: "coder_agent.dev", Type: "coder_agent", @@ -269,7 +324,7 @@ func TestInstanceIDAssociation(t *testing.T) { }, }}, // This is manually created to join the edges. - }, `digraph { + }}, `digraph { compound = "true" newrank = "true" subgraph "root" { 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..4126db761f588 --- /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" + ] + } + ] + } + } +} From 120a70a3a135d2817b4591f3b2a949f7d99a7bdc Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Fri, 30 Sep 2022 15:52:50 +0000 Subject: [PATCH 06/14] Add deprecated key to codersdk parameter values --- cli/cliui/parameter.go | 2 +- cli/create.go | 12 ++-- cli/parameter.go | 2 +- cli/parameterslist.go | 16 ++--- cli/templatecreate.go | 16 ++--- cli/templatepush_test.go | 4 +- cli/update.go | 4 +- coderd/coderdtest/authorize.go | 10 +-- coderd/parameters.go | 24 +++---- coderd/parameters_test.go | 44 ++++++------- coderd/templateversions.go | 8 +-- coderd/templateversions_test.go | 16 ++--- coderd/users_test.go | 4 +- codersdk/organizations.go | 8 +-- codersdk/parameters.go | 112 ++++++++++++++++---------------- codersdk/templateversions.go | 10 +-- codersdk/workspaces.go | 2 +- 17 files changed, 147 insertions(+), 147 deletions(-) diff --git a/cli/cliui/parameter.go b/cli/cliui/parameter.go index 28e0c08e785ce..b0842f45214cb 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 ParameterSchema(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 efbfb7c557dda..0856caa2c2bcf 100644 --- a/cli/create.go +++ b/cli/create.go @@ -123,7 +123,7 @@ func create() *cobra.Command { parameters, err := prepWorkspaceBuild(cmd, client, prepWorkspaceBuildArgs{ Template: template, - ExistingParams: []codersdk.Parameter{}, + ExistingParams: []codersdk.DeprecatedParameter{}, ParameterFile: parameterFile, NewWorkspaceName: workspaceName, }) @@ -171,14 +171,14 @@ func create() *cobra.Command { type prepWorkspaceBuildArgs struct { Template codersdk.Template - ExistingParams []codersdk.Parameter + ExistingParams []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 { @@ -201,7 +201,7 @@ func prepWorkspaceBuild(cmd *cobra.Command, client *codersdk.Client, args prepWo } } disclaimerPrinted := false - parameters := make([]codersdk.CreateParameterRequest, 0) + parameters := make([]codersdk.DeprecatedCreateParameterRequest, 0) PromptParamLoop: for _, parameterSchema := range parameterSchemas { if !parameterSchema.AllowOverrideSource { @@ -228,10 +228,10 @@ PromptParamLoop: return 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, }) } diff --git a/cli/parameter.go b/cli/parameter.go index 904148ae13005..a9846586b93bc 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 getParameterValueFromMapOrInput(cmd *cobra.Command, parameterMap map[string]string, parameterSchema codersdk.DeprecatedParameterSchema) (string, error) { var parameterValue string if parameterMap != nil { var ok bool diff --git a/cli/parameterslist.go b/cli/parameterslist.go index dd4065c990c4f..f7e98cb235e7e 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.DeprecatedParameters(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 5eee32a892d5c..e012309adbb4d 100644 --- a/cli/templatecreate.go +++ b/cli/templatecreate.go @@ -158,7 +158,7 @@ type createValidTemplateVersionArgs struct { ReuseParameters bool } -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) { before := time.Now() client := args.Client @@ -210,7 +210,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 { @@ -218,7 +218,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.DeprecatedParameters(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) } @@ -228,7 +228,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 } @@ -245,7 +245,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 { @@ -258,7 +258,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)) @@ -279,10 +279,10 @@ func createValidTemplateVersion(cmd *cobra.Command, args createValidTemplateVers 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/templatepush_test.go b/cli/templatepush_test.go index 246296d0b4958..a764b3e9d5efc 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.DeprecatedParameters(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 0fca3f4554b22..389ac53a25f8c 100644 --- a/cli/update.go +++ b/cli/update.go @@ -39,9 +39,9 @@ func update() *cobra.Command { return nil } - var existingParams []codersdk.Parameter + var existingParams []codersdk.DeprecatedParameter if !alwaysPrompt { - existingParams, err = client.DeprecatedParameters(cmd.Context(), codersdk.ParameterWorkspace, workspace.ID) + existingParams, err = client.DeprecatedParameters(cmd.Context(), codersdk.DeprecatedParameterWorkspace, workspace.ID) if err != nil { return nil } diff --git a/coderd/coderdtest/authorize.go b/coderd/coderdtest/authorize.go index 3d58faaa31e6c..11f0043be77e0 100644 --- a/coderd/coderdtest/authorize.go +++ b/coderd/coderdtest/authorize.go @@ -298,7 +298,7 @@ type AuthTester struct { WorkspaceResource codersdk.WorkspaceResource File codersdk.UploadResponse TemplateVersionDryRun codersdk.ProvisionerJob - TemplateParam codersdk.Parameter + TemplateParam codersdk.DeprecatedParameter URLParams map[string]string } @@ -354,15 +354,15 @@ func NewAuthTester(ctx context.Context, t *testing.T, client *codersdk.Client, a workspaceResources, err := client.WorkspaceResourcesByBuild(ctx, workspace.LatestBuild.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.DeprecatedCreateParameter(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/parameters.go b/coderd/parameters.go index 819b915d735c3..21214ece6f892 100644 --- a/coderd/parameters.go +++ b/coderd/parameters.go @@ -33,7 +33,7 @@ func (api *API) deprecatedPostParameter(rw http.ResponseWriter, r *http.Request) return } - var createRequest codersdk.CreateParameterRequest + var createRequest codersdk.DeprecatedCreateParameterRequest if !httpapi.Read(ctx, rw, r, &createRequest) { return } @@ -108,7 +108,7 @@ func (api *API) deprecatedParameters(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)) } @@ -162,26 +162,26 @@ func (api *API) deprecatedDeleteParameter(rw http.ResponseWriter, r *http.Reques }) } -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 ee4e810856b2a..9f9c1140dd64a 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.DeprecatedCreateParameter(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.DeprecatedCreateParameter(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.DeprecatedCreateParameter(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.DeprecatedCreateParameter(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.DeprecatedParameters(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.DeprecatedCreateParameter(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.DeprecatedParameters(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.DeprecatedDeleteParameter(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.DeprecatedCreateParameter(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.DeprecatedDeleteParameter(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/templateversions.go b/coderd/templateversions.go index c08bfeff21af6..009d06d5f3fed 100644 --- a/coderd/templateversions.go +++ b/coderd/templateversions.go @@ -131,7 +131,7 @@ func (api *API) deprecatedTemplateVersionSchema(rw http.ResponseWriter, r *http. }) return } - apiSchemas := make([]codersdk.ParameterSchema, 0) + apiSchemas := make([]codersdk.DeprecatedParameterSchema, 0) for _, schema := range schemas { apiSchema, err := convertParameterSchema(schema) if err != nil { @@ -737,11 +737,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), }) } } diff --git a/coderd/templateversions_test.go b/coderd/templateversions_test.go index b898780e0bb62..b0b24db759d54 100644 --- a/coderd/templateversions_test.go +++ b/coderd/templateversions_test.go @@ -98,11 +98,11 @@ func TestPostTemplateVersionsByOrganization(t *testing.T) { StorageMethod: codersdk.ProvisionerStorageMethodFile, StorageSource: file.Hash, 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) @@ -599,7 +599,7 @@ func TestTemplateVersionDryRun(t *testing.T) { // Create template version dry-run after := time.Now() job, err := client.CreateTemplateVersionDryRun(ctx, version.ID, codersdk.CreateTemplateVersionDryRunRequest{ - ParameterValues: []codersdk.CreateParameterRequest{}, + ParameterValues: []codersdk.DeprecatedCreateParameterRequest{}, }) require.NoError(t, err) @@ -657,7 +657,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) @@ -700,7 +700,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) @@ -740,7 +740,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) @@ -792,7 +792,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 cb29175e596e6..a9b42bf5fd133 100644 --- a/coderd/users_test.go +++ b/coderd/users_test.go @@ -119,7 +119,7 @@ func TestFirstUser(t *testing.T) { for _, template := range templates { // Check template parameters. - templateParams, err := client.DeprecatedParameters(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. @@ -148,7 +148,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.DeprecatedParameters(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/codersdk/organizations.go b/codersdk/organizations.go index 003b9156dd7c6..f8fad9456af2b 100644 --- a/codersdk/organizations.go +++ b/codersdk/organizations.go @@ -43,7 +43,7 @@ type CreateTemplateVersionRequest struct { Provisioner ProvisionerType `json:"provisioner" validate:"oneof=terraform echo,required"` // 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. @@ -63,8 +63,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"` // MaxTTLMillis allows optionally specifying the maximum allowable TTL // for all workspaces created from this template. @@ -84,7 +84,7 @@ type CreateWorkspaceRequest struct { TTLMillis *int64 `json:"ttl_ms,omitempty"` // ParameterValues allows for additional parameters to be provided // during the initial provision. - ParameterValues []CreateParameterRequest `json:"parameter_values,omitempty"` + ParameterValues []DeprecatedCreateParameterRequest `json:"parameter_values,omitempty"` } func (c *Client) Organization(ctx context.Context, id uuid.UUID) (Organization, error) { diff --git a/codersdk/parameters.go b/codersdk/parameters.go index 3043931bc39d5..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,28 +92,28 @@ 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) DeprecatedCreateParameter(ctx context.Context, scope ParameterScope, id uuid.UUID, req CreateParameterRequest) (Parameter, error) { +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) DeprecatedDeleteParameter(ctx context.Context, scope ParameterScope, id uuid.UUID, name string) error { +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,7 +128,7 @@ func (c *Client) DeprecatedDeleteParameter(ctx context.Context, scope ParameterS return nil } -func (c *Client) DeprecatedParameters(ctx context.Context, scope ParameterScope, id uuid.UUID) ([]Parameter, error) { +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) DeprecatedParameters(ctx context.Context, scope ParameterScope, 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 9db8340164a7b..0a75e657a5599 100644 --- a/codersdk/templateversions.go +++ b/codersdk/templateversions.go @@ -53,7 +53,7 @@ func (c *Client) CancelTemplateVersion(ctx context.Context, version uuid.UUID) e } // DeprecatedTemplateVersionSchema returns schemas for a template version by ID. -func (c *Client) DeprecatedTemplateVersionSchema(ctx context.Context, version uuid.UUID) ([]ParameterSchema, error) { +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 @@ -62,12 +62,12 @@ func (c *Client) DeprecatedTemplateVersionSchema(ctx context.Context, version uu if res.StatusCode != http.StatusOK { return nil, readBodyAsError(res) } - var params []ParameterSchema + 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) ([]ComputedParameter, error) { +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 @@ -76,7 +76,7 @@ func (c *Client) DeprecatedTemplateVersionParameters(ctx context.Context, versio if res.StatusCode != http.StatusOK { return nil, readBodyAsError(res) } - var params []ComputedParameter + var params []DeprecatedComputedParameter return params, json.NewDecoder(res.Body).Decode(¶ms) } @@ -108,7 +108,7 @@ func (c *Client) TemplateVersionLogsAfter(ctx context.Context, version uuid.UUID // CreateTemplateVersionDryRun. type CreateTemplateVersionDryRunRequest struct { WorkspaceName string - ParameterValues []CreateParameterRequest + ParameterValues []DeprecatedCreateParameterRequest } // CreateTemplateVersionDryRun begins a dry-run provisioner job against the diff --git a/codersdk/workspaces.go b/codersdk/workspaces.go index a9a2c68e9c5c7..8956a68fa8164 100644 --- a/codersdk/workspaces.go +++ b/codersdk/workspaces.go @@ -42,7 +42,7 @@ type CreateWorkspaceBuildRequest struct { // ParameterValues 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"` + ParameterValues []DeprecatedCreateParameterRequest `json:"parameter_values,omitempty"` } type WorkspaceOptions struct { From a414314691c5bccbd73bbda4f55887a7cc4d7a39 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Fri, 30 Sep 2022 18:59:28 +0000 Subject: [PATCH 07/14] Add new template parameter endpoint --- coderd/coderd.go | 1 + coderd/coderdtest/authorize.go | 4 + coderd/database/databasefake/databasefake.go | 37 + coderd/database/dump.sql | 8 +- .../migrations/000055_parameters.up.sql | 8 +- coderd/database/models.go | 6 +- coderd/database/querier.go | 2 + coderd/database/queries.sql.go | 1513 +++++++++-------- ...mas.sql => deprecatedparameterschemas.sql} | 0 ...lues.sql => deprecatedparametervalues.sql} | 0 .../database/queries/templateparameters.sql | 32 + .../database/queries/workspaceparameters.sql | 0 coderd/provisionerdaemons.go | 37 + coderd/templateversions.go | 86 +- coderd/templateversions_test.go | 50 +- codersdk/templateversions.go | 36 + provisioner/echo/serve.go | 3 + provisionerd/proto/provisionerd.pb.go | 173 +- provisionerd/proto/provisionerd.proto | 1 + provisionerd/runner/runner.go | 26 +- site/src/api/typesGenerated.ts | 157 +- 21 files changed, 1307 insertions(+), 873 deletions(-) rename coderd/database/queries/{parameterschemas.sql => deprecatedparameterschemas.sql} (100%) rename coderd/database/queries/{parametervalues.sql => deprecatedparametervalues.sql} (100%) create mode 100644 coderd/database/queries/templateparameters.sql create mode 100644 coderd/database/queries/workspaceparameters.sql diff --git a/coderd/coderd.go b/coderd/coderd.go index 26d6b9472307e..24d3d42ab96f7 100644 --- a/coderd/coderd.go +++ b/coderd/coderd.go @@ -336,6 +336,7 @@ func New(options *Options) *API { r.Get("/", api.templateVersion) r.Patch("/cancel", api.patchCancelTemplateVersion) + r.Get("/parameters", api.templateVersionParameters) r.Get("/deprecated-schema", api.deprecatedTemplateVersionSchema) r.Get("/deprecated-parameters", api.deprecatedTemplateVersionParameters) r.Get("/resources", api.templateVersionResources) diff --git a/coderd/coderdtest/authorize.go b/coderd/coderdtest/authorize.go index 11f0043be77e0..a0bab80bcb328 100644 --- a/coderd/coderdtest/authorize.go +++ b/coderd/coderdtest/authorize.go @@ -179,6 +179,10 @@ 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}/parameters": { + 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), diff --git a/coderd/database/databasefake/databasefake.go b/coderd/database/databasefake/databasefake.go index 839633f7f815e..30cd3a00e8e25 100644 --- a/coderd/database/databasefake/databasefake.go +++ b/coderd/database/databasefake/databasefake.go @@ -41,6 +41,7 @@ func New() database.Store { provisionerJobResourceMetadata: 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), workspaceApps: make([]database.WorkspaceApp, 0), @@ -93,6 +94,7 @@ type data struct { provisionerJobResourceMetadata []database.WorkspaceResourceMetadatum provisionerJobs []database.ProvisionerJob templateVersions []database.TemplateVersion + templateVersionParameters []database.TemplateVersionParameter templates []database.Template workspaceBuilds []database.WorkspaceBuild workspaceApps []database.WorkspaceApp @@ -1136,6 +1138,20 @@ func (q *fakeQuerier) GetTemplateVersionByTemplateIDAndName(_ context.Context, a return database.TemplateVersion{}, sql.ErrNoRows } +func (q *fakeQuerier) GetTemplateVersionParameters(ctx 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) GetTemplateVersionByID(_ context.Context, templateVersionID uuid.UUID) (database.TemplateVersion, error) { q.mutex.RLock() defer q.mutex.RUnlock() @@ -1733,6 +1749,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() diff --git a/coderd/database/dump.sql b/coderd/database/dump.sql index 7cd3bcabf1430..4a0626274b61d 100644 --- a/coderd/database/dump.sql +++ b/coderd/database/dump.sql @@ -278,9 +278,9 @@ CREATE TABLE template_version_parameters ( default_value text NOT NULL, icon text NOT NULL, options jsonb DEFAULT '[]'::jsonb NOT NULL, - validation_regex text, - validation_min integer, - validation_max integer + validation_regex text NOT NULL, + validation_min integer NOT NULL, + validation_max integer NOT NULL ); CREATE TABLE template_versions ( @@ -586,7 +586,7 @@ 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; + ADD CONSTRAINT template_version_parameters_template_version_id_fkey FOREIGN KEY (template_version_id) REFERENCES provisioner_jobs(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; diff --git a/coderd/database/migrations/000055_parameters.up.sql b/coderd/database/migrations/000055_parameters.up.sql index 9bbe2343380ba..45f5633d7f342 100644 --- a/coderd/database/migrations/000055_parameters.up.sql +++ b/coderd/database/migrations/000055_parameters.up.sql @@ -1,5 +1,5 @@ CREATE TABLE template_version_parameters ( - template_version_id uuid not null references template_versions (id) on delete cascade, + template_version_id uuid not null references provisioner_jobs (id) on delete cascade, name text not null, description text not null, type text not null, @@ -7,9 +7,9 @@ CREATE TABLE template_version_parameters ( default_value text not null, icon text not null, options jsonb not null default '[]'::jsonb, - validation_regex text, - validation_min integer, - validation_max integer, + validation_regex text not null, + validation_min integer not null, + validation_max integer not null, unique (template_version_id, name) ); diff --git a/coderd/database/models.go b/coderd/database/models.go index 48a865a6257f2..59a8c3d159edd 100644 --- a/coderd/database/models.go +++ b/coderd/database/models.go @@ -546,9 +546,9 @@ type TemplateVersionParameter struct { DefaultValue string `db:"default_value" json:"default_value"` Icon string `db:"icon" json:"icon"` Options json.RawMessage `db:"options" json:"options"` - ValidationRegex sql.NullString `db:"validation_regex" json:"validation_regex"` - ValidationMin sql.NullInt32 `db:"validation_min" json:"validation_min"` - ValidationMax sql.NullInt32 `db:"validation_max" json:"validation_max"` + 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 { diff --git a/coderd/database/querier.go b/coderd/database/querier.go index 110c5d4410efe..c9741fcc58381 100644 --- a/coderd/database/querier.go +++ b/coderd/database/querier.go @@ -64,6 +64,7 @@ type querier interface { GetTemplateVersionByID(ctx context.Context, id uuid.UUID) (TemplateVersion, error) GetTemplateVersionByJobID(ctx context.Context, jobID uuid.UUID) (TemplateVersion, error) GetTemplateVersionByTemplateIDAndName(ctx context.Context, arg GetTemplateVersionByTemplateIDAndNameParams) (TemplateVersion, error) + GetTemplateVersionParameters(ctx context.Context, templateVersionID uuid.UUID) ([]TemplateVersionParameter, error) GetTemplateVersionsByTemplateID(ctx context.Context, arg GetTemplateVersionsByTemplateIDParams) ([]TemplateVersion, error) GetTemplateVersionsCreatedAfter(ctx context.Context, createdAt time.Time) ([]TemplateVersion, error) GetTemplates(ctx context.Context) ([]Template, error) @@ -117,6 +118,7 @@ type querier interface { InsertProvisionerJobLogs(ctx context.Context, arg InsertProvisionerJobLogsParams) ([]ProvisionerJobLog, 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) diff --git a/coderd/database/queries.sql.go b/coderd/database/queries.sql.go index 669a9d2e07d84..ee2298cf63d4c 100644 --- a/coderd/database/queries.sql.go +++ b/coderd/database/queries.sql.go @@ -608,199 +608,44 @@ func (q *sqlQuerier) InsertAuditLog(ctx context.Context, arg InsertAuditLogParam return i, err } -const getFileByHash = `-- name: GetFileByHash :one -SELECT - hash, created_at, created_by, mimetype, data -FROM - files -WHERE - hash = $1 -LIMIT - 1 -` - -func (q *sqlQuerier) GetFileByHash(ctx context.Context, hash string) (File, error) { - row := q.db.QueryRowContext(ctx, getFileByHash, hash) - var i File - err := row.Scan( - &i.Hash, - &i.CreatedAt, - &i.CreatedBy, - &i.Mimetype, - &i.Data, - ) - return i, err -} - -const insertFile = `-- name: InsertFile :one -INSERT INTO - files (hash, created_at, created_by, mimetype, "data") -VALUES - ($1, $2, $3, $4, $5) RETURNING hash, created_at, created_by, mimetype, data -` - -type InsertFileParams struct { - Hash string `db:"hash" json:"hash"` - CreatedAt time.Time `db:"created_at" json:"created_at"` - CreatedBy uuid.UUID `db:"created_by" json:"created_by"` - Mimetype string `db:"mimetype" json:"mimetype"` - Data []byte `db:"data" json:"data"` -} - -func (q *sqlQuerier) InsertFile(ctx context.Context, arg InsertFileParams) (File, error) { - row := q.db.QueryRowContext(ctx, insertFile, - arg.Hash, - arg.CreatedAt, - arg.CreatedBy, - arg.Mimetype, - arg.Data, - ) - var i File - err := row.Scan( - &i.Hash, - &i.CreatedAt, - &i.CreatedBy, - &i.Mimetype, - &i.Data, - ) - return i, err -} - -const deleteGitSSHKey = `-- name: DeleteGitSSHKey :exec -DELETE FROM - gitsshkeys -WHERE - user_id = $1 -` - -func (q *sqlQuerier) DeleteGitSSHKey(ctx context.Context, userID uuid.UUID) error { - _, err := q.db.ExecContext(ctx, deleteGitSSHKey, userID) - return err -} - -const getGitSSHKey = `-- name: GetGitSSHKey :one +const getParameterSchemasByJobID = `-- name: GetParameterSchemasByJobID :many SELECT - user_id, created_at, updated_at, private_key, public_key + 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 - gitsshkeys -WHERE - user_id = $1 -` - -func (q *sqlQuerier) GetGitSSHKey(ctx context.Context, userID uuid.UUID) (GitSSHKey, error) { - row := q.db.QueryRowContext(ctx, getGitSSHKey, userID) - var i GitSSHKey - err := row.Scan( - &i.UserID, - &i.CreatedAt, - &i.UpdatedAt, - &i.PrivateKey, - &i.PublicKey, - ) - return i, err -} - -const insertGitSSHKey = `-- name: InsertGitSSHKey :one -INSERT INTO - gitsshkeys ( - user_id, - created_at, - updated_at, - private_key, - public_key - ) -VALUES - ($1, $2, $3, $4, $5) RETURNING user_id, created_at, updated_at, private_key, public_key -` - -type InsertGitSSHKeyParams struct { - 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"` - PrivateKey string `db:"private_key" json:"private_key"` - PublicKey string `db:"public_key" json:"public_key"` -} - -func (q *sqlQuerier) InsertGitSSHKey(ctx context.Context, arg InsertGitSSHKeyParams) (GitSSHKey, error) { - row := q.db.QueryRowContext(ctx, insertGitSSHKey, - arg.UserID, - arg.CreatedAt, - arg.UpdatedAt, - arg.PrivateKey, - arg.PublicKey, - ) - var i GitSSHKey - err := row.Scan( - &i.UserID, - &i.CreatedAt, - &i.UpdatedAt, - &i.PrivateKey, - &i.PublicKey, - ) - return i, err -} - -const updateGitSSHKey = `-- name: UpdateGitSSHKey :exec -UPDATE - gitsshkeys -SET - updated_at = $2, - private_key = $3, - public_key = $4 + parameter_schemas WHERE - user_id = $1 -` - -type UpdateGitSSHKeyParams struct { - UserID uuid.UUID `db:"user_id" json:"user_id"` - UpdatedAt time.Time `db:"updated_at" json:"updated_at"` - PrivateKey string `db:"private_key" json:"private_key"` - PublicKey string `db:"public_key" json:"public_key"` -} - -func (q *sqlQuerier) UpdateGitSSHKey(ctx context.Context, arg UpdateGitSSHKeyParams) error { - _, err := q.db.ExecContext(ctx, updateGitSSHKey, - arg.UserID, - arg.UpdatedAt, - arg.PrivateKey, - arg.PublicKey, - ) - return 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 -FROM licenses -ORDER BY (id) + job_id = $1 +ORDER BY + index ` -func (q *sqlQuerier) GetLicenses(ctx context.Context) ([]License, error) { - rows, err := q.db.QueryContext(ctx, getLicenses) +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 []License + var items []ParameterSchema for rows.Next() { - var i License + var i ParameterSchema if err := rows.Scan( &i.ID, - &i.UploadedAt, - &i.JWT, - &i.Exp, + &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 } @@ -815,27 +660,37 @@ func (q *sqlQuerier) GetLicenses(ctx context.Context) ([]License, error) { return items, nil } -const getUnexpiredLicenses = `-- name: GetUnexpiredLicenses :many -SELECT id, uploaded_at, jwt, exp -FROM licenses -WHERE exp > NOW() -ORDER BY (id) +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) GetUnexpiredLicenses(ctx context.Context) ([]License, error) { - rows, err := q.db.QueryContext(ctx, getUnexpiredLicenses) +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 []License + var items []ParameterSchema for rows.Next() { - var i License + var i ParameterSchema if err := rows.Scan( &i.ID, - &i.UploadedAt, - &i.JWT, - &i.Exp, + &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 } @@ -850,128 +705,299 @@ func (q *sqlQuerier) GetUnexpiredLicenses(ctx context.Context) ([]License, error return items, nil } -const insertLicense = `-- name: InsertLicense :one +const insertParameterSchema = `-- name: InsertParameterSchema :one INSERT INTO - licenses ( - uploaded_at, - jwt, - exp -) -VALUES - ($1, $2, $3) RETURNING id, uploaded_at, jwt, exp -` - -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"` + 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) InsertLicense(ctx context.Context, arg InsertLicenseParams) (License, error) { - row := q.db.QueryRowContext(ctx, insertLicense, arg.UploadedAt, arg.JWT, arg.Exp) - var i License +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.UploadedAt, - &i.JWT, - &i.Exp, + &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 getOrganizationIDsByMemberIDs = `-- name: GetOrganizationIDsByMemberIDs :many -SELECT - user_id, array_agg(organization_id) :: uuid [ ] AS "organization_IDs" -FROM - organization_members +const deleteParameterValueByID = `-- name: DeleteParameterValueByID :exec +DELETE FROM + parameter_values WHERE - user_id = ANY($1 :: uuid [ ]) -GROUP BY - user_id + 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)) - if err != nil { - return nil, err - } - defer rows.Close() - var items []GetOrganizationIDsByMemberIDsRow - for rows.Next() { - var i GetOrganizationIDsByMemberIDsRow - if err := rows.Scan(&i.UserID, pq.Array(&i.OrganizationIDs)); 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) DeleteParameterValueByID(ctx context.Context, id uuid.UUID) error { + _, err := q.db.ExecContext(ctx, deleteParameterValueByID, id) + return err } -const getOrganizationMemberByUserID = `-- name: GetOrganizationMemberByUserID :one +const getParameterValueByScopeAndName = `-- name: GetParameterValueByScopeAndName :one SELECT - user_id, organization_id, created_at, updated_at, roles + id, created_at, updated_at, scope, scope_id, name, source_scheme, source_value, destination_scheme FROM - organization_members + parameter_values WHERE - organization_id = $1 - AND user_id = $2 + scope = $1 + AND scope_id = $2 + AND NAME = $3 LIMIT 1 ` -type GetOrganizationMemberByUserIDParams struct { - OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` - UserID uuid.UUID `db:"user_id" json:"user_id"` +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) GetOrganizationMemberByUserID(ctx context.Context, arg GetOrganizationMemberByUserIDParams) (OrganizationMember, error) { - row := q.db.QueryRowContext(ctx, getOrganizationMemberByUserID, arg.OrganizationID, arg.UserID) - var i OrganizationMember +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.UserID, - &i.OrganizationID, + &i.ID, &i.CreatedAt, &i.UpdatedAt, - pq.Array(&i.Roles), + &i.Scope, + &i.ScopeID, + &i.Name, + &i.SourceScheme, + &i.SourceValue, + &i.DestinationScheme, ) return i, err } -const getOrganizationMembershipsByUserID = `-- name: GetOrganizationMembershipsByUserID :many +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 - user_id, organization_id, created_at, updated_at, roles + id, created_at, updated_at, scope, scope_id, name, source_scheme, source_value, destination_scheme FROM - organization_members + parameter_values WHERE - user_id = $1 + 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 ` -func (q *sqlQuerier) GetOrganizationMembershipsByUserID(ctx context.Context, userID uuid.UUID) ([]OrganizationMember, error) { - rows, err := q.db.QueryContext(ctx, getOrganizationMembershipsByUserID, userID) +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 []OrganizationMember + var items []ParameterValue for rows.Next() { - var i OrganizationMember + var i ParameterValue if err := rows.Scan( - &i.UserID, - &i.OrganizationID, + &i.ID, &i.CreatedAt, &i.UpdatedAt, - pq.Array(&i.Roles), + &i.Scope, + &i.ScopeID, + &i.Name, + &i.SourceScheme, + &i.SourceValue, + &i.DestinationScheme, ); err != nil { return nil, err } @@ -986,145 +1012,199 @@ func (q *sqlQuerier) GetOrganizationMembershipsByUserID(ctx context.Context, use return items, nil } -const insertOrganizationMember = `-- name: InsertOrganizationMember :one +const getFileByHash = `-- name: GetFileByHash :one +SELECT + hash, created_at, created_by, mimetype, data +FROM + files +WHERE + hash = $1 +LIMIT + 1 +` + +func (q *sqlQuerier) GetFileByHash(ctx context.Context, hash string) (File, error) { + row := q.db.QueryRowContext(ctx, getFileByHash, hash) + var i File + err := row.Scan( + &i.Hash, + &i.CreatedAt, + &i.CreatedBy, + &i.Mimetype, + &i.Data, + ) + return i, err +} + +const insertFile = `-- name: InsertFile :one INSERT INTO - organization_members ( - organization_id, + files (hash, created_at, created_by, mimetype, "data") +VALUES + ($1, $2, $3, $4, $5) RETURNING hash, created_at, created_by, mimetype, data +` + +type InsertFileParams struct { + Hash string `db:"hash" json:"hash"` + CreatedAt time.Time `db:"created_at" json:"created_at"` + CreatedBy uuid.UUID `db:"created_by" json:"created_by"` + Mimetype string `db:"mimetype" json:"mimetype"` + Data []byte `db:"data" json:"data"` +} + +func (q *sqlQuerier) InsertFile(ctx context.Context, arg InsertFileParams) (File, error) { + row := q.db.QueryRowContext(ctx, insertFile, + arg.Hash, + arg.CreatedAt, + arg.CreatedBy, + arg.Mimetype, + arg.Data, + ) + var i File + err := row.Scan( + &i.Hash, + &i.CreatedAt, + &i.CreatedBy, + &i.Mimetype, + &i.Data, + ) + return i, err +} + +const deleteGitSSHKey = `-- name: DeleteGitSSHKey :exec +DELETE FROM + gitsshkeys +WHERE + user_id = $1 +` + +func (q *sqlQuerier) DeleteGitSSHKey(ctx context.Context, userID uuid.UUID) error { + _, err := q.db.ExecContext(ctx, deleteGitSSHKey, userID) + return err +} + +const getGitSSHKey = `-- name: GetGitSSHKey :one +SELECT + user_id, created_at, updated_at, private_key, public_key +FROM + gitsshkeys +WHERE + user_id = $1 +` + +func (q *sqlQuerier) GetGitSSHKey(ctx context.Context, userID uuid.UUID) (GitSSHKey, error) { + row := q.db.QueryRowContext(ctx, getGitSSHKey, userID) + var i GitSSHKey + err := row.Scan( + &i.UserID, + &i.CreatedAt, + &i.UpdatedAt, + &i.PrivateKey, + &i.PublicKey, + ) + return i, err +} + +const insertGitSSHKey = `-- name: InsertGitSSHKey :one +INSERT INTO + gitsshkeys ( user_id, created_at, updated_at, - roles + private_key, + public_key ) VALUES - ($1, $2, $3, $4, $5) RETURNING user_id, organization_id, created_at, updated_at, roles + ($1, $2, $3, $4, $5) RETURNING user_id, created_at, updated_at, private_key, public_key ` -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"` +type InsertGitSSHKeyParams struct { + 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"` + PrivateKey string `db:"private_key" json:"private_key"` + PublicKey string `db:"public_key" json:"public_key"` } -func (q *sqlQuerier) InsertOrganizationMember(ctx context.Context, arg InsertOrganizationMemberParams) (OrganizationMember, error) { - row := q.db.QueryRowContext(ctx, insertOrganizationMember, - arg.OrganizationID, +func (q *sqlQuerier) InsertGitSSHKey(ctx context.Context, arg InsertGitSSHKeyParams) (GitSSHKey, error) { + row := q.db.QueryRowContext(ctx, insertGitSSHKey, arg.UserID, arg.CreatedAt, arg.UpdatedAt, - pq.Array(arg.Roles), + arg.PrivateKey, + arg.PublicKey, ) - var i OrganizationMember + var i GitSSHKey err := row.Scan( &i.UserID, - &i.OrganizationID, &i.CreatedAt, &i.UpdatedAt, - pq.Array(&i.Roles), + &i.PrivateKey, + &i.PublicKey, ) return i, err } -const updateMemberRoles = `-- name: UpdateMemberRoles :one +const updateGitSSHKey = `-- name: UpdateGitSSHKey :exec UPDATE - organization_members + gitsshkeys SET - -- Remove all duplicates from the roles. - roles = ARRAY(SELECT DISTINCT UNNEST($1 :: text[])) + updated_at = $2, + private_key = $3, + public_key = $4 WHERE - user_id = $2 - AND organization_id = $3 -RETURNING user_id, organization_id, created_at, updated_at, roles + user_id = $1 ` -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 UpdateGitSSHKeyParams struct { + UserID uuid.UUID `db:"user_id" json:"user_id"` + UpdatedAt time.Time `db:"updated_at" json:"updated_at"` + PrivateKey string `db:"private_key" json:"private_key"` + PublicKey string `db:"public_key" json:"public_key"` } -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, +func (q *sqlQuerier) UpdateGitSSHKey(ctx context.Context, arg UpdateGitSSHKeyParams) error { + _, err := q.db.ExecContext(ctx, updateGitSSHKey, + arg.UserID, + arg.UpdatedAt, + arg.PrivateKey, + arg.PublicKey, ) - return i, err + return err } -const getOrganizationByName = `-- name: GetOrganizationByName :one -SELECT - id, name, description, created_at, updated_at -FROM - organizations -WHERE - LOWER("name") = LOWER($1) -LIMIT - 1 +const deleteLicense = `-- name: DeleteLicense :one +DELETE +FROM licenses +WHERE id = $1 +RETURNING id ` -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, - ) - return i, err +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 getOrganizations = `-- name: GetOrganizations :many -SELECT - id, name, description, created_at, updated_at -FROM - organizations +const getLicenses = `-- name: GetLicenses :many +SELECT id, uploaded_at, jwt, exp +FROM licenses +ORDER BY (id) ` -func (q *sqlQuerier) GetOrganizations(ctx context.Context) ([]Organization, error) { - rows, err := q.db.QueryContext(ctx, getOrganizations) +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, ); err != nil { return nil, err } @@ -1139,37 +1219,27 @@ 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 +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, ); err != nil { return nil, err } @@ -1184,79 +1254,61 @@ 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 +) VALUES - ($1, $2, $3, $4, $5) RETURNING id, name, description, created_at, updated_at + ($1, $2, $3) RETURNING id, uploaded_at, jwt, exp ` -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"` } -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 +func (q *sqlQuerier) InsertLicense(ctx context.Context, arg InsertLicenseParams) (License, error) { + row := q.db.QueryRowContext(ctx, insertLicense, arg.UploadedAt, arg.JWT, arg.Exp) + var i License err := row.Scan( &i.ID, - &i.Name, - &i.Description, - &i.CreatedAt, - &i.UpdatedAt, + &i.UploadedAt, + &i.JWT, + &i.Exp, ) 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) @@ -1270,37 +1322,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 } @@ -1315,299 +1390,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, - ) - 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, + arg.UpdatedAt, + pq.Array(arg.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 -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 + 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, + pq.Array(&i.Roles), ) 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"` +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 +` + +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) 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 +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, + pq.Array(&i.Roles), ) 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 getOrganizationByID = `-- name: GetOrganizationByID :one +SELECT + id, name, description, created_at, updated_at +FROM + organizations 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 +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 parameterValues = `-- name: ParameterValues :many +const getOrganizationByName = `-- name: GetOrganizationByName :one 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 + organizations 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 + LOWER("name") = LOWER($1) +LIMIT + 1 ` -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) 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, + ) + return i, err } -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 getOrganizations = `-- name: GetOrganizations :many +SELECT + id, name, description, created_at, updated_at +FROM + organizations +` + +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 []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, + ); 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 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 []Organization + for rows.Next() { + var i Organization + if err := rows.Scan( + &i.ID, &i.Name, - &i.SourceScheme, - &i.SourceValue, - &i.DestinationScheme, + &i.Description, + &i.CreatedAt, + &i.UpdatedAt, ); err != nil { return nil, err } @@ -1622,6 +1588,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 @@ -2188,6 +2188,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 getTemplateByID = `-- name: GetTemplateByID :one SELECT id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, max_ttl, min_autostart_interval, created_by, icon 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..e69de29bb2d1d diff --git a/coderd/provisionerdaemons.go b/coderd/provisionerdaemons.go index cf0ff6dfa19db..67dcf0d1f2308 100644 --- a/coderd/provisionerdaemons.go +++ b/coderd/provisionerdaemons.go @@ -130,6 +130,10 @@ type templateVersionDryRunJob struct { ParameterValues []database.ParameterValue `json:"parameter_values"` } +type templateVersionImportJob struct { + TemplateVersionID uuid.UUID `json:"template_version_id"` +} + // Implementation of the provisioner daemon protobuf server. type provisionerdServer struct { AccessURL *url.URL @@ -568,6 +572,12 @@ func (server *provisionerdServer) CompleteJob(ctx context.Context, completed *pr 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, @@ -586,6 +596,33 @@ func (server *provisionerdServer) CompleteJob(ctx context.Context, completed *pr } } + 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(), diff --git a/coderd/templateversions.go b/coderd/templateversions.go index 009d06d5f3fed..144976af32a11 100644 --- a/coderd/templateversions.go +++ b/coderd/templateversions.go @@ -20,6 +20,8 @@ import ( "github.com/coder/coder/coderd/parameter" "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) { @@ -188,6 +190,50 @@ func (api *API) deprecatedTemplateVersionParameters(rw http.ResponseWriter, r *h httpapi.Write(ctx, rw, http.StatusOK, values) } +func (api *API) templateVersionParameters(rw http.ResponseWriter, r *http.Request) { + ctx := r.Context() + templateVersion := httpmw.TemplateVersionParam(r) + if !api.Authorize(r, rbac.ActionRead, templateVersion) { + 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() apiKey := httpmw.APIKey(r) @@ -767,6 +813,13 @@ func (api *API) postTemplateVersionsByOrganization(rw http.ResponseWriter, r *ht } } + templateVersionID := uuid.New() + jobInput, err := json.Marshal(templateVersionImportJob{ + TemplateVersionID: templateVersionID, + }) + if err != nil { + return xerrors.Errorf("marshal job input: %w", err) + } provisionerJob, err = db.InsertProvisionerJob(ctx, database.InsertProvisionerJobParams{ ID: jobID, CreatedAt: database.Now(), @@ -777,7 +830,7 @@ func (api *API) postTemplateVersionsByOrganization(rw http.ResponseWriter, r *ht StorageMethod: database.ProvisionerStorageMethodFile, StorageSource: file.Hash, Type: database.ProvisionerJobTypeTemplateVersionImport, - Input: []byte{'{', '}'}, + Input: jobInput, }) if err != nil { return xerrors.Errorf("insert provisioner job: %w", err) @@ -796,7 +849,7 @@ func (api *API) postTemplateVersionsByOrganization(rw http.ResponseWriter, r *ht } templateVersion, err = db.InsertTemplateVersion(ctx, database.InsertTemplateVersionParams{ - ID: uuid.New(), + ID: templateVersionID, TemplateID: templateID, OrganizationID: organization.ID, CreatedAt: database.Now(), @@ -906,3 +959,32 @@ func convertTemplateVersion(version database.TemplateVersion, job codersdk.Provi CreatedByName: createdByName, } } + +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 +} diff --git a/coderd/templateversions_test.go b/coderd/templateversions_test.go index b0b24db759d54..d3ac10353d648 100644 --- a/coderd/templateversions_test.go +++ b/coderd/templateversions_test.go @@ -76,7 +76,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}) @@ -208,7 +208,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() @@ -283,6 +283,52 @@ func TestTemplateVersionSchema(t *testing.T) { } func TestTemplateVersionParameters(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.TemplateVersionParameters(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: echo.ParseComplete, + ProvisionDryRun: []*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() diff --git a/codersdk/templateversions.go b/codersdk/templateversions.go index 0a75e657a5599..51f4f276ec890 100644 --- a/codersdk/templateversions.go +++ b/codersdk/templateversions.go @@ -25,6 +25,28 @@ type TemplateVersion struct { CreatedByName string `json:"created_by_name"` } +// 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"` + 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) @@ -52,6 +74,20 @@ func (c *Client) CancelTemplateVersion(ctx context.Context, version uuid.UUID) e return 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 + } + defer res.Body.Close() + if res.StatusCode != http.StatusOK { + return nil, readBodyAsError(res) + } + var params []TemplateVersionParameter + return params, json.NewDecoder(res.Body).Decode(¶ms) +} + // 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) diff --git a/provisioner/echo/serve.go b/provisioner/echo/serve.go index d5465b938fdcd..448a9d7ad3597 100644 --- a/provisioner/echo/serve.go +++ b/provisioner/echo/serve.go @@ -185,6 +185,9 @@ func Tar(responses *Responses) ([]byte, error) { if responses.ProvisionDryRun == nil { responses.ProvisionDryRun = responses.Provision } + if responses.Parse == nil { + responses.Parse = ParseComplete + } var buffer bytes.Buffer writer := tar.NewWriter(&buffer) diff --git a/provisionerd/proto/provisionerd.pb.go b/provisionerd/proto/provisionerd.pb.go index 060b6f80f0e9a..6a9274c907e5f 100644 --- a/provisionerd/proto/provisionerd.pb.go +++ b/provisionerd/proto/provisionerd.pb.go @@ -1031,8 +1031,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() { @@ -1081,6 +1082,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 @@ -1220,8 +1228,8 @@ var file_provisionerd_proto_provisionerd_proto_rawDesc = []byte{ 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, + 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, @@ -1245,7 +1253,7 @@ var file_provisionerd_proto_provisionerd_proto_rawDesc = []byte{ 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, + 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, @@ -1254,67 +1262,70 @@ var file_provisionerd_proto_provisionerd_proto_rawDesc = []byte{ 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, 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, 0xbd, 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, 0x53, 0x0a, 0x11, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 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, - 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, 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, 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, 0x98, 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, 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, + 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, 0xbd, 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, 0x53, 0x0a, 0x11, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 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, 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, 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, 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, 0x98, 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, 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 ( @@ -1354,6 +1365,7 @@ var file_provisionerd_proto_provisionerd_proto_goTypes = []interface{}{ (*proto.ParameterValue)(nil), // 19: provisioner.ParameterValue (*proto.Provision_Metadata)(nil), // 20: provisioner.Provision.Metadata (*proto.Resource)(nil), // 21: provisioner.Resource + (*proto.Parameter)(nil), // 22: provisioner.Parameter } var file_provisionerd_proto_provisionerd_proto_depIdxs = []int32{ 8, // 0: provisionerd.AcquiredJob.workspace_build:type_name -> provisionerd.AcquiredJob.WorkspaceBuild @@ -1378,20 +1390,21 @@ var file_provisionerd_proto_provisionerd_proto_depIdxs = []int32{ 21, // 19: provisionerd.CompletedJob.WorkspaceBuild.resources:type_name -> provisioner.Resource 21, // 20: provisionerd.CompletedJob.TemplateImport.start_resources:type_name -> provisioner.Resource 21, // 21: provisionerd.CompletedJob.TemplateImport.stop_resources:type_name -> provisioner.Resource - 21, // 22: provisionerd.CompletedJob.TemplateDryRun.resources:type_name -> provisioner.Resource - 1, // 23: provisionerd.ProvisionerDaemon.AcquireJob:input_type -> provisionerd.Empty - 6, // 24: provisionerd.ProvisionerDaemon.UpdateJob:input_type -> provisionerd.UpdateJobRequest - 3, // 25: provisionerd.ProvisionerDaemon.FailJob:input_type -> provisionerd.FailedJob - 4, // 26: provisionerd.ProvisionerDaemon.CompleteJob:input_type -> provisionerd.CompletedJob - 2, // 27: provisionerd.ProvisionerDaemon.AcquireJob:output_type -> provisionerd.AcquiredJob - 7, // 28: provisionerd.ProvisionerDaemon.UpdateJob:output_type -> provisionerd.UpdateJobResponse - 1, // 29: provisionerd.ProvisionerDaemon.FailJob:output_type -> provisionerd.Empty - 1, // 30: provisionerd.ProvisionerDaemon.CompleteJob:output_type -> provisionerd.Empty - 27, // [27:31] is the sub-list for method output_type - 23, // [23:27] 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 + 22, // 22: provisionerd.CompletedJob.TemplateImport.parameters:type_name -> provisioner.Parameter + 21, // 23: provisionerd.CompletedJob.TemplateDryRun.resources:type_name -> provisioner.Resource + 1, // 24: provisionerd.ProvisionerDaemon.AcquireJob:input_type -> provisionerd.Empty + 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 + 7, // 29: provisionerd.ProvisionerDaemon.UpdateJob:output_type -> provisionerd.UpdateJobResponse + 1, // 30: provisionerd.ProvisionerDaemon.FailJob:output_type -> provisionerd.Empty + 1, // 31: provisionerd.ProvisionerDaemon.CompleteJob:output_type -> provisionerd.Empty + 28, // [28:32] is the sub-list for method output_type + 24, // [24:28] is the sub-list for method input_type + 24, // [24:24] is the sub-list for extension type_name + 24, // [24:24] is the sub-list for extension extendee + 0, // [0:24] 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 8a1974f1ce97f..7c2e841fd69f4 100644 --- a/provisionerd/proto/provisionerd.proto +++ b/provisionerd/proto/provisionerd.proto @@ -63,6 +63,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; diff --git a/provisionerd/runner/runner.go b/provisionerd/runner/runner.go index 7c7e1cf7d902d..74577e1725f0f 100644 --- a/provisionerd/runner/runner.go +++ b/provisionerd/runner/runner.go @@ -145,7 +145,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") @@ -551,7 +551,7 @@ func (r *Runner) runTemplateImport(ctx context.Context) (*proto.CompletedJob, *p if err != nil { return nil, r.failedJobf("write log: %s", err) } - startResources, err := r.runTemplateImportProvision(ctx, updateResponse.ParameterValues, &sdkproto.Provision_Metadata{ + startResources, parameters, err := r.runTemplateImportProvision(ctx, updateResponse.ParameterValues, &sdkproto.Provision_Metadata{ CoderUrl: r.job.GetTemplateImport().Metadata.CoderUrl, WorkspaceTransition: sdkproto.WorkspaceTransition_START, }) @@ -572,7 +572,7 @@ func (r *Runner) runTemplateImport(ctx context.Context) (*proto.CompletedJob, *p if err != nil { return nil, r.failedJobf("write log: %s", err) } - stopResources, err := r.runTemplateImportProvision(ctx, updateResponse.ParameterValues, &sdkproto.Provision_Metadata{ + stopResources, _, err := r.runTemplateImportProvision(ctx, updateResponse.ParameterValues, &sdkproto.Provision_Metadata{ CoderUrl: r.job.GetTemplateImport().Metadata.CoderUrl, WorkspaceTransition: sdkproto.WorkspaceTransition_STOP, }) @@ -586,6 +586,7 @@ func (r *Runner) runTemplateImport(ctx context.Context) (*proto.CompletedJob, *p TemplateImport: &proto.CompletedJob_TemplateImport{ StartResources: startResources, StopResources: stopResources, + Parameters: parameters, }, }, }, nil @@ -643,7 +644,7 @@ func (r *Runner) runTemplateImportParse(ctx context.Context) ([]*sdkproto.Deprec // 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() @@ -658,7 +659,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() { @@ -684,13 +685,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: @@ -709,7 +710,7 @@ func (r *Runner) runTemplateImportProvision(ctx context.Context, values []*sdkpr }}, }) if err != nil { - return nil, xerrors.Errorf("send job update: %w", err) + return nil, nil, xerrors.Errorf("send job update: %w", err) } case *sdkproto.Provision_Response_Complete: if msgType.Complete.Error != "" { @@ -717,7 +718,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", @@ -726,10 +727,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) } } } @@ -767,7 +767,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/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index fdacbc6dacadf..8dc24745cd47a 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -131,13 +131,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 @@ -157,22 +150,13 @@ 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 readonly description?: string readonly icon?: string readonly template_version_id: string - readonly parameter_values?: CreateParameterRequest[] + readonly parameter_values?: DeprecatedCreateParameterRequest[] readonly max_ttl_ms?: number readonly min_autostart_interval_ms?: number } @@ -180,7 +164,7 @@ export interface CreateTemplateRequest { // From codersdk/templateversions.go export interface CreateTemplateVersionDryRunRequest { readonly WorkspaceName: string - readonly ParameterValues: CreateParameterRequest[] + readonly ParameterValues: DeprecatedCreateParameterRequest[] } // From codersdk/organizations.go @@ -190,7 +174,7 @@ export interface CreateTemplateVersionRequest { readonly storage_method: ProvisionerStorageMethod readonly storage_source: string readonly provisioner: ProvisionerType - readonly parameter_values?: CreateParameterRequest[] + readonly parameter_values?: DeprecatedCreateParameterRequest[] } // From codersdk/audit.go @@ -215,7 +199,7 @@ export interface CreateWorkspaceBuildRequest { readonly dry_run?: boolean readonly state?: string readonly orphan?: boolean - readonly parameter_values?: CreateParameterRequest[] + readonly parameter_values?: DeprecatedCreateParameterRequest[] } // From codersdk/organizations.go @@ -224,7 +208,7 @@ export interface CreateWorkspaceRequest { readonly name: string readonly autostart_schedule?: string readonly ttl_ms?: number - readonly parameter_values?: CreateParameterRequest[] + readonly parameter_values?: DeprecatedCreateParameterRequest[] } // From codersdk/templates.go @@ -239,6 +223,55 @@ export interface DERPRegion { readonly latency_ms: number } +// 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 @@ -322,39 +355,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/provisionerdaemons.go export interface ProvisionerDaemon { readonly id: string @@ -449,6 +449,28 @@ export interface TemplateVersion { readonly created_by_name: string } +// 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_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 @@ -668,6 +690,21 @@ export type AuditAction = "create" | "delete" | "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" @@ -680,18 +717,6 @@ export type LogSource = "provisioner" | "provisioner_daemon" // From codersdk/users.go export type LoginType = "github" | "oidc" | "password" -// 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" From bc6c7883551012585e74b733f8b4145448072fb0 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Fri, 30 Sep 2022 23:03:34 +0000 Subject: [PATCH 08/14] Begin to integrate parameter validation --- cli/create.go | 10 ++-- cli/update.go | 6 +-- coderd/database/databasefake/databasefake.go | 30 +++++++++++ coderd/database/querier.go | 2 + coderd/database/queries.sql.go | 53 +++++++++++++++++++ .../database/queries/workspaceparameters.sql | 16 ++++++ coderd/workspacebuilds.go | 38 ++++++++++++- coderd/workspaces.go | 2 +- codersdk/organizations.go | 4 +- codersdk/workspacebuilds.go | 6 +++ codersdk/workspaces.go | 10 +++- site/src/api/typesGenerated.ts | 7 +++ 12 files changed, 170 insertions(+), 14 deletions(-) diff --git a/cli/create.go b/cli/create.go index 0856caa2c2bcf..dd938aba322fd 100644 --- a/cli/create.go +++ b/cli/create.go @@ -141,11 +141,11 @@ func create() *cobra.Command { after := time.Now() 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 diff --git a/cli/update.go b/cli/update.go index 389ac53a25f8c..00d8853274bc2 100644 --- a/cli/update.go +++ b/cli/update.go @@ -59,9 +59,9 @@ func update() *cobra.Command { before := time.Now() 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/database/databasefake/databasefake.go b/coderd/database/databasefake/databasefake.go index 30cd3a00e8e25..d74434492db41 100644 --- a/coderd/database/databasefake/databasefake.go +++ b/coderd/database/databasefake/databasefake.go @@ -44,6 +44,7 @@ func New() database.Store { 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), @@ -97,6 +98,7 @@ type data struct { templateVersionParameters []database.TemplateVersionParameter templates []database.Template workspaceBuilds []database.WorkspaceBuild + workspaceBuildParameters []database.WorkspaceBuildParameter workspaceApps []database.WorkspaceApp workspaces []database.Workspace licenses []database.License @@ -855,6 +857,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() @@ -2066,6 +2082,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/querier.go b/coderd/database/querier.go index c9741fcc58381..15c2a88d0a5ea 100644 --- a/coderd/database/querier.go +++ b/coderd/database/querier.go @@ -90,6 +90,7 @@ type querier interface { GetWorkspaceBuildByJobID(ctx context.Context, jobID uuid.UUID) (WorkspaceBuild, error) GetWorkspaceBuildByWorkspaceID(ctx context.Context, arg GetWorkspaceBuildByWorkspaceIDParams) ([]WorkspaceBuild, error) GetWorkspaceBuildByWorkspaceIDAndBuildNumber(ctx context.Context, arg GetWorkspaceBuildByWorkspaceIDAndBuildNumberParams) (WorkspaceBuild, error) + GetWorkspaceBuildParameters(ctx context.Context, workspaceBuildID uuid.UUID) ([]WorkspaceBuildParameter, error) GetWorkspaceBuildsCreatedAfter(ctx context.Context, createdAt time.Time) ([]WorkspaceBuild, error) GetWorkspaceByID(ctx context.Context, id uuid.UUID) (Workspace, error) GetWorkspaceByOwnerIDAndName(ctx context.Context, arg GetWorkspaceByOwnerIDAndNameParams) (Workspace, error) @@ -125,6 +126,7 @@ type querier interface { 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 ee2298cf63d4c..11fd612370085 100644 --- a/coderd/database/queries.sql.go +++ b/coderd/database/queries.sql.go @@ -4694,6 +4694,59 @@ func (q *sqlQuerier) UpdateWorkspaceBuildByID(ctx context.Context, arg UpdateWor return 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, + unnset($2 :: text[]) AS name, + unnset($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 diff --git a/coderd/database/queries/workspaceparameters.sql b/coderd/database/queries/workspaceparameters.sql index e69de29bb2d1d..bdfe905c39542 100644 --- a/coderd/database/queries/workspaceparameters.sql +++ 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, + unnset(@name :: text[]) AS name, + unnset(@value :: text[]) AS value +RETURNING *; + +-- name: GetWorkspaceBuildParameters :many +SELECT + * +FROM + workspace_build_parameters +WHERE + workspace_build_id = $1; diff --git a/coderd/workspacebuilds.go b/coderd/workspacebuilds.go index 362fb388c0b57..522b7b3d6ae43 100644 --- a/coderd/workspacebuilds.go +++ b/coderd/workspacebuilds.go @@ -300,6 +300,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. @@ -312,6 +313,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 { @@ -382,6 +386,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 @@ -398,7 +419,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 { @@ -426,6 +447,21 @@ func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) { } workspaceBuildID := uuid.New() + 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) + } + input, err := json.Marshal(workspaceProvisionJob{ WorkspaceBuildID: workspaceBuildID, }) diff --git a/coderd/workspaces.go b/coderd/workspaces.go index 3d08d222990aa..9ac0c99636fef 100644 --- a/coderd/workspaces.go +++ b/coderd/workspaces.go @@ -372,7 +372,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 == "" { diff --git a/codersdk/organizations.go b/codersdk/organizations.go index f8fad9456af2b..c89d34046236a 100644 --- a/codersdk/organizations.go +++ b/codersdk/organizations.go @@ -82,9 +82,9 @@ 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 []DeprecatedCreateParameterRequest `json:"parameter_values,omitempty"` + DeprecatedParameterValues []DeprecatedCreateParameterRequest `json:"parameter_values,omitempty"` } func (c *Client) Organization(ctx context.Context, id uuid.UUID) (Organization, error) { diff --git a/codersdk/workspacebuilds.go b/codersdk/workspacebuilds.go index cc8cdbf082f74..58e214d232655 100644 --- a/codersdk/workspacebuilds.go +++ b/codersdk/workspacebuilds.go @@ -54,6 +54,12 @@ type WorkspaceBuild struct { Deadline NullTime `json:"deadline,omitempty"` } +// 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 8956a68fa8164..8b741d17c45bb 100644 --- a/codersdk/workspaces.go +++ b/codersdk/workspaces.go @@ -37,12 +37,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 []DeprecatedCreateParameterRequest `json:"parameter_values,omitempty"` + DeprecatedParameterValues []DeprecatedCreateParameterRequest `json:"parameter_values,omitempty"` } type WorkspaceOptions struct { diff --git a/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index 8dc24745cd47a..739dce0d0f4d7 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -198,6 +198,7 @@ export interface CreateWorkspaceBuildRequest { readonly transition: WorkspaceTransition readonly dry_run?: boolean readonly state?: string + readonly parameters?: WorkspaceBuildParameter[] readonly orphan?: boolean readonly parameter_values?: DeprecatedCreateParameterRequest[] } @@ -648,6 +649,12 @@ export interface WorkspaceBuild { readonly deadline?: string } +// 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 From c85f7d27e1fa5bcba586ca4c58e616bcb805644b Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Sun, 2 Oct 2022 15:58:39 +0000 Subject: [PATCH 09/14] Add new frontend for rendering parameters --- codersdk/templateversions.go | 1 + .../testdata/parameters/parameters.tf | 20 +- site/src/api/typesGenerated.ts | 1 + .../WorkspaceParameter.stories.tsx | 185 +++++++++++++ .../WorkspaceParameter/WorkspaceParameter.tsx | 243 ++++++++++++++++++ site/src/testHelpers/handlers.ts | 9 +- site/static/icon/github-gradient.svg | 12 + 7 files changed, 458 insertions(+), 13 deletions(-) create mode 100644 site/src/components/WorkspaceParameter/WorkspaceParameter.stories.tsx create mode 100644 site/src/components/WorkspaceParameter/WorkspaceParameter.tsx create mode 100644 site/static/icon/github-gradient.svg diff --git a/codersdk/templateversions.go b/codersdk/templateversions.go index 51f4f276ec890..81b7b9a69b916 100644 --- a/codersdk/templateversions.go +++ b/codersdk/templateversions.go @@ -34,6 +34,7 @@ type TemplateVersionParameter struct { 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"` diff --git a/provisioner/terraform/testdata/parameters/parameters.tf b/provisioner/terraform/testdata/parameters/parameters.tf index 4126db761f588..ad48a4afd9385 100644 --- a/provisioner/terraform/testdata/parameters/parameters.tf +++ b/provisioner/terraform/testdata/parameters/parameters.tf @@ -8,16 +8,16 @@ terraform { } data "coder_parameter" "example" { - name = "Example" - type = "string" - option { - name = "First Option" - value = "first" - } - option { - name = "Second Option" - value = "second" - } + name = "Example" + type = "string" + option { + name = "First Option" + value = "first" + } + option { + name = "Second Option" + value = "second" + } } resource "coder_agent" "dev" { diff --git a/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index 739dce0d0f4d7..1c6f65610af17 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -459,6 +459,7 @@ export interface TemplateVersionParameter { 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 diff --git a/site/src/components/WorkspaceParameter/WorkspaceParameter.stories.tsx b/site/src/components/WorkspaceParameter/WorkspaceParameter.stories.tsx new file mode 100644 index 0000000000000..58cc8128e51a0 --- /dev/null +++ b/site/src/components/WorkspaceParameter/WorkspaceParameter.stories.tsx @@ -0,0 +1,185 @@ +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..fd24d9ec7ea17 --- /dev/null +++ b/site/src/components/WorkspaceParameter/WorkspaceParameter.tsx @@ -0,0 +1,243 @@ +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> = ({ + 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={{ + pattern: templateParameter.validation_regex, + }} + 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/testHelpers/handlers.ts b/site/src/testHelpers/handlers.ts index 3e648f5345e70..fff1b4b137abf 100644 --- a/site/src/testHelpers/handlers.ts +++ b/site/src/testHelpers/handlers.ts @@ -38,9 +38,12 @@ export const handlers = [ rest.get("/api/v2/templateversions/:templateVersionId", async (req, res, ctx) => { return res(ctx.status(200), ctx.json(M.MockTemplateVersion)) }), - rest.get("/api/v2/templateversions/:templateVersionId/deprecated-schema", async (req, res, ctx) => { - return res(ctx.status(200), ctx.json([])) - }), + rest.get( + "/api/v2/templateversions/:templateVersionId/deprecated-schema", + async (req, res, ctx) => { + return res(ctx.status(200), ctx.json([])) + }, + ), rest.get("/api/v2/templateversions/:templateVersionId/resources", async (req, res, ctx) => { return res(ctx.status(200), ctx.json([M.MockWorkspaceResource, M.MockWorkspaceResource2])) }), 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 @@ + + + + + + + + + + + + From 5d9ac641217953a988c2981597b725406d736913 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Sun, 2 Oct 2022 18:13:33 +0000 Subject: [PATCH 10/14] Add parameters to the create screen --- coderd/database/dump.sql | 2 +- .../migrations/000055_parameters.up.sql | 2 +- coderd/database/queries.sql.go | 4 +- .../database/queries/workspaceparameters.sql | 4 +- examples/templates/docker/main.tf | 35 +++++++----- site/src/api/api.ts | 13 ++++- .../CreateWorkspacePage.tsx | 2 + .../CreateWorkspacePageView.tsx | 24 ++++++--- .../createWorkspaceXService.ts | 53 +++++++++++++++++-- 9 files changed, 107 insertions(+), 32 deletions(-) diff --git a/coderd/database/dump.sql b/coderd/database/dump.sql index 4a0626274b61d..470839ad09d98 100644 --- a/coderd/database/dump.sql +++ b/coderd/database/dump.sql @@ -586,7 +586,7 @@ 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 provisioner_jobs(id) ON DELETE CASCADE; + 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; diff --git a/coderd/database/migrations/000055_parameters.up.sql b/coderd/database/migrations/000055_parameters.up.sql index 45f5633d7f342..8bb1555cb2a14 100644 --- a/coderd/database/migrations/000055_parameters.up.sql +++ b/coderd/database/migrations/000055_parameters.up.sql @@ -1,5 +1,5 @@ CREATE TABLE template_version_parameters ( - template_version_id uuid not null references provisioner_jobs (id) on delete cascade, + 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, diff --git a/coderd/database/queries.sql.go b/coderd/database/queries.sql.go index 11fd612370085..8383f0d502db0 100644 --- a/coderd/database/queries.sql.go +++ b/coderd/database/queries.sql.go @@ -4731,8 +4731,8 @@ INSERT INTO workspace_build_parameters (workspace_build_id, name, value) SELECT $1 :: uuid AS workspace_build_id, - unnset($2 :: text[]) AS name, - unnset($3 :: text[]) AS value + unnest($2 :: text[]) AS name, + unnest($3 :: text[]) AS value RETURNING workspace_build_id, name, value ` diff --git a/coderd/database/queries/workspaceparameters.sql b/coderd/database/queries/workspaceparameters.sql index bdfe905c39542..07198d4e3725e 100644 --- a/coderd/database/queries/workspaceparameters.sql +++ b/coderd/database/queries/workspaceparameters.sql @@ -3,8 +3,8 @@ INSERT INTO workspace_build_parameters (workspace_build_id, name, value) SELECT @workspace_build_id :: uuid AS workspace_build_id, - unnset(@name :: text[]) AS name, - unnset(@value :: text[]) AS value + unnest(@name :: text[]) AS name, + unnest(@value :: text[]) AS value RETURNING *; -- name: GetWorkspaceBuildParameters :many diff --git a/examples/templates/docker/main.tf b/examples/templates/docker/main.tf index 36ce85da7f5f3..c4c9393706823 100644 --- a/examples/templates/docker/main.tf +++ b/examples/templates/docker/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.15" + version = "0.5.0-pre" } docker = { source = "kreuzwerker/docker" @@ -54,15 +54,26 @@ resource "coder_app" "code-server" { } } - -variable "docker_image" { - description = "Which Docker image would you like to use for your workspace?" - # The codercom/enterprise-* images are only built for amd64 - default = "codercom/enterprise-base:ubuntu" - validation { - condition = contains(["codercom/enterprise-base:ubuntu", "codercom/enterprise-node:ubuntu", - "codercom/enterprise-intellij:ubuntu", "codercom/enterprise-golang:ubuntu"], var.docker_image) - error_message = "Invalid Docker image!" +data "coder_parameter" "image" { + name = "Image" + description = "Select a Docker image to use for your workspace." + mutable = true + icon = "/emojis/1f5bc-fe0f.png" + option { + name = "Ubuntu" + value = "codercom/enterprise-base:ubuntu" + } + option { + name = "Node" + value = "codercom/enterprise-node:ubuntu" + } + option { + name = "Java" + value = "codercom/enterprise-intellij:ubuntu" + } + option { + name = "Go" + value = "codercom/enterprise-golang:ubuntu" } } @@ -72,7 +83,7 @@ resource "docker_volume" "home_volume" { resource "docker_container" "workspace" { count = data.coder_workspace.me.start_count - image = var.docker_image + image = data.coder_parameter.image.value # Uses lower() to avoid Docker restriction on container names. name = "coder-${data.coder_workspace.me.owner}-${lower(data.coder_workspace.me.name)}" # Hostname makes the shell more user friendly: coder@my-workspace:~$ @@ -99,6 +110,6 @@ resource "coder_metadata" "container_info" { item { key = "image" - value = var.docker_image + value = data.coder_parameter.image.value } } diff --git a/site/src/api/api.ts b/site/src/api/api.ts index 6e03b2ba34ed2..159187baa4a3a 100644 --- a/site/src/api/api.ts +++ b/site/src/api/api.ts @@ -167,13 +167,22 @@ export const getTemplateVersion = async (versionId: string): Promise => { - const response = await axios.get( +): 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 +} + export const getTemplateVersionResources = async ( versionId: string, ): Promise => { diff --git a/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx b/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx index 9e2ef6bba448b..b8f87774f5741 100644 --- a/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx +++ b/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx @@ -24,6 +24,7 @@ const CreateWorkspacePage: FC = () => { const { templates, templateSchema, + templateVersionParameters, selectedTemplate, getTemplateSchemaError, getTemplatesError, @@ -44,6 +45,7 @@ const CreateWorkspacePage: FC = () => { templates={templates} selectedTemplate={selectedTemplate} templateSchema={templateSchema} + templateParameters={templateVersionParameters} createWorkspaceErrors={{ [CreateWorkspaceErrors.GET_TEMPLATES_ERROR]: getTemplatesError, [CreateWorkspaceErrors.GET_TEMPLATE_SCHEMA_ERROR]: getTemplateSchemaError, diff --git a/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx b/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx index 03ef6e9a38aba..b3618b2bbb1cd 100644 --- a/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx +++ b/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx @@ -1,6 +1,7 @@ import { makeStyles } from "@material-ui/core/styles" import TextField from "@material-ui/core/TextField" import { ErrorSummary } from "components/ErrorSummary/ErrorSummary" +import { WorkspaceParameter } from "components/WorkspaceParameter/WorkspaceParameter" import { FormikContextType, FormikTouched, useFormik } from "formik" import { FC, useState } from "react" import * as Yup from "yup" @@ -31,7 +32,8 @@ export interface CreateWorkspacePageViewProps { templateName: string templates?: TypesGen.Template[] selectedTemplate?: TypesGen.Template - templateSchema?: TypesGen.ParameterSchema[] + templateSchema?: TypesGen.DeprecatedParameterSchema[] + templateParameters?: TypesGen.TemplateVersionParameter[] createWorkspaceErrors: Partial> onCancel: () => void onSubmit: (req: TypesGen.CreateWorkspaceRequest) => void @@ -46,7 +48,9 @@ export const validationSchema = Yup.object({ export const CreateWorkspacePageView: FC> = ( props, ) => { - const [parameterValues, setParameterValues] = useState>({}) + const [deprecatedParameterValues, setDeprecatedParameterValues] = useState< + Record + >({}) useStyles() const form: FormikContextType = @@ -63,11 +67,11 @@ export const CreateWorkspacePageView: FC { 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, @@ -149,8 +153,8 @@ export const CreateWorkspacePageView: FC { - setParameterValues({ - ...parameterValues, + setDeprecatedParameterValues({ + ...deprecatedParameterValues, [schema.name]: value, }) }} @@ -163,6 +167,12 @@ export const CreateWorkspacePageView: FC )} + + {props.selectedTemplate && + props.templateParameters && + props.templateParameters.map((parameter) => ( + + ))} diff --git a/site/src/xServices/createWorkspace/createWorkspaceXService.ts b/site/src/xServices/createWorkspace/createWorkspaceXService.ts index 2b81709ceb3e4..2ef4e7b8ee14f 100644 --- a/site/src/xServices/createWorkspace/createWorkspaceXService.ts +++ b/site/src/xServices/createWorkspace/createWorkspaceXService.ts @@ -1,9 +1,15 @@ import { assign, createMachine } from "xstate" -import { createWorkspace, getTemplates, getTemplateVersionSchema } from "../../api/api" +import { + createWorkspace, + getTemplates, + getTemplateVersionParameters, + getTemplateVersionSchema, +} from "../../api/api" import { CreateWorkspaceRequest, - ParameterSchema, + DeprecatedParameterSchema, Template, + TemplateVersionParameter, Workspace, } from "../../api/typesGenerated" @@ -12,7 +18,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 @@ -38,7 +46,10 @@ export const createWorkspaceMachine = createMachine( data: Template[] } getTemplateSchema: { - data: ParameterSchema[] + data: DeprecatedParameterSchema[] + } + getTemplateVersionParameters: { + data: TemplateVersionParameter[] } createWorkspace: { data: Workspace @@ -73,7 +84,7 @@ export const createWorkspaceMachine = createMachine( src: "getTemplateSchema", onDone: { actions: ["assignTemplateSchema"], - target: "fillingParams", + target: "gettingTemplateVersionParameters", }, onError: { actions: ["assignGetTemplateSchemaError"], @@ -81,6 +92,20 @@ export const createWorkspaceMachine = createMachine( }, }, }, + gettingTemplateVersionParameters: { + entry: "clearTemplateVersionParametersError", + invoke: { + src: "getTemplateVersionParameters", + onDone: { + actions: ["assignTemplateVersionParameters"], + target: "fillingParams", + }, + onError: { + actions: ["assignTemplateVersionParametersError"], + target: "error", + }, + }, + }, fillingParams: { on: { CREATE_WORKSPACE: { @@ -121,6 +146,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) + }, createWorkspace: (context) => { const { createWorkspaceRequest, organizationId } = context @@ -149,6 +183,15 @@ export const createWorkspaceMachine = createMachine( // CLI code: https://github.com/coder/coder/blob/main/cli/create.go#L152-L155 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, + }), assignCreateWorkspaceRequest: assign({ createWorkspaceRequest: (_, event) => event.request, }), From b9dcfc3a657e61e19d3628e579c087bd81d88f5d Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Mon, 3 Oct 2022 14:24:19 +0000 Subject: [PATCH 11/14] Show parameters in the UI --- .../UserAutocomplete/UserAutocomplete.tsx | 2 +- .../CreateWorkspacePage/CreateWorkspacePageView.tsx | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/site/src/components/UserAutocomplete/UserAutocomplete.tsx b/site/src/components/UserAutocomplete/UserAutocomplete.tsx index 113eab737a5b4..c9723013dcd27 100644 --- a/site/src/components/UserAutocomplete/UserAutocomplete.tsx +++ b/site/src/components/UserAutocomplete/UserAutocomplete.tsx @@ -44,7 +44,7 @@ export const UserAutocomplete: FC = ({ const handleFilterChange = debounce((event: ChangeEvent) => { sendSearch("SEARCH", { query: event.target.value }) - }, 1000) + }, 250) return ( { const { t } = useTranslation("createWorkspacePage") - const [deprecatedParameterValues, setDeprecatedParameterValues] = useState< Record >({}) @@ -139,7 +138,7 @@ export const CreateWorkspacePageView: FC {props.loadingTemplateSchema && } - {props.selectedTemplate && props.templateSchema && ( + {props.selectedTemplate && props.templateSchema && props.templateParameters && ( <> )} + {props.templateParameters.map((parameter) => ( + + ))} + {props.workspaceQuota && ( )} - - {props.selectedTemplate && - props.templateParameters && - props.templateParameters.map((parameter) => ( - - ))} From 022eec8e71de6094387a7b77a614ab2b01d0da2d Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Tue, 25 Oct 2022 20:09:58 +0000 Subject: [PATCH 12/14] Add deprecated parameter schema --- coderd/provisionerdaemons.go | 35 +- coderd/workspacebuilds.go | 30 +- coderd/workspaces.go | 16 + codersdk/organizations.go | 3 +- examples/templates/gcp-linux/main.tf | 52 ++- go.mod | 2 +- go.sum | 4 +- provisioner/terraform/provision.go | 6 +- provisionerd/proto/provisionerd.pb.go | 378 +++++++++--------- provisionerd/proto/provisionerd.proto | 11 +- provisionerd/runner/runner.go | 23 +- provisionersdk/proto/provisioner.pb.go | 319 ++++++++------- provisionersdk/proto/provisioner.proto | 9 +- site/src/api/typesGenerated.ts | 3 +- .../WorkspaceParameter/WorkspaceParameter.tsx | 3 +- .../CreateWorkspacePageView.tsx | 19 +- 16 files changed, 516 insertions(+), 397 deletions(-) diff --git a/coderd/provisionerdaemons.go b/coderd/provisionerdaemons.go index f32061ca9ac3d..42b6f5a4cf9e5 100644 --- a/coderd/provisionerdaemons.go +++ b/coderd/provisionerdaemons.go @@ -227,8 +227,8 @@ func (server *provisionerdServer) AcquireJob(ctx context.Context, _ *proto.Empty return nil, failJob(fmt.Sprintf("get owner: %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, @@ -244,18 +244,31 @@ func (server *provisionerdServer) AcquireJob(ctx context.Context, _ *proto.Empty } // Convert types to their corresponding protobuf types. - protoParameters := convertComputedParameterValues(parameters) + 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, @@ -404,8 +417,8 @@ func (server *provisionerdServer) UpdateJob(ctx context.Context, request *proto. } } - 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) @@ -472,8 +485,8 @@ func (server *provisionerdServer) UpdateJob(ctx context.Context, request *proto. } return &proto.UpdateJobResponse{ - Canceled: job.CanceledAt.Valid, - ParameterValues: protoParameters, + Canceled: job.CanceledAt.Valid, + DeprecatedParameterValues: protoParameters, }, nil } diff --git a/coderd/workspacebuilds.go b/coderd/workspacebuilds.go index 7d0cfaf180f87..11badeafb3b08 100644 --- a/coderd/workspacebuilds.go +++ b/coderd/workspacebuilds.go @@ -481,21 +481,6 @@ func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) { } workspaceBuildID := uuid.New() - 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) - } - input, err := json.Marshal(workspaceProvisionJob{ WorkspaceBuildID: workspaceBuildID, }) @@ -535,6 +520,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 }) if err != nil { diff --git a/coderd/workspaces.go b/coderd/workspaces.go index 6efae44c169da..63554ef57b628 100644 --- a/coderd/workspaces.go +++ b/coderd/workspaces.go @@ -509,6 +509,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 }) if err != nil { diff --git a/codersdk/organizations.go b/codersdk/organizations.go index 3470467b9e55b..980916c30024d 100644 --- a/codersdk/organizations.go +++ b/codersdk/organizations.go @@ -84,7 +84,8 @@ type CreateWorkspaceRequest struct { TTLMillis *int64 `json:"ttl_ms,omitempty"` // DeprecatedParameterValues allows for additional parameters to be provided // during the initial provision. - DeprecatedParameterValues []DeprecatedCreateParameterRequest `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/examples/templates/gcp-linux/main.tf b/examples/templates/gcp-linux/main.tf index 8e184b17c3186..e36cf530b9fef 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-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}-root" type = "pd-ssd" - zone = var.zone + zone = data.coder_parameter.region.value image = "debian-cloud/debian-11" lifecycle { ignore_changes = [image] @@ -75,7 +105,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 9dcbb6180c85f..559fe35412538 100644 --- a/go.mod +++ b/go.mod @@ -71,7 +71,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.4.16-0.20220929232427-aaa860cdfa3a + 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 diff --git a/go.sum b/go.sum index fb92055f6a41c..062d34c759124 100644 --- a/go.sum +++ b/go.sum @@ -357,8 +357,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.20221015033036-5861cbbf7bf5 h1:WVH6e/qK3Wpl0wbmpORD2oQ1qLJborF3fsFHyO1ps0Y= github.com/coder/tailscale v1.1.1-0.20221015033036-5861cbbf7bf5/go.mod h1:5amxy08qijEa8bcTW2SeIy4MIqcmd7LMsuOxqOlj2Ak= -github.com/coder/terraform-provider-coder v0.4.16-0.20220929232427-aaa860cdfa3a h1:AQRie9LF7kXw/BzrJtfX1lKQXlYqBmt1j+fSOXOQ6/I= -github.com/coder/terraform-provider-coder v0.4.16-0.20220929232427-aaa860cdfa3a/go.mod h1:UIfU3bYNeSzJJvHyJ30tEKjD6Z9utloI+HUM/7n94CY= +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= diff --git a/provisioner/terraform/provision.go b/provisioner/terraform/provision.go index 3b458207985ec..2df8520bc5d45 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. @@ -174,7 +175,7 @@ func (s *server) Provision(stream proto.DRPCProvisioner_ProvisionStream) error { func provisionVars(start *proto.Provision_Start) ([]string, error) { vars := []string{} - for _, param := range start.ParameterValues { + for _, param := range start.DeprecatedParameterValues { vars = append(vars, fmt.Sprintf("%s=%s", param.Name, param.Value)) } return vars, nil @@ -194,6 +195,9 @@ func provisionEnv(start *proto.Provision_Start) ([]string, error) { for key, value := range provisionersdk.AgentScriptEnv() { env = append(env, key+"="+value) } + for _, parameter := range start.ParameterValues { + env = append(env, provider.ParameterEnvironmentVariable(parameter.Name)+"="+parameter.Value) + } return env, nil } diff --git a/provisionerd/proto/provisionerd.pb.go b/provisionerd/proto/provisionerd.pb.go index 6a9274c907e5f..1c0a0dd738ccd 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.DeprecatedParameterSchema `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.DeprecatedParameterSchema { +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 } @@ -672,11 +672,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() { @@ -725,6 +726,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 @@ -1145,7 +1153,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, @@ -1173,159 +1181,168 @@ 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, 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, 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, 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, + 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, 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, 0xbd, 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, 0x53, 0x0a, 0x11, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 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, 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, 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, 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, 0x98, 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, 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, + 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, 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, 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, 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, 0x98, 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, 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 ( @@ -1380,31 +1397,32 @@ var file_provisionerd_proto_provisionerd_proto_depIdxs = []int32{ 0, // 9: provisionerd.Log.source:type_name -> provisionerd.LogSource 17, // 10: provisionerd.Log.level:type_name -> provisioner.LogLevel 5, // 11: provisionerd.UpdateJobRequest.logs:type_name -> provisionerd.Log - 18, // 12: provisionerd.UpdateJobRequest.parameter_schemas:type_name -> provisioner.DeprecatedParameterSchema - 19, // 13: provisionerd.UpdateJobResponse.parameter_values:type_name -> provisioner.ParameterValue - 19, // 14: provisionerd.AcquiredJob.WorkspaceBuild.parameter_values:type_name -> provisioner.ParameterValue - 20, // 15: provisionerd.AcquiredJob.WorkspaceBuild.metadata:type_name -> provisioner.Provision.Metadata - 20, // 16: provisionerd.AcquiredJob.TemplateImport.metadata:type_name -> provisioner.Provision.Metadata - 19, // 17: provisionerd.AcquiredJob.TemplateDryRun.parameter_values:type_name -> provisioner.ParameterValue - 20, // 18: provisionerd.AcquiredJob.TemplateDryRun.metadata:type_name -> provisioner.Provision.Metadata - 21, // 19: provisionerd.CompletedJob.WorkspaceBuild.resources:type_name -> provisioner.Resource - 21, // 20: provisionerd.CompletedJob.TemplateImport.start_resources:type_name -> provisioner.Resource - 21, // 21: provisionerd.CompletedJob.TemplateImport.stop_resources:type_name -> provisioner.Resource - 22, // 22: provisionerd.CompletedJob.TemplateImport.parameters:type_name -> provisioner.Parameter - 21, // 23: provisionerd.CompletedJob.TemplateDryRun.resources:type_name -> provisioner.Resource - 1, // 24: provisionerd.ProvisionerDaemon.AcquireJob:input_type -> provisionerd.Empty - 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 - 7, // 29: provisionerd.ProvisionerDaemon.UpdateJob:output_type -> provisionerd.UpdateJobResponse - 1, // 30: provisionerd.ProvisionerDaemon.FailJob:output_type -> provisionerd.Empty - 1, // 31: provisionerd.ProvisionerDaemon.CompleteJob:output_type -> provisionerd.Empty - 28, // [28:32] is the sub-list for method output_type - 24, // [24:28] is the sub-list for method input_type - 24, // [24:24] is the sub-list for extension type_name - 24, // [24:24] is the sub-list for extension extendee - 0, // [0:24] is the sub-list for field type_name + 18, // 12: provisionerd.UpdateJobRequest.deprecated_parameter_schemas:type_name -> provisioner.DeprecatedParameterSchema + 19, // 13: provisionerd.UpdateJobResponse.deprecated_parameter_values:type_name -> provisioner.ParameterValue + 19, // 14: provisionerd.AcquiredJob.WorkspaceBuild.deprecated_parameter_values:type_name -> provisioner.ParameterValue + 19, // 15: provisionerd.AcquiredJob.WorkspaceBuild.parameter_values:type_name -> provisioner.ParameterValue + 20, // 16: provisionerd.AcquiredJob.WorkspaceBuild.metadata:type_name -> provisioner.Provision.Metadata + 20, // 17: provisionerd.AcquiredJob.TemplateImport.metadata:type_name -> provisioner.Provision.Metadata + 19, // 18: provisionerd.AcquiredJob.TemplateDryRun.parameter_values:type_name -> provisioner.ParameterValue + 20, // 19: provisionerd.AcquiredJob.TemplateDryRun.metadata:type_name -> provisioner.Provision.Metadata + 21, // 20: provisionerd.CompletedJob.WorkspaceBuild.resources:type_name -> provisioner.Resource + 21, // 21: provisionerd.CompletedJob.TemplateImport.start_resources:type_name -> provisioner.Resource + 21, // 22: provisionerd.CompletedJob.TemplateImport.stop_resources:type_name -> provisioner.Resource + 22, // 23: provisionerd.CompletedJob.TemplateImport.parameters:type_name -> provisioner.Parameter + 21, // 24: provisionerd.CompletedJob.TemplateDryRun.resources:type_name -> provisioner.Resource + 1, // 25: provisionerd.ProvisionerDaemon.AcquireJob:input_type -> provisionerd.Empty + 6, // 26: provisionerd.ProvisionerDaemon.UpdateJob:input_type -> provisionerd.UpdateJobRequest + 3, // 27: provisionerd.ProvisionerDaemon.FailJob:input_type -> provisionerd.FailedJob + 4, // 28: provisionerd.ProvisionerDaemon.CompleteJob:input_type -> provisionerd.CompletedJob + 2, // 29: provisionerd.ProvisionerDaemon.AcquireJob:output_type -> provisionerd.AcquiredJob + 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 + 29, // [29:33] is the sub-list for method output_type + 25, // [25:29] 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 7c2e841fd69f4..88663b3ff9d6d 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; @@ -96,7 +97,7 @@ message Log { message UpdateJobRequest { string job_id = 1; repeated Log logs = 2; - repeated provisioner.DeprecatedParameterSchema parameter_schemas = 3; + repeated provisioner.DeprecatedParameterSchema deprecated_parameter_schemas = 3; bytes readme = 4; } @@ -104,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; } service ProvisionerDaemon { diff --git a/provisionerd/runner/runner.go b/provisionerd/runner/runner.go index 74577e1725f0f..7588dac34709f 100644 --- a/provisionerd/runner/runner.go +++ b/provisionerd/runner/runner.go @@ -515,23 +515,23 @@ func (r *Runner) runTemplateImport(ctx context.Context) (*proto.CompletedJob, *p if err != nil { return nil, r.failedJobf("write log: %s", err) } - 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) @@ -551,7 +551,7 @@ func (r *Runner) runTemplateImport(ctx context.Context) (*proto.CompletedJob, *p if err != nil { return nil, r.failedJobf("write log: %s", err) } - startResources, parameters, 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, }) @@ -572,7 +572,7 @@ func (r *Runner) runTemplateImport(ctx context.Context) (*proto.CompletedJob, *p if err != nil { return nil, r.failedJobf("write log: %s", err) } - 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, }) @@ -834,10 +834,11 @@ func (r *Runner) runWorkspaceBuild(ctx context.Context) (*proto.CompletedJob, *p err = stream.Send(&sdkproto.Provision_Request{ Type: &sdkproto.Provision_Request_Start{ Start: &sdkproto.Provision_Start{ - Directory: r.workDirectory, - ParameterValues: r.job.GetWorkspaceBuild().ParameterValues, - Metadata: r.job.GetWorkspaceBuild().Metadata, - State: r.job.GetWorkspaceBuild().State, + Directory: r.workDirectory, + ParameterValues: r.job.GetWorkspaceBuild().ParameterValues, + DeprecatedParameterValues: r.job.GetWorkspaceBuild().DeprecatedParameterValues, + Metadata: r.job.GetWorkspaceBuild().Metadata, + State: r.job.GetWorkspaceBuild().State, }, }, }) diff --git a/provisionersdk/proto/provisioner.pb.go b/provisionersdk/proto/provisioner.pb.go index 6fcc3b7106d75..953db7914a97e 100644 --- a/provisionersdk/proto/provisioner.pb.go +++ b/provisionersdk/proto/provisioner.pb.go @@ -1464,11 +1464,12 @@ type Provision_Start struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Directory string `protobuf:"bytes,1,opt,name=directory,proto3" json:"directory,omitempty"` - ParameterValues []*ParameterValue `protobuf:"bytes,2,rep,name=parameter_values,json=parameterValues,proto3" json:"parameter_values,omitempty"` - Metadata *Provision_Metadata `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"` - State []byte `protobuf:"bytes,4,opt,name=state,proto3" json:"state,omitempty"` - DryRun bool `protobuf:"varint,5,opt,name=dry_run,json=dryRun,proto3" json:"dry_run,omitempty"` + Directory string `protobuf:"bytes,1,opt,name=directory,proto3" json:"directory,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"` + Metadata *Provision_Metadata `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` + State []byte `protobuf:"bytes,5,opt,name=state,proto3" json:"state,omitempty"` + DryRun bool `protobuf:"varint,6,opt,name=dry_run,json=dryRun,proto3" json:"dry_run,omitempty"` } func (x *Provision_Start) Reset() { @@ -1510,6 +1511,13 @@ func (x *Provision_Start) GetDirectory() string { return "" } +func (x *Provision_Start) GetDeprecatedParameterValues() []*ParameterValue { + if x != nil { + return x.DeprecatedParameterValues + } + return nil +} + func (x *Provision_Start) GetParameterValues() []*ParameterValue { if x != nil { return x.ParameterValues @@ -2097,7 +2105,7 @@ var file_provisionersdk_proto_provisioner_proto_rawDesc = []byte{ 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, 0xe7, 0x07, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, + 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc4, 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, @@ -2119,135 +2127,141 @@ var file_provisionersdk_proto_provisioner_proto_rawDesc = []byte{ 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, 0xd9, 0x01, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, + 0x72, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x1a, 0xb6, 0x02, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 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, 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, 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, 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, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x72, 0x79, - 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x64, 0x72, 0x79, 0x52, - 0x75, 0x6e, 0x1a, 0x08, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x1a, 0x80, 0x01, 0x0a, - 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, - 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x37, - 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x02, 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, - 0xa3, 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, 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, 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, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 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, 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, 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, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x72, 0x79, 0x5f, 0x72, 0x75, + 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x64, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x1a, + 0x08, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x1a, 0x80, 0x01, 0x0a, 0x07, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, + 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, + 0x72, 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x37, 0x0a, 0x06, 0x63, + 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x02, 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, 0xa3, 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, 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, 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, + 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, 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, 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, + 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 ( @@ -2309,26 +2323,27 @@ var file_provisionersdk_proto_provisioner_proto_depIdxs = []int32{ 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 - 14, // 12: provisioner.Provision.Start.parameter_values:type_name -> provisioner.ParameterValue - 21, // 13: provisioner.Provision.Start.metadata:type_name -> provisioner.Provision.Metadata - 22, // 14: provisioner.Provision.Request.start:type_name -> provisioner.Provision.Start - 23, // 15: provisioner.Provision.Request.cancel:type_name -> provisioner.Provision.Cancel - 11, // 16: provisioner.Provision.Complete.resources:type_name -> provisioner.Resource - 13, // 17: provisioner.Provision.Complete.parameters:type_name -> provisioner.Parameter - 6, // 18: provisioner.Provision.Response.log:type_name -> provisioner.Log - 25, // 19: provisioner.Provision.Response.complete:type_name -> provisioner.Provision.Complete - 18, // 20: provisioner.DeprecatedParse.Complete.parameter_schemas:type_name -> provisioner.DeprecatedParameterSchema - 6, // 21: provisioner.DeprecatedParse.Response.log:type_name -> provisioner.Log - 28, // 22: provisioner.DeprecatedParse.Response.complete:type_name -> provisioner.DeprecatedParse.Complete - 27, // 23: provisioner.Provisioner.DeprecatedParse:input_type -> provisioner.DeprecatedParse.Request - 24, // 24: provisioner.Provisioner.Provision:input_type -> provisioner.Provision.Request - 29, // 25: provisioner.Provisioner.DeprecatedParse:output_type -> provisioner.DeprecatedParse.Response - 26, // 26: provisioner.Provisioner.Provision:output_type -> provisioner.Provision.Response - 25, // [25:27] is the sub-list for method output_type - 23, // [23:25] 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 + 14, // 12: provisioner.Provision.Start.deprecated_parameter_values:type_name -> provisioner.ParameterValue + 14, // 13: provisioner.Provision.Start.parameter_values:type_name -> provisioner.ParameterValue + 21, // 14: provisioner.Provision.Start.metadata:type_name -> provisioner.Provision.Metadata + 22, // 15: provisioner.Provision.Request.start:type_name -> provisioner.Provision.Start + 23, // 16: provisioner.Provision.Request.cancel:type_name -> provisioner.Provision.Cancel + 11, // 17: provisioner.Provision.Complete.resources:type_name -> provisioner.Resource + 13, // 18: provisioner.Provision.Complete.parameters:type_name -> provisioner.Parameter + 6, // 19: provisioner.Provision.Response.log:type_name -> provisioner.Log + 25, // 20: provisioner.Provision.Response.complete:type_name -> provisioner.Provision.Complete + 18, // 21: provisioner.DeprecatedParse.Complete.parameter_schemas:type_name -> provisioner.DeprecatedParameterSchema + 6, // 22: provisioner.DeprecatedParse.Response.log:type_name -> provisioner.Log + 28, // 23: provisioner.DeprecatedParse.Response.complete:type_name -> provisioner.DeprecatedParse.Complete + 27, // 24: provisioner.Provisioner.DeprecatedParse:input_type -> provisioner.DeprecatedParse.Request + 24, // 25: provisioner.Provisioner.Provision:input_type -> provisioner.Provision.Request + 29, // 26: provisioner.Provisioner.DeprecatedParse:output_type -> provisioner.DeprecatedParse.Response + 26, // 27: provisioner.Provisioner.Provision:output_type -> provisioner.Provision.Response + 26, // [26:28] is the sub-list for method output_type + 24, // [24:26] is the sub-list for method input_type + 24, // [24:24] is the sub-list for extension type_name + 24, // [24:24] is the sub-list for extension extendee + 0, // [0:24] is the sub-list for field type_name } func init() { file_provisionersdk_proto_provisioner_proto_init() } diff --git a/provisionersdk/proto/provisioner.proto b/provisionersdk/proto/provisioner.proto index f4828bc9152ce..d6aae99413005 100644 --- a/provisionersdk/proto/provisioner.proto +++ b/provisionersdk/proto/provisioner.proto @@ -130,10 +130,11 @@ message Provision { } message Start { string directory = 1; - repeated ParameterValue parameter_values = 2; - Metadata metadata = 3; - bytes state = 4; - bool dry_run = 5; + repeated ParameterValue deprecated_parameter_values = 2; + repeated ParameterValue parameter_values = 3; + Metadata metadata = 4; + bytes state = 5; + bool dry_run = 6; } message Cancel {} message Request { diff --git a/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index 11e1c750ed7cd..d0699ce5b8098 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -221,7 +221,8 @@ export interface CreateWorkspaceRequest { readonly name: string readonly autostart_schedule?: string readonly ttl_ms?: number - readonly parameter_values?: DeprecatedCreateParameterRequest[] + readonly deprecated_parameter_values?: DeprecatedCreateParameterRequest[] + readonly parameters: WorkspaceBuildParameter[] } // From codersdk/templates.go diff --git a/site/src/components/WorkspaceParameter/WorkspaceParameter.tsx b/site/src/components/WorkspaceParameter/WorkspaceParameter.tsx index 806109d02aa7b..92d3e026c8e67 100644 --- a/site/src/components/WorkspaceParameter/WorkspaceParameter.tsx +++ b/site/src/components/WorkspaceParameter/WorkspaceParameter.tsx @@ -110,7 +110,8 @@ export const WorkspaceParameter: FC< setValue(event.target.value) }} inputProps={{ - pattern: templateParameter.validation_regex, + // Empty strings break the pattern matching! + pattern: templateParameter.validation_regex || undefined, }} onBlur={(event) => { if (event.target.checkValidity()) { diff --git a/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx b/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx index 7080200291c0a..b4f80661ed4da 100644 --- a/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx +++ b/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx @@ -57,12 +57,16 @@ export const CreateWorkspacePageView: FC< const [deprecatedParameterValues, setDeprecatedParameterValues] = useState< Record >({}) + const [parameterValues, setParameterValues] = useState< + Record + >({}) const form: FormikContextType = useFormik({ initialValues: { name: "", template_id: props.selectedTemplate ? props.selectedTemplate.id : "", + parameters: [], }, enableReinitialize: true, validationSchema, @@ -85,9 +89,16 @@ 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) }, @@ -223,6 +234,12 @@ export const CreateWorkspacePageView: FC< { + setParameterValues({ + ...parameterValues, + [parameter.name]: value, + }) + }} /> ))} From 1e05960594328f3440a584446a0ca1e3ba41346e Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Thu, 27 Oct 2022 18:02:26 +0000 Subject: [PATCH 13/14] Update deprecated parameter name in CLI --- cli/cliui/parameter.go | 2 +- cli/create.go | 37 +++++++++++++++++++------------------ cli/parameter.go | 4 ++-- cli/templatecreate.go | 2 +- cli/update.go | 8 ++++---- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/cli/cliui/parameter.go b/cli/cliui/parameter.go index b0842f45214cb..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.DeprecatedParameterSchema) (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 dd938aba322fd..31dd4fc51e6ae 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.DeprecatedParameter{}, - ParameterFile: parameterFile, - NewWorkspaceName: workspaceName, + Template: template, + ExistingDeprecatedParams: []codersdk.DeprecatedParameter{}, + ParameterFile: parameterFile, + NewWorkspaceName: workspaceName, }) if err != nil { return err @@ -170,10 +170,11 @@ func create() *cobra.Command { } type prepWorkspaceBuildArgs struct { - Template codersdk.Template - ExistingParams []codersdk.DeprecatedParameter - 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. @@ -184,7 +185,7 @@ func prepWorkspaceBuild(cmd *cobra.Command, client *codersdk.Client, args prepWo if err != nil { return nil, err } - parameterSchemas, err := client.DeprecatedTemplateVersionSchema(ctx, templateVersion.ID) + deprecatedParameterSchemas, err := client.DeprecatedTemplateVersionSchema(ctx, templateVersion.ID) if err != nil { return nil, err } @@ -201,9 +202,9 @@ func prepWorkspaceBuild(cmd *cobra.Command, client *codersdk.Client, args prepWo } } disclaimerPrinted := false - parameters := make([]codersdk.DeprecatedCreateParameterRequest, 0) -PromptParamLoop: - for _, parameterSchema := range parameterSchemas { + deprecatedParameters := make([]codersdk.DeprecatedCreateParameterRequest, 0) +PromptDeprecatedParamLoop: + for _, parameterSchema := range deprecatedParameterSchemas { if !parameterSchema.AllowOverrideSource { continue } @@ -214,21 +215,21 @@ 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.DeprecatedCreateParameterRequest{ + deprecatedParameters = append(deprecatedParameters, codersdk.DeprecatedCreateParameterRequest{ Name: parameterSchema.Name, SourceValue: parameterValue, SourceScheme: codersdk.DeprecatedParameterSourceSchemeData, @@ -241,7 +242,7 @@ PromptParamLoop: after := time.Now() 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) @@ -281,5 +282,5 @@ PromptParamLoop: return nil, err } - return parameters, nil + return deprecatedParameters, nil } diff --git a/cli/parameter.go b/cli/parameter.go index a9846586b93bc..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.DeprecatedParameterSchema) (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/templatecreate.go b/cli/templatecreate.go index e6ed7eca13bbb..e21b288784a63 100644 --- a/cli/templatecreate.go +++ b/cli/templatecreate.go @@ -276,7 +276,7 @@ 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 } diff --git a/cli/update.go b/cli/update.go index 00d8853274bc2..6e97d328f4cbe 100644 --- a/cli/update.go +++ b/cli/update.go @@ -48,10 +48,10 @@ func update() *cobra.Command { } 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 From a864d469375b732474a62d1d8a9c8f9cf146a531 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Fri, 2 Dec 2022 21:26:04 +0000 Subject: [PATCH 14/14] Fix some test things --- coderd/provisionerdserver/provisionerdserver.go | 10 +++++----- coderd/templateversions.go | 2 +- coderd/templateversions_test.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/coderd/provisionerdserver/provisionerdserver.go b/coderd/provisionerdserver/provisionerdserver.go index 7ab729838bd25..dd83abb4d3b15 100644 --- a/coderd/provisionerdserver/provisionerdserver.go +++ b/coderd/provisionerdserver/provisionerdserver.go @@ -38,10 +38,6 @@ var ( lastAcquireMutex sync.RWMutex ) -type templateVersionImportJob struct { - TemplateVersionID uuid.UUID `json:"template_version_id"` -} - type Server struct { AccessURL *url.URL ID uuid.UUID @@ -593,7 +589,7 @@ func (server *Server) CompleteJob(ctx context.Context, completed *proto.Complete switch jobType := completed.Type.(type) { case *proto.CompletedJob_TemplateImport_: - var input templateVersionImportJob + var input TemplateVersionImportJob err = json.Unmarshal(job.Input, &input) if err != nil { return nil, xerrors.Errorf("unmarshal job data: %w", err) @@ -1104,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 d582bd8e93161..288f2eebe2541 100644 --- a/coderd/templateversions.go +++ b/coderd/templateversions.go @@ -904,7 +904,7 @@ func (api *API) postTemplateVersionsByOrganization(rw http.ResponseWriter, r *ht } templateVersionID := uuid.New() - jobInput, err := json.Marshal(templateVersionImportJob{ + jobInput, err := json.Marshal(provisionerdserver.TemplateVersionImportJob{ TemplateVersionID: templateVersionID, }) if err != nil { diff --git a/coderd/templateversions_test.go b/coderd/templateversions_test.go index 55ff1e1283749..34d3115c0b02d 100644 --- a/coderd/templateversions_test.go +++ b/coderd/templateversions_test.go @@ -321,7 +321,7 @@ func TestTemplateVersionParameters(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - ProvisionDryRun: []*proto.Provision_Response{{ + ProvisionPlan: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Parameters: []*proto.Parameter{{