@PUT
    @ApiOperation(value = "Updates the AWS default configuration.")
    @RequiresPermissions({RestPermissions.CLUSTER_CONFIG_ENTRY_CREATE, RestPermissions.CLUSTER_CONFIG_ENTRY_EDIT})
    @AuditEvent(type = AuditEventTypes.CLUSTER_CONFIGURATION_UPDATE)
    public Response updateConfig(@Valid AWSPluginConfigurationUpdate update) {
        final AWSPluginConfiguration existingConfiguration = clusterConfigService.getOrDefault(
                AWSPluginConfiguration.class,
                AWSPluginConfiguration.createDefault()
        );
        final AWSPluginConfiguration.Builder newConfigBuilder = existingConfiguration.toBuilder()
                .lookupsEnabled(update.lookupsEnabled())
                .lookupRegions(update.lookupRegions())
                .accessKey(update.accessKey())
                .proxyEnabled(update.proxyEnabled());

        final AWSPluginConfiguration newConfiguration = update.secretKey()
                .map(secretKey -> newConfigBuilder.secretKey(secretKey, systemConfiguration.getPasswordSecret()))
                .orElse(newConfigBuilder)
                .build();

        clusterConfigService.write(newConfiguration);
        return Response.accepted(newConfiguration).build();
    }
@Test
    public void updatesPreviouslyMissingConfig() {
        mockPreviousConfig(AWSPluginConfiguration.createDefault());
        final AWSPluginConfigurationUpdate update = AWSPluginConfigurationUpdate.create(
                true,
                "lookupRegions",
                "myAccessKey",
                "aNewSecretKey",
                true
        );

        this.awsConfigurationResource.updateConfig(update);

        final AWSPluginConfiguration writtenConfig = captureWrittenConfig();
        assertThat(writtenConfig.lookupsEnabled()).isTrue();
        assertThat(writtenConfig.lookupRegions()).isEqualTo("lookupRegions");
        assertThat(writtenConfig.accessKey()).isEqualTo("myAccessKey");
        assertThat(writtenConfig.proxyEnabled()).isTrue();
        assertThat(writtenConfig.secretKey("verySecret123456")).isEqualTo("aNewSecretKey");
    }