def _create(self, object_type=None, template_attribute=None, credential=None): operation = Operation(OperationEnum.CREATE) if object_type is None: raise ValueError('object_type cannot be None') req_pl = create.CreateRequestPayload( object_type=object_type, template_attribute=template_attribute) batch_item = messages.RequestBatchItem(operation=operation, request_payload=req_pl) message = self._build_request_message(credential, [batch_item]) self._send_message(message) message = messages.ResponseMessage() data = self._receive_message() message.read(data) batch_items = message.batch_items batch_item = batch_items[0] payload = batch_item.response_payload if payload is None: payload_unique_identifier = None payload_template_attribute = None payload_object_type = None else: payload_unique_identifier = payload.unique_identifier payload_template_attribute = payload.template_attribute payload_object_type = payload.object_type result = CreateResult(batch_item.result_status, batch_item.result_reason, batch_item.result_message, payload_object_type, payload_unique_identifier, payload_template_attribute) return result
def _create_create_payload(self): return create.CreateRequestPayload()