|
| 1 | +/* |
| 2 | + * Copyright 2015 Google Inc. All Rights Reserved. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the 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 |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package com.google.gcloud.storage; |
| 18 | + |
| 19 | +public final class BucketInfo { |
| 20 | + |
| 21 | + private final String id; |
| 22 | + private final String name; |
| 23 | + private final long createTime; |
| 24 | + private final long metageneration; |
| 25 | + private final Cors cors; |
| 26 | + private final Acl acl; |
| 27 | + private final Acl defaultAcl; |
| 28 | + |
| 29 | + public enum StorageClass { |
| 30 | + DURABLE_REDUCED_AVAILABILITY, |
| 31 | + STANDARD |
| 32 | + } |
| 33 | + |
| 34 | + public final static class Builder { |
| 35 | + |
| 36 | + private final String id; |
| 37 | + private final String name; |
| 38 | + private final long createTime; |
| 39 | + private final long metageneration; |
| 40 | + private Cors cors; |
| 41 | + private Acl acl; |
| 42 | + private Acl defaultAcl; |
| 43 | + |
| 44 | + Builder(String id, String name, long createTime, long metageneration) { |
| 45 | + this.id = id; |
| 46 | + this.name = name; |
| 47 | + this.createTime = createTime; |
| 48 | + this.metageneration = metageneration; |
| 49 | + } |
| 50 | + |
| 51 | + public Builder cors(Cors cors) { |
| 52 | + this.cors = cors; |
| 53 | + return this; |
| 54 | + } |
| 55 | + |
| 56 | + public Builder acl(Acl acl) { |
| 57 | + this.acl = acl; |
| 58 | + return this; |
| 59 | + } |
| 60 | + |
| 61 | + public Builder defaultAcl(Acl defaultAcl) { |
| 62 | + this.defaultAcl = defaultAcl; |
| 63 | + return this; |
| 64 | + } |
| 65 | + |
| 66 | + public BucketInfo build() { |
| 67 | + return new BucketInfo(this); |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | + private BucketInfo(Builder builder) { |
| 72 | + id = builder.id; |
| 73 | + name = builder.name; |
| 74 | + createTime = builder.createTime; |
| 75 | + metageneration = builder.metageneration; |
| 76 | + cors = builder.cors; |
| 77 | + acl = builder.acl; |
| 78 | + defaultAcl = builder.defaultAcl; |
| 79 | + } |
| 80 | + |
| 81 | + public String id() { |
| 82 | + return id; |
| 83 | + } |
| 84 | + |
| 85 | + public String name() { |
| 86 | + return name; |
| 87 | + } |
| 88 | + |
| 89 | + public Cors cors() { |
| 90 | + return cors; |
| 91 | + } |
| 92 | + |
| 93 | + public Acl acl() { |
| 94 | + return acl; |
| 95 | + } |
| 96 | + |
| 97 | + public Acl defaultObjectAcl() { |
| 98 | + return defaultAcl; |
| 99 | + } |
| 100 | + |
| 101 | + public Builder toBuilder() { |
| 102 | + return builder(id, name, createTime, metageneration).cors(cors).acl(acl).defaultAcl(defaultAcl); |
| 103 | + } |
| 104 | + |
| 105 | + public static Builder builder(String id, String name, long createTime, long metageneration) { |
| 106 | + return new Builder(id, name, createTime, metageneration); |
| 107 | + } |
| 108 | +} |
0 commit comments