提交
This commit is contained in:
37
vendor/alibabacloud/oss-v2/.github/workflows/main.yml
vendored
Normal file
37
vendor/alibabacloud/oss-v2/.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: main
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
phpunit:
|
||||
name: PHPUnit
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
|
||||
steps:
|
||||
- name: Install SASL library on macOS
|
||||
if: matrix.operating-system == 'macos-latest' && matrix.php-version >= 8.5
|
||||
run: brew update && brew install cyrus-sasl
|
||||
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
extensions: bz2, curl, fileinfo, mbstring, exif, openssl, zip
|
||||
coverage: xdebug
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --ansi --prefer-dist --no-interaction --no-progress
|
||||
|
||||
- name: PHPUnit Migrate Configuration
|
||||
if: ${{ matrix.php-version != '7.4' && matrix.php-version != '8.0'}}
|
||||
run: vendor/bin/phpunit --migrate-configuration
|
||||
|
||||
- name: Run PHPUnit
|
||||
run: vendor/bin/phpunit --testsuite UnitTest --fail-on-warning --fail-on-incomplete --fail-on-risky
|
||||
|
||||
|
||||
10
vendor/alibabacloud/oss-v2/.gitignore
vendored
Normal file
10
vendor/alibabacloud/oss-v2/.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
.vscode/
|
||||
.DS_Store
|
||||
vendor/
|
||||
composer.lock
|
||||
.phpunit.result.cache
|
||||
.phpunit.cache
|
||||
coverage.xml
|
||||
phpunit.xml.bak
|
||||
report/
|
||||
*.phar
|
||||
72
vendor/alibabacloud/oss-v2/CHANGELOG.md
vendored
Normal file
72
vendor/alibabacloud/oss-v2/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
# ChangeLog - Alibaba Cloud OSS SDK for PHP v2
|
||||
|
||||
## 版本号:0.4.0 日期:2025-12-25
|
||||
### 变更内容
|
||||
- Feature: Add seal append object api
|
||||
- Feature: Add bucket overwrite config api
|
||||
- Break Change: Change the name and type of LifecycleRuleFilter.not
|
||||
|
||||
## 版本号:0.3.2 日期:2025-11-07
|
||||
### 变更内容
|
||||
- Update: ListBuckets api supports more parameters
|
||||
- Update: Routing rule supports more parameters
|
||||
- Update: Bucket logging supports more parameters
|
||||
- Update: Bucket https configuration supports more parameters
|
||||
- Update: Normalize parameter naming
|
||||
- Fix:Rename bucket request payment class name
|
||||
|
||||
## 版本号:0.3.1 日期:2025-06-13
|
||||
### 变更内容
|
||||
- Update:Meta query api supports more search condition settings
|
||||
- Update:Api-level options supports credentials_provider
|
||||
|
||||
## 版本号:0.3.0 日期:2025-04-24
|
||||
### 变更内容
|
||||
- Feature:Add bucket inventory api
|
||||
- Feature:Add bucket style api
|
||||
- Feature:Add bucket resource group api
|
||||
- Feature:Add bucket https config api
|
||||
- Feature:Add bucket redundancy transition api
|
||||
- Feature:Add list cloud boxes api and add cloud box id param
|
||||
- Feature:Add bucket replication api
|
||||
- Feature:Add access point api
|
||||
|
||||
## 版本号:0.2.1 日期:2025-03-18
|
||||
### 变更内容
|
||||
- Fix:Add a default content-type if possible.
|
||||
- Fix:Use end() to get last error
|
||||
- Fix:Compatibility with php 8.0
|
||||
|
||||
## 版本号:0.2.0 日期:2025-02-27
|
||||
### 变更内容
|
||||
- Feature:Add bucket lifecycle api
|
||||
- Feature:Add bucket bucket transfer acceleration api
|
||||
- Feature:Add bucket policy api
|
||||
- Feature:Add bucket logging api
|
||||
- Feature:Add bucket website api
|
||||
- Feature:Add bucket referer api
|
||||
- Feature:Add bucket tags api
|
||||
- Feature:Add bucket request payment api
|
||||
- Feature:Add bucket cors api
|
||||
- Feature:Add bucket cname api
|
||||
- Feature:Add bucket access monitor api
|
||||
- Feature:Add bucket meta query api
|
||||
- Feature:Add bucket encryption api
|
||||
- Feature:Add bucket archive direct read api
|
||||
- Feature:Add public access block api for oss resource, bucket resource
|
||||
- Update:change guzzlehttp/psr7 version to "^2.7"
|
||||
|
||||
## 版本号:0.1.0 日期:2025-01-03
|
||||
### 变更内容
|
||||
- Feature:Add credentials provider
|
||||
- Feature:Add retryer
|
||||
- Feature:Add signer v4/v1
|
||||
- Feature:Add annotation for 8.x
|
||||
- Feature:Add bucket's basic api
|
||||
- Feature:Add object's api
|
||||
- Feature:Add presigner
|
||||
- Feature:Add paginator
|
||||
- Feature:Add uploader, downloader and copier
|
||||
- Feature:Add encryption client
|
||||
- Feature:Add isObjectExist/isBucketExist api
|
||||
- Feature:Add putObjectFromFile/getObjectToFile api
|
||||
1767
vendor/alibabacloud/oss-v2/DEVGUIDE-CN.md
vendored
Normal file
1767
vendor/alibabacloud/oss-v2/DEVGUIDE-CN.md
vendored
Normal file
File diff suppressed because it is too large
Load Diff
0
vendor/alibabacloud/oss-v2/DEVGUIDE.md
vendored
Normal file
0
vendor/alibabacloud/oss-v2/DEVGUIDE.md
vendored
Normal file
201
vendor/alibabacloud/oss-v2/LICENSE
vendored
Normal file
201
vendor/alibabacloud/oss-v2/LICENSE
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
146
vendor/alibabacloud/oss-v2/README-CN.md
vendored
Normal file
146
vendor/alibabacloud/oss-v2/README-CN.md
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
# Alibaba Cloud OSS SDK for PHP v2
|
||||
|
||||
[](https://badge.fury.io/gh/aliyun%2Falibabacloud-oss-php-sdk-v2)
|
||||
|
||||
alibabacloud-oss-php-sdk-v2 是OSS在PHP编译语言下的第二版SDK
|
||||
|
||||
## [English](README.md)
|
||||
|
||||
## 关于
|
||||
> - 此PHP SDK基于[阿里云对象存储服务](http://www.aliyun.com/product/oss/)官方API构建。
|
||||
> - 阿里云对象存储(Object Storage Service,简称OSS),是阿里云对外提供的海量,安全,低成本,高可靠的云存储服务。
|
||||
> - OSS适合存放任意文件类型,适合各种网站、开发企业及开发者使用。
|
||||
> - 使用此SDK,用户可以方便地在任何应用、任何时间、任何地点上传,下载和管理数据。
|
||||
|
||||
## 运行环境
|
||||
> - PHP 7.4及以上。
|
||||
|
||||
## 安装方法
|
||||
### 通过 composer 安装
|
||||
如果您通过composer管理您的项目依赖,可以在你的项目根目录运行:
|
||||
```bash
|
||||
$ composer require alibabacloud/oss-v2
|
||||
```
|
||||
或者在你的`composer.json`中声明对Alibaba Cloud OSS SDK for PHP v2的依赖:
|
||||
```php
|
||||
"require": {
|
||||
"alibabacloud/oss-v2": "*"
|
||||
}
|
||||
```
|
||||
然后通过`composer install`安装依赖
|
||||
|
||||
### 通过[PHAR 文件](https://github.com/aliyun/alibabacloud-oss-php-sdk-v2/releases)安装
|
||||
```bash
|
||||
require_once '/path/to/alibabacloud-oss-php-sdk-v2-{version}.phar'
|
||||
```
|
||||
|
||||
## 快速使用
|
||||
#### 获取存储空间列表(List Bucket)
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
$region = 'cn-hangzhou';
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
// Create the Paginator for the ListBuckets operation
|
||||
$paginator = new Oss\Paginator\ListBucketsPaginator($client);
|
||||
$iter = $paginator->iterPage(new Oss\Models\ListBucketsRequest());
|
||||
|
||||
// Iterate through the bucket pages
|
||||
foreach ($iter as $page) {
|
||||
foreach ($page->buckets ?? [] as $bucket) {
|
||||
print("Bucket: $bucket->name, $bucket->location\n");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 获取文件列表(List Objects)
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
$region = 'cn-hangzhou';
|
||||
$bucket = 'your bucket name';
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
# Create the Paginator for the ListBuckets operation
|
||||
$paginator = new Oss\Paginator\ListObjectsV2Paginator($client);
|
||||
$iter = $paginator->iterPage(new Oss\Models\ListObjectsV2Request($bucket));
|
||||
|
||||
// Iterate through the object pages
|
||||
foreach ($iter as $page) {
|
||||
foreach ($page->contents ?? [] as $object) {
|
||||
print("Object: $object->key, $object->type, $object->size\n");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 上传文件(Put Object)
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
$region = 'cn-hangzhou';
|
||||
$bucket = 'your bucket name';
|
||||
$key = 'your object name';
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$data = 'Hello OSS';
|
||||
|
||||
$request = new Oss\Models\PutObjectRequest($bucket, $key);
|
||||
$request->body = Oss\Utils::streamFor($data);
|
||||
|
||||
$result = $client->putObject($request);
|
||||
|
||||
printf(
|
||||
'status code:'. $result->statusCode .PHP_EOL.
|
||||
'request id:'. $result->requestId .PHP_EOL.
|
||||
'etag:'. $result->etag. PHP_EOL
|
||||
);
|
||||
```
|
||||
|
||||
## 更多示例
|
||||
请参看`sample`目录
|
||||
|
||||
### 运行示例
|
||||
> - 执行`composer install`下载依赖的库
|
||||
> - 进入示例程序目录 `sample`。
|
||||
> - 通过环境变量,配置访问凭证, `export OSS_ACCESS_KEY_ID="your access key id"`, `export OSS_ACCESS_KEY_SECRET="your access key secrect"`
|
||||
> - 以 ListBuckets.php 为例,执行 `php ListBuckets.php --region cn-hangzhou`。
|
||||
|
||||
## 资源
|
||||
[开发者指南](DEVGUIDE-CN.md) - 参阅该指南,来帮助您安装、配置和使用该开发套件。
|
||||
|
||||
## 许可协议
|
||||
> - Apache-2.0, 请参阅 [许可文件](LICENSE)
|
||||
146
vendor/alibabacloud/oss-v2/README.md
vendored
Normal file
146
vendor/alibabacloud/oss-v2/README.md
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
# Alibaba Cloud OSS SDK for PHP v2
|
||||
|
||||
[](https://badge.fury.io/gh/aliyun%2Falibabacloud-oss-php-sdk-v2)
|
||||
|
||||
alibabacloud-oss-php-sdk-v2 is the v2 of the OSS SDK for the PHP programming language
|
||||
|
||||
## [简体中文](README-CN.md)
|
||||
|
||||
## About
|
||||
> - This PHP SDK is based on the official APIs of [Alibaba Cloud OSS](http://www.aliyun.com/product/oss/).
|
||||
> - Alibaba Cloud Object Storage Service (OSS) is a cloud storage service provided by Alibaba Cloud, featuring massive capacity, security, a low cost, and high reliability.
|
||||
> - The OSS can store any type of files and therefore applies to various websites, development enterprises and developers.
|
||||
> - With this SDK, you can upload, download and manage data on any app anytime and anywhere conveniently.
|
||||
|
||||
## Running Environment
|
||||
> - PHP 7.4 or above.
|
||||
|
||||
## Installing
|
||||
### Install the sdk through composer
|
||||
If you use the composer to manage project dependencies, run the following command in your project's root directory:
|
||||
```bash
|
||||
$ composer require alibabacloud/oss-v2
|
||||
```
|
||||
You can also declare the dependency on Alibaba Cloud OSS SDK for PHP v2 in the composer.json file.
|
||||
```json
|
||||
"require": {
|
||||
"alibabacloud/oss-v2": "*"
|
||||
}
|
||||
```
|
||||
|
||||
### Install from the [PHAR File](https://github.com/aliyun/alibabacloud-oss-php-sdk-v2/releases) directly
|
||||
```bash
|
||||
$ require_once '/path/to/alibabacloud-oss-php-sdk-v2-{version}.phar'
|
||||
```
|
||||
|
||||
|
||||
## Getting Started
|
||||
#### List Bucket
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
$region = 'cn-hangzhou';
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
// Create the Paginator for the ListBuckets operation
|
||||
$paginator = new Oss\Paginator\ListBucketsPaginator($client);
|
||||
$iter = $paginator->iterPage(new Oss\Models\ListBucketsRequest());
|
||||
|
||||
// Iterate through the bucket pages
|
||||
foreach ($iter as $page) {
|
||||
foreach ($page->buckets ?? [] as $bucket) {
|
||||
print("Bucket: $bucket->name, $bucket->location\n");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### List Objects
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
$region = 'cn-hangzhou';
|
||||
$bucket = 'your bucket name';
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
# Create the Paginator for the ListBuckets operation
|
||||
$paginator = new Oss\Paginator\ListObjectsV2Paginator($client);
|
||||
$iter = $paginator->iterPage(new Oss\Models\ListObjectsV2Request($bucket));
|
||||
|
||||
// Iterate through the object pages
|
||||
foreach ($iter as $page) {
|
||||
foreach ($page->contents ?? [] as $object) {
|
||||
print("Object: $object->key, $object->type, $object->size\n");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Put Object
|
||||
```php
|
||||
<?php
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
$region = 'cn-hangzhou';
|
||||
$bucket = 'your bucket name';
|
||||
$key = 'your object name';
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$data = 'Hello OSS';
|
||||
|
||||
$request = new Oss\Models\PutObjectRequest($bucket, $key);
|
||||
$request->body = Oss\Utils::streamFor($data);
|
||||
|
||||
$result = $client->putObject($request);
|
||||
|
||||
printf(
|
||||
'status code:'. $result->statusCode .PHP_EOL.
|
||||
'request id:'. $result->requestId .PHP_EOL.
|
||||
'etag:'. $result->etag. PHP_EOL
|
||||
);
|
||||
```
|
||||
|
||||
## Complete Example
|
||||
More example projects can be found in the `sample` folder
|
||||
|
||||
### Running Example
|
||||
> - Run `composer install` to download the dependent libraries.
|
||||
> - Go to the sample code folder `sample`。
|
||||
> - Configure credentials values from the environment variables, like `export OSS_ACCESS_KEY_ID="your access key id"`, `export OSS_ACCESS_KEY_SECRET="your access key secrect"`
|
||||
> - Take ListBuckets.php as an example,run `php ListBuckets.php --region cn-hangzhou` command。
|
||||
|
||||
## Resources
|
||||
[Developer Guide](DEVGUIDE-CN.md) - Use this document to learn how to get started and use this sdk.
|
||||
|
||||
## License
|
||||
> - Apache-2.0, see [license file](LICENSE)
|
||||
11
vendor/alibabacloud/oss-v2/autoload.php
vendored
Normal file
11
vendor/alibabacloud/oss-v2/autoload.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
function classLoader($class)
|
||||
{
|
||||
$path = str_replace('\\', DIRECTORY_SEPARATOR, $class);
|
||||
$file = __DIR__ . DIRECTORY_SEPARATOR .'src'. DIRECTORY_SEPARATOR . $path . '.php';
|
||||
if (file_exists($file)) {
|
||||
require_once $file;
|
||||
}
|
||||
}
|
||||
spl_autoload_register('classLoader');
|
||||
30
vendor/alibabacloud/oss-v2/composer.json
vendored
Normal file
30
vendor/alibabacloud/oss-v2/composer.json
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "alibabacloud/oss-v2",
|
||||
"description": "Aliyun OSS SDK for PHP v2",
|
||||
"homepage": "https://github.com/aliyun/alibabacloud-oss-php-sdk-v2",
|
||||
"type": "library",
|
||||
"license": "Apache-2.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alibaba Cloud OSS SDK",
|
||||
"email": "sdk-team@alibabacloud.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"ext-simplexml": "*",
|
||||
"ext-json": "*",
|
||||
"psr/http-message": "^1.0 || ^2.0",
|
||||
"guzzlehttp/guzzle": "^6.5.8 || ^7.4.5",
|
||||
"guzzlehttp/psr7": "^2.7",
|
||||
"guzzlehttp/promises": "^1.4.0 || ^2.0"
|
||||
},
|
||||
"require-dev" : {
|
||||
"phpunit/phpunit": "*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"AlibabaCloud\\Oss\\V2\\": "src"
|
||||
}
|
||||
}
|
||||
}
|
||||
3
vendor/alibabacloud/oss-v2/index.php
vendored
Normal file
3
vendor/alibabacloud/oss-v2/index.php
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
46
vendor/alibabacloud/oss-v2/phpunit.xml
vendored
Normal file
46
vendor/alibabacloud/oss-v2/phpunit.xml
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xml>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.2/phpunit.xsd">
|
||||
<coverage>
|
||||
<include>
|
||||
<directory suffix=".php">src</directory>
|
||||
</include>
|
||||
<report>
|
||||
<clover outputFile="coverage.xml"/>
|
||||
</report>
|
||||
</coverage>
|
||||
<logging/>
|
||||
<testsuites>
|
||||
<testsuite name="UnitTest">
|
||||
<!-- for 7.x -->
|
||||
<directory phpVersion="8.0.0" phpVersionOperator="lt">./tests/UnitTests/Exception</directory>
|
||||
<directory phpVersion="8.0.0" phpVersionOperator="lt">./tests/UnitTests/Retry</directory>
|
||||
<directory phpVersion="8.0.0" phpVersionOperator="lt">./tests/UnitTests/Signer</directory>
|
||||
<directory phpVersion="8.0.0" phpVersionOperator="lt">./tests/UnitTests/Types</directory>
|
||||
<directory phpVersion="8.0.0" phpVersionOperator="lt">./tests/UnitTests/Crypto</directory>
|
||||
<directory phpVersion="8.0.0" phpVersionOperator="lt">./tests/UnitTests/Credentials</directory>
|
||||
<file phpVersion="8.0.0" phpVersionOperator="lt">./tests/UnitTests/ClientImplTest.php</file>
|
||||
<file phpVersion="8.0.0" phpVersionOperator="lt">./tests/UnitTests/UtilsTest.php</file>
|
||||
<file phpVersion="8.0.0" phpVersionOperator="lt">./tests/UnitTests/ValidationTest.php</file>
|
||||
<file phpVersion="8.0.0" phpVersionOperator="lt">./tests/UnitTests/Transform/BucketBasicTest.php</file>
|
||||
<file phpVersion="8.0.0" phpVersionOperator="lt">./tests/UnitTests/Transform/FunctionsTest.php</file>
|
||||
<file phpVersion="8.0.0" phpVersionOperator="lt">./tests/UnitTests/Transform/ObjectMultipartTest.php</file>
|
||||
<file phpVersion="8.0.0" phpVersionOperator="lt">./tests/UnitTests/Transform/ObjectBasicTest.php</file>
|
||||
<!-- for 8.x -->
|
||||
<directory phpVersion="8.0.0">./tests/UnitTests/</directory>
|
||||
</testsuite>
|
||||
<testsuite name="IntegrationTests">
|
||||
<!-- for 7.x -->
|
||||
<file phpVersion="8.0.0" phpVersionOperator="lt">./tests/IntegrationTests/ClientBucketBasicTest.php</file>
|
||||
<file phpVersion="8.0.0" phpVersionOperator="lt">./tests/IntegrationTests/ClientObjectMultipartTest.php</file>
|
||||
<file phpVersion="8.0.0" phpVersionOperator="lt">./tests/IntegrationTests/ClientMiscTest.php</file>
|
||||
<file phpVersion="8.0.0" phpVersionOperator="lt">./tests/IntegrationTests/ClientExtensionTest.php</file>
|
||||
<file phpVersion="8.0.0" phpVersionOperator="lt">./tests/IntegrationTests/ClientObjectBasicTest.php</file>
|
||||
<file phpVersion="8.0.0" phpVersionOperator="lt">./tests/IntegrationTests/ClientPaginatorTest.php</file>
|
||||
<file phpVersion="8.0.0" phpVersionOperator="lt">./tests/IntegrationTests/ClientPresignerTest.php</file>
|
||||
<file phpVersion="8.0.0" phpVersionOperator="lt">./tests/IntegrationTests/EncryptionClientTest.php</file>
|
||||
<!-- for 8.x -->
|
||||
<directory phpVersion="8.0.0">./tests/IntegrationTests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
45
vendor/alibabacloud/oss-v2/sample/AbortBucketWorm.php
vendored
Normal file
45
vendor/alibabacloud/oss-v2/sample/AbortBucketWorm.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\AbortBucketWormRequest($bucket);
|
||||
$result = $client->abortBucketWorm($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
50
vendor/alibabacloud/oss-v2/sample/AbortMultipartUpload.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/AbortMultipartUpload.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
"upload-id" => ['help' => 'The upload id', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
$uploadId = $options["upload-id"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\AbortMultipartUploadRequest($bucket, $key);
|
||||
$request->uploadId = $uploadId;
|
||||
$result = $client->abortMultipartUpload($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
54
vendor/alibabacloud/oss-v2/sample/AppendObject.php
vendored
Normal file
54
vendor/alibabacloud/oss-v2/sample/AppendObject.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$data = 'Hello Append Object';
|
||||
|
||||
$request = new Oss\Models\AppendObjectRequest($bucket, $key);
|
||||
$request->body = Oss\Utils::streamFor($data);
|
||||
$request->position = 0;
|
||||
|
||||
$result = $client->appendObject($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
59
vendor/alibabacloud/oss-v2/sample/AsyncProcessObject.php
vendored
Normal file
59
vendor/alibabacloud/oss-v2/sample/AsyncProcessObject.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$style = "video/convert,f_avi,vcodec_h265,s_1920x1080,vb_2000000,fps_30,acodec_aac,ab_100000,sn_1";
|
||||
$process = sprintf("%s|sys/saveas,b_%s,o_%s",
|
||||
$style,
|
||||
rtrim(base64_encode($bucket), '='),
|
||||
rtrim(base64_encode($key), '=')
|
||||
);
|
||||
|
||||
$request = new Oss\Models\AsyncProcessObjectRequest($bucket, $key);
|
||||
$request->process = $process;
|
||||
|
||||
$result = $client->asyncProcessObject($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'async process result:' . var_export($result, true)
|
||||
);
|
||||
49
vendor/alibabacloud/oss-v2/sample/CleanRestoredObject.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/CleanRestoredObject.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\CleanRestoredObjectRequest($bucket, $key);
|
||||
$result = $client->cleanRestoredObject($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
45
vendor/alibabacloud/oss-v2/sample/CloseMetaQuery.php
vendored
Normal file
45
vendor/alibabacloud/oss-v2/sample/CloseMetaQuery.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new \AlibabaCloud\Oss\V2\Models\CloseMetaQueryRequest($bucket);
|
||||
$result = $client->closeMetaQuery($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
125
vendor/alibabacloud/oss-v2/sample/CompleteMultipartUpload.php
vendored
Normal file
125
vendor/alibabacloud/oss-v2/sample/CompleteMultipartUpload.php
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
"upload-id" => ['help' => 'The upload id', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
$uploadId = $options["upload-id"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\UploadPartRequest($bucket, $key);
|
||||
$bigFileName = "upload.tmp";
|
||||
$partSize = 200 * 1024;
|
||||
generateFile($bigFileName, 500 * 1024);
|
||||
$file = fopen($bigFileName, 'r');
|
||||
$parts = array();
|
||||
if ($file) {
|
||||
$i = 1;
|
||||
while (!feof($file)) {
|
||||
$chunk = fread($file, $partSize);
|
||||
$partResult = $client->uploadPart(
|
||||
new Oss\Models\UploadPartRequest(
|
||||
$bucket,
|
||||
$key,
|
||||
$i,
|
||||
$uploadId,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
Oss\Utils::streamFor($chunk)
|
||||
)
|
||||
);
|
||||
$part = new Oss\Models\UploadPart(
|
||||
$i,
|
||||
$partResult->etag,
|
||||
);
|
||||
array_push($parts, $part);
|
||||
$i++;
|
||||
}
|
||||
fclose($file);
|
||||
}
|
||||
$comResult = $client->completeMultipartUpload(
|
||||
new Oss\Models\CompleteMultipartUploadRequest(
|
||||
$bucket,
|
||||
$key,
|
||||
$uploadId,
|
||||
null,
|
||||
new Oss\Models\CompleteMultipartUpload(
|
||||
$parts
|
||||
),
|
||||
)
|
||||
);
|
||||
unlink($bigFileName);
|
||||
printf(
|
||||
'status code:' . $comResult->statusCode . PHP_EOL .
|
||||
'request id:' . $comResult->requestId . PHP_EOL .
|
||||
'complete multipart upload result:' . var_export($comResult, true)
|
||||
);
|
||||
|
||||
function generateFile($filename, $size)
|
||||
{
|
||||
if (
|
||||
file_exists($filename) &&
|
||||
$size == sprintf('%u', filesize($filename))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
$part_size = 32;
|
||||
$fp = fopen($filename, "w");
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
|
||||
$charactersLength = strlen($characters);
|
||||
if ($fp) {
|
||||
while ($size > 0) {
|
||||
if ($size < $part_size) {
|
||||
$write_size = $size;
|
||||
} else {
|
||||
$write_size = $part_size;
|
||||
}
|
||||
$size -= $write_size;
|
||||
$a = $characters[rand(0, $charactersLength - 1)];
|
||||
$content = str_repeat($a, $write_size);
|
||||
$flag = fwrite($fp, $content);
|
||||
if (!$flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
120
vendor/alibabacloud/oss-v2/sample/Copier.php
vendored
Normal file
120
vendor/alibabacloud/oss-v2/sample/Copier.php
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
"src-key" => ['help' => 'The name of the source object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
$srcKey = $options["src-key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$copier = $client->newCopier();
|
||||
|
||||
// case 1, empty metadata & tagging
|
||||
$dstKey = "multipart-copy-repalce-empty-metadata-and-tagging-$key.js";
|
||||
$copyRequest = new Oss\Models\CopyObjectRequest(
|
||||
$bucket,
|
||||
$dstKey,
|
||||
$bucket,
|
||||
$srcKey
|
||||
);
|
||||
$copyRequest->metadataDirective = 'REPLACE';
|
||||
$copyRequest->taggingDirective = 'REPLACE';
|
||||
$result = $copier->copy(
|
||||
$copyRequest,
|
||||
[
|
||||
'multipart_copy_threshold' => 0,
|
||||
'disable_shallow_copy' => true
|
||||
]
|
||||
);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL
|
||||
);
|
||||
|
||||
// case 2, has metadata & tagging
|
||||
$dstKey = "multipart-copy-repalce-metadata-and-tagging-$key.js";
|
||||
$copyRequest = new Oss\Models\CopyObjectRequest(
|
||||
$bucket,
|
||||
$dstKey,
|
||||
$bucket,
|
||||
$srcKey
|
||||
);
|
||||
$copyRequest->metadataDirective = 'REPLACE';
|
||||
$copyRequest->taggingDirective = 'REPLACE';
|
||||
$copyRequest->contentType = 'text/txt';
|
||||
$copyRequest->cacheControl = 'cache-123';
|
||||
$copyRequest->contentDisposition = 'contentDisposition';
|
||||
$copyRequest->expires = '123';
|
||||
$copyRequest->metadata = ['test1' => 'val1', 'test2' => 'value2'];
|
||||
$copyRequest->tagging = 'k3=v3&k4=v4';
|
||||
$result = $copier->copy(
|
||||
$copyRequest,
|
||||
[
|
||||
'multipart_copy_threshold' => 0,
|
||||
'disable_shallow_copy' => true
|
||||
]
|
||||
);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL
|
||||
);
|
||||
|
||||
// multipart copy, 'copy' directive
|
||||
$copyRequest = new Oss\Models\CopyObjectRequest(
|
||||
$bucket,
|
||||
$dstKey,
|
||||
$bucket,
|
||||
$srcKey
|
||||
);
|
||||
$copyRequest->contentType = 'text/txt';
|
||||
$copyRequest->cacheControl = 'cache-123';
|
||||
$copyRequest->contentDisposition = 'contentDisposition';
|
||||
$copyRequest->expires = '123';
|
||||
$copyRequest->metadata = ['test1' => 'val1', 'test2' => 'value2'];
|
||||
$copyRequest->tagging = 'k3=v3&k4=v4';
|
||||
$result = $copier->copy(
|
||||
$copyRequest,
|
||||
[
|
||||
'multipart_copy_threshold' => 0,
|
||||
'disable_shallow_copy' => true
|
||||
]
|
||||
);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
57
vendor/alibabacloud/oss-v2/sample/CopyObject.php
vendored
Normal file
57
vendor/alibabacloud/oss-v2/sample/CopyObject.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
"src-bucket" => ['help' => 'The name of the source bucket', 'required' => False],
|
||||
"src-key" => ['help' => 'The name of the source object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
$srcKey = $options["src-key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\CopyObjectRequest($bucket, $key);
|
||||
if (!empty($options["src-bucket"])) {
|
||||
$request->sourceBucket = $options["src-bucket"];
|
||||
}
|
||||
$request->sourceKey = $srcKey;
|
||||
|
||||
$result = $client->copyObject($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
52
vendor/alibabacloud/oss-v2/sample/CreateAccessPoint.php
vendored
Normal file
52
vendor/alibabacloud/oss-v2/sample/CreateAccessPoint.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$accessPointName = 'ap-01';
|
||||
$config = new Oss\Models\CreateAccessPointConfiguration();
|
||||
$config->accessPointName = $accessPointName;
|
||||
$config->networkOrigin = 'internet';
|
||||
$request = new Oss\Models\CreateAccessPointRequest($bucket, $config);
|
||||
$result = $client->createAccessPoint($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'create access point:' . var_export($result->createAccessPoint, true)
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/CreateBucketDataRedundancyTransition.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/CreateBucketDataRedundancyTransition.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\CreateBucketDataRedundancyTransitionRequest($bucket, 'ZRS');
|
||||
$result = $client->createBucketDataRedundancyTransition($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'task id:' . $result->bucketDataRedundancyTransition->taskId
|
||||
);
|
||||
51
vendor/alibabacloud/oss-v2/sample/CreateCnameToken.php
vendored
Normal file
51
vendor/alibabacloud/oss-v2/sample/CreateCnameToken.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\CreateCnameTokenRequest($bucket, new Oss\Models\BucketCnameConfiguration(
|
||||
new Oss\Models\Cname(
|
||||
'example.com'
|
||||
)
|
||||
));
|
||||
$result = $client->createCnameToken($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'cname token:' . var_export($result->cnameToken, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/DeleteAccessPoint.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/DeleteAccessPoint.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$accessPointName = 'ap-01';
|
||||
$request = new Oss\Models\DeleteAccessPointRequest($bucket, $accessPointName);
|
||||
$result = $client->deleteAccessPoint($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucket.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucket.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\DeleteBucketRequest($bucket);
|
||||
$result = $client->deleteBucket($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketCors.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketCors.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketCorsRequest($bucket);
|
||||
$result = $client->deleteBucketCors($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketDataRedundancyTransition.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketDataRedundancyTransition.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"task-id" => ['help' => 'The Id of the redundancy change task.', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$taskId = $options["task-id"];
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketDataRedundancyTransitionRequest($bucket, $taskId);
|
||||
$result = $client->deleteBucketDataRedundancyTransition($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketEncryption.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketEncryption.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketEncryptionRequest($bucket);
|
||||
$result = $client->deleteBucketEncryption($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
50
vendor/alibabacloud/oss-v2/sample/DeleteBucketInventory.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/DeleteBucketInventory.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$inventoryId = 'test-inventory-id';
|
||||
$request = new Oss\Models\DeleteBucketInventoryRequest(
|
||||
$bucket,
|
||||
inventoryId: $inventoryId
|
||||
);
|
||||
$result = $client->deleteBucketInventory($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketLifecycle.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketLifecycle.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketLifecycleRequest($bucket);
|
||||
$result = $client->deleteBucketLifecycle($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketLogging.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketLogging.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketLoggingRequest($bucket);
|
||||
$result = $client->deleteBucketLogging($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketOverwrite.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketOverwrite.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketOverwriteConfigRequest($bucket);
|
||||
$result = $client->deleteBucketOverwriteConfig($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketPolicy.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketPolicy.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketPolicyRequest($bucket);
|
||||
$result = $client->deleteBucketPolicy($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL
|
||||
);
|
||||
|
||||
46
vendor/alibabacloud/oss-v2/sample/DeleteBucketPublicAccessBlock.php
vendored
Normal file
46
vendor/alibabacloud/oss-v2/sample/DeleteBucketPublicAccessBlock.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketPublicAccessBlockRequest($bucket);
|
||||
$result = $client->deleteBucketPublicAccessBlock($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
51
vendor/alibabacloud/oss-v2/sample/DeleteBucketReplication.php
vendored
Normal file
51
vendor/alibabacloud/oss-v2/sample/DeleteBucketReplication.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
use AlibabaCloud\Oss\V2\Models\LifecycleConfiguration;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"rule-id" => ['help' => 'The replication rule id of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$ruleId = $options["rule-id"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketReplicationRequest($bucket, replicationRules: new Oss\Models\ReplicationRules(
|
||||
ids: [$ruleId]
|
||||
));
|
||||
$result = $client->deleteBucketReplication($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketTags.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketTags.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketTagsRequest($bucket);
|
||||
$result = $client->deleteBucketTags($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketWebsite.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketWebsite.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketWebsiteRequest($bucket);
|
||||
$result = $client->deleteBucketWebsite($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
50
vendor/alibabacloud/oss-v2/sample/DeleteCname.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/DeleteCname.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteCnameRequest($bucket, new Oss\Models\BucketCnameConfiguration(
|
||||
new Oss\Models\Cname(
|
||||
'example.com'
|
||||
)
|
||||
));
|
||||
$result = $client->deleteCname($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
57
vendor/alibabacloud/oss-v2/sample/DeleteMultipleObjects.php
vendored
Normal file
57
vendor/alibabacloud/oss-v2/sample/DeleteMultipleObjects.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"keys" => ['help' => 'The name of the objects', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$keys = $options["keys"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\DeleteMultipleObjectsRequest($bucket);
|
||||
$objects = explode(',', $keys);
|
||||
$deleteObjects = [];
|
||||
foreach ($objects as $key => $object) {
|
||||
$deleteObjects[] = new Oss\Models\DeleteObject($object);
|
||||
}
|
||||
$request->objects = $deleteObjects;
|
||||
|
||||
$result = $client->deleteMultipleObjects($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'deleted objects' . var_export($result->deletedObjects, true)
|
||||
);
|
||||
50
vendor/alibabacloud/oss-v2/sample/DeleteObject.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/DeleteObject.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\DeleteObjectRequest($bucket, $key);
|
||||
|
||||
$result = $client->deleteObject($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
46
vendor/alibabacloud/oss-v2/sample/DeleteObjectTagging.php
vendored
Normal file
46
vendor/alibabacloud/oss-v2/sample/DeleteObjectTagging.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteObjectTaggingRequest($bucket, $key);
|
||||
$result = $client->deleteObjectTagging($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
44
vendor/alibabacloud/oss-v2/sample/DeletePublicAccessBlock.php
vendored
Normal file
44
vendor/alibabacloud/oss-v2/sample/DeletePublicAccessBlock.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeletePublicAccessBlockRequest();
|
||||
$result = $client->deletePublicAccessBlock($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
49
vendor/alibabacloud/oss-v2/sample/DeleteStyle.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/DeleteStyle.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteStyleRequest(
|
||||
$bucket,
|
||||
styleName: 'test',
|
||||
);
|
||||
$result = $client->deleteStyle($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
46
vendor/alibabacloud/oss-v2/sample/DeleteUserDefinedLogFieldsConfig.php
vendored
Normal file
46
vendor/alibabacloud/oss-v2/sample/DeleteUserDefinedLogFieldsConfig.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteUserDefinedLogFieldsConfigRequest($bucket);
|
||||
$result = $client->deleteUserDefinedLogFieldsConfig($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/DeletetAccessPointPolicy.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/DeletetAccessPointPolicy.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$accessPointName = 'ap-01';
|
||||
$request = new Oss\Models\DeleteAccessPointPolicyRequest($bucket, $accessPointName);
|
||||
$result = $client->deleteAccessPointPolicy($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
46
vendor/alibabacloud/oss-v2/sample/DescribeRegions.php
vendored
Normal file
46
vendor/alibabacloud/oss-v2/sample/DescribeRegions.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\DescribeRegionsRequest();
|
||||
|
||||
$result = $client->describeRegions($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
80
vendor/alibabacloud/oss-v2/sample/DoMetaQuery.php
vendored
Normal file
80
vendor/alibabacloud/oss-v2/sample/DoMetaQuery.php
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
// case 1:meta search
|
||||
$request = new \AlibabaCloud\Oss\V2\Models\DoMetaQueryRequest($bucket, new \AlibabaCloud\Oss\V2\Models\MetaQuery(
|
||||
maxResults: 5,
|
||||
query: "{'Field': 'Size','Value': '1048576','Operation': 'gt'}",
|
||||
sort: 'Size',
|
||||
order: \AlibabaCloud\Oss\V2\Models\MetaQueryOrderType::ASC,
|
||||
aggregations: new \AlibabaCloud\Oss\V2\Models\MetaQueryAggregations(
|
||||
[
|
||||
new \AlibabaCloud\Oss\V2\Models\MetaQueryAggregation(
|
||||
field: 'Size',
|
||||
operation: 'sum'
|
||||
),
|
||||
new \AlibabaCloud\Oss\V2\Models\MetaQueryAggregation(
|
||||
field: 'Size',
|
||||
operation: 'max'
|
||||
),
|
||||
]
|
||||
),
|
||||
));
|
||||
$result = $client->doMetaQuery($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
|
||||
// case 2: ai search
|
||||
/*$request = new Oss\Models\DoMetaQueryRequest($bucket, new Oss\Models\MetaQuery(
|
||||
maxResults: 99,
|
||||
query: "Overlook the snow-covered forest",
|
||||
mediaTypes: new Oss\Models\MetaQueryMediaTypes('image'),
|
||||
simpleQuery: '{"Operation":"gt", "Field": "Size", "Value": "30"}',
|
||||
), 'semantic');
|
||||
|
||||
$result = $client->doMetaQuery($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);*/
|
||||
71
vendor/alibabacloud/oss-v2/sample/Downloader.php
vendored
Normal file
71
vendor/alibabacloud/oss-v2/sample/Downloader.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$downloader = $client->newDownloader();
|
||||
|
||||
// download to
|
||||
$stream = new \GuzzleHttp\Psr7\BufferStream(1 * 1024 * 1024);
|
||||
$result = $downloader->downloadTo(
|
||||
new Oss\Models\GetObjectRequest(
|
||||
$bucket,
|
||||
$key
|
||||
),
|
||||
$stream,
|
||||
);
|
||||
printf(
|
||||
'download to body:' . $stream->getContents() . PHP_EOL
|
||||
);
|
||||
|
||||
// download file
|
||||
$filename = "download.tmp";
|
||||
touch($filename);
|
||||
$result = $downloader->downloadFile(
|
||||
new Oss\Models\GetObjectRequest(
|
||||
$bucket,
|
||||
$key
|
||||
),
|
||||
$filename,
|
||||
);
|
||||
printf(
|
||||
'download file body:' . file_get_contents($filename)
|
||||
);
|
||||
unlink($filename);
|
||||
172
vendor/alibabacloud/oss-v2/sample/EncryptionClient.php
vendored
Normal file
172
vendor/alibabacloud/oss-v2/sample/EncryptionClient.php
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
const RSA_PUBLIC_KEY = <<<BBB
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCokfiAVXXf5ImFzKDw+XO/UByW
|
||||
6mse2QsIgz3ZwBtMNu59fR5zttSx+8fB7vR4CN3bTztrP9A6bjoN0FFnhlQ3vNJC
|
||||
5MFO1PByrE/MNd5AAfSVba93I6sx8NSk5MzUCA4NJzAUqYOEWGtGBcom6kEF6MmR
|
||||
1EKib1Id8hpooY5xaQIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
BBB;
|
||||
|
||||
const RSA_PRIVATE_KEY = <<<BBB
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAKiR+IBVdd/kiYXM
|
||||
oPD5c79QHJbqax7ZCwiDPdnAG0w27n19HnO21LH7x8Hu9HgI3dtPO2s/0DpuOg3Q
|
||||
UWeGVDe80kLkwU7U8HKsT8w13kAB9JVtr3cjqzHw1KTkzNQIDg0nMBSpg4RYa0YF
|
||||
yibqQQXoyZHUQqJvUh3yGmihjnFpAgMBAAECgYA49RmCQ14QyKevDfVTdvYlLmx6
|
||||
kbqgMbYIqk+7w611kxoCTMR9VMmJWgmk/Zic9mIAOEVbd7RkCdqT0E+xKzJJFpI2
|
||||
ZHjrlwb21uqlcUqH1Gn+wI+jgmrafrnKih0kGucavr/GFi81rXixDrGON9KBE0FJ
|
||||
cPVdc0XiQAvCBnIIAQJBANXu3htPH0VsSznfqcDE+w8zpoAJdo6S/p30tcjsDQnx
|
||||
l/jYV4FXpErSrtAbmI013VYkdJcghNSLNUXppfk2e8UCQQDJt5c07BS9i2SDEXiz
|
||||
byzqCfXVzkdnDj9ry9mba1dcr9B9NCslVelXDGZKvQUBqNYCVxg398aRfWlYDTjU
|
||||
IoVVAkAbTyjPN6R4SkC4HJMg5oReBmvkwFCAFsemBk0GXwuzD0IlJAjXnAZ+/rIO
|
||||
ItewfwXIL1Mqz53lO/gK+q6TR585AkB304KUIoWzjyF3JqLP3IQOxzns92u9EV6l
|
||||
V2P+CkbMPXiZV6sls6I4XppJXX2i3bu7iidN3/dqJ9izQK94fMU9AkBZvgsIPCot
|
||||
y1/POIbv9LtnviDKrmpkXgVQSU4BmTPvXwTJm8APC7P/horSh3SVf1zgmnsyjm9D
|
||||
hO92gGc+4ajL
|
||||
-----END PRIVATE KEY-----
|
||||
BBB;
|
||||
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$masterCipher = new Oss\Crypto\MasterRsaCipher(
|
||||
RSA_PUBLIC_KEY,
|
||||
RSA_PRIVATE_KEY,
|
||||
['tag' => 'value']
|
||||
);
|
||||
|
||||
$eclient = new Oss\EncryptionClient($client, $masterCipher);
|
||||
|
||||
// case 1: Simple Upload
|
||||
$putObjRequest = new Oss\Models\PutObjectRequest($bucket, $key);
|
||||
$putObjResult = $eclient->putObject($putObjRequest);
|
||||
printf(
|
||||
'put object status code:' . $putObjResult->statusCode . PHP_EOL .
|
||||
'request id:' . $putObjResult->requestId . PHP_EOL
|
||||
);
|
||||
|
||||
// case 2: Multipart Upload
|
||||
$initRequest = new Oss\Models\InitiateMultipartUploadRequest($bucket, $key);
|
||||
$initRequest->cseDataSize = 500 * 1024;
|
||||
$initRequest->csePartSize = 200 * 1024;
|
||||
$initResult = $eclient->initiateMultipartUpload($initRequest);
|
||||
$uploadPartRequest = new Oss\Models\UploadPartRequest($bucket, $key);
|
||||
$bigFileName = "upload.tmp";
|
||||
$partSize = 200 * 1024;
|
||||
generateFile($bigFileName, 500 * 1024);
|
||||
$file = fopen($bigFileName, 'r');
|
||||
$parts = array();
|
||||
if ($file) {
|
||||
$i = 1;
|
||||
while (!feof($file)) {
|
||||
$chunk = fread($file, $partSize);
|
||||
$uploadPartRequest = new Oss\Models\UploadPartRequest(
|
||||
$bucket,
|
||||
$key,
|
||||
$i,
|
||||
$initResult->uploadId,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
Oss\Utils::streamFor($chunk)
|
||||
);
|
||||
$uploadPartRequest->encryptionMultipartContext = $initResult->encryptionMultipartContext;
|
||||
$partResult = $eclient->uploadPart($uploadPartRequest);
|
||||
$part = new Oss\Models\UploadPart(
|
||||
$i,
|
||||
$partResult->etag,
|
||||
);
|
||||
array_push($parts, $part);
|
||||
$i++;
|
||||
}
|
||||
fclose($file);
|
||||
}
|
||||
$comResult = $eclient->completeMultipartUpload(
|
||||
new Oss\Models\CompleteMultipartUploadRequest(
|
||||
$bucket,
|
||||
$key,
|
||||
$initResult->uploadId,
|
||||
null,
|
||||
new Oss\Models\CompleteMultipartUpload(
|
||||
$parts
|
||||
),
|
||||
)
|
||||
);
|
||||
unlink($bigFileName);
|
||||
printf(
|
||||
'complete multipart upload status code:' . $comResult->statusCode . PHP_EOL .
|
||||
'complete multipart upload request id:' . $comResult->requestId . PHP_EOL .
|
||||
'complete multipart upload result:' . var_export($comResult, true)
|
||||
);
|
||||
|
||||
function generateFile($filename, $size)
|
||||
{
|
||||
if (
|
||||
file_exists($filename) &&
|
||||
$size == sprintf('%u', filesize($filename))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
$part_size = 32;
|
||||
$fp = fopen($filename, "w");
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
|
||||
$charactersLength = strlen($characters);
|
||||
if ($fp) {
|
||||
while ($size > 0) {
|
||||
if ($size < $part_size) {
|
||||
$write_size = $size;
|
||||
} else {
|
||||
$write_size = $part_size;
|
||||
}
|
||||
$size -= $write_size;
|
||||
$a = $characters[rand(0, $charactersLength - 1)];
|
||||
$content = str_repeat($a, $write_size);
|
||||
$flag = fwrite($fp, $content);
|
||||
if (!$flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
47
vendor/alibabacloud/oss-v2/sample/ExtentBucketWorm.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/ExtentBucketWorm.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"worm-id" => ['help' => 'The worm id of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$wormId = $options["worm-id"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\ExtendBucketWormRequest($bucket, $wormId, new Oss\Models\ExtendWormConfiguration(3));
|
||||
$result = $client->extendBucketWorm($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
49
vendor/alibabacloud/oss-v2/sample/GetAccessPoint.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/GetAccessPoint.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$accessPointName = 'ap-01';
|
||||
$request = new Oss\Models\GetAccessPointRequest($bucket, $accessPointName);
|
||||
$result = $client->getAccessPoint($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'get access point:' . var_export($result->getAccessPoint, true)
|
||||
);
|
||||
|
||||
49
vendor/alibabacloud/oss-v2/sample/GetAccessPointPolicy.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/GetAccessPointPolicy.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$accessPointName = 'ap-01';
|
||||
$request = new Oss\Models\GetAccessPointPolicyRequest($bucket, $accessPointName);
|
||||
$result = $client->getAccessPointPolicy($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'access point policy:' . $result->body
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetBucketAccessMonitor.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetBucketAccessMonitor.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketAccessMonitorRequest($bucket);
|
||||
$result = $client->GetBucketAccessMonitor($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'access monitor status:' . $result->accessMonitorConfiguration->status
|
||||
);
|
||||
45
vendor/alibabacloud/oss-v2/sample/GetBucketAcl.php
vendored
Normal file
45
vendor/alibabacloud/oss-v2/sample/GetBucketAcl.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketAclRequest($bucket);
|
||||
$result = $client->getBucketAcl($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'bucket acl:' . $result->accessControlList->grant
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetBucketArchiveDirectRead.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetBucketArchiveDirectRead.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketArchiveDirectReadRequest($bucket);
|
||||
$result = $client->getBucketArchiveDirectRead($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'archive direct read config:' . var_export($result->archiveDirectReadConfiguration->enabled, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketCors.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketCors.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketCorsRequest($bucket);
|
||||
$result = $client->getBucketCors($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'cors:' . var_export($result->corsConfiguration, true)
|
||||
);
|
||||
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketDataRedundancyTransition.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketDataRedundancyTransition.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"task-id" => ['help' => 'The Id of the redundancy change task.', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$taskId = $options["task-id"];
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketDataRedundancyTransitionRequest($bucket, $taskId);
|
||||
$result = $client->getBucketDataRedundancyTransition($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'bucket data redundancy transition:' . var_export($result->bucketDataRedundancyTransition, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketEncryption.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketEncryption.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketEncryptionRequest($bucket);
|
||||
$result = $client->getBucketEncryption($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'encryption:' . var_export($result->serverSideEncryptionRule, true)
|
||||
);
|
||||
|
||||
49
vendor/alibabacloud/oss-v2/sample/GetBucketHttpsConfig.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/GetBucketHttpsConfig.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketHttpsConfigRequest(
|
||||
$bucket,
|
||||
);
|
||||
$result = $client->getBucketHttpsConfig($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'https config:' . var_export($result->httpsConfiguration, true)
|
||||
);
|
||||
49
vendor/alibabacloud/oss-v2/sample/GetBucketInfo.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/GetBucketInfo.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\GetBucketInfoRequest($bucket);
|
||||
|
||||
$result = $client->getBucketInfo($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'bucket info:' . var_export($result->bucketInfo, true)
|
||||
);
|
||||
51
vendor/alibabacloud/oss-v2/sample/GetBucketInventory.php
vendored
Normal file
51
vendor/alibabacloud/oss-v2/sample/GetBucketInventory.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$inventoryId = 'test-inventory-id';
|
||||
$request = new Oss\Models\GetBucketInventoryRequest(
|
||||
$bucket,
|
||||
inventoryId: $inventoryId
|
||||
);
|
||||
$result = $client->getBucketInventory($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'inventory config:' . var_export($result->inventoryConfiguration, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketLifecycle.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketLifecycle.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketLifecycleRequest($bucket);
|
||||
$result = $client->getBucketLifecycle($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'lifecycle:' . var_export($result->lifecycleConfiguration, true)
|
||||
);
|
||||
|
||||
49
vendor/alibabacloud/oss-v2/sample/GetBucketLocation.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/GetBucketLocation.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\GetBucketLocationRequest($bucket);
|
||||
|
||||
$result = $client->getBucketLocation($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'bucket location:' . var_export($result->location, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketLogging.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketLogging.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketLoggingRequest($bucket);
|
||||
$result = $client->getBucketLogging($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'logging status:' . var_export($result->bucketLoggingStatus, true)
|
||||
);
|
||||
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketOverwrite.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketOverwrite.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketOverwriteConfigRequest($bucket);
|
||||
$result = $client->getBucketOverwriteConfig($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'overwrite config:' . var_export($result->overwriteConfiguration, true)
|
||||
);
|
||||
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketPolicy.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketPolicy.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketPolicyRequest($bucket);
|
||||
$result = $client->getBucketPolicy($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'policy:' . $result->body
|
||||
);
|
||||
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketPolicyStatus.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketPolicyStatus.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketPolicyStatusRequest($bucket);
|
||||
$result = $client->getBucketPolicyStatus($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'policy status:' . var_export($result->policyStatus->isPublic, true)
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetBucketPublicAccessBlock.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetBucketPublicAccessBlock.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketPublicAccessBlockRequest($bucket);
|
||||
$result = $client->getBucketPublicAccessBlock($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'bucket public access block config:' . var_export($result->publicAccessBlockConfiguration, true)
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetBucketReferer.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetBucketReferer.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketRefererRequest($bucket);
|
||||
$result = $client->getBucketReferer($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'referer config:' . var_export($result->refererConfiguration, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketReplication.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketReplication.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
use AlibabaCloud\Oss\V2\Models\LifecycleConfiguration;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketReplicationRequest($bucket);
|
||||
$result = $client->getBucketReplication($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'replication config:' . var_export($result->replicationConfiguration, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketReplicationLocation.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketReplicationLocation.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
use AlibabaCloud\Oss\V2\Models\LifecycleConfiguration;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketReplicationLocationRequest($bucket);
|
||||
$result = $client->getBucketReplicationLocation($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'replication location:' . var_export($result->replicationLocation, true)
|
||||
);
|
||||
50
vendor/alibabacloud/oss-v2/sample/GetBucketReplicationProgress.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/GetBucketReplicationProgress.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
use AlibabaCloud\Oss\V2\Models\LifecycleConfiguration;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"rule-id" => ['help' => 'The replication rule id of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$ruleId = $options["rule-id"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketReplicationProgressRequest($bucket, $ruleId);
|
||||
$result = $client->getBucketReplicationProgress($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'replication progress:' . var_export($result->replicationProgress, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketRequestPayment.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketRequestPayment.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketRequestPaymentRequest($bucket);
|
||||
$result = $client->getBucketRequestPayment($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'request payer:' . $result->requestPaymentConfiguration->payer
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetBucketResourceGroup.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetBucketResourceGroup.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketResourceGroupRequest($bucket);
|
||||
$result = $client->getBucketResourceGroup($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'resource group id:' . var_export($result->bucketResourceGroupConfiguration->resourceGroupId, true)
|
||||
);
|
||||
49
vendor/alibabacloud/oss-v2/sample/GetBucketStat.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/GetBucketStat.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\GetBucketStatRequest($bucket);
|
||||
|
||||
$result = $client->getBucketStat($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketTags.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketTags.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketTagsRequest($bucket);
|
||||
$result = $client->getBucketTags($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'tags:' . var_export($result->tagging, true)
|
||||
);
|
||||
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketTransferAcceleration.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketTransferAcceleration.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketTransferAccelerationRequest($bucket);
|
||||
$result = $client->getBucketTransferAcceleration($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'transfer acceleration status:' . var_export($result->transferAccelerationConfiguration->enabled, true)
|
||||
);
|
||||
|
||||
45
vendor/alibabacloud/oss-v2/sample/GetBucketVersioning.php
vendored
Normal file
45
vendor/alibabacloud/oss-v2/sample/GetBucketVersioning.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketVersioningRequest($bucket);
|
||||
$result = $client->getBucketVersioning($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'version status:' . $result->versioningConfiguration->status
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketWebsite.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketWebsite.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketWebsiteRequest($bucket);
|
||||
$result = $client->getBucketWebsite($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'website config:' . var_export($result->websiteConfiguration, true)
|
||||
);
|
||||
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketWorm.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketWorm.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"worm-id" => ['help' => 'The worm id of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$wormId = $options["worm-id"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketWormRequest($bucket);
|
||||
$result = $client->getBucketWorm($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'worm config:' . var_export($result->wormConfiguration, true)
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetCnameToken.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetCnameToken.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetCnameTokenRequest($bucket, 'example.com');
|
||||
$result = $client->getCnameToken($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'cname token:' . var_export($result->cnameToken, true)
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetMetaQueryStatus.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetMetaQueryStatus.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetMetaQueryStatusRequest($bucket);
|
||||
$result = $client->getMetaQueryStatus($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'meta query status:' . var_export($result->metaQueryStatus, true)
|
||||
);
|
||||
51
vendor/alibabacloud/oss-v2/sample/GetObject.php
vendored
Normal file
51
vendor/alibabacloud/oss-v2/sample/GetObject.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\GetObjectRequest($bucket, $key);
|
||||
|
||||
$result = $client->getObject($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'body:' . $result->body->getContents()
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetObjectAcl.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetObjectAcl.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetObjectAclRequest($bucket, $key);
|
||||
$result = $client->getObjectAcl($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'acl:' . $result->accessControlList->grant
|
||||
);
|
||||
51
vendor/alibabacloud/oss-v2/sample/GetObjectMeta.php
vendored
Normal file
51
vendor/alibabacloud/oss-v2/sample/GetObjectMeta.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\GetObjectMetaRequest($bucket, $key);
|
||||
|
||||
$result = $client->getObjectMeta($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetObjectTagging.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetObjectTagging.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetObjectTaggingRequest($bucket, $key);
|
||||
$result = $client->getObjectTagging($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
45
vendor/alibabacloud/oss-v2/sample/GetPublicAccessBlock.php
vendored
Normal file
45
vendor/alibabacloud/oss-v2/sample/GetPublicAccessBlock.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetPublicAccessBlockRequest();
|
||||
$result = $client->getPublicAccessBlock($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'public access block config:' . var_export($result->publicAccessBlockConfiguration, true)
|
||||
);
|
||||
50
vendor/alibabacloud/oss-v2/sample/GetStyle.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/GetStyle.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetStyleRequest(
|
||||
$bucket,
|
||||
styleName: 'test',
|
||||
);
|
||||
$result = $client->getStyle($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'style info:' . var_export($result->style, true)
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetSymlink.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetSymlink.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetSymlinkRequest($bucket, $key);
|
||||
$result = $client->getSymlink($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetUserDefinedLogFieldsConfig.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetUserDefinedLogFieldsConfig.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetUserDefinedLogFieldsConfigRequest($bucket);
|
||||
$result = $client->getUserDefinedLogFieldsConfig($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId. PHP_EOL .
|
||||
'user defined log fields config:'. var_export($result->userDefinedLogFieldsConfiguration, true)
|
||||
);
|
||||
51
vendor/alibabacloud/oss-v2/sample/HeadObject.php
vendored
Normal file
51
vendor/alibabacloud/oss-v2/sample/HeadObject.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\HeadObjectRequest($bucket, $key);
|
||||
|
||||
$result = $client->headObject($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/InitiateBucketWorm.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/InitiateBucketWorm.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\InitiateBucketWormRequest($bucket, new Oss\Models\InitiateWormConfiguration(
|
||||
3
|
||||
));
|
||||
$result = $client->initiateBucketWorm($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'worm id:' . $result->wormId
|
||||
);
|
||||
50
vendor/alibabacloud/oss-v2/sample/InitiateMultipartUpload.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/InitiateMultipartUpload.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\InitiateMultipartUploadRequest($bucket, $key);
|
||||
$result = $client->initiateMultipartUpload($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
98
vendor/alibabacloud/oss-v2/sample/InvokeOperation.php
vendored
Normal file
98
vendor/alibabacloud/oss-v2/sample/InvokeOperation.php
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
// PutCname sample case 1:
|
||||
$body = Oss\Utils::streamFor("<BucketCnameConfiguration>
|
||||
<Cname>
|
||||
<Domain>example.com</Domain>
|
||||
</Cname>
|
||||
</BucketCnameConfiguration>");
|
||||
|
||||
$input = new Oss\OperationInput(
|
||||
"PutCname",
|
||||
"POST",
|
||||
);
|
||||
$input->setParameter("cname", "");
|
||||
$input->setParameter("comp", "add");
|
||||
$input->setBody($body);
|
||||
$input->setBucket($bucket);
|
||||
|
||||
$result = $client->invokeOperation($input);
|
||||
printf(
|
||||
'status code:' . $result->GetStatusCode() . PHP_EOL .
|
||||
'request id:' . $result->getHeaders()["x-oss-request-id"] . PHP_EOL
|
||||
);
|
||||
|
||||
// PutCname sample case 2:
|
||||
//$body = Oss\Utils::streamFor("<BucketCnameConfiguration>
|
||||
// <Cname>
|
||||
// <Domain>example.com</Domain>
|
||||
// </Cname>
|
||||
//</BucketCnameConfiguration>");
|
||||
//
|
||||
//
|
||||
//$input = new Oss\OperationInput(
|
||||
// opName: "PutCname",
|
||||
// method: "POST",
|
||||
// headers: null,
|
||||
// parameters: ["cname" => "", "comp" => "add"],
|
||||
// body: $body,
|
||||
// bucket: $bucket
|
||||
//);
|
||||
//$result = $client->invokeOperation($input);
|
||||
//printf(
|
||||
// 'status code:' . $result->GetStatusCode() . PHP_EOL .
|
||||
// 'request id:' . $result->getHeaders()["x-oss-request-id"] . PHP_EOL
|
||||
//);
|
||||
|
||||
// GetCnameToken sample
|
||||
$input = new Oss\OperationInput(
|
||||
"GetCnameToken",
|
||||
"GET",
|
||||
null,
|
||||
["cname" => "example.com", "comp" => "token"],
|
||||
NULL,
|
||||
$bucket
|
||||
);
|
||||
$result = $client->invokeOperation($input);
|
||||
printf(
|
||||
'status code:' . $result->GetStatusCode() . PHP_EOL .
|
||||
'request id:' . $result->getHeaders()["x-oss-request-id"] . PHP_EOL .
|
||||
'body:' . $result->getBody()->getContents()
|
||||
);
|
||||
45
vendor/alibabacloud/oss-v2/sample/IsBucketExist.php
vendored
Normal file
45
vendor/alibabacloud/oss-v2/sample/IsBucketExist.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$exist = $client->isBucketExist($bucket);
|
||||
|
||||
printf(
|
||||
'bucket is exist:' . var_export($exist, true)
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/IsObjectExist.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/IsObjectExist.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$exist = $client->isObjectExist($bucket, $key);
|
||||
|
||||
printf(
|
||||
'object is exist:' . var_export($exist, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/ListAccessPoint.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/ListAccessPoint.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\ListAccessPointsRequest();
|
||||
$result = $client->listAccessPoints($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'list access points:' . var_export($result->listAccessPoints, true)
|
||||
);
|
||||
|
||||
46
vendor/alibabacloud/oss-v2/sample/ListBucketDataRedundancyTransition.php
vendored
Normal file
46
vendor/alibabacloud/oss-v2/sample/ListBucketDataRedundancyTransition.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\ListBucketDataRedundancyTransitionRequest($bucket);
|
||||
$result = $client->listBucketDataRedundancyTransition($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'bucket data redundancy transitions:' . var_export($result->listBucketDataRedundancyTransition->bucketDataRedundancyTransitions, true)
|
||||
);
|
||||
49
vendor/alibabacloud/oss-v2/sample/ListBucketInventory.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/ListBucketInventory.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\ListBucketInventoryRequest(
|
||||
$bucket,
|
||||
);
|
||||
$result = $client->listBucketInventory($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'list inventory config:' . var_export($result->listInventoryConfigurationsResult->inventoryConfigurations, true)
|
||||
);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user