Instantiate a BucketStorageUri from the current BucketStorageUri,
        but replacing the object_name.

        @type new_name: string
        @param new_name: new object name
517772
def clone_replace_name(self, new_name):
        
        if not self.bucket_name:
            raise InvalidUriError('clone_replace_name() on bucket-less URI %s' %
                                  self.uri)
        return BucketStorageUri(
            self.scheme, self.bucket_name, new_name, self.debug,
            suppress_consec_slashes=self.suppress_consec_slashes)
413916
def instantiate_by_name(self, object_name):
        
        if object_name not in self.instances:
            instance = self.instantiate_from_data(self.environment[object_name])

            self.instances[object_name] = instance
            return instance
        else:
            return self.instances[object_name]
1025563
def name=(new_val)
      return nil if new_val == @name
      new_val = nil if new_val == ''
      raise JSS::MissingDataError, "Name can't be empty" unless new_val
      raise JSS::AlreadyExistsError, "A #{RSRC_OBJECT_KEY} already exists with the name '#{args[:name]}'" if JSS.send(LIST_METHOD).values.include?

      ### if the filename is the same, keep it the same
      @filename = new_val if @filename == @name
      @name = new_val

      ### if our REST resource is based on the name, update that too
      @rest_rsrc = "#{RSRC_BASE}/name/#{CGI.escape @name}" if @rest_rsrc.include? '/name/'
      @need_to_update = true
    end
77089
def copy(self, old_name, new_name, index=None):
        
        if index is None:
            index = len(self)
        self._copy(old_name, new_name, index)
        return self[new_name]
1184861
def _expand_list(names):
  

  if names is None:
    names = []
  elif isinstance(names, basestring):
    names = [names]

  results = []  # The expanded list.
  objects = {}  # Cached contents of buckets; used for matching.
  for name in names:
    bucket, key = google.datalab.storage._bucket.parse_name(name)
    results_len = len(results)  # If we fail to add any we add name and let caller deal with it.
    if bucket:
      if not key:
        # Just a bucket; add it.
        results.append('gs://%s' % bucket)
      elif google.datalab.storage.Object(bucket, key).exists():
        results.append('gs://%s/%s' % (bucket, key))
      else:
        # Expand possible key values.
        if bucket not in objects and key[:1] == '*':
          # We need the full list; cache a copy for efficiency.
          objects[bucket] = [obj.metadata.name
                             for obj in list(google.datalab.storage.Bucket(bucket).objects())]
        # If we have a cached copy use it
        if bucket in objects:
          candidates = objects[bucket]
        # else we have no cached copy but can use prefix matching which is more efficient than
        # getting the full contents.
        else:
          # Get the non-wildchar prefix.
          match = re.search('\?|\*|\[', key)
          prefix = key
          if match:
            prefix = key[0:match.start()]

          candidates = [obj.metadata.name
                        for obj in google.datalab.storage.Bucket(bucket).objects(prefix=prefix)]

        for obj in candidates:
          if fnmatch.fnmatch(obj, key):
            results.append('gs://%s/%s' % (bucket, obj))

    # If we added no matches, add the original name and let caller deal with it.
    if len(results) == results_len:
      results.append(name)

  return results
959895
public void rename(String newName) {
        URL url = FILE_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());
        BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "PUT");

        JsonObject updateInfo = new JsonObject();
        updateInfo.add("name", newName);

        request.setBody(updateInfo.toString());
        BoxAPIResponse response = request.send();
        response.disconnect();
    }
242557
public Blob createBlob(String bucketName, String blobName) {
    // [START createBlob]
    BlobId blobId = BlobId.of(bucketName, blobName);
    BlobInfo blobInfo = BlobInfo.newBuilder(blobId).setContentType("text/plain").build();
    Blob blob = storage.create(blobInfo);
    // [END createBlob]
    return blob;
  }
563775
def rename(self, bucket, key, key_to, force='false'):
        
        return self.move(bucket, key, bucket, key_to, force)
364547
def instantiate_by_name_with_default(self, object_name, default_value=None):
        
        if object_name not in self.instances:
            if object_name not in self.environment:
                return default_value
            else:
                instance = self.instantiate_from_data(self.environment[object_name])

                self.instances[object_name] = instance
                return instance
        else:
            return self.instances[object_name]
149617
@Override
  public void create(String bucketName, CreateBucketOptions options) throws IOException {
    logger.atFine().log("create(%s)", bucketName);
    Preconditions.checkArgument(
        !Strings.isNullOrEmpty(bucketName), "bucketName must not be null or empty");
    checkNotNull(options, "options must not be null");
    checkNotNull(storageOptions.getProjectId(), "projectId must not be null");

    Bucket bucket = new Bucket();
    bucket.setName(bucketName);
    bucket.setLocation(options.getLocation());
    bucket.setStorageClass(options.getStorageClass());
    Storage.Buckets.Insert insertBucket =
        configureRequest(gcs.buckets().insert(storageOptions.getProjectId(), bucket), bucketName);
    // TODO(user): To match the behavior of throwing FileNotFoundException for 404, we probably
    // want to throw org.apache.commons.io.FileExistsException for 409 here.
    try {
      ResilientOperation.retry(
          ResilientOperation.getGoogleRequestCallable(insertBucket),
          backOffFactory.newBackOff(),
          rateLimitedRetryDeterminer,
          IOException.class,
          sleeper);
    } catch (InterruptedException e) {
      throw new IOException(e); // From sleep
    }
  }
330513
def add_name(self, name_attr, space_attr, new_schema):
        # type: (Text, Optional[Text], NamedSchema) -> Name
        
        to_add = Name(name_attr, space_attr, self.default_namespace)

        if to_add.fullname in VALID_TYPES:
            fail_msg = '%s is a reserved type name.' % to_add.fullname
            raise SchemaParseException(fail_msg)
        elif to_add.fullname in self.names:
            fail_msg = 'The name "%s" is already in use.' % to_add.fullname
            raise SchemaParseException(fail_msg)

        self.names[to_add.fullname] = new_schema
        return to_add
276015
def renamed(self, name):
        
        duplicate = copy(self)
        duplicate._name = name
        return duplicate
901588
def newNsPropEatName(self, node, name, value):
        
        if node is None: node__o = None
        else: node__o = node._o
        ret = libxml2mod.xmlNewNsPropEatName(node__o, self._o, name, value)
        if ret is None:raise treeError('xmlNewNsPropEatName() failed')
        __tmp = xmlAttr(_obj=ret)
        return __tmp
509439
def new_dir(self, name):
        # type: (bytes) -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('Path Table Record already initialized')

        # Zero for the parent dir num is bogus, but that will get fixed later.
        self._new(name, 0)
1213106
def _require_bucket(self, bucket_name):
        
        if not self.exists(bucket_name) and not self.claim_bucket(bucket_name):
            raise OFSException("Invalid bucket: %s" % bucket_name)
        return self._get_bucket(bucket_name)
706518
def rename(self, new_name):
        

        yield from self._hypervisor.send("nio rename {name} {new_name}".format(name=self._name, new_name=new_name))

        log.info("NIO {name} renamed to {new_name}".format(name=self._name, new_name=new_name))
        self._name = new_name
460761
public Bucket createBucketWithStorageClassAndLocation(String bucketName) {
    // [START createBucketWithStorageClassAndLocation]
    Bucket bucket =
        storage.create(
            BucketInfo.newBuilder(bucketName)
                // See here for possible values: http://g.co/cloud/storage/docs/storage-classes
                .setStorageClass(StorageClass.COLDLINE)
                // Possible values: http://g.co/cloud/storage/docs/bucket-locations#location-mr
                .setLocation("asia")
                .build());
    // [END createBucketWithStorageClassAndLocation]
    return bucket;
  }