public ContentPackInstallation installContentPack(ContentPack contentPack,
                                                      Map<String, ValueReference> parameters,
                                                      String comment,
                                                      String user) {
        if (contentPack instanceof ContentPackV1 contentPackV1) {
            return installContentPack(contentPackV1, parameters, comment, user);
        } else {
            throw new IllegalArgumentException("Unsupported content pack version: " + contentPack.version());
        }
    }
@Test
    public void installContentPackWithCloudCheck() throws Exception {
        ImmutableSet<Entity> entities = ImmutableSet.of(createTestGelfUDPEntity());
        ContentPackV1 contentPack = ContentPackV1.builder()
                .description("test")
                .entities(entities)
                .name("test")
                .revision(1)
                .summary("")
                .vendor("")
                .url(URI.create("http://graylog.com"))
                .id(ModelId.of("dead-beef"))
                .build();

        Input input = mock(Input.class);
        GELFUDPInput gelfUDPInput = mock(GELFUDPInput.class);
        when(messageInputFactory.create(any(), any())).thenReturn(gelfUDPInput);
        when(inputService.find(any())).thenReturn(input);
        when(input.getId()).thenReturn("id1");
        when(input.getTitle()).thenReturn("myGelfUDP");

        ArgumentCaptor<ContentPackInstallation> captor = ArgumentCaptor.forClass(ContentPackInstallation.class);
        when(contentPackInstallService.insert(captor.capture())).thenReturn(null);

        when(configuration.isCloud()).thenReturn(false);
        contentPackService.installContentPack(contentPack, Collections.emptyMap(), "", TEST_USER);
        assertThat(captor.getValue().entities()).hasSize(1);

        when(configuration.isCloud()).thenReturn(true);
        contentPackService.installContentPack(contentPack, Collections.emptyMap(), "", TEST_USER);
        assertThat(captor.getValue().entities()).isEmpty();
    }