S3ClientConfiguration.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3. * SPDX-License-Identifier: Apache-2.0.
  4. */
  5. #pragma once
  6. #include <aws/s3/S3_EXPORTS.h>
  7. #include <aws/core/client/GenericClientConfiguration.h>
  8. #include <aws/core/auth/signer/AWSAuthV4Signer.h>
  9. namespace Aws
  10. {
  11. namespace S3
  12. {
  13. enum class US_EAST_1_REGIONAL_ENDPOINT_OPTION
  14. {
  15. NOT_SET,
  16. LEGACY, //stands for using global endpoint for us-east-1,
  17. REGIONAL //stands for using regional endpoint for us-east-1
  18. };
  19. struct AWS_S3_API S3ClientConfiguration : public Aws::Client::GenericClientConfiguration</*EndpointDiscoverySupported*/true>
  20. {
  21. using BaseClientConfigClass = Aws::Client::GenericClientConfiguration</*EndpointDiscoverySupported*/true>;
  22. S3ClientConfiguration();
  23. /**
  24. * Create a configuration based on settings in the aws configuration file for the given profile name.
  25. * The configuration file location can be set via the environment variable AWS_CONFIG_FILE
  26. * @param profileName the aws profile name.
  27. * @param shouldDisableIMDS whether or not to disable IMDS calls.
  28. */
  29. S3ClientConfiguration(const char* profileName, bool shouldDisableIMDS = false);
  30. /**
  31. * Create a configuration with a predefined smart defaults
  32. * @param useSmartDefaults, required to differentiate c-tors
  33. * @param defaultMode, default mode to use
  34. * @param shouldDisableIMDS whether or not to disable IMDS calls.
  35. */
  36. S3ClientConfiguration(bool useSmartDefaults, const char* defaultMode = "legacy", bool shouldDisableIMDS = false);
  37. /**
  38. * Converting constructors for compatibility with a legacy code
  39. */
  40. S3ClientConfiguration(const Client::ClientConfiguration& config,
  41. Client::AWSAuthV4Signer::PayloadSigningPolicy iPayloadSigningPolicy = Client::AWSAuthV4Signer::PayloadSigningPolicy::Never,
  42. bool iUseVirtualAddressing = true,
  43. US_EAST_1_REGIONAL_ENDPOINT_OPTION iUseUSEast1RegionalEndPointOption = US_EAST_1_REGIONAL_ENDPOINT_OPTION::NOT_SET);
  44. bool useVirtualAddressing = true;
  45. US_EAST_1_REGIONAL_ENDPOINT_OPTION useUSEast1RegionalEndPointOption = US_EAST_1_REGIONAL_ENDPOINT_OPTION::NOT_SET;
  46. bool disableMultiRegionAccessPoints = false;
  47. bool useArnRegion = false;
  48. Client::AWSAuthV4Signer::PayloadSigningPolicy payloadSigningPolicy = Client::AWSAuthV4Signer::PayloadSigningPolicy::RequestDependent;
  49. private:
  50. void LoadS3SpecificConfig(const Aws::String& profileName);
  51. };
  52. }
  53. }