confluence

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

README

Confluence

Extract page metadata and relationships from Confluence spaces using the Confluence REST API v2.

Usage

source:
  name: confluence
  scope: my-confluence
  config:
    base_url: https://mycompany.atlassian.net/wiki
    username: user@company.com
    token: your-api-token
    spaces:
      - ENG
      - DATA
    exclude:
      - ARCHIVE

Configuration

Key Type Required Description
base_url string Yes Confluence base URL (e.g. https://mycompany.atlassian.net/wiki).
username string Yes Atlassian account email for API authentication.
token string Yes Atlassian API token.
spaces []string No Space keys to extract. Defaults to all spaces.
exclude []string No Space keys to exclude from extraction.

Entities

The extractor emits two entity types and their relationships as edges.

Entity: space
Field Sample Value
urn urn:confluence:my-confluence:space:ENG
name Engineering
description Engineering team documentation
properties.space_key ENG
properties.space_type global
properties.status current
properties.web_url https://mycompany.atlassian.net/wiki/spaces/ENG
Entity: document
Field Sample Value
urn urn:confluence:my-confluence:document:12345
name Data Pipeline Architecture
properties.page_id 12345
properties.space_key ENG
properties.status current
properties.version 5
properties.labels ["architecture", "data"]
properties.created_at 2024-01-15T10:30:00Z
properties.updated_at 2024-03-20T14:15:00Z
properties.web_url https://mycompany.atlassian.net/wiki/spaces/ENG/pages/12345
Edges
Type Source Target Description
belongs_to document space Page belongs to a space
child_of document document Page is a child of another page
owned_by document user Page is owned by its author
documented_by document any Page references a data asset via URN in its content
URN Reference Detection

The extractor scans page content for URN patterns (urn:service:scope:type:id) and emits documented_by edges linking the page to referenced data assets. This enables connecting business documentation to technical metadata.

Contributing

Refer to the contribution guidelines for information on contributing to this module.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps the Confluence REST API v2.

func NewClient

func NewClient(baseURL, username, token string) *Client

NewClient creates a new Confluence API client.

func (*Client) GetPageLabels

func (c *Client) GetPageLabels(ctx context.Context, pageID string) ([]Label, error)

GetPageLabels returns all labels for a page, handling pagination.

func (*Client) GetPages

func (c *Client) GetPages(ctx context.Context, spaceID string) ([]Page, error)

GetPages returns all pages in a space.

func (*Client) GetSpaces

func (c *Client) GetSpaces(ctx context.Context, keys []string) ([]Space, error)

GetSpaces returns all spaces, optionally filtered by keys.

type Config

type Config struct {
	BaseURL  string   `json:"base_url" yaml:"base_url" mapstructure:"base_url" validate:"required,url"`
	Username string   `json:"username" yaml:"username" mapstructure:"username" validate:"required"`
	Token    string   `json:"token" yaml:"token" mapstructure:"token" validate:"required"`
	Spaces   []string `json:"spaces" yaml:"spaces" mapstructure:"spaces"`
	Exclude  []string `json:"exclude" yaml:"exclude" mapstructure:"exclude"`
}

type Extractor

type Extractor struct {
	plugins.BaseExtractor
	// contains filtered or unexported fields
}

func New

func New(logger log.Logger) *Extractor

func (*Extractor) Extract

func (e *Extractor) Extract(ctx context.Context, emit plugins.Emit) error

func (*Extractor) Init

func (e *Extractor) Init(ctx context.Context, config plugins.Config) error

type Label

type Label struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Label represents a Confluence label.

type Page

type Page struct {
	ID        string    `json:"id"`
	Title     string    `json:"title"`
	Status    string    `json:"status"`
	SpaceID   string    `json:"spaceId"`
	ParentID  string    `json:"parentId"`
	AuthorID  string    `json:"authorId"`
	CreatedAt time.Time `json:"createdAt"`
	Version   struct {
		Number    int       `json:"number"`
		AuthorID  string    `json:"authorId"`
		CreatedAt time.Time `json:"createdAt"`
	} `json:"version"`
	Body struct {
		Storage struct {
			Value string `json:"value"`
		} `json:"storage"`
	} `json:"body"`
	Labels struct {
		Results []Label `json:"results"`
	} `json:"labels"`
	Links struct {
		WebUI string `json:"webui"`
	} `json:"_links"`
}

Page represents a Confluence page from the v2 API.

type Space

type Space struct {
	ID          string `json:"id"`
	Key         string `json:"key"`
	Name        string `json:"name"`
	Type        string `json:"type"`
	Status      string `json:"status"`
	Description struct {
		Plain struct {
			Value string `json:"value"`
		} `json:"plain"`
	} `json:"description"`
	Links struct {
		WebUI string `json:"webui"`
	} `json:"_links"`
}

Space represents a Confluence space.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL