keboola / provisioning-client
Keboola Provisioning Client
Installs: 7 295
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 12
Forks: 0
Open Issues: 0
Requires
- ext-pdo: *
- guzzle/guzzle: ~3.7
- keboola/syrup-php-client: ^5.2
Requires (Dev)
- doctrine/orm: ~2.3.0
- keboola/php-temp: ^2.0.1
- keboola/storage-api-client: ~4.11.0
- phpunit/phpunit: ^8.4
- dev-master
- 7.4.0
- 7.3.0
- 7.2.0
- 7.1.0
- 7.0.1
- 7.0.0
- 6.0.0
- 5.0.0
- 4.1.0
- 4.0.0
- 3.0.1
- 3.0.0
- 2.0.0
- 1.0.1
- 1.0.0
- 0.5.0
- 0.4.6
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.1
- 0.3.0
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1
- dev-dependabot/composer/guzzlehttp/guzzle-6.5.7
- dev-ujovlado-license-and-readme
- dev-dependabot/composer/guzzlehttp/psr7-1.8.5
- dev-piv-input
This package is auto-updated.
Last update: 2022-06-14 08:28:39 UTC
README
Get Credentials from Provisioning API.
Usage
Getting Credentials
If you have already an instance of Storage API client in $storageApi
, then you can get credentials to transformation database with the following call:
$provisioning = new \Keboola\Provisioning\Client('snowflake', $storageApi->getTokenString(), $storageApi->getRunId());
$credentials = $provisioning->getCredentials('transformations');
First argument to Client
constructor is database backend, which may be either snowflake
, mysql
or redshift-workspace
. The $credentials
variable above will contain the following structure:
array (
'id' => 'foo',
'hostname' => 'ACMEdatabseServerAddress',
'db' => 'ACMEDatabse',
'password' => 'ACMEPassword',
'user' => 'Wile.E.Coyote',
'schema' => 'ACMESchema',
)
Resetting Credentials
Resetting credentials is useful when you want to clean up the working schema. Resetting credentials will drop the entire schema and create a new empty one. Resetting credentials does not delete the credentials themselves - i.e. password and user name may remain the same. If you have already an instance of Storage API client in $storageApi
, then you can get credentials to transformation database with the following call:
// get current credentials
$provisioning = new \Keboola\Provisioning\Client('snowflake', $storageApi->getTokenString(), $storageApi->getRunId());
$credentials = $provisioning->getCredentials('transformations');
$provisioning->dropCredentials($credentials['id']);
// get new credentials
$credentials = $provisioning->getCredentials('transformations');
Installation
Library is available as composer package. To start using composer in your project follow these steps:
Install composer
curl -s http://getcomposer.org/installer | php mv ./composer.phar ~/bin/composer # or /usr/local/bin/composer
Create composer.json file in your project root folder:
{ "require": { "php" : ">=5.3.2", "keboola/provisioning-client": "0.3.*" } }
Install package:
composer install
Add autoloader in your bootstrap script:
require 'vendor/autoload.php';
Read more in Composer documentation
Development
Preparation
- Create
.env
file and fill the missing info
PROVISIONING_API_URL=
PROVISIONING_API_TOKEN=
SYRUP_QUEUE_URL=
- Build Docker image
docker-compose build
Tests Execution
Run tests with following command.
docker-compose run --rm tests /code/vendor/bin/phpunit
Please note, for running Docker (RStudio / Jupyter) tests, you need to have async job queue processing running or
run the provisioning:devel:poll-jobs
command of the provisioning-bundle.
License
MIT licensed, see LICENSE file.