tableau

package module
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: MIT Imports: 10 Imported by: 0

README

Tableau Go Client

Simple Tableau client library for Go. This client library used by our internal project to automate users onboarding.

Features

Installation

go get github.com/tiketdatarisal/tableau

Usage

The following samples will assist you to use this library.

import "github.com/tiketdatarisal/tableau"

First you have to configure Tableau client library, fill in Host, Username, Password, and ContentUrl. By default Version will used version 3.10.

cfg := tableau.Config{
	Host:       "https://your-tableau-server.com/",
	Version:    "3.12",
	Username:   "your-user-name",
	Password:   "your-password",
	ContentUrl: "your-content-url",
}

Create a new Tableau client instance.

client, err := tableau.NewClient(cfg)
if err != nil {
	panic(err)
}

You will need to authenticate user before using client library. NOTE: This library will automatically called this method before calling other methods.

err = client.Authentication.SignIn()
if err != nil {
    panic(err)
}

After that you can call other methods that you need. For example to get list of users on current site you can call following method.

users, err := client.UsersGroups.GetUsersOnSite()
if err != nil {
    panic(err)
}

You can browse examples folder for more examples.

Documentation

Index

Constants

View Source
const (
	DefaultVersion = "3.10"
)

Variables

View Source
var (
	ErrInvalidHost                 = errors.New("not a valid host")
	ErrInvalidUsernamePassword     = errors.New("not a valid username or password")
	ErrFailedUnmarshalResponseBody = errors.New("failed to unmarshal response body")
	ErrUnknownError                = errors.New("unknown error")

	ErrBadRequest             = errors.New("the content of the request body is missing or incomplete")
	ErrInvalidPageNumber      = errors.New("invalid page number")
	ErrInvalidPageSize        = errors.New("invalid page size")
	ErrInvalidSiteRole        = errors.New("invalid site role")
	ErrMalformedImportElement = errors.New("malformed import element")
	ErrDeleteFailed           = errors.New("delete failed")
	ErrAddTagsWorkbook        = errors.New("add tags to workbook failed")
	ErrDeleteTagFromWorkbook  = errors.New("delete tag from workbook failed")
	ErrQueryViewImageError    = errors.New("query view image error")
	ErrAddTagsView            = errors.New("add tags to view failed")
	ErrDeleteTagFromView      = errors.New("delete tag from view failed")
	ErrUnsupportedParameter   = errors.New("unsupported parameter")
	ErrDownloadWorkbookPDF    = errors.New("failed to download workbook as PDF")

	ErrNoCredential      = errors.New("no credentials were provided")
	ErrLoginError        = errors.New("the credentials are invalid (wrong username/password) or blocked")
	ErrInvalidCredential = errors.New("invalid credentials were provided")
	ErrSwitchSiteError   = errors.New("cannot switch site; the site might be unavailable or was not found")

	ErrForbidden                    = errors.New("user do not have sufficient permissions")
	ErrActiveDirectoryNotConfigured = errors.New("active directory was not configured")
	ErrPageSizeExceeded             = errors.New("the specified page size in larger than maximum page size")
	ErrQueryWorkbookForbidden       = errors.New("user do not have access to query workbooks")
	ErrImportNameForbidden          = errors.New("imported name element different with referenced group-id")
	ErrReadForbidden                = errors.New("do not have read access to this resource")
	ErrCannotSwitchToSameSite       = errors.New("cannot switch to the same site")
	ErrDownloadPDFDisabled          = errors.New("download PDF was disabled")
	ErrQueryUserForbidden           = errors.New("user does not have permission to query user information")

	ErrSiteNotFound                 = errors.New("site was not found")
	ErrVersionNotFound              = errors.New("invalid version were provided")
	ErrUserNotFound                 = errors.New("user was not found")
	ErrWorkbookNotFound             = errors.New("workbook was not found")
	ErrTagNotFound                  = errors.New("tag was not found")
	ErrWorkbookIDMismatch           = errors.New("workbook id mismatch")
	ErrViewNotFound                 = errors.New("view was not found")
	ErrGroupNotFound                = errors.New("group was not found")
	ErrDomainNotFound               = errors.New("domain was not found")
	ErrActiveDirectoryGroupNotFound = errors.New("active directory group was not found")

	ErrInvalidRequestMethod = errors.New("not a valid request type")

	ErrUserAlreadyOnSite      = errors.New("the specified user already exist on the site")
	ErrUserAssetConflict      = errors.New("user still owns content and cannot be deleted")
	ErrGuestUserNotAllowed    = errors.New("adding user to a site with guest role was not allowed")
	ErrGroupNameAlreadyExists = errors.New("group name already exists")
	ErrUserAlreadyInGroup     = errors.New("the specified user already a member of the group")

	ErrPayloadToLarge = errors.New("request body is too large to process")

	ErrTooManyRequest = errors.New("request limit reached")

	ErrInternalServerError   = errors.New("tableau server error")
	ErrInternalServiceError  = errors.New("tableau service error")
	ErrBroadcastServiceError = errors.New("broadcast service error")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Authentication *authentication
	UsersGroups    *usersGroups
	WorkbooksViews *workbooksViews
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg Config) (*Client, error)

NewClient Initialize a new Tableau client.

func (*Client) GetResponse added in v0.5.0

func (c *Client) GetResponse() *resty.Response

GetResponse return last response object returned by resty.Request.

func (*Client) SetResponse added in v0.5.0

func (c *Client) SetResponse(r resty.Response)

SetResponse set last response object created by resty.Request.

type Config

type Config struct {
	Host       string
	Version    string
	Username   string
	Password   string
	ContentUrl string
}

func (*Config) GetUrl

func (c *Config) GetUrl(paths ...string) string

type Param added in v0.3.0

type Param map[string]any

func (Param) String added in v0.3.0

func (p Param) String() string

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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