|
1 | 1 | #!/usr/bin/python
|
2 | 2 | # -*- coding:utf-8 -*-
|
| 3 | +# Copyright 2019 Huawei Technologies Co.,Ltd. |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| 5 | +# this file except in compliance with the License. You may obtain a copy of the |
| 6 | +# License at |
| 7 | + |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + |
| 10 | +# Unless required by applicable law or agreed to in writing, software distributed |
| 11 | +# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| 12 | +# CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 13 | +# specific language governing permissions and limitations under the License. |
3 | 14 |
|
4 | 15 | '''
|
5 | 16 | This sample demonstrates how to do bucket-related operations
|
@@ -51,6 +62,21 @@ def doBucketQuotaOperation():
|
51 | 62 | resp = bucketClient.getBucketQuota()
|
52 | 63 |
|
53 | 64 | print('Getting bucket quota ' + str(resp.body) + ' \n')
|
| 65 | + |
| 66 | +def doBucketEncryptionOperation(): |
| 67 | + print('Setting bucket encryption\n') |
| 68 | +# obsClient.setBucketEncryption(bucketName, 'kms') |
| 69 | + bucketClient.setBucketEncryption('kms') |
| 70 | + |
| 71 | + print('Getting bucket encryption\n') |
| 72 | +# resp = obsClient.getBucketEncryption(bucketName) |
| 73 | + resp = bucketClient.getBucketEncryption() |
| 74 | + print('\t' + str(resp.body) + '\n') |
| 75 | + |
| 76 | + print('Deleting bucket encryption\n') |
| 77 | +# obsClient.deleteBucketEncryption(bucketName) |
| 78 | + bucketClient.deleteBucketEncryption() |
| 79 | + |
54 | 80 |
|
55 | 81 | def doBucketVersioningOperation():
|
56 | 82 | # print('Getting bucket versioning config ' + str(obsClient.getBucketVersioning(bucketName).body) + ' \n')
|
@@ -207,6 +233,9 @@ def deleteBucket():
|
207 | 233 | # Put/Get bucket quota operations
|
208 | 234 | doBucketQuotaOperation()
|
209 | 235 |
|
| 236 | +# Put/Get/Delete encryption operations |
| 237 | +doBucketEncryptionOperation() |
| 238 | + |
210 | 239 | # Put/Get bucket versioning operations
|
211 | 240 | doBucketVersioningOperation()
|
212 | 241 |
|
|
0 commit comments