keboola/azure-api-client
最新稳定版本:2.0.0
Composer 安装命令:
composer require keboola/azure-api-client
包简介
Keboola Azure API client
README 文档
README
Installation
composer require keboola/azure-api-client
Usage
The simplest way to use API client is just by creating its instance.
use Keboola\AzureApiClient\ApiClientConfiguration; use Keboola\AzureApiClient\Marketplace\MarketplaceApiClient; use Monolog\Logger; $logger = new Logger('azure-api-client'); $marketplaces = new MarketplaceApiClient(new ClientCredentialsAuth( logger: $logger, ));
Authentication
By default, API client will try to authenticate using ENV variables AZURE_TENANT_ID, AZURE_CLIENT_ID and
AZURE_CLIENT_SECRET. If some of them is not available, it'll fall back to Azure metadata API.
If you want to supply your own credentials, you can pass custom authenticator instance in the client options:
use Keboola\AzureApiClient\ApiClientConfiguration; use Keboola\AzureApiClient\Authentication\Authenticator\ClientCredentialsAuth; use Keboola\AzureApiClient\Marketplace\MarketplaceApiClient; $marketplaces = new MarketplaceApiClient(new ApiClientConfiguration( authenticator: new ClientCredentialsAuth( 'tenant-id', 'client-id', 'client-secret', ), ));
Or can provide custom authentication token directly:
use Keboola\AzureApiClient\ApiClientConfiguration; use Keboola\AzureApiClient\Authentication\Authenticator\StaticBearerTokenAuth; use Keboola\AzureApiClient\Marketplace\MarketplaceApiClient; $marketplaces = new MarketplaceApiClient(new ApiClientConfiguration( authenticator: new StaticBearerTokenAuth('my-token'), ));
Or even use custom authentication header if needed:
use Keboola\AzureApiClient\ApiClientConfiguration; use Keboola\AzureApiClient\Authentication\Authenticator\StaticBearerTokenAuth; use Keboola\AzureApiClient\Marketplace\MarketplaceApiClient; $marketplaces = new MarketplaceApiClient(new ApiClientConfiguration( authenticator: new CustomHeaderAuth('aeg-sas-key', 'XXXXXXXXXXXXXXXXXX0GXXX/nDT4hgdEj9DpBeRr38arnnm5OFg=='), ));
If even this is not enough for your use-case, you can implement your own
Keboola\AzureApiClient\Authentication\Authenticator\RequestAuthenticatorFactoryInterface and pass it as authenticator.
License
MIT licensed, see LICENSE file.
统计信息
- 总下载量: 377
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-02-10