sets or changes a bucket's default object
423429
def set_def_xml_acl(self, acl_str, key_name='', headers=None):
        """"""
        return self.set_xml_acl(acl_str, key_name, headers, 
                                query_args=DEF_OBJ_ACL)
789057
async def reset_bucket(self, *,
                           chat: typing.Union[str, int, None] = None,
                           user: typing.Union[str, int, None] = None):
        
        await self.set_data(chat=chat, user=user, data={})
453607
def bucket(options={})
      defaults = {:bucket => nil, :acl => :private, :location_constraint => 'us-east-1', :create_if_missing => false}
      options = parse_opts(options, defaults)

      s3b = @s3.buckets[options[:bucket]]
      return s3b if s3b.exists?
      return @s3.buckets.create(options[:bucket],
                         :acl => options[:acl],
                         :location_constraint => options[:location_constraint]) if options[:create_if_missing]
      nil
    end
416147
def set_bucket_type_props(self, bucket_type, props):
        
        self._check_bucket_types(bucket_type)
        url = self.bucket_type_properties_path(bucket_type.name)
        headers = {'Content-Type': 'application/json'}
        content = json.dumps({'props': props})

        # Run the request...
        status, _, _ = self._request('PUT', url, headers, content)

        if status != 204:
            raise RiakError('Error setting bucket-type properties.')
        return True
138972
def change_status(self, bucket, key, status, cond):
        
        resource = entry(bucket, key)
        if cond and isinstance(cond, dict):
            condstr = ""
            for k, v in cond.items():
                condstr += "{0}={1}&".format(k, v)
            condstr = urlsafe_base64_encode(condstr[:-1])
            return self.__rs_do('chstatus', resource, 'status/{0}'.format(status), 'cond', condstr)
        return self.__rs_do('chstatus', resource, 'status/{0}'.format(status))
1043027
def setdefault(obj, field, default):
    """"""
    setattr(obj, field, getattr(obj, field, default))
1109788
public <T> void setRiakBucketName(T obj, BinaryValue bucketName)
    {
        if (riakBucketNameSetter != null)
        {
            if (riakBucketNameSetter.getParameterTypes()[0].isArray())
            {
                setMethodValue(riakBucketNameSetter, obj, bucketName.unsafeGetValue());
            }
            else
            {
                setMethodValue(riakBucketNameSetter, obj, bucketName.toString());
            }
        }
        else if (riakBucketNameField != null)
        {
            if (riakBucketNameField.getType().equals(String.class))
            {
                setFieldValue(riakBucketNameField, obj, bucketName.toString());
            }
            else
            {
                setFieldValue(riakBucketNameField, obj, bucketName.unsafeGetValue());
            }
        }
    }
1330222
def _opts_defaults(self, **kwargs):
        '''
        
        '''
        # Let's start with the default salt cloud configuration
        opts = salt.config.DEFAULT_CLOUD_OPTS.copy()
        # Update it with the loaded configuration
        opts.update(self.opts.copy())
        # Reset some of the settings to sane values
        opts['parallel'] = False
        opts['keep_tmp'] = False
        opts['deploy'] = True
        opts['update_bootstrap'] = False
        opts['show_deploy_args'] = False
        opts['script_args'] = ''
        # Update it with the passed kwargs
        if 'kwargs' in kwargs:
            opts.update(kwargs['kwargs'])
        opts.update(kwargs)
        profile = opts.get('profile', None)
        # filter other profiles if one is specified
        if profile:
            tmp_profiles = opts.get('profiles', {}).copy()
            for _profile in [a for a in tmp_profiles]:
                if not _profile == profile:
                    tmp_profiles.pop(_profile)
            # if profile is specified and we have enough info about providers
            # also filter them to speedup methods like
            # __filter_non_working_providers
            providers = [a.get('provider', '').split(':')[0]
                         for a in six.itervalues(tmp_profiles)
                         if a.get('provider', '')]
            if providers:
                _providers = opts.get('providers', {})
                for provider in _providers.copy():
                    if provider not in providers:
                        _providers.pop(provider)
        return opts
393612
def fill_buckets(self):
        '''
        
        '''
        update_intervals = self.fileserver.update_intervals()
        self.buckets = {}
        for backend in self.fileserver.backends():
            fstr = '{0}.update'.format(backend)
            try:
                update_func = self.fileserver.servers[fstr]
            except KeyError:
                log.debug(
                    'No update function for the %s filserver backend',
                    backend
                )
                continue
            if backend in update_intervals:
                # Variable intervals are supported for this backend
                for id_, interval in six.iteritems(update_intervals[backend]):
                    if not interval:
                        # Don't allow an interval of 0
                        interval = DEFAULT_INTERVAL
                        log.debug(
                            'An update_interval of 0 is not supported, '
                            'falling back to %s', interval
                        )
                    i_ptr = self.buckets.setdefault(interval, OrderedDict())
                    # Backend doesn't technically need to be present in the
                    # key, all we *really* need is the function reference, but
                    # having it there makes it easier to provide meaningful
                    # debug logging in the update threads.
                    i_ptr.setdefault((backend, update_func), []).append(id_)
            else:
                # Variable intervals are not supported for this backend, so
                # fall back to the global interval for that fileserver. Since
                # this backend doesn't support variable updates, we have
                # nothing to pass to the backend's update func, so we'll just
                # set the value to None.
                try:
                    interval_key = '{0}_update_interval'.format(backend)
                    interval = self.opts[interval_key]
                except KeyError:
                    interval = DEFAULT_INTERVAL
                    log.warning(
                        '%s key missing from configuration. Falling back to '
                        'default interval of %d seconds',
                        interval_key, interval
                    )
                self.buckets.setdefault(
                    interval, OrderedDict())[(backend, update_func)] = None
1284990
function(bucket, callback) {
    deleteObjects(bucket, function(err, data) {
      if (err) callback(err);
      deleteBucket(bucket, callback);
    });
  }
320863
def _set_default(path, dest, name):
    '''
    
    '''
    subvol_id = __salt__['btrfs.subvolume_show'](path)[name]['subvolume id']
    return __salt__['btrfs.subvolume_set_default'](subvol_id, dest)
649905
public Bucket setDefaultKmsKey(String bucketName, String kmsKeyName) throws StorageException {
    // [START storage_set_bucket_default_kms_key]
    // Instantiate a Google Cloud Storage client
    Storage storage = StorageOptions.getDefaultInstance().getService();

    // The name of the existing bucket to set a default KMS key for, e.g. "my-bucket"
    // String bucketName = "my-bucket"

    // The name of the KMS-key to use as a default
    // Key names are provided in the following format:
    // 'projects/<PROJECT>/locations/<LOCATION>/keyRings/<RING_NAME>/cryptoKeys/<KEY_NAME>'
    // String kmsKeyName = ""

    BucketInfo bucketInfo =
        BucketInfo.newBuilder(bucketName).setDefaultKmsKeyName(kmsKeyName).build();

    Bucket bucket = storage.update(bucketInfo);

    System.out.println("Default KMS Key Name: " + bucket.getDefaultKmsKeyName());
    // [END storage_set_bucket_default_kms_key]
    return bucket;
  }
1074946
def empty(Bucket, MFA=None, RequestPayer=None, region=None, key=None,
          keyid=None, profile=None):
    '''
    

    '''

    stuff = list_object_versions(Bucket, region=region, key=key, keyid=keyid,
                                 profile=profile)
    Delete = {}
    Delete['Objects'] = [{'Key': v['Key'], 'VersionId': v['VersionId']} for v in stuff.get('Versions', [])]
    Delete['Objects'] += [{'Key': v['Key'], 'VersionId': v['VersionId']} for v in stuff.get('DeleteMarkers', [])]
    if Delete['Objects']:
        ret = delete_objects(Bucket, Delete, MFA=MFA, RequestPayer=RequestPayer,
                             region=region, key=key, keyid=keyid, profile=profile)
        failed = ret.get('failed', [])
        if failed:
            return {'deleted': False, 'failed': ret[failed]}
    return {'deleted': True}
45288
def _set_defaults(cls, app):
        
        app.config.setdefault('IMAGINE_URL', '/media/cache/resolve')
        app.config.setdefault('IMAGINE_NAME', 'imagine')
        app.config.setdefault('IMAGINE_CACHE_ENABLED', True)
        app.config.setdefault('IMAGINE_CACHE_REDIRECT_CODE', 302)

        app.config.setdefault('IMAGINE_ADAPTERS', {})
        app.config.setdefault('IMAGINE_FILTERS', {})

        app.config.setdefault('IMAGINE_ADAPTER', {
            'name': 'fs',
        })

        app.config.setdefault('IMAGINE_FILTER_SETS', {})

        return app
907724
def get(self, key):

    

    try:
      try:
        obj = self.bucket.get(key)
      except:
        raise

      return dict(obj or {})

    except:
      raise
518916
def create_bucket(self, bucket):
        
        details = self._details(
            method=b"PUT",
            url_context=self._url_context(bucket=bucket),
        )
        query = self._query_factory(details)
        return self._submit(query)
61363
def objects_delete(self, bucket, key):
    
    url = Api._ENDPOINT + (Api._OBJECT_PATH % (bucket, Api._escape_key(key)))
    datalab.utils.Http.request(url, method='DELETE', credentials=self._credentials,
                               raw_response=True)