forked from minio/minio-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateBucketBaseArgs.java
More file actions
114 lines (96 loc) · 3.46 KB
/
CreateBucketBaseArgs.java
File metadata and controls
114 lines (96 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2025 MinIO, Inc.
*
* 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.
*/
package io.minio;
import io.minio.messages.CreateBucketConfiguration;
import io.minio.messages.Tags;
import java.util.Objects;
/** Common arguments of {@link CreateBucketArgs} and {@link MakeBucketArgs}. */
public abstract class CreateBucketBaseArgs extends BucketArgs {
protected boolean objectLock;
protected CreateBucketConfiguration.Location locationConfig;
protected CreateBucketConfiguration.Bucket bucket;
protected Tags tags;
protected boolean forceCreate;
protected CreateBucketBaseArgs() {}
protected CreateBucketBaseArgs(CreateBucketBaseArgs args) {
super(args);
this.objectLock = args.objectLock;
this.locationConfig = args.locationConfig;
this.bucket = args.bucket;
this.tags = args.tags;
this.forceCreate = args.forceCreate;
}
public boolean objectLock() {
return objectLock;
}
public CreateBucketConfiguration.Location locationConfig() {
return locationConfig;
}
public CreateBucketConfiguration.Bucket bucketConfig() {
return bucket;
}
public Tags tags() {
return tags;
}
public boolean forceCreate() {
return forceCreate;
}
/** Base argument builder of {@link CreateBucketBaseArgs}. */
@SuppressWarnings("unchecked") // Its safe to type cast to B as B is inherited by this class
public abstract static class Builder<B extends Builder<B, A>, A extends CreateBucketBaseArgs>
extends BucketArgs.Builder<B, A> {
public B objectLock(boolean objectLock) {
operations.add(args -> args.objectLock = objectLock);
return (B) this;
}
public B locationConstraint(String region) {
operations.add(args -> args.region = region);
return (B) this;
}
public B locationConfig(CreateBucketConfiguration.Location locationConfig) {
operations.add(args -> args.locationConfig = locationConfig);
return (B) this;
}
public B bucketConfig(CreateBucketConfiguration.Bucket bucket) {
operations.add(args -> args.bucket = bucket);
return (B) this;
}
public B tags(Tags tags) {
operations.add(args -> args.tags = tags);
return (B) this;
}
public B forceCreate(boolean forceCreate) {
operations.add(args -> args.forceCreate = forceCreate);
return (B) this;
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof CreateBucketBaseArgs)) return false;
if (!super.equals(o)) return false;
CreateBucketBaseArgs that = (CreateBucketBaseArgs) o;
return objectLock == that.objectLock
&& Objects.equals(locationConfig, that.locationConfig)
&& Objects.equals(bucket, that.bucket)
&& Objects.equals(tags, that.tags)
&& forceCreate == that.forceCreate;
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), objectLock, locationConfig, bucket, tags, forceCreate);
}
}