Exemple #1
0
    def _process_resource(self, resource, event=None):

        for storage_type in self.storage_types:
            if storage_type in [BLOB_TYPE, QUEUE_TYPE, FILE_TYPE]:
                log_settings = {
                    'delete': self.DELETE in self.logs_to_enable,
                    'read': self.READ in self.logs_to_enable,
                    'write': self.WRITE in self.logs_to_enable,
                    'retention_policy': {
                        'enabled': self.retention != 0,
                        'days': self.retention
                        if self.retention != 0 else None  # Throws if 0
                    },
                    'version': '1.0'
                }
            else:
                log_settings = Logging(self.DELETE in self.logs_to_enable,
                                       self.READ in self.logs_to_enable,
                                       self.WRITE in self.logs_to_enable,
                                       retention_policy=RetentionPolicy(
                                           enabled=self.retention != 0,
                                           days=self.retention))

            StorageSettingsUtilities.update_logging(storage_type, resource,
                                                    log_settings, self.session)
Exemple #2
0
    def _process_resource(self, resource, event=None):
        retention = RetentionPolicy(enabled=self.retention != 0, days=self.retention)
        log_settings = Logging(self.DELETE in self.logs_to_enable, self.READ in self.logs_to_enable,
                               self.WRITE in self.logs_to_enable, retention_policy=retention)

        for storage_type in self.storage_types:
            StorageSettingsUtilities.update_logging(storage_type, resource,
                                                    log_settings, self.session, self.token)