func()

in internal/provider/datasource_gitlab_pipeline_schedule.go [85:211]


func (d *gitlabPipelineScheduleDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
	resp.Schema = schema.Schema{
		MarkdownDescription: `The ` + "`gitlab_pipeline_schedule`" + ` data source retrieves information about a gitlab pipeline schedule for a project.

**Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/api/pipeline_schedules/)`,

		Attributes: map[string]schema.Attribute{
			"id": schema.StringAttribute{
				MarkdownDescription: "The ID of this Terraform resource. In the format of `<project-id>:<pipeline-schedule-id>`.",
				Computed:            true,
			},
			"pipeline_schedule_id": schema.Int64Attribute{
				MarkdownDescription: "The pipeline schedule id.",
				Required:            true,
			},
			"project": schema.StringAttribute{
				MarkdownDescription: "The name or id of the project to add the schedule to.",
				Required:            true,
			},
			"description": schema.StringAttribute{
				MarkdownDescription: "The description of the pipeline schedule.",
				Computed:            true,
			},
			"ref": schema.StringAttribute{
				MarkdownDescription: "The branch/tag name to be triggered. This will be the full branch reference, for example: `refs/heads/main`, not `main`.",
				Computed:            true,
			},
			"cron": schema.StringAttribute{
				MarkdownDescription: "The cron (e.g. `0 1 * * *`).",
				Computed:            true,
			},
			"cron_timezone": schema.StringAttribute{
				MarkdownDescription: "The timezone.",
				Optional:            true,
				Computed:            true,
			},
			"next_run_at": schema.StringAttribute{
				MarkdownDescription: "The datetime of when the schedule will next run.",
				Computed:            true,
			},
			"active": schema.BoolAttribute{
				MarkdownDescription: "The activation status of pipeline schedule.",
				Computed:            true,
			},
			"created_at": schema.StringAttribute{
				MarkdownDescription: "The datetime of when the schedule was created.",
				Computed:            true,
			},
			"updated_at": schema.StringAttribute{
				MarkdownDescription: "The datetime of when the schedule was last updated.",
				Computed:            true,
			},
			"last_pipeline": schema.SingleNestedAttribute{
				MarkdownDescription: "The details of the last pipeline run by the schedule.",
				Computed:            true,
				Attributes: map[string]schema.Attribute{
					"id": schema.Int64Attribute{
						MarkdownDescription: "The pipeline ID.",
						Computed:            true,
					},
					"sha": schema.StringAttribute{
						MarkdownDescription: "The SHA of the pipeline.",
						Computed:            true,
					},
					"ref": schema.StringAttribute{
						MarkdownDescription: "The ref of the pipeline.",
						Computed:            true,
					},
					"status": schema.StringAttribute{
						MarkdownDescription: "The status of pipelines, one of: created, waiting_for_resource, preparing, pending, running, success, failed, canceled, skipped, manual, scheduled.",
						Computed:            true,
					},
				},
			},
			"owner": schema.SingleNestedAttribute{
				MarkdownDescription: "The details of the pipeline schedule owner.",
				Computed:            true,
				Attributes: map[string]schema.Attribute{
					"id": schema.Int64Attribute{
						MarkdownDescription: "The user ID.",
						Computed:            true,
					},
					"name": schema.StringAttribute{
						MarkdownDescription: "Name.",
						Computed:            true,
					},
					"username": schema.StringAttribute{
						MarkdownDescription: "Username.",
						Computed:            true,
					},
					"state": schema.StringAttribute{
						MarkdownDescription: "User's state, one of: active, blocked.",
						Computed:            true,
					},
					"avatar_url": schema.StringAttribute{
						MarkdownDescription: "Image URL for the user's avatar.",
						Computed:            true,
					},
					"web_url": schema.StringAttribute{
						MarkdownDescription: "URL to the user's profile.",
						Computed:            true,
					},
				},
			},
			"variables": schema.ListNestedAttribute{
				MarkdownDescription: "The list of the pipeline schedule variables.",
				Computed:            true,
				NestedObject: schema.NestedAttributeObject{
					Attributes: map[string]schema.Attribute{
						"key": schema.StringAttribute{
							MarkdownDescription: "The key of a variable.",
							Computed:            true,
						},
						"variable_type": schema.StringAttribute{
							MarkdownDescription: "The type of a variable, one of: env_var and file.",
							Computed:            true,
						},
						"value": schema.StringAttribute{
							MarkdownDescription: "The value of a variable.",
							Computed:            true,
						},
					},
				},
			},
		},
	}
}