engineor / flysystem-runabove
Runabove 的 Flysystem 适配器
v1.0.1
2015-10-31 23:23 UTC
Requires
- php: >=5.4.0
- league/flysystem: ~1.0
- rackspace/php-opencloud: ~1.12
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: ~4.0
This package is auto-updated.
Last update: 2024-09-14 20:09:25 UTC
README
注意:由于 OVH 正在将对象存储从 Runabove 迁移到 OVH 公共云,我们正在迁移此库(并尝试不破坏您现有的代码)。
安装
composer require engineor/flysystem-runabove
用法
请参阅配置部分以获取凭据详细信息。
use Engineor\Flysystem\Runabove; use Engineor\Flysystem\RunaboveAdapter as Adapter; use League\Flysystem\Filesystem; $client = new Runabove([ 'username' => ':username', 'password' => ':password', 'tenantId' => ':tenantId', ]); $store = $client->objectStoreService('swift', 'SBG1'); $container = $store->getContainer('flysystem'); $filesystem = new Filesystem(new Adapter($container));
或者
use Engineor\Flysystem\Runabove; use Engineor\Flysystem\RunaboveAdapter as Adapter; use League\Flysystem\Filesystem; $options = [ 'username' => ':username', 'password' => ':password', 'tenantId' => ':tenantId', 'container' => 'flysystem', 'region' => 'SBG1', ]; $client = new Runabove($options); $filesystem = new Filesystem(new Adapter($client->getContainer()));
配置
要获取所需的凭据,您需要验证并从 Runabove OVH Horizon 站点下载凭据文件
- OVH: https://horizon.cloud.ovh.net/auth/login/?next=/project/access_and_security/api_access/openrc/
- Runabove: https://cloud.runabove.com/horizon/project/access_and_security/api_access/openrc/
然后您将收到一个类似以下内容的文件
OVH 示例
#!/bin/bash # To use an Openstack cloud you need to authenticate against keystone, which # returns a **Token** and **Service Catalog**. The catalog contains the # endpoint for all services the user/tenant has access to - including nova, # glance, keystone, swift. # # *NOTE*: Using the 2.0 *auth api* does not mean that compute api is 2.0. We # will use the 1.1 *compute api* export OS_AUTH_URL=https://auth.cloud.ovh.net/v2.0 # With the addition of Keystone we have standardized on the term **tenant** # as the entity that owns the resources. export OS_TENANT_ID=******************************** export OS_TENANT_NAME="**********" # In addition to the owning entity (tenant), openstack stores the entity # performing the action as the **user**. export OS_USERNAME="**********" # With Keystone you pass the keystone password. echo "Please enter your OpenStack Password: " read -sr OS_PASSWORD_INPUT export OS_PASSWORD=$OS_PASSWORD_INPUT # If your configuration has multiple regions, we set that information here. # OS_REGION_NAME is optional and only valid in certain environments. export OS_REGION_NAME="GRA1" # Don't leave a blank variable, unset it if it was empty if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi
您可以使用以下表格从文件中检索您的 username
和 tenantId
您的用户名和密码是在 OVH 管理界面中创建的,在您的云存储项目中,点击 项目管理和合并
(页面右上角),然后选择 OpenStack
选项卡。一旦您的用户创建,您就可以访问上述链接。
目前有 3 个可用区域(SBG1
、BHS1
和 GRA1
)。
最后,容器 ID 是您要针对的对象存储容器的名称。
Runabove 示例
#!/bin/bash # With the addition of Keystone, to use an openstack cloud you should # authenticate against keystone, which returns a **Token** and **Service # Catalog**. The catalog contains the endpoint for all services the # user/tenant has access to - including nova, glance, keystone, swift. # # *NOTE*: Using the 2.0 *auth api* does not mean that compute api is 2.0. We # will use the 1.1 *compute api* export OS_AUTH_URL=https://auth.runabove.io/v2.0 # With the addition of Keystone we have standardized on the term **tenant** # as the entity that owns the resources. export OS_TENANT_ID=******************************** export OS_TENANT_NAME="**********" # In addition to the owning entity (tenant), openstack stores the entity # performing the action as the **user**. export OS_USERNAME="********@********.***" # With Keystone you pass the keystone password. echo "Please enter your OpenStack Password: " read -sr OS_PASSWORD_INPUT export OS_PASSWORD=$OS_PASSWORD_INPUT
您可以使用以下表格从文件中检索您的 username
和 tenantId
您的密码是您在 Runabove 登录时使用的密码,与 username
电子邮件地址关联。
目前有 3 个可用区域(SBG-1
、BHS-1
和 HZ1
)。由于 HZ1
目前仅适用于特定 VPS 实例,因此此库仅包含 REGION_EUROPE
(SGB-1
)和 REGION_US
(BHS-1
)的常量。
最后,容器 ID 是您要针对的对象存储容器的名称。