@@ -99,6 +99,10 @@ All operation use es7 async/await to implement. All api is async function.
99
99
- [ .putBucketTags(name, tag[ , options] )] ( #putBucketTagsname-tag-options )
100
100
- [ .getBucketTags(name, [ , options] )] ( #getBucketTagsname-options )
101
101
- [ .deleteBucketTags(name, [ , options] )] ( #deleteBucketTagsname-options )
102
+ - policy
103
+ - [ .putBucketPolicy(name, policy[ , options] )] ( #putBucketPolicyname-policy-options )
104
+ - [ .getBucketPolicy(name, [ , options] )] ( #getBucketPolicyname-options )
105
+ - [ .deleteBucketPolicy(name, [ , options] )] ( #deleteBucketPolicyname-options )
102
106
- [ Object Operations] ( #object-operations )
103
107
- [ .list(query[ , options] )] ( #listquery-options )
104
108
- [ .put(name, file[ , options] )] ( #putname-file-options )
@@ -1087,6 +1091,72 @@ Success will return:
1087
1091
1088
1092
---
1089
1093
1094
+ ### .putBucketPolicy(name, policy[ , options] )
1095
+
1096
+ Adds or modify policy for a bucket.
1097
+
1098
+ parameters:
1099
+
1100
+ - name {String} the bucket name
1101
+ - policy {Object} bucket policy
1102
+ - [ options] {Object} optional args
1103
+
1104
+ Success will return:
1105
+
1106
+ - status {Number} response status
1107
+ - res {Object} response info
1108
+
1109
+ example:
1110
+ ``` js
1111
+ const policy = {
1112
+ Version: ' 1' ,
1113
+ Statement: [
1114
+ {
1115
+ Action: [' oss:PutObject' , ' oss:GetObject' ],
1116
+ Effect: ' Deny' ,
1117
+ Principal: [' 1234567890' ],
1118
+ Resource: [' acs:oss:*:1234567890:*/*' ]
1119
+ }
1120
+ ]
1121
+ };
1122
+ const result = await store .putBucketPolicy (bucket, policy);
1123
+ console .log (result);
1124
+ ```
1125
+ ---
1126
+
1127
+ ### .getBucketPolicy(name[ , options] )
1128
+
1129
+ Obtains the policy for a bucket.
1130
+
1131
+ parameters:
1132
+
1133
+ - name {String} the bucket name
1134
+ - [ options] {Object} optional args
1135
+
1136
+ Success will return:
1137
+
1138
+ - policy {Object} the policy of bucket, if not exist, the value is null
1139
+ - res {Object} response info
1140
+ - status {Number} response status
1141
+
1142
+ ---
1143
+
1144
+ ### .deleteBucketPolicy(name[ , options] )
1145
+
1146
+ Deletes the policy added for a bucket.
1147
+
1148
+ parameters:
1149
+
1150
+ - name {String} the bucket name
1151
+ - [ options] {Object} optional args
1152
+
1153
+ Success will return:
1154
+
1155
+ - status {Number} response status
1156
+ - res {Object} response info
1157
+
1158
+ ---
1159
+
1090
1160
## Object Operations
1091
1161
1092
1162
All operations function return Promise, except ` signatureUrl ` .
0 commit comments