Bez popisu

AWSService.h 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. //
  2. // Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License").
  5. // You may not use this file except in compliance with the License.
  6. // A copy of the License is located at
  7. //
  8. // http://aws.amazon.com/apache2.0
  9. //
  10. // or in the "license" file accompanying this file. This file is distributed
  11. // on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  12. // express or implied. See the License for the specific language governing
  13. // permissions and limitations under the License.
  14. //
  15. #import <Foundation/Foundation.h>
  16. #import "AWSNetworking.h"
  17. #import "AWSCredentialsProvider.h"
  18. #import "AWSServiceEnum.h"
  19. //! SDK version for AWS Core
  20. FOUNDATION_EXPORT NSString *const AWSiOSSDKVersion;
  21. FOUNDATION_EXPORT NSString *const AWSServiceErrorDomain;
  22. typedef NS_ENUM(NSInteger, AWSServiceErrorType) {
  23. AWSServiceErrorUnknown,
  24. AWSServiceErrorRequestTimeTooSkewed,
  25. AWSServiceErrorInvalidSignatureException,
  26. AWSServiceErrorSignatureDoesNotMatch,
  27. AWSServiceErrorRequestExpired,
  28. AWSServiceErrorAuthFailure,
  29. AWSServiceErrorAccessDeniedException,
  30. AWSServiceErrorUnrecognizedClientException,
  31. AWSServiceErrorIncompleteSignature,
  32. AWSServiceErrorInvalidClientTokenId,
  33. AWSServiceErrorMissingAuthenticationToken,
  34. AWSServiceErrorAccessDenied,
  35. AWSServiceErrorExpiredToken,
  36. AWSServiceErrorInvalidAccessKeyId,
  37. AWSServiceErrorInvalidToken,
  38. AWSServiceErrorTokenRefreshRequired,
  39. AWSServiceErrorAccessFailure,
  40. AWSServiceErrorAuthMissingFailure,
  41. AWSServiceErrorThrottling,
  42. AWSServiceErrorThrottlingException,
  43. };
  44. @class AWSEndpoint;
  45. #pragma mark - AWSService
  46. /**
  47. An abstract representation of AWS services.
  48. */
  49. @interface AWSService : NSObject
  50. + (NSDictionary<NSString *, NSNumber *> *)errorCodeDictionary;
  51. @end
  52. #pragma mark - AWSServiceManager
  53. @class AWSServiceConfiguration;
  54. /**
  55. The service manager class that manages the default service configuration.
  56. */
  57. @interface AWSServiceManager : NSObject
  58. /**
  59. The default service configuration object. This property can be set only once, and any subsequent setters are ignored.
  60. */
  61. @property (nonatomic, copy) AWSServiceConfiguration *defaultServiceConfiguration;
  62. /**
  63. Returns a default singleton object. You should use this singleton method instead of creating an instance of the service manager.
  64. @return The default service manager. This is a singleton object.
  65. */
  66. + (instancetype)defaultServiceManager;
  67. @end
  68. #pragma mark - AWSServiceConfiguration
  69. /**
  70. A service configuration object.
  71. */
  72. @interface AWSServiceConfiguration : AWSNetworkingConfiguration
  73. @property (nonatomic, assign, readonly) AWSRegionType regionType;
  74. @property (nonatomic, strong, readonly) id<AWSCredentialsProvider> credentialsProvider;
  75. @property (nonatomic, strong, readonly) AWSEndpoint *endpoint;
  76. @property (nonatomic, readonly) NSString *userAgent;
  77. + (NSString *)baseUserAgent;
  78. + (void)addGlobalUserAgentProductToken:(NSString *)productToken;
  79. - (instancetype)initWithRegion:(AWSRegionType)regionType
  80. credentialsProvider:(id<AWSCredentialsProvider>)credentialsProvider;
  81. - (instancetype)initWithRegion:(AWSRegionType)regionType
  82. endpoint:(AWSEndpoint *)endpoint
  83. credentialsProvider:(id<AWSCredentialsProvider>)credentialsProvider;
  84. - (void)addUserAgentProductToken:(NSString *)productToken;
  85. @end
  86. #pragma mark - AWSEndpoint
  87. @interface AWSEndpoint : NSObject
  88. @property (nonatomic, readonly) AWSRegionType regionType;
  89. @property (nonatomic, readonly) NSString *regionName;
  90. @property (nonatomic, readonly) AWSServiceType serviceType;
  91. @property (nonatomic, readonly) NSString *serviceName;
  92. @property (nonatomic, readonly) NSURL *URL;
  93. @property (nonatomic, readonly) NSString *hostName;
  94. @property (nonatomic, readonly) BOOL useUnsafeURL;
  95. + (NSString *)regionNameFromType:(AWSRegionType)regionType;
  96. - (instancetype)initWithRegion:(AWSRegionType)regionType
  97. service:(AWSServiceType)serviceType
  98. useUnsafeURL:(BOOL)useUnsafeURL;
  99. - (instancetype)initWithRegion:(AWSRegionType)regionType
  100. service:(AWSServiceType)serviceType
  101. URL:(NSURL *)URL;
  102. - (instancetype)initWithRegion:(AWSRegionType)regionType
  103. serviceName:(NSString *)serviceName
  104. URL:(NSURL *)URL;
  105. - (instancetype)initWithURL:(NSURL *)URL;
  106. - (instancetype)initWithURLString:(NSString *)URLString;
  107. @end