use of com.google.api.services.storage.model.Bucket.Owner in project google-cloud-java by GoogleCloudPlatform.
the class BucketInfo method toPb.
com.google.api.services.storage.model.Bucket toPb() {
com.google.api.services.storage.model.Bucket bucketPb = new com.google.api.services.storage.model.Bucket();
bucketPb.setId(generatedId);
bucketPb.setName(name);
bucketPb.setEtag(etag);
if (createTime != null) {
bucketPb.setTimeCreated(new DateTime(createTime));
}
if (metageneration != null) {
bucketPb.setMetageneration(metageneration);
}
if (location != null) {
bucketPb.setLocation(location);
}
if (storageClass != null) {
bucketPb.setStorageClass(storageClass.toString());
}
if (cors != null) {
bucketPb.setCors(transform(cors, Cors.TO_PB_FUNCTION));
}
if (acl != null) {
bucketPb.setAcl(transform(acl, new Function<Acl, BucketAccessControl>() {
@Override
public BucketAccessControl apply(Acl acl) {
return acl.toBucketPb();
}
}));
}
if (defaultAcl != null) {
bucketPb.setDefaultObjectAcl(transform(defaultAcl, new Function<Acl, ObjectAccessControl>() {
@Override
public ObjectAccessControl apply(Acl acl) {
return acl.toObjectPb();
}
}));
}
if (owner != null) {
bucketPb.setOwner(new Owner().setEntity(owner.toPb()));
}
bucketPb.setSelfLink(selfLink);
if (versioningEnabled != null) {
bucketPb.setVersioning(new Versioning().setEnabled(versioningEnabled));
}
if (indexPage != null || notFoundPage != null) {
Website website = new Website();
website.setMainPageSuffix(indexPage);
website.setNotFoundPage(notFoundPage);
bucketPb.setWebsite(website);
}
if (deleteRules != null) {
Lifecycle lifecycle = new Lifecycle();
lifecycle.setRule(transform(deleteRules, new Function<DeleteRule, Rule>() {
@Override
public Rule apply(DeleteRule deleteRule) {
return deleteRule.toPb();
}
}));
bucketPb.setLifecycle(lifecycle);
}
return bucketPb;
}
Aggregations