[VARIABLE "my_unique_bucket"]
172543
public Acl getDefaultBucketAcl(String bucketName) {
    // [START getDefaultBucketAcl]
    Acl acl = storage.getDefaultAcl(bucketName, User.ofAllAuthenticatedUsers());
    // [END getDefaultBucketAcl]
    return acl;
  }
901666
public Acl updateDefaultBucketAcl(String bucketName) {
    // [START updateDefaultBucketAcl]
    Acl acl =
        storage.updateDefaultAcl(bucketName, Acl.of(User.ofAllAuthenticatedUsers(), Role.OWNER));
    // [END updateDefaultBucketAcl]
    return acl;
  }
1270797
public Blob copyToBucket(String bucketName) {
    // [START copyToBucket]
    CopyWriter copyWriter = blob.copyTo(bucketName);
    Blob copiedBlob = copyWriter.getResult();
    // [END copyToBucket]
    return copiedBlob;
  }
29107
public static HashMap<StoreDefinition, Integer> getUniqueStoreDefinitionsWithCounts(List<StoreDefinition> storeDefs) {

        HashMap<StoreDefinition, Integer> uniqueStoreDefs = Maps.newHashMap();
        for(StoreDefinition storeDef: storeDefs) {
            if(uniqueStoreDefs.isEmpty()) {
                uniqueStoreDefs.put(storeDef, 1);
            } else {
                StoreDefinition sameStore = null;

                // Go over all the other stores to find if this is unique
                for(StoreDefinition uniqueStoreDef: uniqueStoreDefs.keySet()) {
                    if(uniqueStoreDef.getReplicationFactor() == storeDef.getReplicationFactor()
                       && uniqueStoreDef.getRoutingStrategyType()
                                        .compareTo(storeDef.getRoutingStrategyType()) == 0) {

                        // Further check for the zone routing case
                        if(uniqueStoreDef.getRoutingStrategyType()
                                         .compareTo(RoutingStrategyType.ZONE_STRATEGY) == 0) {
                            boolean zonesSame = true;
                            for(int zoneId: uniqueStoreDef.getZoneReplicationFactor().keySet()) {
                                if(storeDef.getZoneReplicationFactor().get(zoneId) == null
                                   || storeDef.getZoneReplicationFactor().get(zoneId) != uniqueStoreDef.getZoneReplicationFactor()
                                                                                                       .get(zoneId)) {
                                    zonesSame = false;
                                    break;
                                }
                            }
                            if(zonesSame) {
                                sameStore = uniqueStoreDef;
                            }
                        } else {
                            sameStore = uniqueStoreDef;
                        }

                        if(sameStore != null) {
                            // Bump up the count
                            int currentCount = uniqueStoreDefs.get(sameStore);
                            uniqueStoreDefs.put(sameStore, currentCount + 1);
                            break;
                        }
                    }
                }

                if(sameStore == null) {
                    // New store
                    uniqueStoreDefs.put(storeDef, 1);
                }
            }
        }

        return uniqueStoreDefs;
    }
732081
def check_uniqueness(self, *args, **kwargs):
        

        if not self.field.unique:
            return

        try:
            pk = self.instance.pk.get()
        except AttributeError:
            pk = None

        key = self.get_storage_key(*args)
        value = list(args)[-1]
        pks = self.get_pks_for_filter(key, 'eq', self.normalize_value(value))

        self.assert_pks_uniqueness(pks, pk, value)
279154
def _set_bucket(self, type, name):
        
        if type:
            self._cfg['bucket_type'] = type
        if name:
            self._cfg['bucket_name'] = name
        self.bucket = self._client.bucket_type(self._cfg['bucket_type']
                                               ).bucket(self._cfg['bucket_name'])
        self.index_name = "%s_%s" % (self._cfg['bucket_type'], self._cfg['bucket_name'])
        return self
723532
protected boolean isSpace(String bucketName) {
        boolean isSpace = false;
        // According to AWS docs, the access key (used in DuraCloud as a
        // prefix for uniqueness) is a 20 character alphanumeric sequence.
        if (bucketName.matches("[\\w]{20}[.].*")) {
            isSpace = true;
        }
        return isSpace;
    }
824067
def _item_exists_in_bucket(self, bucket, key, checksums):
        
        try:
            obj = self.target_s3.meta.client.head_object(Bucket=bucket, Key=key)
            if obj and obj.containsKey('Metadata'):
                if obj['Metadata'] == checksums:
                    return True
        except ClientError:
            # An exception from calling `head_object` indicates that no file with the specified name could be found
            # in the specified bucket.
            return False
82905
function unique(array) {
      var uniqueItems = [], i = array.length, item;

      while (i--) {
        item = array[i];

        if (!item.__checked) {
          uniqueItems.push(item);
          item.__checked = 1;
        }
      }

      i = uniqueItems.length;
      while (i--) {
        delete uniqueItems[i].__checked;
      }

      return uniqueItems;
    }
1122328
private boolean bucketsEmpty() {
        for (int i = 0; i < numberOfBuckets; i++) {
            if (bucketContainer.getBucket(i).elementsInBucket > 0) {
                return false;
            }
        }
        return true;
    }
1115058
public List<Acl> listBucketAcls(String bucketName) {
    // [START listBucketAcls]
    List<Acl> acls = storage.listAcls(bucketName);
    for (Acl acl : acls) {
      // do something with ACL entry
    }
    // [END listBucketAcls]
    return acls;
  }
1067029
function bucketExists () {
    // if bucket exists already set then return existing value
    if (defined(this._bucketExists)) {
        // if bucket does not exist then throw error
        if (this._bucketExists === false) {
            throw new Error(`bucket does not exist ${this.bucketName}`)
        }
        // otherwise return value which may be promise or true
        else {
            return Promise.resolve(this._bucketExists)
        }
    }
    // check if bucket exists storing promise so that check will only be done
    // once per instance
    this._bucketExists = this.bucket.exists().then(data => {
        var exists = data[0]
        // bucket exists
        if (exists === true) {
            // replace original promise with boolean
            this._bucketExists = true
            // resolve with true
            return true
        }
        // bucket does not exists and should not be created
        if (!this.createBucket) {
            throw new Error(`bucket does not exist ${this.bucketName}`)
        }
        // create bucket
        return this.bucket.create().then(data => {
            // replace original promise with boolean
            this._bucketExists = true
            // resolve with true
            return true
        })
    })
    // return promise
    return this._bucketExists
}
499695
public void createBucket(BucketConfiguration config) throws BucketAlreadyExistsException, IOException {
        if (!config.validate()) {
            throw new IllegalArgumentException("Invalid bucket configuration");
        }

        synchronized (buckets) {
            if (buckets.containsKey(config.name)) {
                throw new BucketAlreadyExistsException(config.name);
            }

            Bucket bucket = Bucket.create(this, config);
            BucketAdminServer adminServer = new BucketAdminServer(bucket, httpServer, this);
            adminServer.register();
            bucket.setAdminServer(adminServer);

            HttpAuthVerifier verifier = new HttpAuthVerifier(bucket, authenticator);

            if (config.type == BucketType.COUCHBASE) {
                CAPIServer capi = new CAPIServer(bucket, verifier);
                capi.register(httpServer);
                bucket.setCAPIServer(capi);
            }

            buckets.put(config.name, bucket);
            bucket.start();
        }
    }
978448
private String buildIndexName(String bucketName)
    {
        if (bucketName == null)
        {
            throw new KunderaException("Bucket Name can't be null!");
        }
        return (bucketName + CouchbaseConstants.INDEX_SUFFIX).toLowerCase();
    }
387813
private Bucket getBucket(String bucketName)
      throws IOException {
    logger.atFine().log("getBucket(%s)", bucketName);
    checkArgument(!Strings.isNullOrEmpty(bucketName), "bucketName must not be null or empty");
    Storage.Buckets.Get getBucket = configureRequest(gcs.buckets().get(bucketName), bucketName);
    try {
      return getBucket.execute();
    } catch (IOException e) {
      if (errorExtractor.itemNotFound(e)) {
        logger.atFine().withCause(e).log("getBucket(%s): not found", bucketName);
        return null;
      }
      throw new IOException("Error accessing Bucket " + bucketName, e);
    }
  }
956108
public Acl createBucketAcl(String bucketName) {
    // [START createBucketAcl]
    Acl acl = storage.createAcl(bucketName, Acl.of(User.ofAllAuthenticatedUsers(), Role.READER));
    // [END createBucketAcl]
    return acl;
  }
45761
private boolean isUniqueFileResolved(final Set<String> alreadyHandled,
      final String s) {
    return this.uniqueFiles && alreadyHandled.contains(s);
  }