예제 #1
0
 def _assert_authenticated_access(self, operation):
   self._assert_value_type(
     operation, types.BooleanType, 'authentication', 'anonymous'
   )
   auth = operation['authentication']
   if auth['anonymous']:
     raise cli_exceptions.InvalidArguments(
       'This operation cannot be performed without authentication'
     )
   cli_util.assert_file_exists(operation['authentication']['cert-file'])
예제 #2
0
 def create_system_metadata(self, operation):
     #import pyxb
     #pyxb.RequireValidWhenGenerating(False)
     cli_util.assert_file_exists(operation['parameters']['science-file'])
     pid = operation['parameters']['identifier']
     format_id = operation['parameters']['format-id']
     file_size = self._get_file_size(
         operation['parameters']['science-file'])
     checksum = dataoneTypes.checksum(
         self._get_file_checksum(operation['parameters']['science-file']))
     return self._create_pyxb_object(operation, pid, format_id, file_size,
                                     checksum)
예제 #3
0
 def _assert_valid_auth_parameter_combination(self, operation):
   self._assert_value_type(
     operation, types.BooleanType, 'authentication', 'anonymous'
   )
   auth = operation['authentication']
   if not auth['anonymous']:
     if not self._is_value_type(
         operation, types.StringTypes, 'authentication', 'cert-file'
     ):
       raise cli_exceptions.InvalidArguments(
         'Specified an authenticated connection without providing a certificate'
       )
     cli_util.assert_file_exists(operation['authentication']['cert-file'])
   if (
     self._is_value_type(
       operation, types.NoneType, 'authentication', 'cert-file'
     ) and not
     self._is_value_type(
         operation, types.NoneType, 'authentication', 'key-file'
     )
   ):
     raise cli_exceptions.InvalidArguments(
       'Specified a certificate private key without specifying a certificate'
     )
예제 #4
0
 def _assert_valid_path(self, operation, *keys):
   self._assert_value_type(operation, types.StringTypes, *keys)
   for key in keys:
     operation = operation[key]
   cli_util.assert_file_exists(operation)