com.google.api.services.storage.model.Bucket.Website

Here are the examples of the java api class com.google.api.services.storage.model.Bucket.Website taken from open source projects.

1. BucketInfo#fromPb()

Project: gcloud-java
Source File: BucketInfo.java
View license
static BucketInfo fromPb(com.google.api.services.storage.model.Bucket bucketPb) {
    Builder builder = new BuilderImpl(bucketPb.getName());
    if (bucketPb.getId() != null) {
        builder.generatedId(bucketPb.getId());
    }
    if (bucketPb.getEtag() != null) {
        builder.etag(bucketPb.getEtag());
    }
    if (bucketPb.getMetageneration() != null) {
        builder.metageneration(bucketPb.getMetageneration());
    }
    if (bucketPb.getSelfLink() != null) {
        builder.selfLink(bucketPb.getSelfLink());
    }
    if (bucketPb.getTimeCreated() != null) {
        builder.createTime(bucketPb.getTimeCreated().getValue());
    }
    if (bucketPb.getLocation() != null) {
        builder.location(bucketPb.getLocation());
    }
    if (bucketPb.getStorageClass() != null) {
        builder.storageClass(bucketPb.getStorageClass());
    }
    if (bucketPb.getCors() != null) {
        builder.cors(transform(bucketPb.getCors(), Cors.FROM_PB_FUNCTION));
    }
    if (bucketPb.getAcl() != null) {
        builder.acl(transform(bucketPb.getAcl(), new Function<BucketAccessControl, Acl>() {

            @Override
            public Acl apply(BucketAccessControl bucketAccessControl) {
                return Acl.fromPb(bucketAccessControl);
            }
        }));
    }
    if (bucketPb.getDefaultObjectAcl() != null) {
        builder.defaultAcl(transform(bucketPb.getDefaultObjectAcl(), new Function<ObjectAccessControl, Acl>() {

            @Override
            public Acl apply(ObjectAccessControl objectAccessControl) {
                return Acl.fromPb(objectAccessControl);
            }
        }));
    }
    if (bucketPb.getOwner() != null) {
        builder.owner(Entity.fromPb(bucketPb.getOwner().getEntity()));
    }
    if (bucketPb.getVersioning() != null) {
        builder.versioningEnabled(bucketPb.getVersioning().getEnabled());
    }
    Website website = bucketPb.getWebsite();
    if (website != null) {
        builder.indexPage(website.getMainPageSuffix());
        builder.notFoundPage(website.getNotFoundPage());
    }
    if (bucketPb.getLifecycle() != null && bucketPb.getLifecycle().getRule() != null) {
        builder.deleteRules(transform(bucketPb.getLifecycle().getRule(), new Function<Rule, DeleteRule>() {

            @Override
            public DeleteRule apply(Rule rule) {
                return DeleteRule.fromPb(rule);
            }
        }));
    }
    return builder.build();
}