func()

in internal/provider/resource_gitlab_project_level_notification.go [76:215]


func (d *gitlabProjectLevelNotificationsResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
	resp.Schema = schema.Schema{
		Version: 1,
		MarkdownDescription: `The ` + "`" + `gitlab_project_level_notifications` + "`" + ` resource allows to manage notifications for a project.

~> While the API supports both groups and projects, this resource only supports projects currently.
		
**Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/api/notification_settings/#group--project-level-notification-settings)`,

		// Schema is external because we'll need to re-implement the state migration function.
		Attributes: map[string]schema.Attribute{
			"id": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "The ID of the resource. Matches the `project` value.",
			},
			"project": schema.StringAttribute{
				MarkdownDescription: "The ID or URL-encoded path of a project where notifications will be configured.",
				Required:            true,
				PlanModifiers:       []planmodifier.String{stringplanmodifier.RequiresReplace()},
			},
			"level": schema.StringAttribute{
				MarkdownDescription: fmt.Sprintf("The level of the notification. Valid values are: %s.", utils.RenderValueListForDocs(allowedNotificationLevels)),
				Optional:            true,
				Computed:            true,
				Validators: []validator.String{
					stringvalidator.OneOf(allowedNotificationLevels...),
				},
				PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
			},
			"new_note": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for new notes on merge requests. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"new_issue": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for new issues. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"reopen_issue": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for reopened issues. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"close_issue": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for closed issues. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"reassign_issue": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for issue reassignments. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"issue_due": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for due issues. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"new_merge_request": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for new merge requests. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"push_to_merge_request": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for push to merge request branches. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"reopen_merge_request": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for reopened merge requests. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"close_merge_request": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for closed merge requests. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"reassign_merge_request": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for merge request reassignments. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"merge_merge_request": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for merged merge requests. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"failed_pipeline": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for failed pipelines. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"fixed_pipeline": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for fixed pipelines. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"success_pipeline": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for successful pipelines. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"moved_project": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for moved projects. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			"merge_when_pipeline_succeeds": schema.BoolAttribute{
				MarkdownDescription: "Enable notifications for merged merge requests when the pipeline succeeds. Can only be used when `level` is `custom`.",
				Optional:            true,
				Computed:            true,
				PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			},
			// "new_epic": schema.BoolAttribute{
			// 	MarkdownDescription: "Enable notifications for new epics. Can only be used when `level` is `custom`. Requires GitLab ultimate.",
			// 	Optional:            true,
			// 	Computed:            true,
			// 	PlanModifiers:       []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
			// },
		},
	}
}