report_id = graphene.String(required=True, name='id') ok = graphene.Boolean() @require_authentication def mutate(root, info, report_id): gmp = get_gmp(info) gmp.delete_report(report_id) return DeleteReport(ok=True) # Explicit classes needed, else we get error # 'AssertionError: Found different types with the same name in the # schema: DeleteByIds, DeleteByIds.' DeleteByIdsClass = create_delete_by_ids_mutation(entity_name='report') class DeleteReportsByIds(DeleteByIdsClass): """Deletes a list of reports Args: ids (List(UUID)): List of UUIDs of reports to delete. Returns: ok (Boolean) """ DeleteByFilterClass = create_delete_by_filter_mutation(entity_name='report')
ok (Boolean) """ class Arguments: host_id = graphene.UUID(required=True, name='id') ok = graphene.Boolean() @staticmethod @require_authentication def mutate(_root, info, host_id): gmp = get_gmp(info) gmp.delete_host(host_id=str(host_id)) return DeleteHost(ok=True) DeleteByIdsClass = create_delete_by_ids_mutation(entity_name='host', gmp_entity_response='asset') class DeleteHostsByIds(DeleteByIdsClass): """Deletes a list of hosts Args: ids (List(UUID)): List of UUIDs of host to delete. ultimate (bool, optional): Whether to remove entirely, or to the trashcan. Returns: ok (Boolean) Example
pass ExportByFilterClass = create_export_by_filter_mutation( entity_name='override', with_details=True ) class ExportOverridesByFilter(ExportByFilterClass): pass # schema: DeleteByIds, DeleteByIds.' DeleteByIdsClass = create_delete_by_ids_mutation(entity_name='override') class DeleteOverridesByIds(DeleteByIdsClass): """Deletes a list of overrides Args: ids (List(UUID)): List of UUIDs of overrides to delete. ultimate (bool, optional): Whether to remove entirely, or to the trashcan. Returns: ok (Boolean) Example
name='id', ) ok = graphene.Boolean() @require_authentication def mutate(root, info, report_id): gmp = get_gmp(info) gmp.delete_asset(report_id=str(report_id)) return DeleteOperatingSystemsByReport(ok=True) # schema: DeleteByIds, DeleteByIds.' DeleteByIdsClass = create_delete_by_ids_mutation( entity_name='asset', asset_type=GvmAssetType.OPERATING_SYSTEM ) class DeleteOperatingSystemsByIds(DeleteByIdsClass): """Deletes a list of operating_systems Args: ids (List(UUID)): List of UUIDs of operating_systems to delete. ultimate (bool, optional): Whether to remove entirely, or to the trashcan. Returns: ok (Boolean) Example
filter_id = graphene.UUID(required=True, name='id') ultimate = graphene.Boolean(name='ultimate') ok = graphene.Boolean() @staticmethod @require_authentication def mutate(_root, info, filter_id, ultimate): gmp = get_gmp(info) gmp.delete_filter(filter_id=str(filter_id), ultimate=ultimate) return DeleteFilter(ok=True) # schema: DeleteByIds, DeleteByIds.' DeleteByIdsClass = create_delete_by_ids_mutation(entity_name='filter') class DeleteFiltersByIds(DeleteByIdsClass): """Deletes a list of filters Args: ids (List(UUID)): List of UUIDs of filter to delete. ultimate (bool, optional): Whether to remove entirely, or to the trashcan. Returns: ok (Boolean) Example
task_id = graphene.UUID(name='id') @staticmethod @require_authentication def mutate(_root, info, task_id): gmp = get_gmp(info) elem = gmp.clone_task(str(task_id)) return CloneTask(task_id=elem.get('id')) # Explicit classes needed, else we get error # 'AssertionError: Found different types with the same name in the # schema: DeleteByIds, DeleteByIds.' DeleteByIdsClass = create_delete_by_ids_mutation(entity_name='task') class DeleteTasksByIds(DeleteByIdsClass): """Delete a list of tasks""" DeleteByFilterClass = create_delete_by_filter_mutation(entity_name='task') class DeleteTasksByFilter(DeleteByFilterClass): """Delete a filtered list of tasks""" class CreateContainerTaskInput(graphene.InputObjectType): """Input ObjectType for create a task container"""
pass ExportByFilterClass = create_export_by_filter_mutation(entity_name='credential') class ExportCredentialsByFilter(ExportByFilterClass): pass # Explicit classes needed, else we get error # 'AssertionError: Found different types with the same name in the # schema: DeleteByIds, DeleteByIds.' DeleteByIdsClass = create_delete_by_ids_mutation(entity_name='credential') class DeleteCredentialsByIds(DeleteByIdsClass): """Deletes a list of credentials Args: ids (List(UUID)): List of UUIDs of credentials to delete. ultimate (bool, optional): Whether to remove entirely, or to the trashcan. Returns: ok (Boolean) Example
audit_id = graphene.UUID(required=True, name='id') ok = graphene.Boolean() @require_authentication def mutate(root, info, audit_id): gmp = get_gmp(info) gmp.delete_audit(str(audit_id)) return DeleteAudit(ok=True) # Explicit classes needed, else we get error # 'AssertionError: Found different types with the same name in the # schema: DeleteByIds, DeleteByIds.' DeleteByIdsClass = create_delete_by_ids_mutation(entity_name='audit', gmp_entity_response='task') class DeleteAuditsByIds(DeleteByIdsClass): """Deletes a list of audits Args: ids (List(UUID)): List of UUIDs of audits to delete. Returns: ok (Boolean) """ DeleteByFilterClass = create_delete_by_filter_mutation( entity_name='audit', gmp_entity_response='task')
# schema: ExportByIds, ExportByIds.' ExportByIdsClass = create_export_by_ids_mutation(entity_name='permission') class ExportPermissionsByIds(ExportByIdsClass): pass ExportByFilterClass = create_export_by_filter_mutation( entity_name='permission', ) class ExportPermissionsByFilter(ExportByFilterClass): pass DeleteByIdsClass = create_delete_by_ids_mutation(entity_name='permission') class DeletePermissionsByIds(DeleteByIdsClass): """Deletes a list of permissions""" DeleteByFilterClass = create_delete_by_filter_mutation( entity_name='permission', ) class DeletePermissionsByFilter(DeleteByFilterClass): """Deletes a filtered list of permissions"""
ok = graphene.Boolean() @require_authentication def mutate(root, info, policy_id, ultimate): gmp = get_gmp(info) gmp.delete_policy(str(policy_id), ultimate=ultimate) return DeletePolicy(ok=True) # Explicit classes needed, else we get error # 'AssertionError: Found different types with the same name in the # schema: DeleteByIds, DeleteByIds.' DeleteByIdsClass = create_delete_by_ids_mutation('policy', entities_name='policies', gmp_entity_response='config') class DeletePoliciesByIds(DeleteByIdsClass): """Deletes a list of policys Args: ids (List(UUID)): List of UUIDs of policys to delete. ultimate (bool, optional): Whether to remove entirely, or to the trashcan. Returns: ok (Boolean) Example
""" class Arguments: tls_certificate_id = graphene.UUID(required=True, name='id') ok = graphene.Boolean() @require_authentication def mutate(root, info, tls_certificate_id): gmp = get_gmp(info) gmp.delete_tls_certificate(str(tls_certificate_id)) return DeleteTLSCertificate(ok=True) # schema: DeleteByIds, DeleteByIds.' DeleteByIdsClass = create_delete_by_ids_mutation(entity_name='tls_certificate') class DeleteTLSCertificatesByIds(DeleteByIdsClass): """Deletes a list of tls certificates Args: ids (List(UUID)): List of UUIDs of tls certificates to delete. Returns: ok (Boolean) Example mutation { deleteTLSCertificatesByIds(
name='id', ) ok = graphene.Boolean() @staticmethod @require_authentication def mutate(_root, info, report_id): gmp = get_gmp(info) gmp.delete_asset(report_id=str(report_id)) return DeleteHostsByReport(ok=True) # schema: DeleteByIds, DeleteByIds.' DeleteByIdsClass = create_delete_by_ids_mutation(entity_name='asset', asset_type=GvmAssetType.HOST) class DeleteHostsByIds(DeleteByIdsClass): """Deletes a list of hosts Args: ids (List(UUID)): List of UUIDs of host to delete. ultimate (bool, optional): Whether to remove entirely, or to the trashcan. Returns: ok (Boolean) Example
ok = graphene.Boolean() @staticmethod @require_authentication def mutate(_root, info, config_id, ultimate): gmp = get_gmp(info) gmp.delete_config(str(config_id), ultimate=ultimate) return DeleteScanConfig(ok=True) # Explicit classes needed, else we get error # 'AssertionError: Found different types with the same name in the # schema: DeleteByIds, DeleteByIds.' DeleteByIdsClass = create_delete_by_ids_mutation(entity_name='config') class DeleteScanConfigsByIds(DeleteByIdsClass): """Deletes a list of scan configs Args: ids (List(UUID)): List of UUIDs of scan configs to delete. ultimate (bool, optional): Whether to remove entirely, or to the trashcan. Returns: ok (Boolean) Example
ok = graphene.Boolean() @staticmethod @require_authentication def mutate(_root, info, operating_system_id): gmp = get_gmp(info) gmp.delete_operating_system( operating_system_id=str(operating_system_id) ) return DeleteOperatingSystem(ok=True) # schema: DeleteByIds, DeleteByIds.' DeleteByIdsClass = create_delete_by_ids_mutation( entity_name='operating_system', gmp_entity_response='asset' ) class DeleteOperatingSystemsByIds(DeleteByIdsClass): """Deletes a list of operating_systems Args: ids (List(UUID)): List of UUIDs of operating_systems to delete. ultimate (bool, optional): Whether to remove entirely, or to the trashcan. Returns: ok (Boolean) Example
# it is really awkward to reuse the same variable # name here, but it seems working ...?! schedule_id = graphene.UUID(name='id') @require_authentication def mutate(root, info, schedule_id): gmp = get_gmp(info) elem = gmp.clone_schedule(str(schedule_id)) return CloneSchedule(schedule_id=elem.get('id')) # Explicit classes needed, else we get error # 'AssertionError: Found different types with the same name in the # schema: DeleteByIds, DeleteByIds.' DeleteByIdsClass = create_delete_by_ids_mutation(entity_name='schedule') class DeleteSchedulesByIds(DeleteByIdsClass): """Deletes a list of schedules Args: ids (List(UUID)): List of UUIDs of schedules to delete. ultimate (bool, optional): Whether to remove entirely, or to the trashcan. Returns: ok (Boolean) Example