in internal/provider/resource_gitlab_project_hook.go [313:479]
func (d *gitlabProjectHookResource) getSchema() schema.Schema {
return schema.Schema{
Version: 1,
MarkdownDescription: `The ` + "`" + `gitlab_project_hook` + "`" + ` resource allows to manage the lifecycle of a project hook.
**Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/api/projects/#hooks)`,
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
MarkdownDescription: `The id of the project hook. In the format of "project:hook_id"`,
Computed: true,
},
"project": schema.StringAttribute{
MarkdownDescription: "The name or id of the project to add the hook to.",
Required: true,
},
"project_id": schema.Int64Attribute{
MarkdownDescription: "The id of the project for the hook.",
Computed: true,
PlanModifiers: []planmodifier.Int64{
int64planmodifier.RequiresReplace(),
},
},
"hook_id": schema.Int64Attribute{
MarkdownDescription: "The id of the project hook.",
Computed: true,
},
"url": schema.StringAttribute{
MarkdownDescription: "The url of the hook to invoke. Forces re-creation to preserve `token`.",
Required: true,
Validators: []validator.String{
stringvalidator.RegexMatches(regexp.MustCompile(`^\S+$`), `The URL may not contain whitespace`),
},
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
},
"token": schema.StringAttribute{
MarkdownDescription: "A token to present when invoking the hook. The token is not available for imported resources.",
Optional: true,
Computed: true,
Sensitive: true,
},
"name": schema.StringAttribute{
MarkdownDescription: "Name of the project webhook.",
Optional: true,
Computed: true,
},
"description": schema.StringAttribute{
MarkdownDescription: "Description of the webhook.",
Optional: true,
Computed: true,
},
"push_events": schema.BoolAttribute{
Description: "Invoke the hook for push events.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(true),
},
"push_events_branch_filter": schema.StringAttribute{
Description: "Invoke the hook for push events on matching branches only.",
Optional: true,
Computed: true,
},
"issues_events": schema.BoolAttribute{
Description: "Invoke the hook for issues events.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
},
"confidential_issues_events": schema.BoolAttribute{
Description: "Invoke the hook for confidential issues events.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
},
"merge_requests_events": schema.BoolAttribute{
Description: "Invoke the hook for merge requests events.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
},
"tag_push_events": schema.BoolAttribute{
Description: "Invoke the hook for tag push events.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
},
"note_events": schema.BoolAttribute{
Description: "Invoke the hook for note events.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
},
"confidential_note_events": schema.BoolAttribute{
Description: "Invoke the hook for confidential note events.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
},
"job_events": schema.BoolAttribute{
Description: "Invoke the hook for job events.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
},
"pipeline_events": schema.BoolAttribute{
Description: "Invoke the hook for pipeline events.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
},
"wiki_page_events": schema.BoolAttribute{
Description: "Invoke the hook for wiki page events.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
},
"resource_access_token_events": schema.BoolAttribute{
Description: "Invoke the hook for project access token expiry events.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
},
"deployment_events": schema.BoolAttribute{
Description: "Invoke the hook for deployment events.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
},
"releases_events": schema.BoolAttribute{
Description: "Invoke the hook for release events.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
},
"enable_ssl_verification": schema.BoolAttribute{
Description: "Enable SSL verification when invoking the hook.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(true),
},
"custom_webhook_template": schema.StringAttribute{
Description: "Custom webhook template.",
Optional: true,
Computed: true,
},
"custom_headers": schema.ListNestedAttribute{
Description: "Custom headers for the project webhook.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"key": schema.StringAttribute{
Description: "Key of the custom header.",
Required: true,
},
"value": schema.StringAttribute{
Required: true,
Description: "Value of the custom header. This value cannot be imported.",
Sensitive: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
},
},
},
},
}
}