Generate a string representing the Rock Ridge Sharing Protocol record.

        Parameters:
         None.
        Returns:
         String containing the Rock Ridge record.
337653
def record(self):
        # type: () -> bytes
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('SP record not yet initialized!')

        return b'SP' + struct.pack('=BBBBB', RRSPRecord.length(), SU_ENTRY_VERSION, 0xbe, 0xef, self.bytes_to_skip)
340699
def parent_link_record_exists(self):
        # type: () -> bool
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('Rock Ridge extension not yet initialized')

        return self.dr_entries.pl_record is not None or self.ce_entries.pl_record is not None
1233198
def record(self):
        # type: () -> bytes
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('ES record not yet initialized!')

        return b'ES' + struct.pack('=BBB', RRESRecord.length(), SU_ENTRY_VERSION, self.extension_sequence)
151017
def generate_query_string(self, otp, nonce, timestamp=False, sl=None,
                              timeout=None):
        
        data = [('id', self.client_id),
                ('otp', otp),
                ('nonce', nonce)]

        if timestamp:
            data.append(('timestamp', '1'))

        if sl is not None:
            if sl not in range(0, 101) and sl not in ['fast', 'secure']:
                raise Exception('sl parameter value must be between 0 and '
                                '100 or string "fast" or "secure"')

            data.append(('sl', sl))

        if timeout:
            data.append(('timeout', timeout))

        query_string = urlencode(data)

        if self.key:
            hmac_signature = self.generate_message_signature(query_string)
            hmac_signature = hmac_signature
            query_string += '&h=%s' % (hmac_signature.replace('+', '%2B'))

        return query_string
535352
def record(self):
        # type: () -> bytes
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('RE record not yet initialized!')

        return b'RE' + struct.pack('=BB', RRRERecord.length(), SU_ENTRY_VERSION)
166493
def _set_rock_ridge(self, rr):
        # type: (str) -> None
        '''
        
        '''
        # We don't allow mixed Rock Ridge versions on the ISO, so apply some
        # checking.  If the current overall Rock Ridge version on the ISO is
        # None, we upgrade it to whatever version we were given.  Once we have
        # seen a particular version, we only allow records of that version or
        # None (to account for dotdot records which have no Rock Ridge).
        if not self.rock_ridge:
            self.rock_ridge = rr  # type: str
        else:
            for ver in ['1.09', '1.10', '1.12']:
                if self.rock_ridge == ver:
                    if rr and rr != ver:
                        raise pycdlibexception.PyCdlibInvalidISO('Inconsistent Rock Ridge versions on the ISO!')
599280
public static SerializedRecord anonymize(SerializedRecord sr)
      throws Exception {

    String hostname = sr.get("hostname");

    if (hostname == null)
      throw new Exception("Malformed SerializedRecord: no hostname found");

    if ("true".equalsIgnoreCase(Environment
        .getProperty("anonymizer.hash.hostnames"))) {
      // hash the node's hostname
      anonymizeField(sr, "message", hostname, "_hn_");
      anonymizeField(sr, "hostname", hostname, "_hn_");
      // hash all other hostnames
      String suffix = Environment.getProperty("anonymizer.hostname.suffix");
      if (suffix != null)
        anonymizeField(sr, "message", "(\\S+\\.)*" + suffix, "_hn_");
    }

    if ("true".equalsIgnoreCase(Environment.getProperty("anonymizer.hash.ips"))) {
      // hash all ip addresses
      String ipPattern = "(\\d{1,3}\\.){3}\\d{1,3}";
      anonymizeField(sr, "message", ipPattern, "_ip_");
      anonymizeField(sr, "ips", ipPattern, "_ip_");
      // if multiple ips are present for a node:
      int i = 0;
      while (sr.get("ips" + "#" + i) != null)
        anonymizeField(sr, "ips" + "#" + i++, ipPattern, "_ip_");

      if ("NIC".equalsIgnoreCase(sr.get("type")))
        anonymizeField(sr, "ipAddress", ipPattern, "_ip_");
    }

    if ("true".equalsIgnoreCase(Environment
        .getProperty("anonymizer.hash.filenames"))) {
      // hash every filename present in messages
      anonymizeField(sr, "message", "\\s+/(\\S+/)*[^:\\s]*", " _fn_");
      anonymizeField(sr, "message", "\\s+hdfs://(\\S+/)*[^:\\s]*",
          " hdfs://_fn_");
    }

    return sr;
  }
390068
public static Record getRecordFromCode(BaseField field, String strDesc)
    {
        return BaseFixData.getRecordFromCode(field, strDesc, null);
    }
188437
def _update_record(self, identifier, rtype=None, name=None, content=None):
        
        if self.protocol == 'rpc':
            return self.rpc_helper.update_record(identifier, rtype, name, content)

        data = {}
        if rtype:
            data['rrset_type'] = rtype
        if name:
            data['rrset_name'] = self._relative_name(name)
        if content:
            if isinstance(content, (list, tuple, set)):
                data['rrset_values'] = list(content)
            else:
                data['rrset_values'] = [content]
        if rtype is not None:
            # replace the records of a specific rtype
            url = '/domains/{0}/records/{1}/{2}'.format(self.domain_id,
                                                        identifier or self._relative_name(
                                                            name),
                                                        rtype)
            self._put(url, data)
        else:
            # replace all records with a matching name
            url = '/domains/{0}/records/{1}'.format(self.domain_id,
                                                    identifier or self._relative_name(name))
            self._put(url, {'items': [data]})
        LOGGER.debug('update_record: %s', True)
        return True
1116739
def record(self):
        # type: () -> bytes
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('PL record not yet initialized!')

        return b'PL' + struct.pack('=BBLL', RRPLRecord.length(), SU_ENTRY_VERSION, self.parent_log_block_num, utils.swab_32bit(self.parent_log_block_num))
1134726
def parse(self, rrstr):
        # type: (bytes) -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('SF record already initialized!')

        # We assume that the caller has already checked the su_entry_version,
        # so we don't bother.

        (su_len, su_entry_version_unused,) = struct.unpack_from('=BB', rrstr[:4], 2)

        if su_len == 12:
            # This is a Rock Ridge version 1.10 SF Record, which is 12 bytes.
            (virtual_file_size_le, virtual_file_size_be) = struct.unpack_from('=LL', rrstr[:12], 4)
            if virtual_file_size_le != utils.swab_32bit(virtual_file_size_be):
                raise pycdlibexception.PyCdlibInvalidISO('Virtual file size little-endian does not match big-endian')
            self.virtual_file_size_low = virtual_file_size_le
        elif su_len == 21:
            # This is a Rock Ridge version 1.12 SF Record, which is 21 bytes.
            (virtual_file_size_high_le, virtual_file_size_high_be, virtual_file_size_low_le,
             virtual_file_size_low_be, self.table_depth) = struct.unpack_from('=LLLLB', rrstr[:21], 4)
            if virtual_file_size_high_le != utils.swab_32bit(virtual_file_size_high_be):
                raise pycdlibexception.PyCdlibInvalidISO('Virtual file size high little-endian does not match big-endian')

            if virtual_file_size_low_le != utils.swab_32bit(virtual_file_size_low_be):
                raise pycdlibexception.PyCdlibInvalidISO('Virtual file size low little-endian does not match big-endian')
            self.virtual_file_size_low = virtual_file_size_low_le
            self.virtual_file_size_high = virtual_file_size_high_le
        else:
            raise pycdlibexception.PyCdlibInvalidISO('Invalid length on Rock Ridge SF record (expected 12 or 21)')

        self._initialized = True
713757
def rpc_get_name_blockchain_record(self, name, **con_info):
        
        res = None
        if check_name(name):
            res = self.get_name_record(name, include_expired=True, include_history=True)
        elif check_subdomain(name):
            res = self.get_subdomain_record(name, include_history=True)
        else:
            return {'error': 'Invalid name or subdomain', 'http_status': 400}

        if 'error' in res:
            return {'error': res['error'], 'http_status': res.get('http_status', 404)}

        return self.success_response({'record': res['record']})
884406
def rpc_get_namespace_blockchain_record( self, namespace_id, **con_info ):
        
        if not check_namespace(namespace_id):
            return {'error': 'Invalid name or namespace', 'http_status': 400}

        db = get_db_state(self.working_dir)
        ns = db.get_namespace( namespace_id )
        if ns is None:
            # maybe revealed?
            ns = db.get_namespace_reveal( namespace_id )
            db.close()

            if ns is None:
                return {"error": "No such namespace", 'http_status': 404}

            assert 'opcode' in ns, 'BUG: missing opcode in {}'.format(json.dumps(ns, sort_keys=True))
            ns = self.sanitize_rec(ns)

            ns['ready'] = False
            return self.success_response( {'record': ns} )

        else:
            db.close()
            
            assert 'opcode' in ns, 'BUG: missing opcode in {}'.format(json.dumps(ns, sort_keys=True))
            ns = self.sanitize_rec(ns)

            ns['ready'] = True
            return self.success_response( {'record': ns} )
767194
def child_link_record_exists(self):
        # type: () -> bool
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('Rock Ridge extension not yet initialized')

        return self.dr_entries.cl_record is not None or self.ce_entries.cl_record is not None
868689
def parse_routing_info(cls, records):
        
        if len(records) != 1:
            raise RoutingProtocolError("Expected exactly one record")
        record = records[0]
        routers = []
        readers = []
        writers = []
        try:
            servers = record["servers"]
            for server in servers:
                role = server["role"]
                addresses = []
                for address in server["addresses"]:
                    addresses.append(SocketAddress.parse(address, DEFAULT_PORT))
                if role == "ROUTE":
                    routers.extend(addresses)
                elif role == "READ":
                    readers.extend(addresses)
                elif role == "WRITE":
                    writers.extend(addresses)
            ttl = record["ttl"]
        except (KeyError, TypeError):
            raise RoutingProtocolError("Cannot parse routing info")
        else:
            return cls(routers, readers, writers, ttl)
1020462
def format (self, record):
        """"""
        record.hostname = self.hostname
        return logging.Formatter.format(self, record)
567249
def to_record(self):
        """"""

        tf_list = [getattr(self, k, None) for k in
                   [_.value for _ in TLSFileType]]
        # If a cert isn't defined in this bundle, remove it
        tf_list = filter(lambda x: x, tf_list)
        files = {tf.file_type.value: tf.file_path for tf in tf_list}
        self.record['files'] = files
        return self.record