Search in sources :

Example 1 with ClientConfig

use of bio.terra.cloudres.common.ClientConfig in project terra-cloud-resource-lib by DataBiosphere.

the class AzureResourceCleanupRecorder method logRequest.

@Override
public Mono<Void> logRequest(ClientLogger logger, HttpRequestLoggingContext loggingOptions) {
    final Context context = loggingOptions.getContext();
    Optional.ofNullable(context).flatMap(c -> c.getData(CLOUD_RESOURCE_REQUEST_DATA_KEY)).ifPresent(data -> {
        ResourceManagerRequestData requestData = (ResourceManagerRequestData) data;
        requestData.resourceUidCreation().ifPresent(resourceUid -> CleanupRecorder.record(resourceUid, requestData.resourceCreationMetadata().orElse(null), clientConfig));
    });
    return Mono.empty();
}
Also used : HttpRequestLoggingContext(com.azure.core.http.policy.HttpRequestLoggingContext) Context(com.azure.core.util.Context) HttpRequestLogger(com.azure.core.http.policy.HttpRequestLogger) HttpRequestLoggingContext(com.azure.core.http.policy.HttpRequestLoggingContext) Context(com.azure.core.util.Context) ClientLogger(com.azure.core.util.logging.ClientLogger) ClientConfig(bio.terra.cloudres.common.ClientConfig) CleanupRecorder(bio.terra.cloudres.common.cleanup.CleanupRecorder) Optional(java.util.Optional) Mono(reactor.core.publisher.Mono) CLOUD_RESOURCE_REQUEST_DATA_KEY(bio.terra.cloudres.azure.resourcemanager.common.Defaults.CLOUD_RESOURCE_REQUEST_DATA_KEY)

Aggregations

CLOUD_RESOURCE_REQUEST_DATA_KEY (bio.terra.cloudres.azure.resourcemanager.common.Defaults.CLOUD_RESOURCE_REQUEST_DATA_KEY)1 ClientConfig (bio.terra.cloudres.common.ClientConfig)1 CleanupRecorder (bio.terra.cloudres.common.cleanup.CleanupRecorder)1 HttpRequestLogger (com.azure.core.http.policy.HttpRequestLogger)1 HttpRequestLoggingContext (com.azure.core.http.policy.HttpRequestLoggingContext)1 Context (com.azure.core.util.Context)1 ClientLogger (com.azure.core.util.logging.ClientLogger)1 Optional (java.util.Optional)1 Mono (reactor.core.publisher.Mono)1