tableau

package
v0.12.8-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceTypeWorkbook   = "workbook"
	ResourceTypeFlow       = "flow"
	ResourceTypeDataSource = "datasource"
	ResourceTypeView       = "view"
	ResourceTypeMetric     = "metric"
)
View Source
const (
	AccountTypeUser = "user"
)

Variables

View Source
var (
	ErrInvalidRole                   = errors.New("invalid role")
	ErrInvalidResourceType           = errors.New("invalid resource type")
	ErrUserNotFound                  = errors.New("cannot find user with the given email")
	ErrInvalidCredentials            = errors.New("invalid credentials type")
	ErrInvalidPermissionConfig       = errors.New("invalid permission config type")
	ErrUnableToEncryptNilCredentials = errors.New("unable to encrypt nil credentials")
	ErrUnableToDecryptNilCredentials = errors.New("unable to decrypt nil credentials")
)
View Source
var PermissionModes = []string{"Allow", "Deny"}
View Source
var PermissionNames = map[string][]string{
	ResourceTypeWorkbook:   {"AddComment", "ChangeHierarchy", "ChangePermissions", "Delete", "ExportData", "ExportImage", "ExportXml", "Filter", "Read", "ShareView", "ViewComments", "ViewUnderlyingData", "WebAuthoring", "Write"},
	ResourceTypeFlow:       {"ChangeHierarchy", "ChangePermissions", "Delete", "Execute", "ExportXml", "Read", "Write"},
	ResourceTypeDataSource: {"ChangePermissions", "Connect", "Delete", "ExportXml", "Read", "Write"},
	ResourceTypeView:       {"AddComment", "ChangePermissions", "Delete", "ExportData", "ExportImage", "ExportXml", "Filter", "Read", "ShareView", "ViewComments", "ViewUnderlyingData", "WebAuthoring", "Write"},
	ResourceTypeMetric:     {"Delete", "Read", "Write"},
}
View Source
var SiteRolePermissions = []string{
	"Creator", "Explorer", "ExplorerCanPublish", "SiteAdministratorExplorer", "SiteAdministratorCreator", "Unlicensed", "Viewer",
}

Functions

func NewClient

func NewClient(config *ClientConfig) (*client, error)

func NewProvider

func NewProvider(typeName string, crypto domain.Crypto) *provider

Types

type ClientConfig

type ClientConfig struct {
	Host       string `validate:"required,url" mapstructure:"host"`
	Username   string `validate:"required" mapstructure:"username"`
	Password   string `validate:"required" mapstructure:"password"`
	ContentURL string `validate:"required" mapstructure:"content_url"`
	APIVersion string `mapstructure:"apiVersion" default:"3.12"`
	HTTPClient HTTPClient
}

type Config

type Config struct {
	ProviderConfig *domain.ProviderConfig
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(pc *domain.ProviderConfig, crypto domain.Crypto) *Config

func (*Config) EncryptCredentials

func (c *Config) EncryptCredentials() error

func (*Config) ParseAndValidate

func (c *Config) ParseAndValidate() error

type Credentials

type Credentials struct {
	Host       string `json:"host" mapstructure:"host" validate:"required,url"`
	Username   string `json:"username" mapstructure:"username" validate:"required"`
	Password   string `json:"password" mapstructure:"password" validate:"required"`
	ContentURL string `json:"content_url" mapstructure:"content_url" validate:"required"`
}

func (*Credentials) Decrypt

func (c *Credentials) Decrypt(decryptor domain.Decryptor) error

func (*Credentials) Encrypt

func (c *Credentials) Encrypt(encryptor domain.Encryptor) error

type DataSource

type DataSource struct {
	Project             project     `json:"project"`
	Owner               owner       `json:"owner"`
	Tags                interface{} `json:"tags"`
	ID                  string      `json:"id"`
	Name                string      `json:"name"`
	EncryptExtracts     string      `json:"encryptExtracts"`
	ContentURL          string      `json:"contentUrl"`
	HasExtracts         bool        `json:"hasExtracts"`
	IsCertified         bool        `json:"isCertified"`
	Type                string      `json:"type"`
	UseRemoteQueryAgent bool        `json:"useRemoteQueryAgent"`
	WebpageURL          string      `json:"webpageUrl"`
}

func (*DataSource) FromDomain

func (d *DataSource) FromDomain(r *domain.Resource) error

func (*DataSource) ToDomain

func (d *DataSource) ToDomain() *domain.Resource

type Flow

type Flow struct {
	Project    project     `json:"project"`
	Owner      owner       `json:"owner"`
	Tags       interface{} `json:"tags"`
	ID         string      `json:"id"`
	Name       string      `json:"name"`
	WebpageURL string      `json:"webpageUrl"`
	FileType   string      `json:"fileType"`
}

func (*Flow) FromDomain

func (f *Flow) FromDomain(r *domain.Resource) error

func (*Flow) ToDomain

func (f *Flow) ToDomain() *domain.Resource

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

type Metric

type Metric struct {
	Project        project        `json:"project"`
	Owner          owner          `json:"owner"`
	Tags           interface{}    `json:"tags"`
	UnderlyingView UnderlyingView `json:"underlyingView"`
	ID             string         `json:"id"`
	Name           string         `json:"name"`
	Description    string         `json:"description"`
	WebpageURL     string         `json:"webpageUrl"`
	Suspended      bool           `json:"suspended"`
}

func (*Metric) FromDomain

func (m *Metric) FromDomain(r *domain.Resource) error

func (*Metric) ToDomain

func (m *Metric) ToDomain() *domain.Resource

type Permission

type Permission struct {
	Name string `json:"name" mapstructure:"name" validate:"required"`
	Type string `json:"type,omitempty" mapstructure:"type"`
}

func (Permission) String

func (p Permission) String() string

type SessionResponse

type SessionResponse struct {
	Credentials responseCredentials `json:"credentials"`
}

type TableauClient

type TableauClient interface {
	GetWorkbooks() ([]*Workbook, error)
	GetFlows() ([]*Flow, error)
	GetDataSources() ([]*DataSource, error)
	GetViews() ([]*View, error)
	GetMetrics() ([]*Metric, error)
	UpdateSiteRole(user, role string) error
	GrantWorkbookAccess(resource *Workbook, user, role string) error
	RevokeWorkbookAccess(resource *Workbook, user, role string) error
	GrantFlowAccess(resource *Flow, user, role string) error
	RevokeFlowAccess(resource *Flow, user, role string) error
	GrantDataSourceAccess(resource *DataSource, user, role string) error
	RevokeDataSourceAccess(resource *DataSource, user, role string) error
	GrantViewAccess(resource *View, user, role string) error
	RevokeViewAccess(resource *View, user, role string) error
	GrantMetricAccess(resource *Metric, user, role string) error
	RevokeMetricAccess(resource *Metric, user, role string) error
}

type UnderlyingView

type UnderlyingView struct {
	ID string `json:"id"`
}

type View

type View struct {
	Project     project     `json:"project"`
	Owner       owner       `json:"owner"`
	Workbook    workbook    `json:"workbook"`
	Tags        interface{} `json:"tags"`
	ID          string      `json:"id"`
	Name        string      `json:"name"`
	ContentURL  string      `json:"contentUrl"`
	ViewUrlName string      `json:"viewUrlName"`
}

func (*View) FromDomain

func (v *View) FromDomain(r *domain.Resource) error

func (*View) ToDomain

func (v *View) ToDomain() *domain.Resource

type Workbook

type Workbook struct {
	Project                project                `json:"project"`
	Owner                  owner                  `json:"owner"`
	Tags                   interface{}            `json:"tags"`
	DataAccelerationConfig dataAccelerationConfig `json:"dataAccelerationConfig"`
	ID                     string                 `json:"id"`
	Name                   string                 `json:"name"`
	ContentURL             string                 `json:"contentUrl"`
	WebpageURL             string                 `json:"webpageUrl"`
	ShowTabs               string                 `json:"showTabs"`
	Size                   string                 `json:"size"`
	CreatedAt              time.Time              `json:"createdAt"`
	UpdatedAt              time.Time              `json:"updatedAt"`
	EncryptExtracts        string                 `json:"encryptExtracts"`
	DefaultViewID          string                 `json:"defaultViewId"`
}

func (*Workbook) FromDomain

func (w *Workbook) FromDomain(r *domain.Resource) error

func (*Workbook) ToDomain

func (w *Workbook) ToDomain() *domain.Resource

Jump to

Keyboard shortcuts

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