rest

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultConfig   *cells_sdk.SdkConfig
	DefaultS3Config *cells_sdk.S3Config

	// Keys to retrieve configuration via environment variables
	KeyURL, KeyClientKey, KeyClientSecret, KeyUser, KeyPassword, KeySkipVerify = "TARGET_URL", "TARGET_CLIENT_KEY", "TARGET_CLIENT_SECRET", "TARGET_USER", "TARGET_PASSWORD", "TARGET_SKIP_VERIFY"

	// Keys to retrieve environment variables to configure a connection to Pydio Cells S3 API
	KeyS3Endpoint, KeyS3Region, KeyS3Bucket, KeyS3ApiKey, KeyS3ApiSecret, KeyS3UsePydioSpecificHeader, KeyS3IsDebug = "TARGET_S3_ENDPOINT", "TARGET_S3_REGION", "TARGET_S3_BUCKET", "TARGET_S3_API_KEY", "TARGET_S3_API_SECRET", "TARGET_S3_USE_PYDIO_SPECIFIC_HEADER", "TARGET_S3_IS_DEBUG"
)

Functions

func ClearKeyring

func ClearKeyring(c *cells_sdk.SdkConfig) error

ClearKeyring removes tokens from local keychain, if they are present

func ConfigFromKeyring

func ConfigFromKeyring(conf *cells_sdk.SdkConfig) error

ConfigFromKeyring tries to find tokens inside local keychain and feed the conf with them

func ConfigToKeyring

func ConfigToKeyring(conf *cells_sdk.SdkConfig) error

ConfigToKeyring tries to store tokens in local keychain and remove them from the conf

func DefaultConfigFilePath

func DefaultConfigFilePath() string

func GetApiClient

func GetApiClient(anonymous ...bool) (context.Context, *client.PydioCellsRest, error)

GetApiClient connects to the Pydio Cells server defined by this config, by sending an authentication request to the OIDC service to get a valid JWT (or taking the JWT from cache). It also returns a context to be used in subsequent requests.

func GetFile

func GetFile(pathToFile string) (io.Reader, int, error)

func GetS3Client

func GetS3Client() (*s3.S3, string, error)

func OAuthExchangeCode

func OAuthExchangeCode(c *cells_sdk.SdkConfig, code, callbackUrl string) error

OAuthExchangeCode gets an OAuth code and retrieves an AccessToken/RefreshToken pair. It updates the passed Conf

func OAuthPrepareUrl

func OAuthPrepareUrl(serverUrl, clientId, clientSecret, state string, browser bool) (redirectUrl string, callbackUrl string, e error)

OAuthPrepareUrl makes a URL that can be opened in browser or copy/pasted by user

func PutFile

func PutFile(pathToFile string, content io.ReadSeeker, checkExists bool) (*s3.PutObjectOutput, error)

func RefreshIfRequired

func RefreshIfRequired(conf *cells_sdk.SdkConfig) (bool, error)

RefreshIfRequired refreshes the token inside the given conf if required

func RetryCallback

func RetryCallback(callback func() error, number int, interval time.Duration) error

RetryCallback implements boiler plate code to easily call the same function until it suceeds or a time-out is reached.

func SetUpEnvironment

func SetUpEnvironment(configFilePath string, s3ConfigFilePath ...string) error

SetUpEnvironment retrieves parameters and stores them in the DefaultConfig of the SDK. configFilePath and s3ConfigFilePath can be <nil> if the parameters are defined via env variables.

func StatNode

func StatNode(pathToFile string) (*models.TreeNode, bool)

Types

This section is empty.

Jump to

Keyboard shortcuts

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