Example usage for com.amazonaws AmazonWebServiceRequest clone

List of usage examples for com.amazonaws AmazonWebServiceRequest clone

Introduction

In this page you can find the example usage for com.amazonaws AmazonWebServiceRequest clone.

Prototype

@Override
public AmazonWebServiceRequest clone() 

Source Link

Document

Creates a shallow clone of this object for all fields except the handler context.

Usage

From source file:com.netflix.spinnaker.clouddriver.aws.security.AddSpinnakerUserToUserAgentRequestHandler.java

License:Apache License

@Override
public AmazonWebServiceRequest beforeMarshalling(AmazonWebServiceRequest request) {
    final String userAgent = String.format("spinnaker-user/%s spinnaker-executionId/%s",
            AuthenticatedRequest.getSpinnakerUser().orElse("unknown"),
            AuthenticatedRequest.getSpinnakerExecutionId().orElse("unknown"));

    final AmazonWebServiceRequest cloned = request.clone();

    cloned.getRequestClientOptions().appendUserAgent(userAgent);
    return super.beforeMarshalling(cloned);
}