1
1
2
2
3
3
const assert = require ( 'assert' ) ;
4
- const _checkBucketName = require ( './common/utils/checkBucketName' ) ;
5
4
6
5
const proto = exports ;
7
6
@@ -17,16 +16,6 @@ function toArray(obj) {
17
16
return [ obj ] ;
18
17
}
19
18
20
- /**
21
- * check Bucket Name
22
- */
23
-
24
- proto . _checkBucketName = function ( name ) {
25
- if ( ! _checkBucketName ( name ) ) {
26
- throw new Error ( 'The bucket must be conform to the specifications' ) ;
27
- }
28
- } ;
29
-
30
19
/**
31
20
* Bucket opertaions
32
21
*/
@@ -113,38 +102,6 @@ proto.getBucketInfo = async function getBucketInfo(name, options) {
113
102
} ;
114
103
} ;
115
104
116
- proto . putBucket = async function putBucket ( name , options ) {
117
- this . _checkBucketName ( name ) ;
118
- options = options || { } ;
119
- const params = this . _bucketRequestParams ( 'PUT' , name , '' , options ) ;
120
-
121
- const startTag = '<?xml version="1.0" encoding="UTF-8"?>\n<CreateBucketConfiguration>' ;
122
- const endTag = '</CreateBucketConfiguration>' ;
123
- let paramlXML = '' ;
124
-
125
- // server not support
126
- // if (region) {
127
- // paramlXML += `<LocationConstraint>${region}</LocationConstraint>`;
128
- // params.content = `${startTag}${paramlXML}${endTag}`;
129
- // }
130
-
131
- if ( options . StorageClass ) {
132
- paramlXML += `<StorageClass>${ options . StorageClass } </StorageClass>` ;
133
- }
134
-
135
- if ( paramlXML ) {
136
- params . mime = 'xml' ;
137
- params . content = `${ startTag } ${ paramlXML } ${ endTag } ` ;
138
- }
139
-
140
- params . successStatuses = [ 200 ] ;
141
- const result = await this . request ( params ) ;
142
- return {
143
- bucket : ( result . headers . location && result . headers . location . substring ( 1 ) ) || null ,
144
- res : result . res
145
- } ;
146
- } ;
147
-
148
105
proto . deleteBucket = async function deleteBucket ( name , options ) {
149
106
this . _checkBucketName ( name ) ;
150
107
const params = this . _bucketRequestParams ( 'DELETE' , name , '' , options ) ;
0 commit comments